/**
 * Kubota Europe dealer finder (WPBakery element `vc_kbeu_dealer_finder`).
 *
 * Based on the Figma design 4595-1819: a rounded, full-bleed background image
 * (622px tall) with a turquoise (#03a8a9) panel floating over its left half —
 * 785px wide, vertically centred, inset 102px from the left edge. Inside the panel,
 * from top to bottom: a bold heading (32px / Bold, white), a search
 * field (turquoise fill, light grey outline) with its search icon at the right end
 * (placeholder 18px / Roman), an "or" separator (24px / Light, #ffefef), a solid
 * white "Around me" button (20px / Roman, black label + turquoise pin icon) and,
 * after a wider gap, the "View dealer list" link (24px / Light, white) with its
 * arrow.
 *
 * Font family "Inter" is provided by the plugin's fonts stylesheet
 * (this handle depends on `kbeu-fonts`), referenced via `--kbeu-font-principal`.
 * The bundled family ships the 300 / 400 / 500 / 700 weights, so the design's 400 (Roman)
 * texts match exactly.
 *
 * Icons: the search magnifier and the list arrow are inline SVG (drawn with
 * `currentColor`); the "Around me" pin is the design's exported PNG. Deviation from
 * the design: the search icon is drawn white instead of the turquoise of the Figma
 * layer, which would sit invisible on the turquoise panel behind it.
 *
 * Below 900px the panel drops to the full width of the block and is pinned to its
 * bottom, so the background image stays visible as a band above it.
 */

.kbeu-dealer-finder {
	--kbeu-df-teal: var( --kbeu-color-teal );
	--kbeu-df-radius: 14px;
	--kbeu-df-border: #dbdbdb;

	font-family: var( --kbeu-font-principal );
}

/* The panel's width and the controls' heights are the design's own measurements,
   so paddings and borders have to stay inside them whatever the theme's box model. */
.kbeu-dealer-finder,
.kbeu-dealer-finder *,
.kbeu-dealer-finder *::before,
.kbeu-dealer-finder *::after {
	box-sizing: border-box;
	position: relative !important;
}

/* Background image of the whole block. The URL comes inline from the element; the
   flat colour is the fallback while it loads or when no image is set. */
.kbeu-dealer-finder__inner {
	display: flex;
	align-items: center;
	min-height: clamp( 420px, 33vw, 622px );
	padding: clamp( 24px, 3vw, 56px ) clamp( 16px, 5.5vw, 102px );
	border-radius: var( --kbeu-df-radius );
	background-color: var( --kbeu-color-line );
	background-position: center;
	background-repeat: no-repeat;
	background-size: cover;
	overflow: hidden;
}

.kbeu-dealer-finder__panel {
	flex: 0 1 785px;
	min-width: 0;
	max-width: 785px;
	padding: clamp( 32px, 3vw, 56px ) clamp( 24px, 2.5vw, 46px ) clamp( 28px, 2vw, 35px );
	border-radius: var( --kbeu-df-radius );
	background: var( --kbeu-df-teal );
	backdrop-filter: blur( 5px );
}

.kbeu-dealer-finder__title {
	margin: 0 0 clamp( 20px, 1.8vw, 28px );
	font-size: clamp( 24px, 2.4vw, 32px );
	font-weight: 700;
	line-height: 1.2;
	color: #fff;
}

/* --- Search field ------------------------------------------------------ */

/* The field and its button are a flex row, NOT an absolutely positioned button over
   the input: Impreza styles `button[type=submit]` with `position: relative` and gives
   `input[type=search]` a `min-height`/`line-height` of its own, either of which pulled
   the button out of place. As flex siblings they stay side by side whatever the theme
   does. The outline and the rounded shape live here, on the row, so the two controls
   read as the single field of the design.
   `position: relative` is kept only as the containing block of the hidden label. */
.kbeu-dealer-finder__search {
	position: relative;
	display: flex;
	align-items: stretch;
	width: 100%;
	height: 46px;
	border: 1px solid var( --kbeu-df-border );
	border-radius: var( --kbeu-df-radius );
	background-color: var( --kbeu-df-teal );
	overflow: hidden;
}

.kbeu-dealer-finder__search:focus-within {
	border-color: #fff;
}

/* The placeholder doubles as the field's visible name, so its label is exposed to
   assistive technology only. */
.kbeu-dealer-finder__label {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	border: 0;
	clip-path: inset( 50% );
	white-space: nowrap;
	overflow: hidden;
}

/* Scoped with the block class ON PURPOSE (0,2,0). Impreza styles this control through
   `input[type=search]`, and an attribute selector weighs the same as a class, so a
   plain `.kbeu-dealer-finder__input` (0,1,0) LOSES to it: the theme's `min-height` and
   `line-height` (both from its `--inputs-height`) stretched the field past the row and
   its `padding` replaced ours. Same reason for the submit button below. Keep the
   double class on any property the theme also sets. */
