/**
 * Internal Instantsearch — front end.
 *
 * Design position: this surface is a guest on somebody else's site, and lands
 * on hundreds of different ones. So it brings no palette and no typeface of its
 * own. Colour is derived from whatever text colour it inherits, the backdrop
 * comes from the system canvas, and the type is the host's. What it does bring
 * is structure: a consistent grid, a fixed typographic scale, and a price line
 * that aligns down the column so figures can be compared at a glance.
 *
 * The host's own body size is the floor, not the ceiling. Nothing here is set
 * smaller than the text around it: a result is the thing the visitor came for,
 * and shrinking its title, its price and its labels to three quarters of the
 * size of the page they sit on makes them read as a footnote. Where something
 * has to recede it does so by weight and by colour, which cost no legibility,
 * and never by capitals or letter-spacing, which cost both.
 *
 * It also styles the product card itself rather than relying on WooCommerce's
 * stylesheet, which is scoped under .woocommerce and never applies to an
 * overlay. The WooCommerce class names are kept on the markup as hooks for
 * shops that want to target them.
 */

/*
 * Declared on both, because the overlay frame is the parent of the search and
 * custom properties travel down rather than up: a value set on .iis alone
 * could never reach the pane it sits in.
 */
.iis,
.iis-overlay-root {
	/* Everything is derived; nothing is invented. */
	--iis-ink: currentColor;
	--iis-surface: Canvas;
	--iis-line: rgba( 128, 128, 128, 0.28 );
	--iis-quiet: rgba( 128, 128, 128, 1 );
	--iis-wash: rgba( 128, 128, 128, 0.1 );
	--iis-mark: rgba( 128, 128, 128, 0.22 );

	/*
	 * The sidebar is a panel in the same shape as a result card. A site that
	 * paints its cards white on a tinted page gets the same panel by setting
	 * these two, and nothing here invents a colour: the surface is the system
	 * canvas, which is what the overlay sits on when nobody has said otherwise.
	 */
	--iis-panel-bg: var( --iis-surface );
	--iis-panel-border: var( --iis-line );
	--iis-panel-padding: 1rem;

	/*
	 * How far down a sticky sidebar starts. Zero in the overlay, where it is
	 * the top of the scrolling area; a site with a fixed header of its own
	 * sets this to the height of that header.
	 */
	--iis-sticky-top: 0px;

	--iis-aside-width: 15rem;

	/*
	 * What a site has to change to make this look like its own, without
	 * rewriting a rule to do it. Every default below is what the baseline
	 * draws already, so adding them changed nothing until somebody sets one.
	 *
	 * A border is a whole shorthand rather than a colour, because "no border"
	 * and "a border of some colour" are the two states sites actually want and
	 * a width alone cannot express both.
	 */
	--iis-card-bg: transparent;
	--iis-card-border: 0;
	--iis-card-radius: 0;

	--iis-input-bg: transparent;
	--iis-input-border: 0;
	--iis-input-rule: 1px solid var( --iis-line );
	--iis-input-radius: 0;
	--iis-input-padding: 0;

	--iis-action-bg: transparent;
	--iis-action-ink: inherit;
	--iis-action-rule: 1px solid var( --iis-line );
	--iis-action-radius: 0;
	--iis-action-padding: 0;

	--iis-pill-bg: transparent;
	--iis-pill-ink: var( --iis-quiet );

	/*
	 * The sale badge paints system ink on system canvas so it inverts in dark
	 * mode without the plugin knowing which mode it is in. That only holds
	 * while the host follows the system, which most themes do not — so set
	 * these two together or not at all, and declare color-scheme on :root so
	 * the system colours agree with the ones the site paints.
	 */
	--iis-flag-bg: CanvasText;
	--iis-flag-ink: Canvas;

	/* The pane the overlay is drawn on. */
	--iis-overlay-bg: Canvas;
	--iis-overlay-ink: CanvasText;
	--iis-overlay-blur: none;
	--iis-overlay-max: 76rem;

	/*
	 * The gutter between the two columns. Sized by the viewport by default,
	 * which is wrong for an inline widget in a narrow column on a wide screen:
	 * such a site sets a flat value here.
	 */
	--iis-column-gap: clamp( 1.5rem, 4vw, 3rem );



	--iis-gap: 1.5rem;
	--iis-gap-tight: 0.75rem;
	--iis-radius: 10px;
	--iis-media: 1 / 1;

	/*
	 * The card has two shapes: a tile in a grid, and a row. List view and any
	 * narrow screen both switch to rows by setting these, so the row layout is
	 * written once.
	 */
	/*
	 * min() so a narrow inline container cannot overflow its own track. The
	 * floor went up with the type: at the host's body size a card carries a
	 * title, a price, a stock line and a button, and 11.5rem was sized when
	 * all of those were three quarters as tall.
	 */
	--iis-card-columns: repeat( auto-fill, minmax( min( 100%, 13.5rem ), 1fr ) );
	--iis-card-gap: var( --iis-gap ) clamp( 1rem, 2vw, 1.75rem );
	--iis-card-direction: column;
	--iis-card-align: stretch;
	--iis-card-media: 100%;
	--iis-card-padding: 0;
	--iis-card-rule: transparent;
	--iis-card-action: inline-block;
}

