/* DPI site search widget. */

.dpi-search {
	position: relative;
	width: 100%;
}

/* Hides a sibling nav-menu widget (e.g. popup nav) while search results show, so they don't visually compete. */
.elementor-widget-dpi-search:has(.dpi-search--active) ~ .elementor-widget-nav-menu {
	display: none;
}

.dpi-search__form {
	position: relative;
	margin: 0;
}

/* Idle: a compact pill (icon + placeholder). Expands on focus, and stays expanded (.is-expanded, set by JS) while the query is non-empty even after blur. */
.dpi-search__field {
	position: relative;
	display: flex;
	align-items: center;
	gap: 8px;
	max-width: 100%;
	padding: 10px 16px;
	background: var(--dpi-lime);
	color: var(--dpi-lime-fg);
	border-radius: 0;
	border-bottom: 2px solid transparent;
	transition: width 0.2s ease, border-radius 0.2s ease, padding 0.2s ease;
}

.dpi-search__field:focus-within,
.dpi-search__field.is-expanded {
	display: flex;
	width: 100%;
	padding-inline: 0;
	border-radius: 0;
	border-bottom-color: currentColor;
}

.dpi-search__icon-label {
	display: inline-flex;
	flex: 0 0 auto;
	cursor: text;
}

.dpi-search__field:focus-within .dpi-search__icon-label,
.dpi-search__field.is-expanded .dpi-search__icon-label {
	display: none;
}

.dpi-search .dpi-search__input {
	flex: 1 1 auto;
	min-width: 0;
	width: 6ch;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: transparent;
	color: inherit;
	font: inherit;
	line-height: 1.2;
	outline: none;
	-webkit-appearance: none;
	appearance: none;
}

.dpi-search .dpi-search__field:focus-within .dpi-search__input,
.dpi-search .dpi-search__field.is-expanded .dpi-search__input {
	width: 100%;
	padding-left: 15px;
	font-size: 20px;
	opacity: 1;
}

/* Faint placeholder while expanded and empty; the typed value itself stays fully opaque (rule above). */
.dpi-search .dpi-search__field:focus-within .dpi-search__input::placeholder,
.dpi-search .dpi-search__field.is-expanded .dpi-search__input::placeholder {
	font-size: 20px;
	opacity: 0.15;
}

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

/* Clear ("x"): only shown once the field is focused/expanded. */
.dpi-search .dpi-search__clear {
	display: none;
	flex: 0 0 auto;
	align-items: center;
	justify-content: center;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: transparent;
	color: inherit;
	cursor: pointer;
}

.dpi-search .dpi-search__field:focus-within .dpi-search__clear,
.dpi-search .dpi-search__field.is-expanded .dpi-search__clear {
	display: inline-flex;
}

.dpi-search .dpi-search__clear:hover,
.dpi-search .dpi-search__clear:focus,
.dpi-search .dpi-search__clear:focus-visible {
	background: transparent;
}

.dpi-search .dpi-search__clear-icon {
	display: block;
	width: 23px;
	height: auto;
}

/* Real submit button, kept for accessibility (Enter already submits the form). */
.dpi-search .dpi-search__submit {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

.dpi-search__icon,
.dpi-search__arrow {
	display: block;
}

.dpi-search__icon {
	width: 25px;
	height: auto;
}

.dpi-search__arrow {
	width: 20px;
	height: auto;
}

/* Dropdown */
.dpi-search__dropdown {
	position: absolute;
	left: 0;
	right: 0;
	top: 100%;
	z-index: 40;
	margin: 0;
	padding: 8px 0;
	list-style: none;
	background: var(--dpi-lime);
	color: var(--dpi-lime-fg);
	max-height: 60vh;
	overflow-y: auto;
	scrollbar-width: thin;
	scrollbar-color: var(--dpi-lime-fg) transparent;
}

.dpi-search__dropdown::-webkit-scrollbar {
	width: 6px;
}

.dpi-search__dropdown::-webkit-scrollbar-track {
	background: transparent;
}

.dpi-search__dropdown::-webkit-scrollbar-thumb {
	background-color: var(--dpi-lime-fg);
	border-radius: 0;
}

.dpi-search__item {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding-block: 10px;
	padding-inline: 15px;
	cursor: pointer;
	color: inherit;
	text-decoration: none;
}

.dpi-search__item:hover,
.dpi-search__item.is-active {
	background: rgba(0, 0, 0, 0.08);
}

.dpi-search__text {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* Direct hit row: emphasised, with the trailing arrow. */
.dpi-search__item--hit .dpi-search__text {
	font-weight: 700;
	text-decoration: underline;
}

.dpi-search__item--hit .dpi-search__arrow {
	flex: 0 0 auto;
}

.dpi-search__item:not(.dpi-search__item--hit) .dpi-search__arrow {
	display: none;
}

/* Matched prefix within a suggestion. */
.dpi-search__match {
	font-weight: 700;
}

.dpi-search__empty {
	padding: 10px 20px;
	opacity: 0.75;
}

/* Visually hidden live region. */
.dpi-search__status {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}
