/**
 * Zaur Search - command palette styles.
 *
 * Uses global --zt-* tokens only. Defines no tokens of its own.
 *
 * Token names were checked against the live site on 16 September 2026. All of
 * them exist in the global layer except four, which must be added to :root in
 * 11-SYSTEM_UI_STYLE_STANDARD.css before deploying:
 *
 *     --zt-accent      #2872fa   brand blue, the colour links already use
 *     --zt-shadow-lg             modal elevation, one step above --zt-shadow-md
 *     --zt-mark        #fde68a   search match highlight
 *     --zt-mark-ink    #713f12   text on that highlight
 *
 * The fallbacks after each var() exist so the palette still renders if a token
 * is renamed in the global layer; they are not a second source of truth.
 *
 * No !important anywhere. If the theme wins a rule, raise it here first.
 */

.zt-search {
	position: fixed;
	inset: 0;
	z-index: 9000;
	display: flex;
	justify-content: center;
	padding: 0 16px;
}

.zt-search[hidden] { display: none; }

/* Default placement: upper third of the viewport.
   The input then stays still while the result list grows downwards. */
.zt-search--top {
	align-items: flex-start;
	padding-top: calc(14vh + env(safe-area-inset-top, 0px));
}

.zt-search--center { align-items: center; }

.zt-search__scrim {
	position: absolute;
	inset: 0;
	background: rgba(10, 14, 18, .44);
	backdrop-filter: blur(2px);
}

