/* ==========================================================================
   Jetour — forms.css: the form card shared by every form (test drive, contact,
   landing-page [jetour_form] shortcodes). Loaded wherever a form renders
   (jetour_form() → jetour_enqueue_view('forms'), plus the contact / test-drive /
   landing views). Builds on components.css — .jt-form, .jt-form__grid,
   .jt-field, .jt-input, .jt-check, .jt-choices / .jt-choice, .jt-form__msg —
   and only adds what is missing: the white card, the approved underline look
   (contact-form spec §3.7), fieldsets, the car / trim / colour choice cards
   and their loading state, the submit button and the response message.

   Markup: <div class="jt-form-card"> <form class="jt-form"> … </form> </div>
   ========================================================================== */

/* --------------------------------------------------------------------------
   The card
   -------------------------------------------------------------------------- */
.jt-form-card {
	position: relative;
	background: #fff;
	color: var(--jt-ink);
	padding: 40px 40px 44px;
	box-shadow: var(--jt-shadow-card);
}
.jt-form-card .jt-form__title {
	margin: 0 0 6px;
	font-size: 32px; line-height: 1;
	color: var(--jt-black);
}
.jt-form-card .jt-form__text { margin: 0 0 18px; font-size: 14px; line-height: 1.7; color: var(--jt-soft); }
.jt-form-card .jt-form__title + .jt-form__grid { margin-top: 24px; }
.jt-form-card .jt-form__grid { gap: 16px 20px; }

/* Anything a script hides ([hidden]) must stay hidden even when a class sets display. */
.jt-form [hidden] { display: none !important; }

/* Fieldsets are plain groups: no box, the legend is a normal block above the choices. */
.jt-form fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
.jt-form legend { float: left; width: 100%; padding: 0; }
.jt-form-card .jt-form__group-title { margin: 6px 0 4px; }
.jt-form-card .jt-form__group-title .jt-field__req { margin-left: 3px; }

/* --------------------------------------------------------------------------
   Labels + underline inputs (the approved contact-card look)
   -------------------------------------------------------------------------- */
.jt-form-card .jt-field { gap: 4px; }
.jt-form-card .jt-field__label { font-size: 12px; font-weight: 500; line-height: 1.4; color: var(--jt-soft); }
.jt-form-card .jt-input {
	padding: 13px 0 12px;
	border-bottom-color: var(--jt-line-input);
	font-weight: 500; font-size: 15px; line-height: 1.5; color: var(--jt-ink);
	transition: border-color .35s var(--jt-ease), box-shadow .35s var(--jt-ease), background-color .35s var(--jt-ease);
}
.jt-form-card .jt-input::placeholder { color: var(--jt-mute); opacity: 1; }
.jt-form-card .jt-input:hover { border-bottom-color: var(--jt-mute); }
.jt-form-card .jt-input:focus { border-bottom-color: var(--jt-teal); box-shadow: 0 1px 0 0 var(--jt-teal); }
.jt-form-card .jt-field.is-invalid .jt-input,
.jt-form-card .jt-input[aria-invalid="true"] { border-bottom-color: var(--jt-error); box-shadow: 0 1px 0 0 var(--jt-error); }
.jt-form-card .jt-input--textarea { height: 100px; min-height: 60px; max-height: 260px; resize: vertical; line-height: 1.6; }
.jt-form-card .jt-input--date { padding-right: 36px; min-height: 48px; }
.jt-form-card .jt-input--select { padding-right: 28px; }
.jt-form-card .jt-input__icon { right: 6px; }
.jt-form-card .jt-field:focus-within .jt-input__icon { color: var(--jt-teal-ink); }

/* Phone: the static +995 prefix follows the input's line. */
.jt-form-card .jt-input-wrap--tel .jt-input__prefix {
	padding: 13px 10px 12px 0;
	border-bottom-color: var(--jt-line-input);
	font-weight: 500; font-size: 15px; line-height: 1.5; color: var(--jt-ink);
	transition: border-color .35s var(--jt-ease), box-shadow .35s var(--jt-ease);
}
.jt-form-card .jt-input-wrap--tel:hover .jt-input__prefix { border-bottom-color: var(--jt-mute); }
.jt-form-card .jt-input-wrap--tel:focus-within .jt-input__prefix { border-bottom-color: var(--jt-teal); box-shadow: 0 1px 0 0 var(--jt-teal); }
.jt-form-card .jt-field.is-invalid .jt-input__prefix { border-bottom-color: var(--jt-error); box-shadow: 0 1px 0 0 var(--jt-error); }

.jt-form-card .jt-field__error { font-weight: 500; line-height: 1.4; }
.jt-form-card .jt-field__help { line-height: 1.4; }

/* Consent checkbox */
.jt-form-card .jt-field--checkbox { margin-top: 4px; }
.jt-form-card .jt-check { font-size: 14px; line-height: 1.7; color: var(--jt-soft); } /* spec §3.1.2 (g): 14px / 1.7 */
.jt-form-card .jt-check__box { margin-top: 2px; border-color: var(--jt-mute); }
.jt-form-card .jt-check:hover .jt-check__box { border-color: var(--jt-teal); }

/* --------------------------------------------------------------------------
   Choice cards: cars (image + name), trims (chips), colours (swatch chips)
   -------------------------------------------------------------------------- */
