/* Header search field + full-screen search. Uses the theme colour variables (light / dark). */

/* ---- header trigger: icon on small screens, a full field on wide ones ---- */
.search-trigger {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 1px solid transparent;
	border-radius: 12px;
	background: transparent;
	color: var(--ink, #fff);
	font: inherit;
	cursor: pointer;
	transition: background 0.25s, color 0.25s, border-color 0.25s, box-shadow 0.25s;
}
.search-trigger .icon { flex: none; width: 20px; height: 20px; }
.search-trigger__text,
.search-trigger kbd { display: none; }
.search-trigger:hover { background: rgba(123, 102, 242, 0.16); color: #cdbfff; }
[data-theme="light"] .search-trigger:hover { background: rgba(91, 67, 214, 0.1); color: #4a33c8; }
.search-trigger:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (min-width: 1400px) {
	.search-trigger {
		width: 250px;
		justify-content: flex-start;
		padding: 0 8px 0 16px;
		border-color: var(--line);
		border-radius: 999px;
		background: var(--soft);
		color: var(--muted);
	}
	.search-trigger__text { display: inline; flex: 1; text-align: left; font-size: 15px; }
	.search-trigger kbd { display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 7px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--muted); font: 600 12px var(--font); }
	.search-trigger:hover { background: var(--soft); border-color: rgba(123, 102, 242, 0.6); color: var(--ink); box-shadow: 0 0 0 4px rgba(123, 102, 242, 0.14); }
	[data-theme="light"] .search-trigger:hover { color: var(--ink); }
}

/* ---- the full-screen search ---- */
body.search-open { overflow: hidden; }
.srch { position: fixed; inset: 0; z-index: 200; }
.srch[hidden] { display: none; }
.srch__backdrop { position: absolute; inset: 0; background: rgba(6, 1, 14, 0.66); backdrop-filter: blur(6px); opacity: 0; transition: opacity 0.3s ease; }
.srch.is-open .srch__backdrop { opacity: 1; }
.srch__panel {
	position: relative;
	display: flex;
	flex-direction: column;
	width: min(780px, calc(100% - 28px));
	max-height: calc(100vh - 14vh);
	margin: 8vh auto 0;
	border: 1px solid var(--line);
	border-radius: 26px;
	background: var(--bg);
	color: var(--ink);
	box-shadow: 0 50px 120px rgba(0, 0, 0, 0.55), 0 0 90px rgba(123, 102, 242, 0.16);
	overflow: hidden;
	opacity: 0;
	transform: translateY(-18px) scale(0.985);
	transition: opacity 0.3s ease, transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
[data-theme="light"] .srch__panel { background: #fff; box-shadow: 0 50px 120px rgba(60, 30, 130, 0.28); }
.srch.is-open .srch__panel { opacity: 1; transform: none; }

.srch__form { display: flex; align-items: center; gap: 12px; padding: 0 14px 0 22px; border-bottom: 1px solid var(--line); }
.srch__form > .icon { flex: none; width: 24px; height: 24px; color: var(--accent-2); }
.srch__form input[type="search"] { flex: 1; min-width: 0; height: 68px; padding: 0; border: 0; background: transparent; color: var(--ink); font: 500 20px var(--font); outline: 0; -webkit-appearance: none; appearance: none; }
.srch__form input[type="search"]::placeholder { color: var(--muted); opacity: 0.8; }
.srch__form input[type="search"]::-webkit-search-cancel-button { display: none; }
.srch__clear { display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--soft); color: var(--muted); cursor: pointer; }
.srch__clear[hidden] { display: none; }
.srch__clear .icon { width: 14px; height: 14px; }
.srch__clear:hover { background: var(--accent); color: #fff; }
.srch__close { min-height: 36px; padding: 0 14px; border: 1px solid var(--line); border-radius: var(--radius); background: transparent; color: var(--muted); font: 600 13px var(--font); cursor: pointer; }
.srch__close:hover { color: var(--ink); background: var(--soft); }

.srch__out { flex: 1; min-height: 160px; overflow-y: auto; padding: 8px 10px 14px; transition: opacity 0.2s; }
.srch__out.is-loading { opacity: 0.55; }
.srch__idle { display: grid; justify-items: center; gap: 8px; padding: 26px 18px 10px; text-align: center; }
.srch__idle-icon { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--soft); color: var(--accent-2); }
.srch__idle-icon svg { width: 26px; height: 26px; }
.srch__idle b { font-family: var(--display); font-size: 20px; }
.srch__idle p { max-width: 30rem; margin: 0; color: var(--muted); font-size: 15px; }
.srch__group { width: 100%; margin-top: 18px; text-align: left; }
.srch__h { display: flex; align-items: center; justify-content: space-between; margin: 0 6px 8px; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.srch__h button { border: 0; background: none; color: var(--accent-2); font: inherit; letter-spacing: 0; text-transform: none; cursor: pointer; }
.srch__chips { display: flex; flex-wrap: wrap; gap: 8px; }
.srch__idle .srch__chips { justify-content: center; }
.srch__chip { padding: 8px 16px; border: 1px solid var(--line); border-radius: 999px; background: var(--soft); color: var(--ink); font: 500 14px var(--font); cursor: pointer; transition: background 0.2s, border-color 0.2s, transform 0.2s; }
.srch__chip:hover { background: var(--accent); border-color: var(--accent); color: #fff; transform: translateY(-2px); }

.srch__hits { display: grid; gap: 4px; }
.srch__hit { display: flex; align-items: center; gap: 14px; padding: 10px 12px; border: 1px solid transparent; border-radius: 16px; color: var(--ink); text-decoration: none; transition: background 0.15s, border-color 0.15s; }
.srch__hit.is-sel { background: rgba(123, 102, 242, 0.16); border-color: rgba(123, 102, 242, 0.45); }
.srch__media { display: grid; place-items: center; flex: none; width: 52px; height: 52px; border-radius: 14px; background: var(--soft); overflow: hidden; }
.srch__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.srch__ico { display: grid; place-items: center; color: var(--accent-2); }
.srch__ico svg { width: 24px; height: 24px; }
.srch__txt { display: grid; flex: 1; gap: 2px; min-width: 0; }
.srch__txt b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--display); font-weight: 700; }
.srch__txt > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 14px; }
.srch__txt mark { padding: 0 2px; border-radius: 4px; background: rgba(255, 178, 63, 0.35); color: inherit; }
.srch__type { flex: none; padding: 3px 10px; border-radius: 999px; background: var(--soft); color: var(--muted); font-size: 11px; font-style: normal; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.srch__type--product { background: rgba(255, 138, 92, 0.18); color: #ff8a5c; }
.srch__type--post { background: rgba(123, 102, 242, 0.18); color: var(--accent-2); }
.srch__all { display: block; margin: 10px 6px 0; padding: 12px 14px; border-radius: 14px; background: var(--soft); color: var(--ink); font-weight: 600; text-align: center; text-decoration: none; transition: background 0.2s, color 0.2s; }
.srch__all:hover { background: var(--accent); color: #fff; }

.srch__keys { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 18px; padding: 12px 22px; border-top: 1px solid var(--line); background: var(--card); color: var(--muted); font-size: 12.5px; }
.srch__keys kbd { display: inline-grid; place-items: center; min-width: 22px; height: 22px; margin-right: 4px; padding: 0 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--soft); font: 600 11px var(--font); }
.srch__keys-end { margin-left: auto; }

@media (max-width: 720px) {
	.srch__panel { width: 100%; max-height: 100vh; margin: 0; border-radius: 0 0 24px 24px; }
	.srch__form { padding-left: 16px; }
	.srch__form input[type="search"] { height: 60px; font-size: 18px; }
	.srch__type { display: none; }
	.srch__keys { display: none; }
	.srch__out { max-height: calc(100vh - 62px); }
}
@media (prefers-reduced-motion: reduce) {
	.srch__panel, .srch__backdrop { transition: none; }
}
