/* =========================================================
   ALSTON — SHARED FORM SYSTEM

   One vocabulary for every Contact Form 7 form on the site.
   Previously only the contact page had form styling (~490 lines);
   fleet, services and join-team had 20, 5 and 13 rules, so the
   same markup rendered as a raw stack of inputs there.

   Scoped to .alston-form so it cannot leak into other markup.
========================================================= */

.alston-form {
	font-family: var(--font-body);
	color: var(--text);
}

/* ---------------------------------------------------------
   FIELDSET — numbered step
--------------------------------------------------------- */

.alston-form .fs {
	padding: 0 0 32px;
	margin: 0 0 32px;
	border-bottom: 1px solid var(--line);
}

.alston-form .fs:last-of-type {
	padding-bottom: 0;
	margin-bottom: 0;
	border-bottom: 0;
}

.alston-form .fs__head {
	display: flex;
	align-items: baseline;
	gap: 12px;
	margin: 0 0 22px;
}

.alston-form .fs__num {
	font-family: var(--font-display);
	font-size: var(--fs-micro);
	font-weight: var(--fw-regular);
	letter-spacing: var(--tracking-eyebrow);
	color: var(--gold);
}

.alston-form .fs__title {
	font-family: var(--font-display);
	font-size: var(--fs-h5);
	font-weight: var(--fw-book);
	letter-spacing: .01em;
	color: var(--ink);
}

.alston-form .fs__hint {
	margin: 6px 0 0;
	font-size: var(--fs-label);
	font-weight: var(--fw-book);
	color: var(--text-faint);
}

/* ---------------------------------------------------------
   GRID
--------------------------------------------------------- */

.alston-form .grid--2,
.alston-form .grid--3 {
	display: grid;
	gap: 18px 20px;
}

.alston-form .grid--2 { grid-template-columns: repeat(2, 1fr); }
.alston-form .grid--3 { grid-template-columns: repeat(3, 1fr); }

.alston-form .grid--2 + .grid--2,
.alston-form .grid--2 + .grid--3,
.alston-form .grid--3 + .grid--2,
.alston-form .field + .field,
.alston-form .grid--2 + .field,
.alston-form .field + .grid--2 {
	margin-top: 18px;
}

/* ---------------------------------------------------------
   FIELD
--------------------------------------------------------- */

.alston-form .field__label {
	display: block;
	margin: 0 0 8px;
	font-family: var(--font-display);
	font-size: var(--fs-label);
	font-weight: var(--fw-regular);
	letter-spacing: .1em;
	text-transform: uppercase;
	color: var(--text-mute);
}

.alston-form .req {
	color: var(--gold);
}

.alston-form input[type="text"],
.alston-form input[type="email"],
.alston-form input[type="tel"],
.alston-form input[type="number"],
.alston-form input[type="date"],
.alston-form input[type="url"],
.alston-form select,
.alston-form textarea {
	width: 100%;
	padding: 13px 15px;
	font-family: var(--font-body);
	font-size: var(--fs-body-sm);
	font-weight: var(--fw-book);
	color: var(--ink);
	background: var(--paper);
	border: 1px solid var(--line-strong);
	border-radius: 0;
	appearance: none;
	transition: border-color var(--dur-fast) var(--ease);
}

.alston-form textarea {
	min-height: 110px;
	resize: vertical;
}

.alston-form input:focus,
.alston-form select:focus,
.alston-form textarea:focus {
	outline: none;
	border-color: var(--gold);
}

.alston-form input::placeholder,
.alston-form textarea::placeholder {
	color: var(--text-faint);
}

/* Native select arrow, drawn rather than imported. */
.alston-form select {
	background-image:
		linear-gradient(45deg, transparent 50%, var(--text-mute) 50%),
		linear-gradient(135deg, var(--text-mute) 50%, transparent 50%);
	background-position:
		calc(100% - 19px) calc(50% + 1px),
		calc(100% - 14px) calc(50% + 1px);
	background-size: 5px 5px, 5px 5px;
	background-repeat: no-repeat;
	padding-right: 38px;
}