/*
 * The layout of the search itself, which is not the frame's business: the
 * block above is shared with the overlay pane only so the pane can read the
 * properties, not so it inherits a width and a position meant for this.
 */
.iis {
	position: relative;
	width: 100%;
	color: var( --iis-ink );

	/*
	 * The host's own body size, not a size of ours. Everything inside is set
	 * to inherit, so there are no proportions here left to protect — pinning
	 * this to sixteen pixels would only mean the search read smaller than the
	 * page around it on a site whose text is larger, which is the thing this
	 * stylesheet is trying not to do.
	 */
	font-size: inherit;
	line-height: 1.5;
	text-align: left;
}

/*
 * Derived tints, where the browser can do it. These read correctly on a light
 * or a dark host without the plugin knowing which it is.
 */
@supports ( color: color-mix( in oklab, currentColor 10%, transparent ) ) {
	.iis,
	.iis-overlay-root {
		--iis-line: color-mix( in oklab, currentColor 16%, transparent );
		--iis-quiet: color-mix( in oklab, currentColor 62%, transparent );
		--iis-wash: color-mix( in oklab, currentColor 6%, transparent );
		--iis-mark: color-mix( in oklab, currentColor 16%, transparent );
	}
}

.iis *,
.iis *::before,
.iis *::after {
	box-sizing: border-box;
}

/* Layout rules below must not resurrect anything the script has hidden. */
.iis [hidden] {
	display: none !important;
}

.iis :focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
	border-radius: 3px;
}

/* ── Search field ───────────────────────────────────────────────────────── */

.iis-input {
	position: relative;
	display: flex;
	align-items: center;
	gap: 0.5rem;
	padding: var( --iis-input-padding );
	background: var( --iis-input-bg );
	border: var( --iis-input-border );
	border-bottom: var( --iis-input-rule );
	border-radius: var( --iis-input-radius );
}

.iis-input__field {
	flex: 1 1 auto;
	width: 100%;
	min-width: 0;
	margin: 0;
	padding: 0.65rem 0;
	font: inherit;
	font-size: clamp( 1.0625rem, 1rem + 0.5vw, 1.375rem );
	line-height: 1.3;
	color: inherit;
	background: none;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	appearance: none;
}

.iis-input__field:focus {
	outline: none;
	box-shadow: none;
}

.iis-input__field::placeholder {
	color: var( --iis-quiet );
	opacity: 1;
}

/* The field owns the focus ring, so the whole row reads as one control. */
.iis-input:focus-within {
	border-bottom-color: currentColor;
}

.iis-input__clear,
.iis-input__close {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2rem;
	height: 2rem;
	padding: 0;
	font: inherit;
	font-size: 1.25rem;
	line-height: 1;
	color: var( --iis-quiet );
	background: none;
	border: 0;
	border-radius: 50%;
	cursor: pointer;
}

.iis-input__clear:hover,
.iis-input__close:hover {
	color: inherit;
	background: var( --iis-wash );
}

