/* Shelby Search: dropdown panel, results-page form and sort switch. */

:root {
	--ss-blue: #0288d1;
	--ss-blue-dark: #0270ad;
	--ss-ink: #111;
	--ss-muted: #5b6670;
	--ss-line: #dfe5ea;
	--ss-soft: #f2f7fb;
	--ss-mark: rgba(2, 136, 209, 0.14);
	--ss-head: "Fira Sans Condensed", "Helvetica Neue", Arial, sans-serif;
	--ss-body: "Libre Franklin", "Helvetica Neue", Arial, sans-serif;
}

/* The theme's old inline search box is replaced by the panel. */
#header-search { display: none !important; }
#search-toggle.ss-toggle--open .search-icon { display: none; }
#search-toggle.ss-toggle--open .close-icon { display: inline-block; }

/* ---------- Mobile header button ---------- */
.ss-toggle { display: none; }
@media (max-width: 781px) {
	#masthead .ss-toggle {
		display: inline-flex; align-items: center; gap: 4px;
		margin: 0 12px 0 0; padding: 4px 2px; min-height: 40px;
		background: none; border: 0; border-radius: 0; box-shadow: none;
		color: var(--ss-ink); font: 600 13.6px/1 var(--ss-head); text-transform: none; letter-spacing: 0;
		cursor: pointer;
	}
	#masthead .ss-toggle:hover, #masthead .ss-toggle:focus { background: none; color: var(--ss-blue); }
	#masthead .ss-toggle svg { width: 22px; height: 22px; }
}

/* ---------- Backdrop + panel ---------- */
.ss-backdrop {
	position: fixed; left: 0; right: 0; bottom: 0; top: 0; z-index: 99990;
	background: rgba(15, 23, 32, 0.32);
	opacity: 0; transition: opacity 0.16s ease;
}
.ss-backdrop.is-open { opacity: 1; }

.ss-panel {
	position: fixed; left: 0; right: 0; top: 0; z-index: 99991;
	background: #fff;
	border-top: 1px solid var(--ss-line);
	box-shadow: 0 22px 44px -12px rgba(15, 23, 32, 0.28);
	opacity: 0; transform: translateY(-6px);
	transition: opacity 0.16s ease, transform 0.16s ease;
	font-family: var(--ss-body); color: var(--ss-ink);
}
.ss-panel.is-open { opacity: 1; transform: none; }
.ss-panel[hidden], .ss-backdrop[hidden] { display: none; }
@media (prefers-reduced-motion: reduce) {
	.ss-panel, .ss-backdrop { transition: none; }
}

.ss-panel__inner {
	max-width: 880px; margin: 0 auto; padding: 20px 24px 14px;
	display: flex; flex-direction: column;
	max-height: var(--ss-max-h, 80vh);
	box-sizing: border-box;
}

/* Reset theme button/input styling inside the panel. */
.ss-panel button {
	background: none; border: 0; border-radius: 0; box-shadow: none; margin: 0; padding: 0;
	color: inherit; font: inherit; line-height: inherit; text-transform: none; letter-spacing: normal;
	min-height: 0; width: auto; cursor: pointer;
}
.ss-panel button:hover, .ss-panel button:focus { background: none; color: inherit; }
.ss-panel ul { list-style: none; margin: 0; padding: 0; }
.ss-panel p { margin: 0; }