/* ---------------------------------------------------------
   RADIO & CHECKBOX
--------------------------------------------------------- */

.alston-form .wpcf7-radio,
.alston-form .wpcf7-checkbox,
.alston-form .wpcf7-acceptance {
	display: block;
}

.alston-form .wpcf7-list-item {
	display: inline-flex;
	margin: 0 18px 10px 0;
}

.alston-form .wpcf7-list-item label {
	display: inline-flex;
	align-items: center;
	gap: 9px;
	cursor: pointer;
}

.alston-form input[type="radio"],
.alston-form input[type="checkbox"] {
	appearance: none;
	flex: 0 0 auto;
	width: 17px;
	height: 17px;
	margin: 0;
	border: 1px solid var(--line-strong);
	background: var(--paper);
	cursor: pointer;
	transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}

.alston-form input[type="radio"] {
	border-radius: 50%;
}

.alston-form input[type="radio"]:checked,
.alston-form input[type="checkbox"]:checked {
	border-color: var(--gold);
	background: var(--gold);
}

.alston-form input[type="checkbox"]:checked {
	background-image: linear-gradient(45deg, transparent 40%, var(--ink) 40%, var(--ink) 45%, transparent 45%);
}

.alston-form .wpcf7-list-item-label {
	font-size: var(--fs-body-sm);
	font-weight: var(--fw-book);
	color: var(--text);
}

/* Checkbox groups stack into a tidy grid. */
.alston-form .field--checks .wpcf7-checkbox {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
	gap: 4px 16px;
}

.alston-form .field--checks .wpcf7-list-item {
	margin: 0;
}

/* ---------------------------------------------------------
   CONDITIONAL BLOCK — return dates
--------------------------------------------------------- */

.alston-form .return-fields {
	max-height: 0;
	opacity: 0;
	overflow: hidden;
	transition: max-height var(--dur) var(--ease), opacity var(--dur) var(--ease), margin var(--dur) var(--ease);
}

.alston-form .return-fields.is-open {
	max-height: 320px;
	opacity: 1;
	margin-top: 18px;
}

/* Optional extras, collapsed behind a summary. */
.alston-form details.extras {
	margin-top: 18px;
}

.alston-form details.extras > summary {
	list-style: none;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-family: var(--font-display);
	font-size: var(--fs-label);
	font-weight: var(--fw-regular);
	letter-spacing: .1em;
	text-transform: uppercase;
	color: var(--gold);
}

.alston-form details.extras > summary::-webkit-details-marker {
	display: none;
}

.alston-form details.extras > summary::after {
	content: "+";
	font-size: 15px;
	line-height: 1;
}

.alston-form details.extras[open] > summary::after {
	content: "–";
}

.alston-form details.extras > .field {
	margin-top: 16px;
}

/* ---------------------------------------------------------
   SUBMIT
--------------------------------------------------------- */

.alston-form .submit-row {
	display: flex;
	align-items: center;
	gap: 18px;
	flex-wrap: wrap;
	margin-top: 30px;
	padding-top: 26px;
	border-top: 1px solid var(--line);
}

.alston-form .btn-submit,
.alston-form input[type="submit"] {
	padding: 15px 40px;
	font-family: var(--font-display);
	font-size: var(--fs-ui);
	font-weight: var(--fw-regular);
	letter-spacing: var(--tracking-nav);
	text-transform: uppercase;
	color: var(--text-inv);
	background: var(--ink);
	border: 1px solid var(--ink);
	cursor: pointer;
	transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}

.alston-form .btn-submit:hover,
.alston-form input[type="submit"]:hover {
	background: var(--gold);
	border-color: var(--gold);
	color: var(--ink);
}

.alston-form .submit-note {
	font-size: var(--fs-label);
	font-weight: var(--fw-book);
	color: var(--text-faint);
}

/* ---------------------------------------------------------
   CF7 FEEDBACK
--------------------------------------------------------- */

