/* =============================================================================
   Docs search — sidebar trigger button + ⌘K command-palette modal.
   Tokens (--bg, --surface, --text, --muted, etc.) are inherited from the
   .docs wrapper in docs.css; everything here is scoped to the search controls
   so no other pages are affected.
   ============================================================================= */

/* ── Sidebar trigger button ────────────────────────────────────────────── */
.docs-sidebar__search {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	padding: 10px 12px;
	margin: 0 0 12px;
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	background: var(--bg);
	color: var(--muted);
	font: inherit;
	font-size: 14px;
	cursor: pointer;
	text-align: left;
	transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.docs-sidebar__search:hover,
.docs-sidebar__search:focus-visible {
	background: var(--surface);
	border-color: var(--accent);
	color: var(--text);
	outline: none;
}

.docs-sidebar__search-icon {
	width: 16px;
	height: 16px;
	flex: 0 0 16px;
	stroke: currentColor;
	fill: none;
	stroke-width: 2;
}

.docs-sidebar__search-label {
	flex: 1 1 auto;
}

.docs-sidebar__search-kbd {
	flex: 0 0 auto;
	font-family: var(--font-mono);
	font-size: 11px;
	padding: 2px 6px;
	border-radius: var(--radius-sm);
	border: 1px solid var(--border);
	background: var(--surface);
	color: var(--muted);
}

/* ── Palette overlay ──────────────────────────────────────────────────── */
.docs-search {
	position: fixed;
	inset: 0;
	z-index: 1000;
	display: flex;
	align-items: flex-start;
	justify-content: center;
	padding: 80px 16px 16px;
}

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

.docs-search__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(15, 15, 26, 0.45);
	backdrop-filter: blur(2px);
}

.docs-search__panel {
	position: relative;
	width: 100%;
	max-width: 640px;
	max-height: calc(100vh - 96px);
	display: flex;
	flex-direction: column;
	background: var(--bg);
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	box-shadow: var(--shadow-dropdown);
	overflow: hidden;
}

/* ── Header (input + esc badge) ───────────────────────────────────────── */
.docs-search__header {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 14px 16px;
	border-bottom: 1px solid var(--border);
}

.docs-search__input {
	flex: 1 1 auto;
	min-width: 0;
	border: 0;
	padding: 6px 0;
	font: inherit;
	font-size: 16px;
	background: transparent;
	color: var(--text);
}

.docs-search__input:focus { outline: none; }
.docs-search__input::placeholder { color: var(--muted); }

.docs-search__esc {
	flex: 0 0 auto;
	font-family: var(--font-mono);
	font-size: 11px;
	padding: 2px 6px;
	border-radius: var(--radius-sm);
	border: 1px solid var(--border);
	background: var(--surface);
	color: var(--muted);
}

/* ── Results list ─────────────────────────────────────────────────────── */
.docs-search__results {
	flex: 1 1 auto;
	overflow-y: auto;
	margin: 0;
	padding: 8px;
	list-style: none;
}

.docs-search__empty {
	padding: 24px 16px;
	color: var(--muted);
	text-align: center;
	font-size: 14px;
}

.docs-search__result {
	border-radius: var(--radius-md);
}

.docs-search__result.is-active {
	background: var(--surface);
}

.docs-search__result-link {
	display: block;
	padding: 10px 12px;
	color: inherit;
	text-decoration: none;
}

.docs-search__crumb {
	display: block;
	font-size: 12px;
	color: var(--muted);
	margin-bottom: 2px;
}

.docs-search__title {
	display: block;
	font-size: 15px;
	font-weight: 600;
	color: var(--text);
	line-height: 1.3;
}

.docs-search__excerpt {
	display: block;
	margin-top: 4px;
	font-size: 13px;
	color: var(--muted);
	line-height: 1.45;
	overflow: hidden;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
}

.docs-search__results mark {
	background: color-mix(in oklab, var(--accent) 18%, transparent);
	color: inherit;
	padding: 0 2px;
	border-radius: 3px;
}

/* ── Footer hint bar ──────────────────────────────────────────────────── */
.docs-search__footer {
	padding: 10px 16px;
	font-size: 12px;
	color: var(--muted);
	border-top: 1px solid var(--border);
	display: flex;
	gap: 16px;
	flex-wrap: wrap;
}

.docs-search__footer kbd {
	font-family: var(--font-mono);
	font-size: 11px;
	padding: 1px 5px;
	border-radius: var(--radius-sm);
	border: 1px solid var(--border);
	background: var(--surface);
	color: var(--muted);
	margin-right: 4px;
}

/* ── Lock body scroll when palette is open ────────────────────────────── */
body.docs-search-open {
	overflow: hidden;
}

/* ── Mobile: full-screen sheet ────────────────────────────────────────── */
@media (max-width: 768px) {
	.docs-search {
		padding: 0;
	}
	.docs-search__panel {
		max-width: none;
		max-height: 100vh;
		height: 100vh;
		border-radius: 0;
		border: 0;
	}
	.docs-search__footer {
		display: none;
	}
}
