/**
 * Kubota Europe contact form (WPBakery element `vc_kbeu_contact_form`).
 *
 * Based on the Figma contact page (fields 4040-2997 … 4040-3036, privacy checkbox
 * 4040-2994, button 4040-2992): one column of labelled controls. Label 24px /
 * Roman (#202024) 16px above its field; fields 65px tall with a 2px #e5e9ec border,
 * 15px corners and a 20px / Roman placeholder (#595959) inset 20px; the textarea
 * 121px tall; 49px between fields; the selects carry the design's chevron at the
 * right end. The footer row (50px below the last field) has the privacy checkbox
 * with its 18px / Light text on the left and the turquoise button on the right.
 *
 * The "contact" variant (Figma 3727-12041 … 3727-12099) and the "finance" one
 * (Figma 4166-8078 … 4166-8126), both `data-columns="2"`, lay the same controls
 * out in two columns — see the layout rules at the end.
 *
 * Sizes are `clamp()`s whose maximum is the Figma value at 2560px.
 *
 * Impreza styles every form control globally (`input:not([type=submit])`,
 * `select`, `textarea`, `input[type=checkbox]` with `appearance: none` and a Font
 * Awesome tick, and the theme's first button style on every
 * `[type=submit]:not(.w-btn):not(.button)` — some of it `!important`). Hence the
 * double-class selectors on every property the theme also sets, the (0,3,0)
 * `:focus` rules, and the `!important`s on the submit button: they out-rank the
 * theme's, as `kbeu-dealer-finder.css` and `kbeu-spec-filter.css` do.
 *
 * Font family "Inter" comes from the plugin's fonts stylesheet
 * (this handle depends on `kbeu-fonts`), referenced via `--kbeu-font-principal`.
 */

.kbeu-contact-form {
	--kbeu-cf-border: #e5e9ec;
	--kbeu-cf-placeholder: #595959;
	--kbeu-cf-label: var( --kbeu-color-ink-alt );
	--kbeu-cf-teal: var( --kbeu-color-teal );
	--kbeu-cf-radius: 15px;
	--kbeu-cf-height: clamp( 52px, 2.55vw, 65px );
	--kbeu-cf-textarea-height: clamp( 100px, 4.75vw, 121px );
	--kbeu-cf-gap: clamp( 28px, 1.9vw, 49px );

	display: block;
	width: 100%;
	margin: 0;
	font-family: var( --kbeu-font-principal );
	color: #000;
}

.kbeu-contact-form,
.kbeu-contact-form *,
.kbeu-contact-form *::before,
.kbeu-contact-form *::after {
	box-sizing: border-box;
}

.kbeu-contact-form__field {
	margin: 0 0 var( --kbeu-cf-gap );
}

.kbeu-contact-form__label {
	display: block;
	margin: 0 0 clamp( 10px, 0.65vw, 16px );
	font-weight: 500;
	line-height: 1.2;
	font-size: clamp( 18px, 0.95vw, 24px );
	color: var( --kbeu-cf-label );
	cursor: default;
}

/* --- Text controls ---------------------------------------------------------- */

.kbeu-contact-form .kbeu-contact-form__input {
	display: block;
	width: 100%;
	min-height: var( --kbeu-cf-height );
	height: var( --kbeu-cf-height );
	margin: 0;
	padding: 0 clamp( 16px, 0.8vw, 20px );
	border: 2px solid var( --kbeu-cf-border );
	border-radius: var( --kbeu-cf-radius );
	background: #fff;
	font-family: inherit;
	font-weight: 400;
	font-size: clamp( 16px, 0.8vw, 20px );
	line-height: 1.5;
	letter-spacing: 0;
	color: #000;
	box-shadow: none;
	appearance: none;
	transition: border-color 0.2s ease;
}

.kbeu-contact-form .kbeu-contact-form__input::placeholder {
	color: var( --kbeu-cf-placeholder );
	opacity: 1;
}

.kbeu-contact-form .kbeu-contact-form__input:focus {
	border-color: var( --kbeu-cf-teal );
	background: #fff;
	color: #000;
	box-shadow: none;
	outline: none;
}

.kbeu-contact-form .kbeu-contact-form__input:focus-visible {
	box-shadow: 0 0 0 3px rgba( 3, 168, 169, 0.2 );
}

.kbeu-contact-form .kbeu-contact-form__input--textarea {
	height: auto;
	min-height: var( --kbeu-cf-textarea-height );
	padding-top: clamp( 14px, 0.7vw, 18px );
	padding-bottom: clamp( 14px, 0.7vw, 18px );
	resize: vertical;
}