.alston-form .wpcf7-not-valid-tip {
	margin-top: 7px;
	font-size: var(--fs-label);
	font-weight: var(--fw-book);
	color: var(--error);
}

.alston-form .wpcf7-not-valid {
	border-color: var(--error);
}

.alston-form .wpcf7-response-output {
	margin: 24px 0 0;
	padding: 14px 18px;
	font-size: var(--fs-body-sm);
	font-weight: var(--fw-book);
	border: 1px solid var(--line-strong);
}

.alston-form form.sent .wpcf7-response-output {
	border-color: var(--gold);
	background: var(--success-soft);
}

.alston-form form.invalid .wpcf7-response-output,
.alston-form form.failed .wpcf7-response-output {
	border-color: var(--error);
	color: var(--error);
}

.alston-form .wpcf7-spinner {
	margin: 0 0 0 12px;
}

/* ---------------------------------------------------------
   DARK SURFACES — fleet and service pages sit on black
--------------------------------------------------------- */

.alston-form--dark .fs {
	border-bottom-color: var(--line-inv);
}

.alston-form--dark .fs__title { color: var(--text-inv); }
.alston-form--dark .field__label { color: var(--text-inv-mute); }
.alston-form--dark .fs__hint,
.alston-form--dark .submit-note { color: var(--text-inv-faint); }
.alston-form--dark .wpcf7-list-item-label { color: var(--text-inv); }
.alston-form--dark .submit-row { border-top-color: var(--line-inv); }

.alston-form--dark input[type="text"],
.alston-form--dark input[type="email"],
.alston-form--dark input[type="tel"],
.alston-form--dark input[type="number"],
.alston-form--dark input[type="date"],
.alston-form--dark select,
.alston-form--dark textarea {
	color: var(--text-inv);
	background: transparent;
	border-color: var(--line-inv-strong);
}

.alston-form--dark input[type="radio"],
.alston-form--dark input[type="checkbox"] {
	background: transparent;
	border-color: var(--line-inv-strong);
}

.alston-form--dark input[type="radio"]:checked,
.alston-form--dark input[type="checkbox"]:checked {
	background: var(--gold);
	border-color: var(--gold);
}

.alston-form--dark .btn-submit,
.alston-form--dark input[type="submit"] {
	color: var(--ink);
	background: var(--paper);
	border-color: var(--paper);
}

.alston-form--dark .btn-submit:hover,
.alston-form--dark input[type="submit"]:hover {
	background: var(--gold);
	border-color: var(--gold);
}

/* ---------------------------------------------------------
   RESPONSIVE
--------------------------------------------------------- */

@media (max-width: 700px) {

	.alston-form .grid--2,
	.alston-form .grid--3 {
		grid-template-columns: 1fr;
	}

	.alston-form .submit-row {
		flex-direction: column;
		align-items: stretch;
	}

	.alston-form .btn-submit,
	.alston-form input[type="submit"] {
		width: 100%;
	}
}


/* =========================================================
   RESET — this file is now the only form stylesheet.
   These guard against CF7's own markup and any stray rule.
========================================================= */

.alston-form label {
	display: block;
	margin: 0;
	font-family: inherit;
}

.alston-form .wpcf7-list-item label {
	display: inline-flex;
}

.alston-form p {
	margin: 0;
}

/* CF7 wraps every control in this. It must not affect layout. */
.alston-form .wpcf7-form-control-wrap {
	display: block;
	width: 100%;
}

/* Rows align on the control, not the label, so a wrapping label in one
   column cannot push its neighbour out of line. */
.alston-form .grid--2,
.alston-form .grid--3 {
	align-items: end;
}

.alston-form .field {
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	min-width: 0;
}

