/* ---------- Search overlay (inc/search.php, assets/js/search.js) ----------
 * Loaded on every page (the magnifier sits in the header). A modal <dialog> filling
 * the screen: dark club blue at 98.5 % (no blur, no backdrop-filter, so it costs nothing
 * on a phone), white text (11.09:1 on #003C73), red Signal button (white on red 4.88:1).
 * Without script the dialog stays hidden and the magnifier is a link to /?s=.
 * Also here: small repairs of the results page (no grey picture block). */

/* Trigger in the header (every width: the symbol opens the full-screen search) */
.tsvff-search-open {
	align-items: center;
	color: var(--wp--preset--color--base);
	cursor: pointer;
	display: inline-flex;
	text-decoration: none;
}

.tsvff-search-open--bar {
	border-radius: 50%;
	flex: none;
	height: 2.75rem;
	justify-content: center;
	transition: background-color 0.15s, transform 0.15s;
	width: 2.75rem;
}

.tsvff-search-open--bar:is(:hover, :focus-visible) {
	background: rgb(255 255 255 / 0.18);
}

.tsvff-search-open:focus-visible {
	outline: var(--wp--custom--wpce--focus--width, 3px) solid var(--wpce-focus, currentcolor);
	outline-offset: var(--wp--custom--wpce--focus--offset, 2px);
}

/* Phone and tablet: button, then the magnifier, then the menu button at the edge. */
@media (max-width: 63.99rem) {

	.wpce-header__nav > .wpce-header__action {
		order: 1;
	}

	.wpce-header__nav > .tsvff-search-open--bar {
		order: 2;
	}

	.wpce-header__nav > .wpce-menu {
		order: 3;
	}

	/* The three belong together: the button, the magnifier and the menu button stand close. */
	.wpce-header__nav {
		gap: 0.25rem;
	}

	.wpce-header__nav > .wpce-header__action {
		margin-inline-end: 0.5rem;
	}
}

.wpce-header__nav:has(.wpce-menu--overlay-always) .tsvff-search-open--bar {
	display: none;
}

/* Trigger inside the open menu panel (small screens): a wide pill */
.tsvff-search-open--panel {
	border: 2px solid rgb(255 255 255 / 0.55);
	border-radius: 2rem;
	box-sizing: border-box;
	font-weight: 600;
	gap: 0.6rem;
	min-height: 2.75rem;
	padding: 0.4rem 1.1rem;
	width: 100%;
}

.tsvff-search-open--panel:is(:hover, :focus-visible) {
	background: var(--wp--preset--color--base);
	color: var(--wp--preset--color--primary);
}

/* The dialog */
.tsvff-overlay {
	background: rgb(0 60 115 / 0.985);
	border: 0;
	box-sizing: border-box;
	color: var(--wp--preset--color--base);
	height: 100%;
	inset: 0;
	margin: 0;
	max-height: none;
	max-width: none;
	overflow-y: auto;
	padding: 0;
	width: 100%;
}

.tsvff-overlay::backdrop {
	background: rgb(0 30 60 / 0.6);
}

