/* ==========================================================================
   Search overlay

   A native <dialog>, so the scrim is ::backdrop and there is no separate scrim
   element to position — the same call enquiry-dialog.css made, and for the
   same reason: the focus trap, Escape, and inert-ing the page behind it are
   the browser's and do not need writing twice.

   Anchored near the top rather than centred. A search field is a thing you
   type into immediately, and a box floating in the middle of the viewport puts
   it further from the control that opened it than it needs to be.
   ========================================================================== */

.tfs-search {
	/* min() keeps it inside a 360px viewport, where the measure would overflow. */
	width: 100%;
	max-width: min(var(--wp--custom--measure), calc(100% - var(--wp--preset--spacing--40)));
	margin-inline: auto;
	margin-block: var(--wp--preset--spacing--70) auto;
	padding: 0;
	color: var(--wp--preset--color--ink);
	background-color: var(--wp--preset--color--surface);
	border: var(--wp--custom--rule-strong);
	border-radius: var(--wp--custom--radius);
}

/* ::backdrop inherits custom properties from the root element in current
   browsers. Where it does not, the user agent's own dimmed backdrop stands in,
   which is a correct fallback and needs no hardcoded colour to express. */
.tfs-search::backdrop {
	background-color: var(--wp--custom--scrim);
}

.tfs-search__inner {
	display: flex;
	align-items: flex-start;
	gap: var(--wp--preset--spacing--20);
	padding: var(--wp--preset--spacing--30);
}

.tfs-search__form {
	flex: 1 1 auto;
	min-width: 0;
	display: grid;
	gap: var(--wp--custom--step--8);
}

.tfs-search__row {
	display: grid;
	gap: var(--wp--preset--spacing--20);
}

/* Field and button share a row once there is one to share. */
@media (min-width: 600px) {
	.tfs-search__row {
		grid-template-columns: minmax(0, 1fr) auto;
		align-items: start;
	}
}

.tfs-search__note {
	margin: 0;
	font-size: var(--wp--preset--font-size--caption);
	line-height: 1.5;
	color: var(--wp--preset--color--muted);
}

.tfs-search__close {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: var(--wp--custom--control--tap-target-minimum);
	min-height: var(--wp--custom--control--tap-target-minimum);
	padding: 0;
	font: inherit;
	color: var(--wp--preset--color--ink);
	background: none;
	border: 0;
	cursor: pointer;
}

.tfs-search__close:hover {
	color: var(--wp--preset--color--accent-hover);
}

/* Focus indicators are exempt from the no-shadow rule: outline, never shadow. */
.tfs-search__close:focus-visible {
	outline: var(--wp--custom--focus--width) solid var(--wp--preset--color--accent);
	outline-offset: var(--wp--custom--focus--offset);
}