/* --- Selects ---------------------------------------------------------------- */

/* The wrapper is the chevron's containing block; the select keeps room for it. */
.kbeu-contact-form__select {
	position: relative;
	display: block;
}

.kbeu-contact-form .kbeu-contact-form__input--select {
	padding-right: clamp( 44px, 2.2vw, 56px );
	cursor: pointer;
}

/* A placeholder option shows in the placeholder grey until a value is picked. */
.kbeu-contact-form .kbeu-contact-form__input--select:invalid,
.kbeu-contact-form .kbeu-contact-form__input--select:has( option[value='']:checked ) {
	color: var( --kbeu-cf-placeholder );
}

.kbeu-contact-form .kbeu-contact-form__input--select option {
	color: #000;
}

.kbeu-contact-form__chevron {
	position: absolute;
	top: 50%;
	right: clamp( 14px, 0.75vw, 19px );
	width: 24px;
	height: 24px;
	transform: translateY( -50% ) rotate( 90deg );
	color: #000;
	pointer-events: none;
}

/* --- Footer row: consent + button ------------------------------------------- */

/* Consent left, button right; the button wraps under the consent when the
   column is too narrow for both (a container rule, not a viewport one — the
   element does not know how wide its column is). */
.kbeu-contact-form__footer {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: clamp( 16px, 1.5vw, 32px );
	margin-top: clamp( 32px, 1.95vw, 50px );
}

.kbeu-contact-form__consent {
	display: flex;
	flex: 1 1 260px;
	align-items: center;
	gap: clamp( 12px, 0.65vw, 17px );
	margin: 0;
	font-weight: 300;
	font-size: clamp( 15px, 0.7vw, 18px );
	line-height: 1.5;
	color: #000;
	cursor: pointer;
}

.kbeu-contact-form__consent-text a {
	color: inherit;
	text-decoration: underline;
}

.kbeu-contact-form__consent-text a:hover {
	color: var( --kbeu-cf-teal );
}

/* Custom box (the theme already removes the native look): the design's 2px
   #e5e9ec outline, a tick drawn from two borders when checked. */
.kbeu-contact-form .kbeu-contact-form__checkbox {
	position: relative;
	flex: 0 0 auto;
	width: 22px;
	height: 22px;
	margin: 0;
	padding: 0;
	border: 2px solid var( --kbeu-cf-border );
	border-radius: 5px;
	background: #fff;
	box-sizing: border-box;
	appearance: none;
	cursor: pointer;
	transition: border-color 0.2s ease, background-color 0.2s ease;
}

.kbeu-contact-form .kbeu-contact-form__checkbox::before {
	content: '';
	position: absolute;
	top: 2px;
	left: 6px;
	width: 5px;
	height: 10px;
	border: solid #fff;
	border-width: 0 2px 2px 0;
	transform: rotate( 45deg );
	visibility: hidden;
	font-family: inherit;
}

.kbeu-contact-form .kbeu-contact-form__checkbox:checked {
	border-color: var( --kbeu-cf-teal );
	background: var( --kbeu-cf-teal );
}

.kbeu-contact-form .kbeu-contact-form__checkbox:checked::before {
	visibility: visible;
}

.kbeu-contact-form .kbeu-contact-form__checkbox:focus-visible {
	outline: none;
	box-shadow: 0 0 0 3px rgba( 3, 168, 169, 0.2 );
}

/* The submit is the shared `.kbeu-btn--primary`; the `!important`s and the
   `[type='submit']` in the selector out-rank the theme's default button style
   (see the file header). Metrics from the design: 48px tall, 20px / Roman label,
   26px side padding, 15px corners. */
.kbeu-contact-form .kbeu-contact-form__submit[type='submit'] {
	flex: 0 0 auto;
	margin: 0;
	padding: 0 clamp( 20px, 1.05vw, 26px ) !important;
	min-height: clamp( 42px, 1.9vw, 48px );
	border: 2px solid var( --kbeu-btn-primary-bg ) !important;
	border-radius: var( --kbeu-cf-radius ) !important;
	background: var( --kbeu-btn-primary-bg ) !important;
	font-family: inherit !important;
	font-size: clamp( 16px, 0.8vw, 20px ) !important;
	font-weight: 400 !important;
	line-height: 1.5 !important;
	letter-spacing: 0 !important;
	text-transform: none !important;
	color: #fff !important;
	box-shadow: none !important;
	cursor: pointer;
}