/* ── Frame ──────────────────────────────────────────────────────────────── */

/*
 * The count, and the tabs where a site has them, describe the whole search
 * rather than the right-hand column, so they take a row of their own across
 * the top. Inside the column they started the cards two lines below the
 * sidebar beside them, and two boxes whose top edges do not line up read as a
 * mistake. It also puts the live region that announces "7 results" ahead of
 * the filters, which is where a screen reader wants it.
 */
.iis__head {
	margin-top: var( --iis-gap-tight );
}

/*
 * Close under the line that labels the two columns. A label wants to sit on
 * what it labels: a full gap here left the count and the section name floating
 * in a band of their own, belonging to neither the field above nor the columns
 * below.
 */
.iis__body {
	display: flex;
	align-items: flex-start;
	gap: var( --iis-column-gap );
	margin-top: var( --iis-gap-tight );
}

.iis__filters {
	flex: 0 0 var( --iis-aside-width );
	max-width: var( --iis-aside-width );
	padding: var( --iis-panel-padding );
	background: var( --iis-panel-bg );
	border: 1px solid var( --iis-panel-border );
	border-radius: var( --iis-radius );
}


/*
 * Kept in view while the results scroll past it. Given a scrollbar of its own
 * where the list is longer than the screen, so a long set of filters cannot
 * put its last choice out of reach.
 */
@media ( min-width: 861px ) {
	.iis__filters {
		position: sticky;
		top: var( --iis-sticky-top );
		max-height: calc( 100dvh - var( --iis-sticky-top ) - var( --iis-gap ) );
		overflow-y: auto;
		overscroll-behavior: contain;
	}

	/*
	 * In the overlay the sidebar does not scroll inside the viewport, it
	 * scrolls inside the body — which is shorter than the viewport by the
	 * search field, the head row and the overlay's own padding. Measuring
	 * against the viewport made its limit up to a couple of hundred pixels
	 * too tall, so its own scrollbar never appeared and the last filter could
	 * sit below the fold with no way to reach it.
	 */
	.iis--overlay .iis__filters {
		max-height: calc( 100% - var( --iis-sticky-top ) );
	}
}

.iis__main {
	flex: 1 1 auto;
	min-width: 0;
}

@media ( max-width: 860px ) {
	.iis__body {
		display: block;
	}

	.iis__filters {
		max-width: none;
		margin-bottom: var( --iis-gap );
	}
}

/* ── Filters ────────────────────────────────────────────────────────────── */

.iis-filter-group + .iis-filter-group {
	margin-top: 1.5rem;
}

.iis-filter-group__title {
	margin: 0 0 0.5rem;
	padding: 0;
	font-size: inherit;
	font-weight: 600;
	line-height: 1.4;
	color: var( --iis-quiet );
}

.iis ul.iis-filter-group__list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.iis .iis-filter {
	margin: 0;
	padding: 0;
	list-style: none;
}

.iis-filter label {
	display: flex;
	align-items: baseline;
	gap: 0.5rem;
	padding: 0.2rem 0;
	font-size: inherit;
	cursor: pointer;
}

.iis-filter.is-disabled label {
	opacity: 0.4;
	cursor: default;
}

.iis-filter__label {
	flex: 1 1 auto;
}

.iis-filter__count {
	font-size: inherit;
	font-variant-numeric: tabular-nums;
	color: var( --iis-quiet );
}

/* ── Summary line ───────────────────────────────────────────────────────── */

/*
 * The margin is on the line, not on the wrapper. The wrapper is always
 * rendered and is empty until there is something to say — on an empty query
 * all four of its cases are false — so a margin here is space paid for
 * nothing every time the overlay opens.
 */
/*
 * The count labels the column of filters and the first section's name labels
 * the results, so they sit on one line at the two columns' widths. Stacked
 * below the breakpoint, where there are no columns to label.
 */
.iis-details {
	font-size: inherit;
	color: var( --iis-quiet );
}

.iis-details p {
	margin: 0 0 var( --iis-gap-tight );
	padding: 0;
}

