/* =====================================================================
 * zzf-core — search.css
 * Header product search with a suggestions panel.
 * ---------------------------------------------------------------------
 * MESH RULE: the suggestions panel is a DATA surface — it is a list of
 * products with prices — so it is flat white with a hairline, never
 * glass. The header itself is glass; the panel hanging off it is not,
 * and that contrast is intentional rather than an oversight.
 *
 * DO NOT put backdrop-filter, transform, filter, perspective or
 * will-change on .zzf-header or on this wrapper. Any of the five creates
 * a containing block for position:fixed and would trap the mobile nav
 * overlay inside the 64px header box — the exact bug that made the menu
 * open as a clipped sliver. The panel is position:absolute against
 * .zzf-search, which is safe.
 *
 * MOBILE: the field collapses to its icon and expands to the full width
 * of the header bar on :focus-within. Pure CSS, no toggle state to keep
 * in sync, and nothing to go wrong if the JS fails to load.
 * ================================================================== */

.zzf-search {
	position: relative;
	display: flex;
	align-items: center;
	flex: 0 1 auto;
}

.zzf-search__form {
	position: relative;
	display: flex;
	align-items: center;
	width: 210px;
	max-width: 100%;
	transition: width .22s ease;
}

.zzf-search:focus-within .zzf-search__form { width: 290px; }

/* CSS-drawn magnifier: a circle plus a rotated bar. An inline SVG would
   be another asset to keep in sync with the palette for no gain. */