.kbeu-contact-form .kbeu-contact-form__submit[type='submit']:hover,
.kbeu-contact-form .kbeu-contact-form__submit[type='submit']:focus-visible {
	border-color: var( --kbeu-btn-primary-bg-hover ) !important;
	background: var( --kbeu-btn-primary-bg-hover ) !important;
	color: #fff !important;
	outline: none;
}

.kbeu-contact-form .kbeu-contact-form__submit[type='submit']::before {
	display: none;
}

/* --- Two-column layout (`data-columns="2"`: contact and finance variants) --- */

/* Figma contact page: two 762px columns 339px apart on the 2560 canvas — the gap
   is 18.2% of the 1863px column, so it follows the row's width; the message and
   the footer span both columns; the textarea is 228px tall in this design. The
   rows keep their spacing from the fields' bottom margin (margins apply to grid
   items). The hidden variant input creates no cell (display: none). */
.kbeu-contact-form[data-columns='2'] {
	--kbeu-cf-textarea-height: clamp( 140px, 8.9vw, 228px );

	display: grid;
	grid-template-columns: repeat( 2, minmax( 0, 1fr ) );
	column-gap: clamp( 24px, 18.2%, 339px );
	align-items: start;
}

.kbeu-contact-form[data-columns='2'] .kbeu-contact-form__field--full,
.kbeu-contact-form[data-columns='2'] .kbeu-contact-form__footer {
	grid-column: 1 / -1;
}

/* One column again on phones. */
@media ( max-width: 767px ) {
	.kbeu-contact-form[data-columns='2'] {
		grid-template-columns: minmax( 0, 1fr );
	}
}

@media ( prefers-reduced-motion: reduce ) {
	.kbeu-contact-form .kbeu-contact-form__input,
	.kbeu-contact-form .kbeu-contact-form__checkbox {
		transition: none;
	}
}

/* --- Submission: status region, field errors, honeypot, busy state --- */

/* The hidden inputs and the off-screen honeypot are positioned against the form. */
.kbeu-contact-form {
	--kbeu-cf-error: #c8102e;

	position: relative;
}

/* The outcome of a submit (success or error), announced through `role="status"`.
   `[hidden]` is re-asserted: Impreza's resets can otherwise give it a display. */
.kbeu-contact-form__status {
	display: block;
	margin: 0 0 var( --kbeu-cf-gap );
	padding: clamp( 14px, 0.8vw, 20px ) clamp( 16px, 0.95vw, 24px );
	border: 2px solid var( --kbeu-cf-border );
	border-left-width: 6px;
	border-radius: var( --kbeu-cf-radius );
	font-size: clamp( 16px, 0.8vw, 20px );
	line-height: 1.5;
	color: #000;
	outline: none;
}

.kbeu-contact-form__status[hidden] {
	display: none;
}

.kbeu-contact-form.is-sent .kbeu-contact-form__status {
	border-color: var( --kbeu-cf-teal );
}

.kbeu-contact-form.is-error .kbeu-contact-form__status {
	border-color: var( --kbeu-cf-error );
}

/* Once sent, only the status stays. */
.kbeu-contact-form.is-sent .kbeu-contact-form__field,
.kbeu-contact-form.is-sent .kbeu-contact-form__footer,
.kbeu-contact-form.is-sent .kbeu-contact-form__hp {
	display: none;
}

/* A field the server rejected. Double-class to out-rank the theme's border. */
.kbeu-contact-form .kbeu-contact-form__input[aria-invalid='true'] {
	border-color: var( --kbeu-cf-error );
}

.kbeu-contact-form__error {
	margin: clamp( 6px, 0.4vw, 10px ) 0 0;
	font-size: clamp( 14px, 0.65vw, 16px );
	line-height: 1.4;
	color: var( --kbeu-cf-error );
}

/* The honeypot: out of sight and out of the tab order, but NOT display:none, so
   a crawler that skips hidden inputs still fills it. */