@media ( min-width: 861px ) {
	.iis-details {
		display: flex;
		align-items: baseline;
		gap: var( --iis-column-gap );
	}

	.iis-details__line {
		flex: 0 0 var( --iis-aside-width );
		max-width: var( --iis-aside-width );
	}

	.iis-details__lead {
		flex: 1 1 auto;
		min-width: 0;
	}
}

/*
 * Named the same way a section heading is, because it is one — the first one,
 * moved up a line so the sidebar has something beside it.
 */
.iis-details__lead {
	font-weight: 600;
	line-height: 1.5;
}

.iis-details__empty,
.iis-details__error {
	font-size: inherit;
	color: inherit;
}

/* ── Results grid ───────────────────────────────────────────────────────── */

.iis ul.iis-results__list {
	display: grid;
	grid-template-columns: var( --iis-card-columns );
	gap: var( --iis-card-gap );
	margin: 0;
	padding: 0;
	list-style: none;
}

.iis .iis-item {
	position: relative;
	display: flex;
	flex-direction: column;
	min-width: 0;
	margin: 0;
	padding: var( --iis-card-padding );
	list-style: none;
	background: var( --iis-card-bg );
	border: var( --iis-card-border );
	border-bottom: 1px solid var( --iis-card-rule );
	border-radius: var( --iis-card-radius );
}

.iis-item__link {
	display: flex;
	flex-direction: var( --iis-card-direction );
	flex: 1 1 auto;
	align-items: var( --iis-card-align );
	gap: 0.6rem;
	color: inherit;
	text-decoration: none;
	box-shadow: none;
}

.iis-item__link:hover,
.iis-item__link:focus {
	color: inherit;
	text-decoration: none;
}

/* ── Media ──────────────────────────────────────────────────────────────── */

/*
 * The width is set by a custom property, never the flex basis: in a tile the
 * card stacks, so a basis would be read as a height and the square would grow
 * to fill the row.
 */
.iis-item__media {
	position: relative;
	flex: 0 0 auto;
	width: var( --iis-card-media );
	overflow: hidden;
	aspect-ratio: var( --iis-media );
	background: var( --iis-wash );
	border-radius: var( --iis-radius );
}

.iis-item__media--wide {
	--iis-media: 4 / 3;
}

.iis-item__media img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: 100%;
	margin: 0;
	object-fit: cover;
	border-radius: inherit;
	transition: transform 220ms ease;
}

/*
 * Product photography is usually a single object on a white background, so it
 * is fitted rather than cropped, and the tile is white to match. Tinting the
 * tile instead would put a visible box around every cut-out, and on a dark site
 * a white photograph would sit on it as a glaring rectangle. A white tile is
 * read as a lightbox, which is what shops use.
 */
/*
 * Product shots are cut out on white, so the tile is white whatever the host
 * is. On a white host that would leave the shot floating, so the tile carries
 * a hairline of its own.
 */
.iis-item__media--contain {
	background: #fff;
	box-shadow: inset 0 0 0 1px var( --iis-line );
}

.iis-item__media--contain img {
	padding: 4%;
	object-fit: contain;
}

.iis-item__link:hover .iis-item__media img {
	transform: scale( 1.03 );
}

.iis-item__media-empty {
	display: block;
	width: 100%;
	height: 100%;
}

/* ── Text ───────────────────────────────────────────────────────────────── */

.iis-item__body {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	gap: 0.25rem;
	min-width: 0;
}

.iis-item__kind {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	font-size: inherit;
	font-weight: 600;
	line-height: 1.4;
	color: var( --iis-quiet );
}

.iis-item__date {
	font-weight: 400;
}

.iis-item__title {
	display: block;
	font-size: inherit;
	font-weight: 600;
	line-height: 1.35;
	/* Danish compound words are long; let them break rather than overflow. */
	overflow-wrap: anywhere;
}

.iis-item__link:hover .iis-item__title {
	text-decoration: underline;
	text-underline-offset: 0.18em;
}

.iis-item__excerpt {
	display: -webkit-box;
	overflow: hidden;
	font-size: inherit;
	line-height: 1.5;
	color: var( --iis-quiet );
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
}