/* Search bar */
.ss-panel .ss-bar {
	display: flex; align-items: center; gap: 10px;
	height: 58px; padding: 0 8px 0 16px; margin: 0;
	border: 2px solid var(--ss-line); border-radius: 12px; background: #fff;
	transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.ss-panel .ss-bar:focus-within { border-color: var(--ss-blue); box-shadow: 0 0 0 4px rgba(2, 136, 209, 0.14); }
.ss-bar__icon { display: inline-flex; color: var(--ss-muted); flex: none; }
.ss-panel .ss-bar__input {
	flex: 1; min-width: 0; height: 100%; margin: 0; padding: 0;
	border: 0; outline: 0; box-shadow: none; background: transparent;
	font: 400 20px/1.2 var(--ss-body); color: var(--ss-ink);
	-webkit-appearance: none; appearance: none;
}
.ss-panel .ss-bar__input::placeholder { color: #8a949c; opacity: 1; }
.ss-panel .ss-bar__input::-webkit-search-cancel-button,
.ss-panel .ss-bar__input::-webkit-search-decoration { -webkit-appearance: none; display: none; }

.ss-panel .ss-bar__clear {
	display: inline-flex; align-items: center; justify-content: center; flex: none;
	width: 32px; height: 32px; border-radius: 50%; color: var(--ss-muted);
}
.ss-panel .ss-bar__clear:hover { background: var(--ss-soft); color: var(--ss-ink); }
.ss-panel .ss-bar__clear[hidden] { display: none; }

.ss-panel .ss-bar__go {
	flex: none; height: 42px; padding: 0 18px; border-radius: 9px;
	background: var(--ss-blue); color: #fff;
	font: 600 16px/42px var(--ss-head);
}
.ss-panel .ss-bar__go:hover, .ss-panel .ss-bar__go:focus { background: var(--ss-blue-dark); color: #fff; }

.ss-bar__spin {
	flex: none; width: 18px; height: 18px; border-radius: 50%;
	border: 2px solid var(--ss-line); border-top-color: var(--ss-blue);
	opacity: 0; animation: ss-spin 0.7s linear infinite; transition: opacity 0.12s;
}
.ss-panel.is-loading .ss-bar__spin { opacity: 1; }
@keyframes ss-spin { to { transform: rotate(360deg); } }

/* Body */
.ss-body { overflow-y: auto; overscroll-behavior: contain; margin-top: 14px; min-height: 0; }

.ss-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 4px 8px; }
.ss-head[hidden] { display: none; }
.ss-status {
	font: 600 12px/1 var(--ss-head); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ss-muted);
}

/* Segmented control (panel + results page) */
.ss-seg {
	display: inline-flex; padding: 3px; gap: 2px; border-radius: 999px; background: #eef2f5; flex: none;
}
.ss-panel .ss-seg__btn,
.ss-seg .ss-seg__btn {
	display: inline-block; padding: 6px 14px; border-radius: 999px;
	font: 600 14px/1.2 var(--ss-head); color: var(--ss-muted); text-decoration: none; white-space: nowrap;
	transition: background 0.12s, color 0.12s, box-shadow 0.12s;
}
.ss-panel .ss-seg__btn:hover, .ss-seg .ss-seg__btn:hover { color: var(--ss-ink); }
.ss-panel .ss-seg__btn[aria-pressed="true"], .ss-seg .ss-seg__btn[aria-pressed="true"] {
	background: #fff; color: var(--ss-blue-dark); box-shadow: 0 1px 3px rgba(15, 23, 32, 0.16);
}
.ss-seg--small .ss-seg__btn { padding: 4px 11px; font-size: 13px; }

/* Result rows */
.ss-item { margin: 0; }
.ss-link {
	display: grid; grid-template-columns: 72px 1fr; gap: 14px; align-items: start;
	padding: 10px; border-radius: 10px; text-decoration: none; color: inherit;
}
.ss-link:hover, .ss-item.is-active .ss-link { background: var(--ss-soft); text-decoration: none; }
.ss-item.is-active .ss-link { box-shadow: inset 3px 0 0 var(--ss-blue); }
.ss-thumb {
	display: block; width: 72px; height: 72px; border-radius: 8px; overflow: hidden; background: #e9eef2;
}
.ss-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; margin: 0; }
.ss-thumb__ph { display: flex; width: 100%; height: 100%; align-items: center; justify-content: center; color: #b3bdc5; }
.ss-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ss-title {
	font: 600 18px/1.25 var(--ss-head); color: var(--ss-ink);
	display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.ss-link:hover .ss-title, .ss-item.is-active .ss-title { color: var(--ss-blue-dark); }
.ss-snip {
	font: 400 14px/1.45 var(--ss-body); color: #4a545c;
	display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.ss-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font: 400 13px/1.3 var(--ss-body); color: var(--ss-muted); }
.ss-sec { font: 600 12px/1.3 var(--ss-head); letter-spacing: 0.05em; text-transform: uppercase; color: var(--ss-blue-dark); }
.ss-dot { color: #b3bdc5; }
.ss-panel mark, .ss-results-bar mark {
	background: var(--ss-mark); color: inherit; padding: 0; border-radius: 2px;
}

/* Loading skeleton */
.ss-item--skel { display: grid; grid-template-columns: 72px 1fr; gap: 14px; padding: 10px; }
.ss-item--skel .ss-thumb, .ss-lines span {
	background: linear-gradient(90deg, #edf1f4 25%, #f6f8fa 37%, #edf1f4 63%); background-size: 400% 100%;
	animation: ss-shimmer 1.2s ease infinite;
}
.ss-lines { display: flex; flex-direction: column; gap: 10px; padding-top: 6px; }
.ss-lines span { display: block; height: 14px; border-radius: 4px; width: 85%; }
.ss-lines span + span { width: 45%; }
@keyframes ss-shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* See all */
.ss-all {
	display: flex; align-items: center; justify-content: space-between; gap: 12px;
	flex: none; margin-top: 6px; padding: 14px 10px 4px; border-top: 1px solid var(--ss-line);
	font: 400 16px/1.3 var(--ss-head); color: var(--ss-blue-dark); text-decoration: none;
}
.ss-all strong { font-weight: 600; }
.ss-all:hover { color: var(--ss-ink); text-decoration: none; }
.ss-all[hidden] { display: none; }

/* Empty state: recent + popular */
.ss-group { padding: 4px 4px 12px; }
.ss-group__label {
	display: flex; align-items: center; justify-content: space-between;
	margin-bottom: 10px !important;
	font: 600 12px/1 var(--ss-head); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ss-muted);
}
.ss-panel .ss-clear-recent { font: 400 13px/1 var(--ss-body); text-transform: none; letter-spacing: 0; color: var(--ss-blue-dark); }
.ss-panel .ss-clear-recent:hover { color: var(--ss-ink); text-decoration: underline; }
.ss-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.ss-panel .ss-chip {
	display: inline-flex; align-items: center; gap: 6px;
	padding: 7px 14px; border: 1px solid var(--ss-line); border-radius: 999px; background: #fff;
	font: 400 15px/1.2 var(--ss-body); color: var(--ss-ink);
}
.ss-panel .ss-chip:hover, .ss-panel .ss-chip:focus { border-color: var(--ss-blue); color: var(--ss-blue-dark); background: #fff; }
.ss-panel .ss-chip svg { color: var(--ss-muted); }
.ss-none { padding: 8px 4px 16px; }
.ss-none__title { font: 600 18px/1.3 var(--ss-head); }
.ss-none__tip { margin-top: 4px !important; font-size: 15px; color: var(--ss-muted); }

.ss-keys { margin-top: 10px !important; padding: 0 4px; font-size: 12px; color: var(--ss-muted); }
.ss-keys kbd {
	display: inline-block; min-width: 18px; margin: 0 2px; padding: 1px 5px;
	border: 1px solid var(--ss-line); border-bottom-width: 2px; border-radius: 4px;
	font: 600 11px/1.4 var(--ss-body); text-align: center; color: var(--ss-ink); background: #fafbfc;
}
.ss-keys kbd + kbd { margin-left: 0; }

@media (max-width: 781px), (hover: none) {
	.ss-keys { display: none; }
}
@media (max-width: 600px) {
	.ss-panel__inner { padding: 12px 12px 8px; }
	.ss-panel .ss-bar { height: 52px; padding-left: 12px; }
	.ss-panel .ss-bar__input { font-size: 17px; }
	.ss-panel .ss-bar__go { display: none; }
	.ss-link, .ss-item--skel { grid-template-columns: 60px 1fr; gap: 12px; padding: 10px 6px; }
	.ss-thumb { width: 60px; height: 60px; }
	.ss-title { font-size: 17px; }
	.ss-snip { -webkit-line-clamp: 2; font-size: 13.5px; }
	.ss-head { flex-wrap: wrap; }
}

/* ---------- Search forms elsewhere (results page, mobile menu) ---------- */
.ss-form { margin: 0; }
.ss-form .ss-form__field {
	display: flex; align-items: center; gap: 8px;
	height: 54px; padding: 0 6px 0 14px;
	border: 2px solid var(--ss-line); border-radius: 12px; background: #fff;
	transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.ss-form .ss-form__field:focus-within { border-color: var(--ss-blue); box-shadow: 0 0 0 4px rgba(2, 136, 209, 0.14); }
.ss-form .ss-icon { flex: none; color: var(--ss-muted); }
.ss-form .ss-form__field input.search-field {
	flex: 1; min-width: 0; height: 100%; margin: 0; padding: 0;
	border: 0; outline: 0; box-shadow: none; background: transparent;
	font: 400 18px/1.2 var(--ss-body); color: var(--ss-ink);
	-webkit-appearance: none; appearance: none;
}
.ss-form .ss-form__field input.search-field::-webkit-search-cancel-button { -webkit-appearance: none; }
.ss-form .ss-form__field button.ss-form__submit {
	position: static; flex: none; height: 40px; width: auto; margin: 0; padding: 0 16px;
	border: 0; border-radius: 9px; box-shadow: none;
	background: var(--ss-blue); color: #fff;
	font: 600 16px/40px var(--ss-head); text-transform: none; letter-spacing: 0;
}
.ss-form .ss-form__field button.ss-form__submit:hover,
.ss-form .ss-form__field button.ss-form__submit:focus { background: var(--ss-blue-dark); color: #fff; }

.search .page-header .ss-form { max-width: 760px; margin-top: 12px; }

/* Results summary + sort switch, only in the results page header */
.ss-results-bar { display: none; }
.page-header .ss-results-bar {
	position: relative;
	display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
	max-width: 760px; margin-top: 14px;
}
.ss-results-count { margin: 0; font: 400 16px/1.4 var(--ss-body); color: var(--ss-muted); }
.ss-results-count strong { color: var(--ss-ink); }
.ss-results-count .ss-q { color: var(--ss-ink); font-weight: 600; }
.page-header .ss-results-bar.is-loading::after {
	content: ""; position: absolute; left: 0; right: 0; bottom: -10px; height: 2px;
	background: linear-gradient(90deg, transparent, var(--ss-blue), transparent); background-size: 50% 100%;
	background-repeat: no-repeat; animation: ss-bar 0.9s ease-in-out infinite;
}
@keyframes ss-bar { 0% { background-position: -50% 0; } 100% { background-position: 150% 0; } }

#main { transition: opacity 0.15s ease; }
#main.ss-swapping { opacity: 0.4; pointer-events: none; }