.kbeu-dealer-finder .kbeu-dealer-finder__input {
	flex: 1 1 auto;
	min-width: 0;
	height: 100%;
	min-height: 0;
	margin: 0;
	padding: 0 8px 0 16px;
	border: 0;
	border-radius: 0;
	background-color: var( --kbeu-df-teal );
	font-family: inherit;
	font-size: clamp( 16px, 1.3vw, 18px );
	font-weight: 500;
	line-height: 1.5;
	color: #fff;
	appearance: none;
}

.kbeu-dealer-finder .kbeu-dealer-finder__input::placeholder {
	color: rgba( 255, 255, 255, 0.85 );
	opacity: 1;
}

/* The field keeps its turquoise fill while focused. Impreza's generated Theme Options
   CSS repaints a focused input `#f2f4f7`, which would leave the white text AND the
   white placeholder on a light grey field — unreadable. As with the submit button's
   padding, that CSS is printed inline by the theme's generator, so there is no fixed
   specificity to outrank and the fill is pinned instead.
   The focus affordance is the white outline on the row (`:focus-within` above). */
.kbeu-dealer-finder .kbeu-dealer-finder__input:focus,
.kbeu-dealer-finder .kbeu-dealer-finder__input:focus-visible {
	background-color: var( --kbeu-df-teal ) !important;
	color: #fff;
	outline: none;
}

/* Guards the placeholder against the same focus restyling. This is also the hook to
   use if the focused field should ever get a placeholder colour of its own. */
.kbeu-dealer-finder .kbeu-dealer-finder__input:focus::placeholder {
	color: rgba( 255, 255, 255, 0.85 ) !important;
	opacity: 1;
}

/* Clears the native clear/decoration widgets of `type="search"`, which would sit
   on top of the submit button. */
.kbeu-dealer-finder .kbeu-dealer-finder__input::-webkit-search-decoration,
.kbeu-dealer-finder .kbeu-dealer-finder__input::-webkit-search-cancel-button {
	appearance: none;
}

/* Scoped like the input above: Impreza's `button[type=submit]` rule (0,1,1) sets
   `display: inline-block`, `line-height`, `vertical-align` and `position: relative`,
   all of which outrank a single class.
   `padding` carries `!important` for a different reason: the theme's BUTTON PADDING
   comes from the CSS Impreza generates out of its Theme Options and prints inline, so
   it is not in `style.min.css` and its weight is whatever that generator emits — no
   fixed specificity we can outrank here. Left alone it squeezes this 52px icon button
   until the magnifier (a flex item, shrinkable by default) collapses to nothing and the
   button renders empty. The `flex: 0 0 auto` on the icon below is the second guard. */
.kbeu-dealer-finder .kbeu-dealer-finder__submit {
	position: static;
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 52px;
	/* Pinned for the same reason: a `min-width` on the theme's buttons would beat the
	   width above and stretch this one across the field. */
	min-width: 0;
	height: 100%;
	padding: 0 !important;
	border: 0;
	/* `!important`: Impreza paints every `[type=submit]:not(.w-btn)` with its own
	   colour with `!important`, which made the button differ from the panel. */
	background: var( --kbeu-df-teal ) !important;
	color: #fff;
	cursor: pointer;
}

/* `flex: 0 0 auto` so the icon can never be shrunk away by whatever padding or
   min-width the theme puts on the button around it. */
.kbeu-dealer-finder__submit-icon {
	flex: 0 0 auto;
	display: block;
	width: 22px;
	height: 21px;
}

.kbeu-dealer-finder .kbeu-dealer-finder__submit:hover,
.kbeu-dealer-finder .kbeu-dealer-finder__submit:focus-visible {
	color: #fff;
	opacity: 0.75;
}

/* --- "or" separator ---------------------------------------------------- */

.kbeu-dealer-finder__or {
	margin: clamp( 14px, 1.4vw, 20px ) 0 clamp( 12px, 1.2vw, 16px );
	font-size: clamp( 18px, 1.6vw, 24px );
	font-weight: 300;
	line-height: 1.55;
	text-align: center;
	color: var( --kbeu-color-pink-light );
}

/* --- "Around me" button ------------------------------------------------ */

.kbeu-dealer-finder__geo {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 12px;
	width: 100%;
	height: 47px;
	padding: 0 16px;
	border: 0;
	border-radius: var( --kbeu-df-radius );
	background: #fff;
	font-family: inherit;
	font-size: clamp( 16px, 1.4vw, 20px );
	font-weight: 500;
	line-height: 1.5;
	color: #000;
	cursor: pointer;
	transition: background-color 0.2s ease;
}

.kbeu-dealer-finder__geo:hover,
.kbeu-dealer-finder__geo:focus-visible {
	background: #f2f2f2;
}