.jt-form-card .jt-choices--cars { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.jt-form-card .jt-choice {
	border-color: var(--jt-line-input);
	background: var(--jt-bg-faint);
	transition: border-color .3s var(--jt-ease), background-color .3s var(--jt-ease), box-shadow .3s var(--jt-ease), transform .3s var(--jt-ease-out);
}
.jt-form-card .jt-choice:hover { border-color: var(--jt-mute); transform: translateY(-2px); box-shadow: 0 14px 26px -16px rgba(0, 0, 0, .35); }
/* Selected card. The :has() rule and the .is-checked (test-drive.js) fallback are SEPARATE rules on
   purpose: a selector list containing an unsupported :has() is dropped as a whole, which would
   silently kill the fallback in the very browsers that need it. */
.jt-form-card .jt-choice:has(.jt-choice__input:checked) { border-color: var(--jt-teal); background: var(--jt-teal-tint); box-shadow: inset 0 0 0 1px var(--jt-teal); }
.jt-form-card .jt-choice.is-checked { border-color: var(--jt-teal); background: var(--jt-teal-tint); box-shadow: inset 0 0 0 1px var(--jt-teal); }
.jt-form-card .jt-choice.is-focus { box-shadow: var(--jt-focus-ring); } /* keyboard focus where :has() is unsupported */

.jt-choice--car { padding: 14px 16px 12px; gap: 10px; }
.jt-choice__media { display: flex; align-items: center; justify-content: center; width: 100%; height: 64px; }
.jt-choice--car .jt-choice__img { height: 100%; width: auto; max-width: 100%; object-fit: contain; transition: transform .45s var(--jt-ease-out); }
.jt-choice--car:hover .jt-choice__img { transform: scale(1.04); }
.jt-choice--car .jt-choice__label { font-family: var(--jt-font-caps); font-size: 12px; font-weight: 700; line-height: 16px; color: var(--jt-ink); } /* spec: Mark GEO CAPS Bold 12/16, no transform */

.jt-form-card .jt-choices--chips { gap: 10px; }
.jt-form-card .jt-choices--chips .jt-choice { padding: 11px 14px; gap: 10px; text-align: left; }
.jt-form-card .jt-choices--chips .jt-choice__label { font-size: 13px; font-weight: 500; }
.jt-form-card .jt-choices--chips .jt-choice__swatch { flex: 0 0 22px; width: 22px; height: 22px; border-color: var(--jt-line); }

/* Loading (aria-busy on the fieldset while a car's options are fetched) and empty states */
.jt-form fieldset[aria-busy="true"] .jt-choices { opacity: .5; pointer-events: none; }
.jt-form-card .jt-choices__empty { margin: 0; }

/* --------------------------------------------------------------------------
   Submit + response
   -------------------------------------------------------------------------- */
.jt-form-card .jt-form__actions { margin-top: 12px; }
.jt-form-card .jt-form__submit {
	display: flex; align-items: center; justify-content: center; gap: 14px;
	width: 100%; max-width: 100%; margin: 0;
	height: var(--jt-btn-h-md); padding: 0 var(--jt-btn-px-md);
	border: var(--jt-border-w) solid transparent; border-radius: var(--jt-radius);
	background: var(--jt-teal); color: #fff; box-shadow: none;
	font-family: var(--jt-font-sans); font-size: var(--jt-btn-fs-md); font-weight: var(--jt-btn-fw); line-height: 1; letter-spacing: var(--jt-btn-ls);
	transition: background-color var(--jt-btn-dur) var(--jt-ease), transform var(--jt-btn-dur) var(--jt-ease-out), box-shadow var(--jt-btn-dur) var(--jt-ease-out);
}
.jt-form-card .jt-form__submit::after {
	content: ""; display: inline-block; width: 9px; height: 9px; margin: -2px 0 0;
	border-top: 2px solid currentColor; border-right: 2px solid currentColor; transform: rotate(45deg);
	transition: transform .4s var(--jt-ease-out);
}
.jt-form-card .jt-form__submit:hover,
.jt-form-card .jt-form__submit:focus-visible { background: var(--jt-dark-2); color: #fff; transform: translateY(-2px); box-shadow: 0 18px 30px -14px rgba(0, 0, 0, .45); }
.jt-form-card .jt-form__submit:hover::after { transform: rotate(45deg) translate(3px, -3px); }
.jt-form-card .jt-form__submit:active { transform: translateY(0); transition-duration: .1s; }
.jt-form-card .jt-form__submit[disabled],
.jt-form-card .jt-form.is-sending .jt-form__submit { opacity: .6; cursor: progress; transform: none; box-shadow: none; }

.jt-form-card .jt-form__msg { margin-top: 18px; padding: 14px 18px; font-weight: 500; line-height: 1.55; }
.jt-form-card .jt-form__msg p { margin: 0; }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
/* The title stays 32px at every breakpoint (spec §3.1.2 (a): measured 32px, one line at 375). */
@media (max-width: 1024px) {
	.jt-form-card { padding: 32px 28px 36px; }
}
@media (max-width: 767px) {
	.jt-form-card {
		padding: 28px 20px 30px;
		box-shadow: 0 30px 50px -22px rgba(0, 0, 0, .4), 0 2px 8px rgba(0, 0, 0, .08);
	}
	.jt-form-card .jt-form__grid { gap: 14px 12px; }
	.jt-form-card .jt-input,
	.jt-form-card .jt-input-wrap--tel .jt-input__prefix { font-size: 16px; } /* no iOS zoom on focus */
	.jt-form-card .jt-choices--cars { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
	.jt-choice--car { padding: 12px 10px 10px; }
	.jt-choice__media { height: 56px; }
	.jt-form-card .jt-form__group-title { text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
	.jt-form-card .jt-choice,
	.jt-choice--car .jt-choice__img,
	.jt-form-card .jt-form__submit,
	.jt-form-card .jt-form__submit::after { transition: none; }
	.jt-form-card .jt-choice:hover,
	.jt-choice--car:hover .jt-choice__img,
	.jt-form-card .jt-form__submit:hover,
	.jt-form-card .jt-form__submit:focus-visible { transform: none; }
}