.alston-form .field__label {
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* Radio groups read as a segmented control rather than loose dots. */
.alston-form .field--segmented .wpcf7-radio {
	display: inline-flex;
	border: 1px solid var(--line-strong);
}

.alston-form .field--segmented .wpcf7-list-item {
	margin: 0;
}

.alston-form .field--segmented .wpcf7-list-item + .wpcf7-list-item {
	border-left: 1px solid var(--line-strong);
}

.alston-form .field--segmented .wpcf7-list-item label {
	padding: 12px 22px;
	font-family: var(--font-display);
	font-size: var(--fs-label);
	letter-spacing: .1em;
	text-transform: uppercase;
	color: var(--text-mute);
	transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}

.alston-form .field--segmented input[type="radio"] {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}

.alston-form .field--segmented .wpcf7-list-item label:hover {
	color: var(--ink);
}

.alston-form .field--segmented input[type="radio"]:checked + .wpcf7-list-item-label {
	color: var(--text-inv);
}

.alston-form .field--segmented .wpcf7-list-item:has(input:checked) label {
	background: var(--ink);
	color: var(--text-inv);
}

/* =========================================================
   FORM CARD
   Owned here rather than by a page stylesheet, so padding
   cannot be lost when page CSS changes.
========================================================= */

.alston-form-card {
	position: relative;
	z-index: 2;
	width: 100%;
	background: var(--paper);
	border: 1px solid var(--line);
	box-shadow: 0 25px 70px rgba(0, 0, 0, .18);
	padding: clamp(26px, 3vw, 44px);
	overflow: visible;
}

.alston-form-card .alston-form {
	padding-bottom: 0;
}

/* =========================================================
   CHIPS — special requirements
   Selectable pills. Reads as a considered choice rather than
   a checklist, and needs no disclosure toggle.
========================================================= */

.alston-form .field--chips .wpcf7-checkbox {
	display: flex;
	flex-wrap: wrap;
	gap: 9px;
}

.alston-form .field--chips .wpcf7-list-item {
	margin: 0;
}

.alston-form .field--chips .wpcf7-list-item label {
	display: inline-flex;
	align-items: center;
	gap: 0;
	padding: 10px 18px;
	border: 1px solid var(--line-strong);
	border-radius: 999px;
	cursor: pointer;
	font-family: var(--font-display);
	font-size: var(--fs-label);
	font-weight: var(--fw-regular);
	letter-spacing: .06em;
	color: var(--text-mute);
	transition:
		border-color var(--dur-fast) var(--ease),
		background var(--dur-fast) var(--ease),
		color var(--dur-fast) var(--ease);
}

.alston-form .field--chips .wpcf7-list-item label:hover {
	border-color: var(--gold);
	color: var(--ink);
}

/* The box itself is hidden — the pill is the control. */
.alston-form .field--chips input[type="checkbox"] {
	position: absolute;
	width: 1px;
	height: 1px;
	opacity: 0;
	pointer-events: none;
}

.alston-form .field--chips .wpcf7-list-item label,
.alston-form .field--chips .wpcf7-list-item-label {
	color: var(--text-mute);
}

.alston-form .field--chips .wpcf7-list-item label:hover,
.alston-form .field--chips .wpcf7-list-item label:hover .wpcf7-list-item-label {
	color: var(--ink);
}

/* The label span sets its own colour, so it has to be named explicitly —
   inheriting from the pill is not enough and produced black-on-black. */
.alston-form .field--chips .wpcf7-list-item:has(input:checked) label,
.alston-form .field--chips .wpcf7-list-item:has(input:checked) .wpcf7-list-item-label {
	background: var(--ink);
	border-color: var(--ink);
	color: var(--text-inv);
}

.alston-form .field--chips .wpcf7-list-item:has(input:checked) .wpcf7-list-item-label {
	background: none;
}

/* Keyboard users must still see focus. */
.alston-form .field--chips input[type="checkbox"]:focus-visible + .wpcf7-list-item-label {
	outline: 2px solid var(--gold);
	outline-offset: 4px;
}

/* Fallback for browsers without :has() — the checkbox stays visible. */
@supports not selector(:has(*)) {

	.alston-form .field--chips input[type="checkbox"] {
		position: static;
		width: 17px;
		height: 17px;
		opacity: 1;
		pointer-events: auto;
		margin-right: 9px;
	}

	.alston-form .field--chips .wpcf7-list-item label {
		border-radius: 0;
	}
}