.zzf-search__icon {
	position: absolute;
	left: 11px;
	width: 11px;
	height: 11px;
	border: 1.5px solid var(--wp--preset--color--muted, #5A6C89);
	border-radius: 50%;
	pointer-events: none;
	opacity: .85;
}

.zzf-search__icon::after {
	content: "";
	position: absolute;
	top: 10px;
	left: 8px;
	width: 5px;
	height: 1.5px;
	background: var(--wp--preset--color--muted, #5A6C89);
	transform: rotate(45deg);
	transform-origin: left center;
}

.zzf-search__input {
	width: 100%;
	padding: .48rem .9rem .48rem 2.05rem;
	background: var(--wp--preset--color--base, #FFFFFF);
	border: 1px solid var(--wp--preset--color--line, #E3EBF6);
	border-radius: 4px;
	color: var(--wp--preset--color--contrast, #0B1B36);
	font-family: var(--wp--preset--font-family--body, Outfit, sans-serif);
	font-size: .85rem;
	font-weight: 300;
	line-height: 1.4;
	outline: none;
	transition: border-color .2s ease, box-shadow .2s ease;
}

.zzf-search__input::placeholder {
	color: var(--wp--preset--color--muted, #5A6C89);
	opacity: .8;
}

.zzf-search__input:focus {
	border-color: var(--wp--preset--color--accent, #14346E);
	box-shadow: 0 0 0 3px rgba(20, 52, 110, .10);
}

/* Kill the UA's own clear affordance — we render our own so it can be
   positioned and coloured with everything else. */
.zzf-search__input::-webkit-search-decoration,
.zzf-search__input::-webkit-search-cancel-button {
	-webkit-appearance: none;
	appearance: none;
}

.zzf-search__clear {
	position: absolute;
	right: 6px;
	width: 20px;
	height: 20px;
	padding: 0;
	background: none;
	border: 0;
	cursor: pointer;
	opacity: .55;
	transition: opacity .2s ease;
}

.zzf-search__clear:hover { opacity: 1; }
.zzf-search__clear[hidden] { display: none; }

.zzf-search__clear::before,
.zzf-search__clear::after {
	content: "";
	position: absolute;
	top: 9px;
	left: 4px;
	width: 12px;
	height: 1.5px;
	background: var(--wp--preset--color--muted, #5A6C89);
}

.zzf-search__clear::before { transform: rotate(45deg); }
.zzf-search__clear::after  { transform: rotate(-45deg); }

/* ── Suggestions panel ─────────────────────────────────────────────── */

.zzf-search__panel {
	position: absolute;
	top: calc(100% + 8px);
	right: 0;
	z-index: 60;
	width: 380px;
	max-width: min(92vw, 420px);
	max-height: min(70vh, 460px);
	overflow-y: auto;
	background: var(--wp--preset--color--base, #FFFFFF);
	border: 1px solid var(--wp--preset--color--line, #E3EBF6);
	border-radius: 10px;
	box-shadow: 0 18px 44px -18px rgba(11, 27, 54, .30);
	padding: .4rem;
}

.zzf-search__panel[hidden] { display: none; }

.zzf-search__label {
	margin: .3rem .55rem .35rem;
	font-family: var(--wp--preset--font-family--mono, ui-monospace, monospace);
	font-size: .66rem;
	letter-spacing: .1em;
	text-transform: uppercase;
	color: var(--wp--preset--color--muted, #5A6C89);
}

.zzf-search__list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.zzf-search__row {
	display: flex;
	align-items: center;
	gap: .7rem;
	padding: .5rem .55rem;
	border-radius: 6px;
	cursor: pointer;
}

.zzf-search__row.is-active,
.zzf-search__row:hover {
	background: var(--wp--preset--color--surface-2, #E9F1FC);
}

.zzf-search__thumb {
	flex: 0 0 auto;
	width: 38px;
	height: 38px;
	object-fit: cover;
	border-radius: 5px;
	background: var(--wp--preset--color--surface-2, #E9F1FC);
	border: 1px solid var(--wp--preset--color--line, #E3EBF6);
}

.zzf-search__thumb--empty { display: block; }

.zzf-search__text {
	display: flex;
	flex-direction: column;
	gap: .1rem;
	min-width: 0;
	flex: 1 1 auto;
}

.zzf-search__name {
	font-family: var(--wp--preset--font-family--body, Outfit, sans-serif);
	font-size: .88rem;
	font-weight: 400;
	color: var(--wp--preset--color--contrast, #0B1B36);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* The matched run. Weight, not colour — the accent is load-bearing
   elsewhere and a red fragment inside a product name would read as an
   alert rather than as emphasis. */
.zzf-search__name mark {
	background: none;
	color: inherit;
	font-weight: 600;
}

/* Size is analytical data, so it is mono like every other figure. */
.zzf-search__meta,
.zzf-search__price {
	font-family: var(--wp--preset--font-family--mono, ui-monospace, monospace);
	font-size: .68rem;
	letter-spacing: .04em;
	color: var(--wp--preset--color--muted, #5A6C89);
}

.zzf-search__price {
	flex: 0 0 auto;
	color: var(--wp--preset--color--contrast, #0B1B36);
}

/* Recent-search rows: a small clock-ish glyph so they read as history
   rather than as products with a missing image. */
.zzf-search__row--term { gap: .55rem; }

.zzf-search__rowicon {
	flex: 0 0 auto;
	width: 13px;
	height: 13px;
	border: 1.5px solid var(--wp--preset--color--muted, #5A6C89);
	border-radius: 50%;
	opacity: .6;
	position: relative;
}

.zzf-search__rowicon::after {
	content: "";
	position: absolute;
	top: 2px;
	left: 4.5px;
	width: 1.5px;
	height: 4px;
	background: var(--wp--preset--color--muted, #5A6C89);
}

.zzf-search__none {
	margin: 0;
	padding: 1.1rem .75rem;
	text-align: center;
	font-size: .85rem;
	font-weight: 300;
	color: var(--wp--preset--color--muted, #5A6C89);
}

.zzf-search__all {
	display: block;
	width: 100%;
	margin-top: .35rem;
	padding: .6rem;
	background: none;
	border: 0;
	border-top: 1px solid var(--wp--preset--color--line, #E3EBF6);
	border-radius: 0 0 8px 8px;
	color: var(--wp--preset--color--accent, #14346E);
	font-family: var(--wp--preset--font-family--body, Outfit, sans-serif);
	font-size: .72rem;
	font-weight: 600;
	letter-spacing: .1em;
	text-transform: uppercase;
	cursor: pointer;
}

.zzf-search__all:hover {
	background: var(--wp--preset--color--surface, #FAFCFF);
	color: var(--wp--preset--color--contrast, #0B1B36);
}

/* ── Mobile ────────────────────────────────────────────────────────────
   Below 880px the field is icon-width and expands across the header bar
   when focused. .zzf-search stays static so the absolutely-positioned
   form resolves against .zzf-header__bar, which is what makes it span
   the full width instead of the 40px collapsed box. */
@media (max-width: 880px) {
	.zzf-search { position: static; }

	.zzf-search__form { width: 40px; }

	.zzf-search__input {
		padding-right: .5rem;
		color: transparent;   /* the collapsed field is a button, not a field */
	}

	.zzf-search__input::placeholder { color: transparent; }

	.zzf-search:focus-within .zzf-search__form {
		position: absolute;
		left: var(--wp--preset--spacing--30, 1rem);
		right: var(--wp--preset--spacing--30, 1rem);
		width: auto;
		z-index: 61;
	}

	.zzf-search:focus-within .zzf-search__input {
		color: var(--wp--preset--color--contrast, #0B1B36);
		padding-right: 2rem;
	}

	.zzf-search:focus-within .zzf-search__input::placeholder {
		color: var(--wp--preset--color--muted, #5A6C89);
	}

	.zzf-search__panel {
		left: var(--wp--preset--spacing--30, 1rem);
		right: var(--wp--preset--spacing--30, 1rem);
		width: auto;
		max-width: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.zzf-search__form { transition: none; }
}

/* ---------------------------------------------------------------------
 * HEADER ALIGNMENT (added 2026-08-20)
 * The field sits in a flex row beside the cart button, which is 46px. It
 * has to declare the same height or the row reads as crooked — nothing
 * centres a control whose height is whatever its contents happen to be.
 * The 95px measured before this was wpautop, fixed in search.php; this is
 * what keeps the three header controls the same size afterwards.
 * ------------------------------------------------------------------ */
.zzf-header__actions .zzf-search,
.zzf-header__actions .zzf-search__form {
	height: 46px;
	align-items: center;
}
.zzf-header__actions .zzf-search__input {
	height: 46px;
	box-sizing: border-box;
	line-height: 1;
}
/* wpautop is fixed at the source, but a stray empty <p> or <br> from a
   future edit must never be able to grow the row again. */
.zzf-header__actions .zzf-search__form > p,
.zzf-header__actions .zzf-search__form > br {
	display: contents;
}