.kbeu-contact-form__hp {
	position: absolute;
	left: -9999px;
	top: 0;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* While the script is waiting for the server. */
.kbeu-contact-form[aria-busy='true'] .kbeu-contact-form__submit[type='submit'] {
	opacity: 0.6;
	cursor: progress;
}

.kbeu-contact-form[data-columns='2'] .kbeu-contact-form__status {
	grid-column: 1 / -1;
}

/* The dealer map dialog's hidden dealer id (`dealer_field`): a full-width slot
   with no height of its own, which only ever shows the server's error. */
.kbeu-contact-form__dealer {
	grid-column: 1 / -1;
	margin: 0;
}

.kbeu-contact-form__dealer .kbeu-contact-form__error {
	margin: 0 0 var( --kbeu-cf-gap );
}

/* The consent row is a flex row: its error message takes a line of its own. */
.kbeu-contact-form__footer .kbeu-contact-form__error {
	flex-basis: 100%;
}

/* --- Compact card look (`kbeu-contact-form--card`) --------------------------- */

/* The lead hero's entry form (Figma 5037-4990, `vc_kbeu_lead_hero` prints this
   class through the template's `extra_class`): a 690px grid of small controls —
   labels 18px / Roman (#1d1d1b) 8px above 34px fields filled #f6f6f6 with a 1px
   #e5e5e5 border and 8px corners, 14px / Light text (#9f9f9f placeholders), 16px
   between the two columns and 24px between rows; the consent row (a 20px box
   outlined turquoise, 12px text) then a full-width 54px button 28px below it.
   Deltas only: the base rules above draw everything else. */
.kbeu-contact-form--card {
	--kbeu-cf-border: #e5e5e5;
	--kbeu-cf-placeholder: var( --kbeu-color-muted );
	--kbeu-cf-label: var( --kbeu-color-ink );
	--kbeu-cf-radius: 8px;
	--kbeu-cf-height: 34px;
	--kbeu-cf-gap: 24px;
}

.kbeu-contact-form--card[data-columns='2'] {
	column-gap: 16px;
}

.kbeu-contact-form--card .kbeu-contact-form__label {
	margin-bottom: 8px;
	font-weight: 400;
	line-height: 1.5;
	font-size: 18px;
}

.kbeu-contact-form--card .kbeu-contact-form__input {
	padding: 0 12px;
	border-width: 1px;
	background: #f6f6f6;
	font-weight: 300;
	font-size: 14px;
}

.kbeu-contact-form--card .kbeu-contact-form__input:focus {
	background: #fff;
}

.kbeu-contact-form--card .kbeu-contact-form__input--select {
	padding-right: 32px;
}

/* The design's 10px turquoise chevron. */
.kbeu-contact-form--card .kbeu-contact-form__chevron {
	right: 10px;
	width: 12px;
	height: 12px;
	color: var( --kbeu-cf-teal );
}

.kbeu-contact-form--card .kbeu-contact-form__footer {
	flex-direction: column;
	align-items: stretch;
	gap: 28px;
	margin-top: 0;
}

.kbeu-contact-form--card .kbeu-contact-form__consent {
	flex: 0 0 auto;
	align-items: flex-start;
	gap: 12px;
	font-weight: 400;
	font-size: 12px;
	line-height: 1.4;
	color: #595959;
}

.kbeu-contact-form--card .kbeu-contact-form__consent-text {
	padding-top: 2px;
}

.kbeu-contact-form--card .kbeu-contact-form__consent-text a {
	color: var( --kbeu-cf-teal );
}

.kbeu-contact-form--card .kbeu-contact-form__consent-text a:hover {
	color: var( --kbeu-color-teal-dark );
}

/* A turquoise-outlined box with a turquoise tick on white (the design's checked state). */
.kbeu-contact-form--card .kbeu-contact-form__checkbox {
	width: 20px;
	height: 20px;
	border-color: var( --kbeu-cf-teal );
	border-radius: 4px;
}

.kbeu-contact-form--card .kbeu-contact-form__checkbox::before {
	top: 1px;
	left: 5px;
	border-color: var( --kbeu-cf-teal );
}

.kbeu-contact-form--card .kbeu-contact-form__checkbox:checked {
	background: #fff;
}

.kbeu-contact-form--card .kbeu-contact-form__submit[type='submit'] {
	width: 100%;
	min-height: 54px;
	border-radius: 15px !important;
	font-size: 20px !important;
}

.kbeu-contact-form--card .kbeu-contact-form__status {
	border-width: 1px;
	border-left-width: 6px;
	font-size: 18px;
}

/* Phones: a 16px text keeps iOS from zooming into the focused field, and the
   fields grow to a comfortable touch height. */
@media ( max-width: 767px ) {
	.kbeu-contact-form--card {
		--kbeu-cf-height: 44px;
	}

	.kbeu-contact-form--card .kbeu-contact-form__input {
		font-size: 16px;
	}

	.kbeu-contact-form--card .kbeu-contact-form__label {
		font-size: 16px;
	}

	.kbeu-contact-form--card .kbeu-contact-form__submit[type='submit'] {
		min-height: 48px;
		font-size: 18px !important;
	}
}