/* Brand stripe on top: blue to red, like the header and the footer. */
.tsvff-overlay::before {
	background: linear-gradient(90deg, var(--wp--preset--color--primary) 0 55%, var(--wp--custom--tsvff--signal, #e30613) 55%);
	content: "";
	display: block;
	height: 0.3125rem;
	position: sticky;
	top: 0;
}

html:has(.tsvff-overlay[open]) {
	overflow: hidden;
}

.tsvff-overlay__panel {
	box-sizing: border-box;
	display: grid;
	gap: 1.75rem;
	margin: 0 auto;
	max-width: 52rem;
	padding: clamp(1.25rem, 6vh, 4.5rem) 1.25rem 3rem;
}

.tsvff-overlay__head {
	align-items: center;
	display: flex;
	gap: 1rem;
	justify-content: space-between;
}

.tsvff-overlay__title {
	color: inherit;
	font-size: clamp(1.1rem, 1rem + 0.6vw, 1.5rem);
	margin: 0;
}

.tsvff-overlay__close {
	align-items: center;
	background: transparent;
	border: 2px solid rgb(255 255 255 / 0.55);
	border-radius: 50%;
	color: inherit;
	cursor: pointer;
	display: inline-flex;
	flex: none;
	height: 2.75rem;
	justify-content: center;
	padding: 0;
	width: 2.75rem;
}

.tsvff-overlay__close:is(:hover, :focus-visible) {
	background: var(--wp--preset--color--base);
	color: var(--wp--preset--color--primary);
}

.tsvff-overlay :is(a, button, input):focus-visible {
	outline: 3px solid var(--wp--preset--color--base);
	outline-offset: 3px;
}

/* The big field: underline style, large type, red button next to it. */
.tsvff-overlay .tsvff-search-form__row {
	align-items: stretch;
	flex-wrap: wrap;
	gap: 0.75rem;
}

.tsvff-overlay .tsvff-search-form input[type="search"] {
	background: var(--wp--preset--color--base);
	border: 0;
	border-radius: 0.75rem;
	color: var(--wp--preset--color--contrast);
	font-size: clamp(1.125rem, 1rem + 0.6vw, 1.375rem);
	font-weight: 500;
	min-height: 3.5rem;
	padding: 0.5rem 1.25rem;
}

.tsvff-overlay .tsvff-search-form input[type="search"]::placeholder {
	color: var(--wp--preset--color--contrast-2);
	font-weight: 400;
	opacity: 1;
}

.tsvff-overlay .tsvff-search-form input[type="search"]::-webkit-search-cancel-button {
	appearance: none;
	display: none;
}

.tsvff-overlay .tsvff-search-form input[type="search"]:focus-visible {
	outline: 2px solid var(--wp--preset--color--secondary);
	outline-offset: 2px;
}

.tsvff-overlay .tsvff-search-form__button {
	background: var(--wp--custom--tsvff--signal, #e30613);
	border-color: var(--wp--custom--tsvff--signal, #e30613);
	border-radius: 0.75rem;
	color: var(--wp--preset--color--base);
	font-size: 1rem;
	min-height: 3.5rem;
	padding-inline: 1.75rem;
}

.tsvff-overlay .tsvff-search-form__button:is(:hover, :focus-visible) {
	background: var(--wp--custom--tsvff--signal-hover, #b8050f);
	border-color: var(--wp--custom--tsvff--signal-hover, #b8050f);
}

.tsvff-overlay__label {
	color: var(--wp--preset--color--secondary);
	font-size: 0.8125rem;
	letter-spacing: 0.12em;
	margin: 0 0 0.75rem;
	text-transform: uppercase;
}

/* Quick access chips and live suggestions */
.tsvff-chips,
.tsvff-live {
	list-style: none;
	margin: 0;
	padding: 0;
}

.tsvff-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 0.6rem;
}

.tsvff-chips > li,
.tsvff-live > li {
	margin: 0;
}

.tsvff-chip {
	align-items: center;
	border: 1px solid rgb(255 255 255 / 0.4);
	border-radius: 0.75rem;
	color: var(--wp--preset--color--base);
	display: inline-flex;
	font-weight: 600;
	min-height: 2.75rem;
	padding: 0.5rem 1.1rem;
	text-decoration: none;
	transition: background-color 0.15s, color 0.15s, transform 0.15s;
}

.tsvff-chip:is(:hover, :focus-visible) {
	background: var(--wp--preset--color--base);
	border-color: var(--wp--preset--color--base);
	color: var(--wp--preset--color--primary);
}

.tsvff-live {
	display: grid;
	gap: 0.5rem;
}

.tsvff-live__link {
	align-items: baseline;
	background: rgb(255 255 255 / 0.1);
	border-radius: 0.5rem;
	color: var(--wp--preset--color--base);
	column-gap: 0.75rem;
	display: flex;
	flex-wrap: wrap;
	padding: 0.7rem 1rem;
	text-decoration: none;
}

.tsvff-live__link:is(:hover, :focus-visible) {
	background: var(--wp--preset--color--base);
	color: var(--wp--preset--color--primary);
}

.tsvff-live__kind {
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.1em;
	min-width: 5.5rem;
	text-transform: uppercase;
}

.tsvff-live__title {
	font-size: 1.125rem;
	font-weight: 600;
}

.tsvff-live__meta {
	flex-basis: 100%;
	font-size: 0.875rem;
	opacity: 0.9;
	padding-inline-start: 6.25rem;
}

/* Phones: full screen, big touch targets. */
@media (max-width: 37.4375rem) {

	.tsvff-overlay__panel {
		gap: 1.25rem;
		padding-top: 0.75rem;
	}

	.tsvff-overlay__title {
		font-size: 1.125rem;
	}

	/* Field and button in one row, in the size of the other controls (44 to 48 px). */
	.tsvff-overlay .tsvff-search-form__row {
		flex-wrap: nowrap;
		gap: 0.5rem;
	}

	.tsvff-overlay .tsvff-search-form input[type="search"] {
		font-size: 1rem;
		min-height: 3rem;
		padding-inline: 1rem;
	}

	.tsvff-overlay .tsvff-search-form__button {
		flex: none;
		min-height: 3rem;
		padding-inline: 1.125rem;
	}

	.tsvff-chip {
		font-size: 0.9375rem;
		min-height: 2.5rem;
		padding: 0.25rem 0.9rem;
	}

	.tsvff-live__kind {
		flex-basis: 100%;
	}

	.tsvff-live__meta {
		padding-inline-start: 0;
	}
}

@media (prefers-reduced-motion: no-preference) {

	.tsvff-overlay[open] {
		animation: tsvff-overlay-in 0.22s ease-out;
	}

	.tsvff-overlay[open] .tsvff-overlay__panel {
		animation: tsvff-overlay-up 0.3s ease-out;
	}

	@keyframes tsvff-overlay-in {

		from {
			opacity: 0;
		}
	}

	@keyframes tsvff-overlay-up {

		from {
			opacity: 0;
			transform: translateY(1rem);
		}
	}
}

/* ---------- Results page: no empty picture block ----------
 * The grey block was the picture area of the card while the lazy picture had not
 * loaded; the area now has no background of its own and exists only when a picture
 * does (inc/search.php prints nothing for hits without one). */
.tsvff-hit__media {
	background: none;
}

.tsvff-hit:not(.tsvff-hit--has-image) .tsvff-hit__body {
	align-content: start;
}
