/* ==========================================================================
   Site console: header Search button and the bottom-docked search / shell.
   Uses the design tokens from main.css.
   ========================================================================== */

/* ---------- Header button ---------- */
.nav__search {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px;
	min-width: 44px; height: 44px; padding: 0 12px; border-radius: 999px;
	border: 1px solid var(--line-2); color: var(--fg-2); font-size: 0.88rem;
	transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.nav__search svg { width: 18px; height: 18px; flex: none; }
.nav__search:hover, .nav__search[aria-expanded="true"] { color: var(--accent); border-color: var(--accent); }
.nav__search:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.nav__search kbd {
	font-family: var(--mono); font-size: 0.7rem; line-height: 1; padding: 0.3em 0.5em; border-radius: 6px;
	border: 1px solid var(--line-2); color: var(--muted); background: rgb(255 255 255 / 0.03);
}
/* Phones: icon only, still a 44px target. */
.nav__search-label, .nav__search kbd { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.nav__search { padding: 0; width: 44px; }
@media (min-width: 960px) {
	.nav__search { width: auto; padding: 0 8px 0 14px; height: 40px; }
	.nav__search-label, .nav__search kbd { position: static; width: auto; height: auto; overflow: visible; clip: auto; }
}

/* ---------- Console ---------- */
.console[hidden] { display: none; }
.console { position: fixed; inset: 0; z-index: 160; pointer-events: none; }
.console__scrim {
	position: absolute; inset: 0; pointer-events: auto;
	background: rgb(5 6 8 / 0.5); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
	opacity: 0; transition: opacity 0.3s var(--ease);
}
.console__panel {
	position: absolute; left: 0; right: 0; bottom: var(--console-kb, 0px);
	height: min(520px, 60svh);
	max-height: calc(var(--console-vh, 100dvh) - 12px);
	min-height: min(260px, calc(var(--console-vh, 100dvh) - 12px));
	display: flex; flex-direction: column; pointer-events: auto;
	background: #07080a; border-top: 1px solid var(--line-2);
	box-shadow: 0 -30px 90px rgb(0 0 0 / 0.6), 0 -1px 0 rgb(200 255 62 / 0.08);
	transform: translateY(102%); transition: transform 0.42s var(--ease);
	overscroll-behavior: contain;
}
.console.is-open .console__scrim { opacity: 1; }
.console.is-open .console__panel { transform: none; }

/* Inner column: full-width sheet, readable measure. */
.console__bar, .console__body > * { width: 100%; max-width: 1040px; margin-inline: auto; }

.console__bar { display: flex; align-items: center; gap: 12px; flex: none; padding: 8px 12px 8px var(--gutter); color: var(--muted); }
.console__panel::before { content: ""; position: absolute; left: 0; right: 0; top: 46px; border-top: 1px solid var(--line); pointer-events: none; }
.console__lights { display: none; gap: 6px; }
.console__lights i { width: 11px; height: 11px; border-radius: 50%; background: #3a3d44; }
.console__lights i:first-child { background: #ff5f57; } .console__lights i:nth-child(2) { background: #febc2e; } .console__lights i:nth-child(3) { background: #28c840; }
.console__name { margin: 0; font-size: 0.78rem; font-weight: 500; letter-spacing: 0.02em; color: var(--fg-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.console__name span { color: var(--muted); }
.console__close { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 6px 0 8px; border-radius: 8px; color: var(--muted); }
.console__close:hover { color: var(--fg); background: var(--bg-3); }
.console__close:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.console__close svg { width: 16px; height: 16px; }
.console__close kbd { display: none; font-family: var(--mono); font-size: 0.68rem; padding: 0.15em 0.45em; border-radius: 5px; border: 1px solid var(--line-2); }

.console__body { flex: 1; min-height: 0; display: flex; flex-direction: column; }

/* Scrollback */
.console__out {
	flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
	padding: 14px var(--gutter) 6px; font-size: 0.8rem; line-height: 1.7; color: var(--fg-2);
	white-space: pre-wrap; overflow-wrap: anywhere;
}
.console__line + .console__line { margin-top: 2px; }
.console__out .c { color: var(--fg); }
.console__out .a { color: var(--accent); }
.console__out .m { color: var(--muted); }
.console__out .e { color: var(--bad); }
.console__out a { color: var(--accent-2); text-decoration: underline; text-underline-offset: 3px; }
.console__out a:hover { color: var(--accent); }
.console__rows { display: grid; grid-template-columns: 1fr; gap: 0 18px; white-space: normal; margin: 2px 0; }
.console__row { display: grid; grid-template-columns: 1fr; padding: 3px 0; border-bottom: 1px dashed rgb(255 255 255 / 0.05); }
.console__k { color: var(--accent); }
.console__v { color: var(--fg-2); }
.console__intro .console__row { border: 0; padding: 1px 0; grid-template-columns: 15ch 1fr; gap: 12px; align-items: baseline; }
.console__cmd {
	font: inherit; color: var(--accent); padding: 0; border-radius: 4px; text-align: left;
	text-decoration: underline dotted rgb(200 255 62 / 0.45); text-underline-offset: 3px;
}
.console__cmd:hover { color: var(--fg); background: rgb(200 255 62 / 0.08); }
.console__cmd:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (min-width: 640px) {
	.console__row { grid-template-columns: minmax(12ch, 18ch) 1fr; gap: 18px; align-items: baseline; }
	.console__intro .console__row { grid-template-columns: 18ch 1fr; gap: 18px; }
}

/* Prompt */
.console__in {
	flex: none; display: flex; align-items: center; gap: 10px;
	padding: 10px var(--gutter) 12px; font-size: 0.9rem;
	border-top: 1px solid var(--line);
}
.console__prompt { color: var(--accent); font-size: 1rem; line-height: 1; }
.console__in input {
	flex: 1; min-width: 0; height: 36px; padding: 0; background: transparent; border: 0; outline: none;
	color: var(--fg); caret-color: var(--accent); font-family: var(--mono);
	font-size: 16px; /* 16px stops iOS zooming on focus */
}
.console__in input::placeholder { color: var(--muted); opacity: 0.8; }
.console__in:focus-within { border-top-color: rgb(200 255 62 / 0.35); }

/* Suggestions take the room they need; the scrollback gets what is left. */
.console__body:has(.console__results:not([hidden])) .console__out { flex: 1 1 0; }
.console__body:has(.console__results:not([hidden])) .console__results { max-height: none; }

/* Suggestions */
.console__results {
	flex: 0 1 auto; min-height: 0; max-height: 72%; overflow-y: auto; overscroll-behavior: contain;
	margin: 0 auto; padding: 0 calc(var(--gutter) - 10px) 10px; list-style: none;
}
.console__results[hidden] { display: none; }
.console__opt {
	display: grid; grid-template-columns: auto 1fr auto; align-items: start; gap: 4px 12px;
	padding: 8px 10px; border-radius: 10px; cursor: pointer; color: var(--fg-2);
}
.console__opt[aria-selected="true"] { background: var(--bg-3); color: var(--fg); box-shadow: inset 2px 0 0 var(--accent); }
.console__type {
	font-family: var(--mono); font-size: 0.64rem; letter-spacing: 0.06em; text-transform: uppercase;
	padding: 0.3em 0.55em; margin-top: 0.15em; border-radius: 6px; min-width: 8.5ch; text-align: center;
	color: var(--muted); border: 1px solid var(--line-2);
}
.console__opt[aria-selected="true"] .console__type { color: var(--accent); border-color: rgb(200 255 62 / 0.4); }
.console__main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.console__title { color: var(--fg); font-size: 0.92rem; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.console__meta {
	font-size: 0.78rem; line-height: 1.45; color: var(--muted);
	display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
}
.console__sub { color: var(--fg-2); }
.console__results mark { background: rgb(200 255 62 / 0.16); color: var(--accent); border-radius: 3px; padding: 0 1px; }
.console__enter { font-family: var(--mono); font-size: 0.8rem; color: var(--muted); opacity: 0; margin-top: 0.1em; }
.console__opt[aria-selected="true"] .console__enter,
.console__results.is-default .console__opt:first-child .console__enter { opacity: 1; }
.console__results.is-default .console__opt:first-child { background: rgb(255 255 255 / 0.03); }

@media (min-width: 720px) {
	.console__lights { display: flex; }
	.console__close kbd { display: inline-block; }
	.console__meta { -webkit-line-clamp: 1; line-clamp: 1; }
}
@media (hover: hover) {
	.console__opt:hover:not([aria-selected="true"]) { background: rgb(255 255 255 / 0.04); }
}

@media (prefers-reduced-motion: reduce) {
	.console__panel, .console__scrim { transition: none; }
}