/*
 * The match is marked with a tint taken from the text colour rather than the
 * browser's yellow, which reads as a rendering artifact rather than a result.
 */
.iis-mark {
	padding: 0.05em 0.15em;
	margin: 0 -0.05em;
	color: inherit;
	background: var( --iis-mark );
	border-radius: 2px;
}

/* ── Price ──────────────────────────────────────────────────────────────── */

/*
 * The signature of the card. Figures are tabular so they line up down the
 * column, the payable amount always comes first, and anything struck through
 * drops back to the quiet tone so the eye is never caught by the old price.
 */
.iis-item__price {
	display: block;
	margin-top: auto;
	padding-top: 0.15rem;
	font-size: inherit;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
	line-height: 1.4;
}

.iis-item__price ins {
	text-decoration: none;
	background: none;
}

.iis-item__price del {
	margin-left: 0.4em;
	font-size: inherit;
	font-weight: 400;
	color: var( --iis-quiet );
	opacity: 1;
}

.iis-item__price del .amount {
	text-decoration: line-through;
}

.iis-item__price .woocommerce-Price-currencySymbol {
	font-weight: inherit;
}

.iis-item__stock {
	font-size: inherit;
	color: var( --iis-quiet );
}

.iis-item__stock--outofstock {
	font-style: italic;
}

/*
 * On back order is neither in stock nor out of it, and until now it read as
 * though it were in stock. It takes the quiet treatment, which is the one
 * thing the baseline can say about it without inventing a colour.
 */
.iis-item__stock--onbackorder {
	font-style: italic;
}

.iis-item__count {
	font-size: inherit;
	font-variant-numeric: tabular-nums;
	color: var( --iis-quiet );
}

/* ── Flags, ratings, terms ──────────────────────────────────────────────── */

/*
 * The flag sits over the corner of the card rather than in the text flow, so
 * every title in a row still starts on the same line.
 */
.iis-item__flag {
	position: absolute;
	top: 0.5rem;
	left: 0.5rem;
	z-index: 1;
	padding: 0.12rem 0.45rem;
	font-size: inherit;
	font-weight: 700;
	line-height: 1.5;
	/*
	 * System ink on system canvas rather than currentColor, which would resolve
	 * to the same value as the text and leave the pill invisible. This also
	 * flips correctly in dark mode without the plugin knowing which it is in.
	 */
	color: var( --iis-flag-ink );
	background: var( --iis-flag-bg );

	/*
	 * A hairline so the badge is still visible in the case the system keywords
	 * get wrong: a light host on a visitor whose system is dark paints a white
	 * pill on a white card, and an outline is better than nothing at all.
	 */
	box-shadow: inset 0 0 0 1px var( --iis-line );
	border-radius: 999px;
}

/* In a row the thumbnail is too small to carry it, so it moves to the end. */
.iis--view-list .iis-item__flag,
.iis--rows .iis-item__flag {
	top: 0.95rem;
	right: 0;
	left: auto;
}

@media ( max-width: 600px ) {
	.iis .iis-item__flag {
		top: 0.95rem;
		right: 0;
		left: auto;
	}
}

.iis-item__rating {
	display: block;
	font-size: inherit;
	line-height: 1.4;
	color: var( --iis-quiet );
}

.iis-item__rating .star-rating {
	margin: 0;
	font-size: inherit;
}

.iis-item__terms {
	display: flex;
	flex-wrap: wrap;
	gap: 0.3rem;
	margin-top: 0.15rem;
}

.iis-item__term {
	padding: 0.05rem 0.4rem;
	font-size: inherit;
	line-height: 1.6;
	color: var( --iis-pill-ink );
	background: var( --iis-pill-bg );
	border: 1px solid var( --iis-line );
	border-radius: 999px;
}

/*
 * The card is already a link, so this is a visual affordance rather than a
 * second tab stop.
 */
.iis-item__action {
	display: var( --iis-card-action );
	/* The rule under it belongs to the words, not to the width of the card. */
	align-self: flex-start;
	margin-top: 0.5rem;
	padding: var( --iis-action-padding );
	font-size: inherit;
	font-weight: 600;
	color: var( --iis-action-ink );
	text-decoration: none;
	background: var( --iis-action-bg );
	border-bottom: var( --iis-action-rule );
	border-radius: var( --iis-action-radius );
}