.zt-search__box {
	position: relative;
	width: 100%;
	max-width: 620px;
	background: var(--zt-bg-page, #ffffff);
	border: 1px solid var(--zt-border-hover, #c7d2e0);
	border-radius: var(--zt-radius-md, 12px);
	box-shadow: var(--zt-shadow-lg, 0 12px 32px -8px rgba(15, 23, 42, .18), 0 32px 64px -16px rgba(15, 23, 42, .16));
	overflow: hidden;
	animation: zt-search-pop .13s ease-out;
}

@keyframes zt-search-pop {
	from { opacity: 0; transform: translateY(-6px) scale(.985); }
	to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
	.zt-search__box { animation: none; }
}

/* ---------- query row ---------- */

.zt-search__q {
	display: flex;
	align-items: center;
	gap: 11px;
	padding: 13px 14px;
	border-bottom: 1px solid var(--zt-border, #dbe3ec);
}

.zt-search__q svg {
	width: 17px;
	height: 17px;
	flex: none;
	color: var(--zt-text-faint, #94a3b8);
}

.zt-search__q input {
	flex: 1;
	min-width: 0;
	font-weight: 400;
	font-size: 16px;
	line-height: 1.4;
	color: var(--zt-text-primary, #0f172a);
	background: none;
	border: 0;
	padding: 0;
	box-shadow: none;
}

.zt-search__q input:focus { outline: none; box-shadow: none; }

.zt-search__q input::placeholder { color: var(--zt-text-faint, #94a3b8); }

.zt-search kbd {
	font: 500 11px/1 var(--zt-font-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
	background: var(--zt-bg-muted, #f1f5f9);
	border: 1px solid var(--zt-border, #dbe3ec);
	border-bottom-width: 2px;
	border-radius: 5px;
	padding: 4px 5px;
	color: var(--zt-text-muted, #64748b);
	white-space: nowrap;
}

/* ---------- type filter ---------- */

.zt-search__tabs {
	display: flex;
	gap: 4px;
	padding: 8px 10px;
	border-bottom: 1px solid var(--zt-border, #dbe3ec);
	background: var(--zt-bg-subtle, #f8fafc);
	overflow-x: auto;
	scrollbar-width: none;
}

.zt-search__tabs::-webkit-scrollbar { display: none; }

.zt-search__tabs button {
	font-weight: 500;
	font-size: 12px;
	line-height: 1;
	color: var(--zt-text-muted, #64748b);
	background: none;
	border: 1px solid transparent;
	border-radius: 999px;
	padding: 6px 11px;
	cursor: pointer;
	white-space: nowrap;
}

.zt-search__tabs button[aria-pressed="true"] {
	background: var(--zt-bg-page, #ffffff);
	border-color: var(--zt-border, #dbe3ec);
	color: var(--zt-text-primary, #0f172a);
}

/* ---------- results ---------- */

.zt-search__list {
	max-height: 44vh;
	overflow-y: auto;
	padding: 6px;
	scrollbar-width: thin;
}

.zt-search__group {
	font-weight: 600;
	font-size: 10.5px;
	line-height: 1;
	letter-spacing: .1em;
	text-transform: uppercase;
	color: var(--zt-text-faint, #94a3b8);
	padding: 12px 10px 6px;
}

.zt-search__row {
	display: flex;
	align-items: center;
	gap: 11px;
	padding: 9px 10px;
	border-radius: 7px;
	cursor: pointer;
	scroll-margin: 8px;
	text-decoration: none;
	color: inherit;
}

.zt-search__row:hover { text-decoration: none; color: inherit; }

.zt-search__row[aria-selected="true"] {
	background: var(--zt-bg-hover-blue, #f0f4ff);
}

.zt-search__ico {
	width: 26px;
	height: 26px;
	flex: none;
	display: grid;
	place-items: center;
	border-radius: 6px;
	background: var(--zt-bg-muted, #f1f5f9);
	border: 1px solid var(--zt-border, #dbe3ec);
	color: var(--zt-text-muted, #64748b);
}

.zt-search__ico svg { width: 14px; height: 14px; }

.zt-search__row[aria-selected="true"] .zt-search__ico {
	background: var(--zt-bg-page, #ffffff);
	border-color: var(--zt-accent, #2872fa);
	color: var(--zt-accent, #2872fa);
}

.zt-search__main {
	min-width: 0;
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 1px;
}

.zt-search__t {
	display: block;
	font-weight: 500;
	font-size: 14.5px;
	line-height: 1.35;
	color: var(--zt-text-primary, #0f172a);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.zt-search__t mark {
	background: var(--zt-mark, #fde68a);
	color: var(--zt-mark-ink, #713f12);
	border-radius: 2px;
	padding: 0 1px;
}

.zt-search__u {
	display: block;
	font: 400 11.5px/1.4 var(--zt-font-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
	color: var(--zt-text-faint, #94a3b8);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.zt-search__tag {
	font-weight: 500;
	font-size: 10.5px;
	line-height: 1;
	color: var(--zt-text-muted, #64748b);
	background: var(--zt-bg-muted, #f1f5f9);
	border: 1px solid var(--zt-border, #dbe3ec);
	border-radius: 4px;
	padding: 4px 6px;
	flex: none;
}

.zt-search__enter {
	opacity: 0;
	font: 500 10.5px/1 var(--zt-font-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
	color: var(--zt-accent, #2872fa);
	flex: none;
}

.zt-search__row[aria-selected="true"] .zt-search__enter { opacity: 1; }

.zt-search__empty {
	padding: 30px 16px 34px;
	text-align: center;
	color: var(--zt-text-muted, #64748b);
	font-size: 14px;
}

.zt-search__empty code { font-size: 12px; }

/* ---------- footer ---------- */

.zt-search__foot {
	display: flex;
	gap: 16px;
	align-items: center;
	flex-wrap: wrap;
	padding: 9px 13px;
	border-top: 1px solid var(--zt-border, #dbe3ec);
	background: var(--zt-bg-subtle, #f8fafc);
	font-size: 11.5px;
	color: var(--zt-text-faint, #94a3b8);
}

.zt-search__foot b {
	font-weight: 500;
	color: var(--zt-text-muted, #64748b);
}

.zt-search__count {
	margin-left: auto;
	font-variant-numeric: tabular-nums;
}

/* ---------- header trigger ---------- */

.zt-search-trigger {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	background: var(--zt-bg-page, #ffffff);
	border: 1px solid var(--zt-border, #dbe3ec);
	color: var(--zt-text-faint, #94a3b8);
	font-weight: 400;
	font-size: 13.5px;
	line-height: 1;
	padding: 8px 10px 8px 11px;
	border-radius: var(--zt-radius-sm, 8px);
	cursor: pointer;
	min-width: 200px;
	text-align: left;
}

.zt-search-trigger:hover {
	border-color: var(--zt-border-hover, #c7d2e0);
	color: var(--zt-text-muted, #64748b);
}

.zt-search-trigger svg { width: 15px; height: 15px; flex: none; }

.zt-search-trigger__label { flex: 1; }

/* ---------- narrow viewports ---------- */

@media (max-width: 600px) {
	.zt-search--top { padding-top: calc(6vh + env(safe-area-inset-top, 0px)); }
	.zt-search__list { max-height: 56vh; }
	.zt-search__foot { display: none; }
	.zt-search__tag { display: none; }
	.zt-search-trigger { min-width: 0; padding: 8px; }
	.zt-search-trigger__label,
	.zt-search-trigger kbd { display: none; }
}

/* ---------- shortcut badge next to a trigger ---------- */

/*
 * Sits beside the header magnifier, which carries no label of its own.
 *
 * The header is dark, and its text colour is already muted, so the badge takes
 * its text at full strength and derives only the fill and the border from it
 * with color-mix. Dimming an already-dim colour with opacity is what made the
 * first attempt invisible. rgba() fallbacks come first for older engines.
 *
 * Two keycaps, not one pill: a single wide rounded box beside an icon reads as
 * a text input.
 */
.zt-search-badge {
	display: inline-flex;
	align-items: center;
	gap: 3px;
	margin-left: 9px;
	padding: 0;
	border: 0;
	background: none;
	color: inherit;
	line-height: 1;
	cursor: pointer;
	white-space: nowrap;
}

.zt-search-badge span {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 20px;
	height: 20px;
	padding: 0 5px;
	border-radius: 5px;
	font: 600 11px/1 var(--zt-font-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
	letter-spacing: .01em;
	color: currentColor;
	background: rgba(148, 163, 184, .20);
	background: color-mix(in srgb, currentColor 18%, transparent);
	border: 1px solid rgba(148, 163, 184, .38);
	border-color: color-mix(in srgb, currentColor 36%, transparent);
	box-shadow: 0 1px 0 rgba(0, 0, 0, .18);
	transition: background-color .12s ease, border-color .12s ease;
}

/* The magnifier and its badge are one control - light up together. */
.zt-search-badge:hover span,
.zt-search-trigger:hover .zt-search-badge span,
.ct-header-search:hover + .zt-search-badge span {
	background: rgba(148, 163, 184, .34);
	background: color-mix(in srgb, currentColor 30%, transparent);
	border-color: rgba(148, 163, 184, .58);
	border-color: color-mix(in srgb, currentColor 55%, transparent);
}

@media (max-width: 700px) {
	.zt-search-badge { display: none; }
}

/* ---------- tip inside the empty state ---------- */

.zt-search__tip {
	padding: 14px 10px 8px;
	text-align: center;
	font-size: 11.5px;
	color: var(--zt-text-faint, #94a3b8);
}

.zt-search__tip kbd {
	margin: 0 2px;
	padding: 3px 5px;
	font-size: 10.5px;
}

@media (max-width: 600px) {
	.zt-search__tip { display: none; }
}
