/* GIFSQ Unified Search: results page, header box, autocomplete.
   Reduced-motion and keyboard access follow the same standard as the
   homepage waves. Header colours use the masterplan palette: Midnight
   Navy #0B1F33, Deep Teal #087E8B, Soft Cyan #38BDF8. */

/* Header search box. It renders on every page via wp_body_open, so this
   stylesheet must load on every page, not only on search pages. The bar
   is a single row: the input flexes, the Search button sits beside it.
   On phones the box hides behind the magnifier toggle and opens as a
   panel under the bar. */
.gifsq-header-search {
	box-sizing: border-box;
	position: relative;
	width: 100%;
	background: #0B1F33;
	padding: 0.5rem 1rem;
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.gifsq-header-search *,
.gifsq-header-search *::before,
.gifsq-header-search *::after {
	box-sizing: border-box;
}

/* The theme defines no screen-reader-text rule, so hide the label here:
   without this, "Search GIFSQ" renders as visible text above the input. */
.gifsq-header-search .screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.gifsq-header-search__form {
	position: relative;
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	align-items: center;
	width: 100%;
	max-width: 40rem;
	margin: 0 auto;
}

.gifsq-header-search__input {
	flex: 1 1 auto;
	min-width: 0;
	padding: 0.625rem 0.75rem;
	border: 1px solid #38BDF8;
	border-radius: 0.375rem;
	font-size: 1rem;
	line-height: 1.4;
	color: #0B1F33;
	background: #fff;
}

.gifsq-header-search__input:focus {
	outline: 2px solid #38BDF8;
	outline-offset: 1px;
}

.gifsq-header-search__submit {
	flex: 0 0 auto;
	white-space: nowrap;
	padding: 0.625rem 1.25rem;
	background: #087E8B;
	color: #fff;
	border: 0;
	border-radius: 0.375rem;
	font-size: 1rem;
	line-height: 1.4;
	cursor: pointer;
}

.gifsq-header-search__submit:hover,
.gifsq-header-search__submit:focus {
	background: #066b7a;
}

.gifsq-header-search__toggle {
	display: none;
	flex: 0 0 auto;
	width: 2.75rem;
	height: 2.75rem;
	padding: 0;
	background: #087E8B;
	color: #fff;
	border: 0;
	border-radius: 0.375rem;
	font-size: 1.25rem;
	line-height: 1;
	cursor: pointer;
	align-items: center;
	justify-content: center;
}

.gifsq-header-search__toggle:hover,
.gifsq-header-search__toggle:focus {
	background: #066b7a;
}

@media (max-width: 640px) {
	.gifsq-header-search {
		padding: 0.5rem 0.75rem;
	}
	.gifsq-header-search__toggle {
		display: inline-flex;
	}
	.gifsq-header-search__form {
		display: none;
	}
	.gifsq-header-search__form.is-open {
		display: flex;
		position: absolute;
		left: 0.5rem;
		right: 0.5rem;
		top: 100%;
		z-index: 50;
		width: auto;
		max-width: none;
		margin: 0.5rem 0 0;
		background: #fff;
		padding: 0.75rem;
		box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
		border-radius: 0.5rem;
	}
	.gifsq-header-search__form.is-open .gifsq-search-popular {
		color: #475569;
	}
}

/* Suggestions drop under the input: the form is position relative, so
   this box anchors to the form, on desktop and in the mobile panel. */
.gifsq-search-suggestions {
	position: absolute;
	left: 0;
	right: 0;
	top: calc(100% + 0.25rem);
	z-index: 60;
	width: auto;
	max-width: none;
	max-height: 70vh;
	overflow-y: auto;
	background: #fff;
	border: 1px solid #cbd5e1;
	border-radius: 0.5rem;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.gifsq-search-suggestions__group {
	padding: 0.5rem 0.75rem 0.25rem;
	font-size: 0.75rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: #64748b;
}

.gifsq-search-suggestions__item {
	display: block;
	padding: 0.5rem 0.75rem;
	cursor: pointer;
}

.gifsq-search-suggestions__item.is-active,
.gifsq-search-suggestions__item:hover {
	background: #f0fdfa;
}

.gifsq-search-suggestions__title {
	display: block;
	font-weight: 600;
}

.gifsq-search-suggestions__type {
	font-size: 0.75rem;
	color: #087E8B;
}

.gifsq-search-suggestions__definition {
	display: block;
	font-size: 0.875rem;
	color: #475569;
}

.gifsq-search-suggestions__did-you-mean {
	padding: 0.5rem 0.75rem;
	border-top: 1px solid #e2e8f0;
	font-size: 0.875rem;
}

/* Popular line: a full-width row under the input row. Light text on the
   navy bar; dark text inside the white mobile panel (see media query). */
.gifsq-search-popular {
	flex: 1 1 100%;
	margin: 0;
	font-size: 0.875rem;
	color: #E2E8F0;
}

.gifsq-search-page {
	max-width: 72rem;
	margin: 0 auto;
	padding: 1.5rem 1rem 3rem;
}

.gifsq-search-page__title {
	font-size: 1.75rem;
	margin: 1rem 0 0.25rem;
}

.gifsq-search-page__count {
	color: #475569;
	margin: 0 0 1rem;
}

.gifsq-search-page__did-you-mean {
	background: #f0fdfa;
	border: 1px solid #99f6e4;
	border-radius: 0.5rem;
	padding: 0.75rem 1rem;
}

.gifsq-search-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin: 1rem 0;
}

.gifsq-search-chip {
	display: inline-block;
	padding: 0.375rem 0.75rem;
	border: 1px solid #cbd5e1;
	border-radius: 999px;
	text-decoration: none;
	color: #0f172a;
}

.gifsq-search-chip.is-active {
	background: #0f766e;
	border-color: #0f766e;
	color: #fff;
}

.gifsq-search-chip.is-disabled {
	opacity: 0.45;
	cursor: not-allowed;
}

.gifsq-search-page__layout {
	display: grid;
	grid-template-columns: 16rem 1fr;
	gap: 2rem;
	align-items: start;
}

@media (max-width: 768px) {
	.gifsq-search-page__layout {
		grid-template-columns: 1fr;
	}
}

.gifsq-search-filters__panel {
	border: 1px solid #e2e8f0;
	border-radius: 0.5rem;
	padding: 1rem;
}

.gifsq-search-filters fieldset {
	border: 0;
	margin: 0 0 1rem;
	padding: 0;
}

.gifsq-search-filters legend {
	font-weight: 700;
	margin-bottom: 0.5rem;
}

.gifsq-search-filters label {
	display: block;
	margin-bottom: 0.25rem;
}

.gifsq-search-filters__apply {
	background: #0f766e;
	color: #fff;
	border: 0;
	border-radius: 0.375rem;
	padding: 0.5rem 1rem;
	cursor: pointer;
}

.gifsq-search-filters__clear {
	display: inline-block;
	margin-left: 0.75rem;
}

.gifsq-search-results__list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.gifsq-search-result {
	border-bottom: 1px solid #e2e8f0;
	padding: 1rem 0;
}

.gifsq-search-result__badge {
	display: inline-block;
	font-size: 0.75rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: #0f766e;
	background: #f0fdfa;
	border-radius: 999px;
	padding: 0.125rem 0.5rem;
}

.gifsq-search-result__title {
	margin: 0.375rem 0;
	font-size: 1.25rem;
}

.gifsq-search-result__excerpt mark {
	background: #fef08a;
}

.gifsq-search-result__meta,
.gifsq-search-result__breadcrumb {
	font-size: 0.875rem;
	color: #64748b;
	margin: 0.25rem 0;
}

.gifsq-search-result__save {
	margin-top: 0.5rem;
	background: none;
	border: 1px solid #0f766e;
	color: #0f766e;
	border-radius: 0.375rem;
	padding: 0.25rem 0.75rem;
	cursor: pointer;
}

.gifsq-search-pagination {
	margin-top: 1.5rem;
}

.gifsq-search-no-results {
	border: 1px solid #e2e8f0;
	border-radius: 0.5rem;
	padding: 1.5rem;
	background: #f8fafc;
}

@media (prefers-reduced-motion: reduce) {
	.gifsq-search-suggestions,
	.gifsq-header-search__form,
	.gifsq-header-search__toggle,
	.gifsq-header-search__submit {
		transition: none;
		animation: none;
	}
}