.iis-item__action:hover {
	color: inherit;
	border-bottom-color: currentColor;
}

/* ── Rows ───────────────────────────────────────────────────────────────── */

/*
 * Used by list view, and by any screen too narrow for a grid. A phone showing
 * one full-width tile per result can only fit two results; as rows it fits six,
 * which is the difference between scrolling and choosing.
 */
.iis--view-list,
.iis--rows {
	--iis-card-columns: 1fr;
	--iis-card-gap: 0;
	--iis-card-direction: row;
	--iis-card-align: flex-start;
	--iis-card-media: 5.5rem;
	--iis-card-padding: var( --iis-gap-tight ) 0;
	--iis-card-rule: var( --iis-line );
	--iis-card-action: none;
}

@media ( max-width: 600px ) {
	.iis {
		--iis-card-columns: 1fr;
		--iis-card-gap: 0;
		--iis-card-direction: row;
		--iis-card-align: flex-start;
		--iis-card-media: 4.5rem;
		--iis-card-padding: var( --iis-gap-tight ) 0;
		--iis-card-rule: var( --iis-line );
		--iis-card-action: none;
	}
}

.iis--view-list .iis-item__link,
.iis--rows .iis-item__link {
	gap: 1rem;
}

/* A line of text is easier to read short, however wide the page is. */
.iis--view-list .iis-item__body {
	max-width: 46rem;
}

.iis--view-list .iis-item__price,
.iis--rows .iis-item__price {
	margin-top: 0.25rem;
}

/*
 * A result with no image, typically a category, still starts its text in the
 * same column as the rest, so the left edge of the list holds.
 */
.iis--view-list .iis-item:not( :has( .iis-item__media ) ) .iis-item__body {
	margin-left: calc( 5.5rem + 1rem );
}

@media ( max-width: 600px ) {
	.iis .iis-item:not( :has( .iis-item__media ) ) .iis-item__body {
		margin-left: calc( 4.5rem + 1rem );
	}
}

/* ── Footer ─────────────────────────────────────────────────────────────── */

.iis-results__footer {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	align-items: center;
	gap: 1rem;
	margin-top: var( --iis-gap );
}

.iis-results__footer:empty {
	margin-top: 0;
}

.iis-results__loading,
.iis-results__all {
	font-size: inherit;
	color: var( --iis-quiet );
}

.iis-results__more {
	padding: 0.55rem 1.4rem;
	font: inherit;
	font-size: inherit;
	font-weight: 600;
	color: inherit;
	background: none;
	border: 1px solid var( --iis-line );
	border-radius: 999px;
	cursor: pointer;
	transition: border-color 160ms ease, background-color 160ms ease;
}

.iis-results__more:hover {
	background: var( --iis-wash );
	border-color: currentColor;
}

/* ── Overlay ────────────────────────────────────────────────────────────── */

/*
 * The search field stays put and the results scroll under it. Not by making
 * the field sticky over a scrolling page — a sticky field has to be painted
 * opaque and has to cover the page's own top padding, and anything it fails to
 * cover shows results sliding along above the field. The overlay is a column
 * instead: the field is the header, the body is the only thing that scrolls,
 * and there is nowhere above the field for a result to appear.
 */
.iis-overlay-root {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	overscroll-behavior: contain;
	padding: clamp( 1rem, 5vw, 4rem ) clamp( 1rem, 5vw, 3rem );
	color: var( --iis-overlay-ink );
	background: var( --iis-overlay-bg );
	backdrop-filter: var( --iis-overlay-blur );
}

/*
 * Redefining the properties rather than repeating the rule. A site that wants
 * its own pane sets --iis-overlay-bg and --iis-overlay-blur once and is done;
 * before this it had to restate this whole @supports block to cancel it.
 */
@supports ( backdrop-filter: blur( 1px ) ) {
	.iis,
	.iis-overlay-root {
		--iis-overlay-bg: color-mix( in srgb, Canvas 92%, transparent );
		--iis-overlay-blur: blur( 20px ) saturate( 1.4 );
	}
}

