/*
 * Structural only. Colours, fonts and spacing of the input are left to the
 * theme / Elementor style controls; everything here is layout that cannot be
 * inherited (positioning, stacking, hidden states).
 */
.wp-search {
	position: relative;
}

.wp-search__form {
	display: flex;
	align-items: stretch;
	gap: var(--wp-search-gap, 0);
}

.wp-search__input {
	flex: 1 1 auto;
	min-width: 0;
}

.wp-search__results {
	position: absolute;
	z-index: var(--wp-search-dropdown-z, 9999);
	top: calc(100% + var(--wp-search-dropdown-offset, 4px));
	left: 0;
	right: 0;
	max-height: var(--wp-search-dropdown-max-height, 60vh);
	overflow-y: auto;
	margin: 0;
	padding: 0;
	list-style: none;
	background: var(--wp-search-dropdown-bg, #fff);
	color: var(--wp-search-dropdown-color, inherit);
	border: var(--wp-search-dropdown-border, 1px solid rgba(0, 0, 0, 0.12));
	border-radius: var(--wp-search-dropdown-radius, 2px);
	box-shadow: var(--wp-search-dropdown-shadow, 0 6px 24px rgba(0, 0, 0, 0.12));
}

.wp-search__results[hidden] {
	display: none;
}

.wp-search__item {
	margin: 0;
}

.wp-search__link {
	display: block;
	padding: var(--wp-search-item-padding, 0.625rem 0.875rem);
	text-decoration: none;
	color: inherit;
}

.wp-search__item[aria-selected="true"] .wp-search__link,
.wp-search__link:hover,
.wp-search__link:focus {
	background: var(--wp-search-item-hover-bg, rgba(0, 0, 0, 0.05));
}

.wp-search__title {
	display: block;
}

.wp-search__type {
	display: inline-block;
	margin-left: 0.5em;
	font-size: 0.75em;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	opacity: 0.6;
}

.wp-search__snippet {
	display: block;
	font-size: 0.875em;
	opacity: 0.75;
}

.wp-search__message {
	padding: var(--wp-search-item-padding, 0.625rem 0.875rem);
	font-size: 0.875em;
	opacity: 0.75;
}

.wp-search__all {
	border-top: var(--wp-search-dropdown-border, 1px solid rgba(0, 0, 0, 0.12));
	font-weight: 600;
}

/* ---------------------------------------------------------------------------
 * Modal layout: icon trigger + frosted-glass dialog.
 * ------------------------------------------------------------------------- */
.wp-search--modal {
	display: flex;
}

/* Doubled class beats theme / Elementor-kit `button` rules while staying
   below the widget's {{WRAPPER}} style controls. */
.wp-search--modal .wp-search__trigger {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0.5em;
	margin: 0;
	font-size: 20px;
	line-height: 1;
	color: inherit;
	background: none;
	border: 0;
	border-radius: 999px;
	cursor: pointer;
	transition: color 0.2s ease, background-color 0.2s ease;
}

.wp-search--modal .wp-search__trigger:hover,
.wp-search--modal .wp-search__trigger:focus {
	background: none;
	color: inherit;
}

.wp-search__trigger:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

.wp-search__trigger svg,
.wp-search__trigger i {
	width: 1em;
	height: 1em;
	font-size: 1em;
	fill: currentColor;
}

.wp-search__trigger .wp-search__icon {
	fill: none;
}

html.wp-search-modal-open {
	overflow: hidden;
}

.wp-search__modal {
	position: fixed;
	inset: 0;
	z-index: var(--wp-search-modal-z, 99999);
	display: flex;
	justify-content: center;
	align-items: flex-start;
	padding: var(--wp-search-panel-top, 12vh) 16px 16px;
	opacity: 0;
	transition: opacity 0.2s ease;
}

.wp-search__modal[hidden] {
	display: none;
}

.wp-search__modal.is-open {
	opacity: 1;
}

.wp-search__backdrop {
	position: absolute;
	inset: 0;
	background: var(--wp-search-backdrop-bg, rgba(24, 22, 20, 0.35));
	-webkit-backdrop-filter: blur(var(--wp-search-backdrop-blur, 14px)) saturate(140%);
	backdrop-filter: blur(var(--wp-search-backdrop-blur, 14px)) saturate(140%);
}

.wp-search__panel {
	position: relative;
	display: flex;
	flex-direction: column;
	width: 100%;
	max-width: var(--wp-search-panel-width, 680px);
	max-height: calc(100vh - var(--wp-search-panel-top, 12vh) - 32px);
	max-height: calc(100dvh - var(--wp-search-panel-top, 12vh) - 32px);
	overflow: hidden;
	color: var(--wp-search-dropdown-color, #1d1b19);
	background: var(--wp-search-panel-bg, rgba(255, 255, 255, 0.94));
	border: 1px solid rgba(255, 255, 255, 0.6);
	border-radius: var(--wp-search-panel-radius, 18px);
	box-shadow:
		0 24px 64px rgba(0, 0, 0, 0.22),
		inset 0 1px 0 rgba(255, 255, 255, 0.7);
	transform: translateY(-8px) scale(0.98);
	transition: transform 0.2s ease;
}

@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
	.wp-search__panel {
		background: var(--wp-search-panel-bg, rgba(255, 255, 255, 0.68));
		-webkit-backdrop-filter: blur(24px) saturate(160%);
		backdrop-filter: blur(24px) saturate(160%);
	}
}

.wp-search__modal.is-open .wp-search__panel {
	transform: none;
}

.wp-search__modal .wp-search__form {
	align-items: center;
	gap: 0.75rem;
	padding: 0.25rem 0.75rem 0.25rem 1.25rem;
	border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.wp-search__field-icon {
	display: inline-flex;
	font-size: 1.25rem;
	opacity: 0.55;
}

.wp-search__modal .wp-search__input {
	padding: 1.125rem 0;
	font-size: 1.25rem;
	color: inherit;
	background: transparent;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	outline: none;
}

.wp-search__modal .wp-search__input::-webkit-search-cancel-button {
	-webkit-appearance: none;
}

.wp-search__modal .wp-search__close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	width: 2.25rem;
	height: 2.25rem;
	padding: 0;
	color: inherit;
	background: rgba(0, 0, 0, 0.05);
	border: 0;
	border-radius: 999px;
	cursor: pointer;
	opacity: 0.7;
	transition: opacity 0.15s ease, background-color 0.15s ease;
}

.wp-search__modal .wp-search__close:hover,
.wp-search__modal .wp-search__close:focus-visible {
	color: inherit;
	background: rgba(0, 0, 0, 0.1);
	opacity: 1;
}

/* Results sit inside the panel rather than floating below the input. */
.wp-search__modal .wp-search__results {
	position: static;
	flex: 1 1 auto;
	max-height: none;
	padding: 0.5rem;
	background: transparent;
	border: 0;
	border-radius: 0;
	box-shadow: none;
}

.wp-search__modal .wp-search__link {
	border-radius: 10px;
	padding: var(--wp-search-item-padding, 0.75rem 0.875rem);
}

.wp-search__modal .wp-search__all {
	margin-top: 0.25rem;
	padding-top: 0.25rem;
	border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.wp-search__hint {
	display: flex;
	flex-wrap: wrap;
	gap: 1rem;
	padding: 0.625rem 1.25rem;
	font-size: 0.75rem;
	opacity: 0.6;
	border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.wp-search__hint kbd {
	display: inline-block;
	min-width: 1.5em;
	margin-right: 0.2em;
	padding: 0.1em 0.35em;
	font: inherit;
	text-align: center;
	background: rgba(0, 0, 0, 0.06);
	border-radius: 4px;
}

@media (max-width: 600px) {
	.wp-search__modal {
		padding: 12px;
	}

	.wp-search__hint {
		display: none;
	}
}

/* ---------------------------------------------------------------------------
 * Loading state: .is-loading on the modal (or inline root) while a slow search
 * runs. The modal's magnifier becomes the spinner; the inline layout gets a
 * .wp-search__spinner after its input. Stale results dim instead of vanishing.
 * ------------------------------------------------------------------------- */

.wp-search__field-icon {
	position: relative;
}

.wp-search__field-icon::after,
.wp-search__spinner {
	content: "";
	box-sizing: border-box;
	width: 1em;
	height: 1em;
	border: 0.125em solid currentColor;
	border-right-color: transparent;
	border-radius: 50%;
	animation: wp-search-spin 0.7s linear infinite;
}

.wp-search__field-icon::after {
	position: absolute;
	inset: 0;
	display: none;
}

.wp-search__spinner {
	display: none;
	flex: 0 0 auto;
	align-self: center;
	margin-inline: 0.5em;
	opacity: 0.55;
}

.is-loading .wp-search__field-icon svg {
	visibility: hidden;
}

.is-loading .wp-search__field-icon::after,
.is-loading .wp-search__spinner {
	display: block;
}

.wp-search__results {
	transition: opacity 0.15s ease;
}

.is-loading .wp-search__results {
	opacity: 0.55;
}

@keyframes wp-search-spin {
	to {
		transform: rotate(360deg);
	}
}

@keyframes wp-search-pulse {
	to {
		opacity: 0.25;
	}
}

@media (prefers-reduced-motion: reduce) {
	.wp-search__modal,
	.wp-search__panel {
		transition: none;
	}

	/* A gentle pulse instead of spinning. */
	.wp-search__field-icon::after,
	.wp-search__spinner {
		border-right-color: currentColor;
		animation: wp-search-pulse 0.9s ease-in-out infinite alternate;
	}
}

/* Visually hidden. Mirrors core's .screen-reader-text. */
.wp-search__sr {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}