/* The pin is a bundled PNG (`assets/img/kbeu-dealer-finder-geo.png`), exported from
   the design at its natural 33x30, so it carries its own colours and there is
   nothing here to tint. */
.kbeu-dealer-finder__geo-icon {
	display: flex;
	flex: 0 0 auto;
}

.kbeu-dealer-finder__geo-icon img {
	display: block;
	width: 33px;
	height: 30px;
}

/* Waiting for the browser's geolocation prompt/answer. */
.kbeu-dealer-finder.is-locating .kbeu-dealer-finder__geo {
	cursor: progress;
	opacity: 0.75;
}

/* Message shown when the position cannot be resolved (denied, unsupported,
   timed out). Hidden until the script needs it. */
.kbeu-dealer-finder__message {
	margin: 12px 0 0;
	font-size: clamp( 14px, 1.1vw, 16px );
	font-weight: 300;
	line-height: 1.4;
	color: #fff;
}

.kbeu-dealer-finder__message[hidden] {
	display: none;
}

/* --- "View dealer list" link ------------------------------------------- */

/* `--color-content-link-hover`: Impreza's `.no-touch a:hover` out-ranks the hover
   colour below and paints it with this variable (see `kbeu-buttons.css`). */
.kbeu-dealer-finder__list {
	--color-content-link-hover: #fff;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	margin-top: clamp( 32px, 4vw, 64px );
	font-size: clamp( 18px, 1.6vw, 24px );
	font-weight: 300;
	line-height: 1.55;
	color: #fff;
	text-decoration: none;
}

.kbeu-dealer-finder__list:hover,
.kbeu-dealer-finder__list:focus-visible {
	color: #fff;
	text-decoration: underline;
}

.kbeu-dealer-finder__list-icon {
	flex: 0 0 auto;
	width: 21px;
	height: 18px;
	transition: transform 0.2s ease;
}

.kbeu-dealer-finder__list:hover .kbeu-dealer-finder__list-icon {
	transform: translateX( 4px );
}

/* --- Info box ------------------------------------------------------------ */

/* Dark glass box at the bottom right of the image (Figma 4595:1841 + 4595:1842):
   rgba(0,0,0,.59) with a 3.475px blur, 29px corners, 20px / 1.5 white text. It is a
   flex item pushed to the bottom right of the block, because every element inside
   `.kbeu-dealer-finder` is `position: relative !important` (see the top of the file). */
.kbeu-dealer-finder__inner {
	justify-content: space-between;
	gap: 24px;
}

.kbeu-dealer-finder__info {
	flex: 0 1 clamp( 320px, 34vw, 636px );
	align-self: flex-end;
	min-width: 0;
	padding: clamp( 18px, 1.5vw, 28px ) clamp( 20px, 2.2vw, 42px );
	border-radius: 29px;
	background: rgba( 0, 0, 0, 0.59 );
	backdrop-filter: blur( 3.475px );
}

.kbeu-dealer-finder__info-text {
	margin: 0;
	font-size: clamp( 15px, 1.1vw, 20px );
	font-weight: 400;
	line-height: 1.5;
	color: #fff;
}

/* --- Unavailable destination ------------------------------------------- */

/* No dealer finder page configured yet: the block keeps its looks but the search
   cannot go anywhere. */
.kbeu-dealer-finder__input:disabled,
.kbeu-dealer-finder__submit:disabled,
.kbeu-dealer-finder__geo:disabled {
	cursor: not-allowed;
	opacity: 0.6;
}

.kbeu-dealer-finder__geo:disabled:hover {
	background: #fff;
}

/* --- Responsive -------------------------------------------------------- */

@media ( max-width: 900px ) {
	/* The panel takes the full width, pinned to the bottom so a band of the
	   background image stays visible above it. */
	.kbeu-dealer-finder__inner {
		align-items: flex-end;
		min-height: 0;
		padding: clamp( 80px, 22vw, 160px ) 12px 12px;
	}

	.kbeu-dealer-finder__panel {
		flex-basis: auto;
		width: 100%;
		max-width: none;
	}

	.kbeu-dealer-finder__list {
		margin-top: 28px;
	}

	/* Stacked: the info box sits above the panel, over the band of image. */
	.kbeu-dealer-finder__inner {
		flex-direction: column-reverse;
		align-items: stretch;
		justify-content: flex-end;
		gap: 12px;
	}

	.kbeu-dealer-finder__info {
		flex: 0 0 auto;
		align-self: stretch;
		border-radius: 20px;
	}
}

@media ( prefers-reduced-motion: reduce ) {
	.kbeu-dealer-finder__geo,
	.kbeu-dealer-finder__list-icon {
		transition: none;
	}

	.kbeu-dealer-finder__list:hover .kbeu-dealer-finder__list-icon {
		transform: none;
	}
}