.iis-overlay-root[hidden] {
	display: none;
}

.iis-overlay-open {
	overflow: hidden;
}

.iis--overlay {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	min-height: 0;
	width: 100%;
	max-width: var( --iis-overlay-max );
	margin: 0 auto;
}

.iis--overlay .iis__bar,
.iis--overlay .iis__head {
	flex: 0 0 auto;
}

.iis--overlay .iis__body {
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
	overscroll-behavior: contain;

	/*
	 * Room for the scrollbar whether or not there is one, so the grid does not
	 * jump sideways by its width the moment the results outgrow the screen.
	 */
	scrollbar-gutter: stable;

	/*
	 * The breathing room at the end of the list belongs inside the scrolling
	 * area. On the overlay root it is below it, where it is a strip of screen
	 * that can never show a result.
	 */
	padding-bottom: var( --iis-gap );
}

/* ── Appearance ─────────────────────────────────────────────────────────── */

.iis-item {
	animation: iis-rise 260ms ease both;
}

@keyframes iis-rise {
	from {
		opacity: 0;
		transform: translateY( 6px );
	}
}

@media ( prefers-reduced-motion: reduce ) {
	.iis *,
	.iis-overlay-root * {
		animation: none !important;
		transition: none !important;
	}

	.iis-item__link:hover .iis-item__media img {
		transform: none;
	}
}

/* ── Utilities ──────────────────────────────────────────────────────────── */

.iis .screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect( 0, 0, 0, 0 );
	white-space: nowrap;
	border: 0;
}

/* ── Type tabs and sections ─────────────────────────────────────────────── */

/*
 * The tab row is a filter in the shape of a tab, so it is drawn with the same
 * derived colours as everything else: a quiet rule under the row, the chosen
 * tab marked by weight and an underline rather than by a colour this
 * stylesheet does not know.
 */
/*
 * Same again: the wrapper is always rendered and the tabs inside it are a
 * results-page thing, so in an overlay it is always empty. The space belongs
 * to the row of tabs, not to the element that may or may not hold one.
 */
.iis-tabs {
	margin: 0;
}

.iis-tabs__list {
	margin-bottom: var( --iis-gap-tight );
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem 1.25rem;
	border-bottom: 1px solid var( --iis-line );
}

.iis .iis-tabs__tab {
	display: inline-flex;
	gap: 0.4em;
	align-items: baseline;
	margin: 0;
	padding: 0.55rem 0;
	font: inherit;
	font-size: inherit;
	color: inherit;
	cursor: pointer;
	background: none;
	border: 0;
	border-bottom: 2px solid transparent;
	border-radius: 0;
}

.iis .iis-tabs__tab:hover {
	border-bottom-color: var( --iis-line );
}

.iis .iis-tabs__tab--active {
	font-weight: 600;
	border-bottom-color: currentColor;
}

.iis .iis-tabs__tab:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

.iis-tabs__count {
	font-size: inherit;
	font-weight: 400;
	color: var( --iis-quiet );
	font-variant-numeric: tabular-nums;
}

/*
 * Sections get a list each rather than a heading inside the grid. A heading
 * spanning the columns would have to fight the grid for its width; a list per
 * section does not, and each one keeps its own product class for the shops
 * that hook into it.
 */
/*
 * Between sections, never above the first one: the rule separates, and there
 * is nothing above the first section to separate it from. Keeping it off the
 * first group is also what lets the first card stay level with the sidebar.
 */
.iis-results__group + .iis-results__group {
	margin-top: var( --iis-gap );
	padding-top: var( --iis-gap );
	border-top: 1px solid var( --iis-line );
}

/*
 * The line-height is stated rather than inherited because the sidebar's drop
 * is measured from it: a host whose own h3 rule is tighter than this would
 * otherwise leave the sidebar a few pixels low, and the two top edges that are
 * the whole point of the head row would not quite meet.
 */
.iis-results__heading {
	margin: 0 0 var( --iis-gap-tight );
	font-size: inherit;
	font-weight: 600;
	line-height: 1.5;
	color: var( --iis-quiet );
}
