/* Buscador block (search.php). A compact field in place (just the search icon
   up to 767px); once focused (.is-open, set by initSearchBar() in vlc_scripts.js)
   its inner box is laid over the whole header container — position/size/padding
   measured into the --search-* variables — with the results panel dropping down
   below. */

/* The wrapper holds the compact field's space, so the menus next to/below it
   don't move when the inner box leaves the flow on open. */
.wp-block-acf-search {
	box-sizing: border-box;
	width: 100%;
	max-width: 100%;
	min-width: 0;
	height: 2.75rem;
}
.wp-block-acf-search .search-bar-inner {
	box-sizing: border-box;
	display: flex;
	flex-flow: row nowrap;
	align-items: center;
	gap: .75rem;
	width: 100%;
	height: 100%;
	padding: 0 .75rem;
	border: 1px solid color-mix(in srgb, var(--wp--preset--color--white) 20%, transparent);
	background-color: var(--wp--preset--color--black);
}
.wp-block-acf-search .search-bar-inner:hover,
.wp-block-acf-search .search-bar-inner:focus-within {
	border-color: color-mix(in srgb, var(--wp--preset--color--gold) 40%, transparent);
}
.wp-block-acf-search .search-bar-field {
	flex: 1 1 auto;
	display: flex;
	flex-flow: row nowrap;
	align-items: center;
	gap: .75rem;
	min-width: 0;
}
.wp-block-acf-search .standalone-icon {
	flex: 0 0 auto;
	display: flex;
}
.wp-block-acf-search .standalone-icon svg {
	width: 1.125rem;
	height: 1.125rem;
}
.wp-block-acf-search .search-modal-input {
	min-width: 0;
	text-overflow: ellipsis;
}
.wp-block-acf-search .dialog-close,
.wp-block-acf-search .search-bar-panel {
	display: none;
}

/* Up to 767px, closed: just the search icon, styled like the header's other
   icons (header .header-search--icons in style.css puts it in one row with
   them). The input stays there, invisible and
   stretched over the icon, so a tap focuses it natively — which opens the
   keyboard reliably, iOS included — and that focus opens the block as usual. */
@media (max-width: 767px) {
	/* Open or not: the open box is position: fixed, so the icon's spot stays. */
	.wp-block-acf-search {
		width: 34px;
		flex: 0 0 auto;
	}
	.wp-block-acf-search:not(.is-open) .search-bar-inner {
		justify-content: center;
		padding: 0;
		border: none;
		background: none;
	}
	.wp-block-acf-search:not(.is-open) .search-bar-field {
		position: relative;
		flex: 0 0 auto;
		justify-content: center;
		width: 100%;
		height: 100%;
	}
	/* !important to beat .standalone-icon.gold svg's own (style.css). */
	.wp-block-acf-search:not(.is-open) .standalone-icon svg {
		stroke: var(--wp--preset--color--white) !important;
	}
	.wp-block-acf-search:not(.is-open) .search-bar-inner:hover .standalone-icon svg {
		stroke: var(--wp--preset--color--gold) !important;
	}
	.wp-block-acf-search:not(.is-open) .search-modal-input {
		position: absolute;
		inset: 0;
		width: 100%;
		opacity: 0;
		cursor: pointer;
	}
}

/* Open: over the whole header container. */
.wp-block-acf-search.is-open .search-bar-inner {
	position: fixed;
	left: var(--search-left, 0);
	top: var(--search-top, 0);
	z-index: 10;
	width: var(--search-width, 100%);
	height: var(--search-height, auto);
	padding: var(--search-padding, 1.25rem 1.5rem);
	border: none;
	animation: search-bar-in .2s ease-out;
}
/* Full-screen backdrop behind it, like the old search modal's dialog::backdrop.
   Clicking it closes the search (initSearchBar(): a click on the block itself). */
.wp-block-acf-search.is-open::before {
	content: '';
	position: fixed;
	inset: 0;
	z-index: 9;
	background-color: color-mix(in srgb, var(--wp--preset--color--black) 80%, transparent);
	animation: search-bar-in .2s ease-out;
}
@keyframes search-bar-in {
	from {
		opacity: 0;
	}
}
@media (prefers-reduced-motion: reduce) {
	.wp-block-acf-search.is-open .search-bar-inner,
	.wp-block-acf-search.is-open::before {
		animation: none;
	}
}
.wp-block-acf-search.is-open .dialog-close {
	display: block;
	flex: 0 0 auto;
	margin-right: -.5rem;
}

/* Results: same width as the container, starting just below the header's
   bottom border, scrolling on their own when taller than the screen. */
.wp-block-acf-search.is-open .search-bar-panel {
	display: block;
	position: absolute;
	top: calc(100% + 1px);
	left: 0;
	right: 0;
	box-sizing: border-box;
	max-height: min(70dvh, 40rem);
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 1.5rem;
	background-color: var(--wp--preset--color--black);
}
.wp-block-acf-search .search-modal-results-list {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 1.25rem 2rem;
}
@media (min-width: 768px) {
	.wp-block-acf-search .search-modal-results-list {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}
@media (min-width: 1024px) {
	.wp-block-acf-search .search-modal-results-list {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}
