/* Contact Form 7 integration.
   main.css is the untouched prototype stylesheet; everything needed to make
   CF7's own markup sit inside those designs lives here.

   CF7 emits three extra children inside <form> — a hidden fieldset, a spinner
   and the response output. In a grid layout they would each claim a cell, so
   they are taken out of the flow or spanned across it. */

.wpcf7-form p { margin: 0; }
.wpcf7-form .wpcf7-form-control-wrap { display: block; }
.wpcf7-form .hidden-fields-container { display: none; }
.wpcf7-form .wpcf7-response-output { grid-column: 1 / -1; }

/* ---- card form: the wrapper is the card, the form itself is transparent --- */
.le-form {
	background: #fff;
	border: 1px solid var(--line);
	border-radius: var(--r);
	padding: clamp(24px, 3vw, 36px);
}
.le-form .wpcf7-form {
	background: transparent;
	border: 0;
	border-radius: 0;
	padding: 0;
}
.le-form .wpcf7-form label { margin: 16px 0 6px; }
.le-form .wpcf7-form label:first-of-type { margin-top: 0; }

/* ---- inline band form on the navy panel ---------------------------------- */
.le-band-form .wpcf7,
.le-band-form .wpcf7-form {
	background: transparent;
	border: 0;
	padding: 0;
}
.le-band-form .wpcf7-form {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px;
	align-items: start;
}
.le-band-form input[type="text"],
.le-band-form input[type="tel"],
.le-band-form input[type="email"],
.le-band-form input[type="number"] {
	background: rgba(255, 255, 255, .1);
	border-color: rgba(255, 255, 255, .24);
	color: #fff;
}
.le-band-form input::placeholder { color: #9FB8D6; }
.le-band-form input:not([type="submit"]):focus {
	border-color: #fff;
	background: rgba(255, 255, 255, .16);
}
.le-band-form .wpcf7-submit {
	grid-column: 1 / -1;
	margin-top: 0;
	width: 100%;
}

/*
 * CF7 keeps the spinner in the layout with visibility:hidden. Inside a grid it
 * claims a whole row — 24px plus the gap — which made this column taller than
 * the text beside it and threw the band off centre. Out of flow it goes.
 */
.le-band-form .wpcf7-form { position: relative; }
.le-band-form .wpcf7-spinner {
	position: absolute;
	left: 50%;
	bottom: -30px;
	margin: 0;
	transform: translateX(-50%);
}

/* ---- in-article band: two fields and the button on one row --------------- */
.art-cta .wpcf7-form {
	background: transparent;
	border: 0;
	padding: 0;
	display: grid;
	grid-template-columns: 1fr 1fr auto;
	gap: 12px;
	margin-top: 22px;
	align-items: start;
}
.art-cta input[type="text"],
.art-cta input[type="tel"],
.art-cta input[type="email"] {
	background: rgba(255, 255, 255, .1);
	border-color: rgba(255, 255, 255, .24);
	color: #fff;
}
.art-cta input::placeholder { color: #9FB8D6; }
.art-cta input:not([type="submit"]):focus { border-color: #fff; background: rgba(255, 255, 255, .16); }
.art-cta .wpcf7-submit { margin: 0; width: auto; grid-column: auto; }
.art-cta .wpcf7-form { position: relative; }
.art-cta .wpcf7-spinner {
	position: absolute;
	left: 50%;
	bottom: -30px;
	margin: 0;
	transform: translateX(-50%);
}

@media (max-width: 900px) {
	.le-band-form .wpcf7-form,
	.art-cta .wpcf7-form { grid-template-columns: 1fr; }
	.art-cta .wpcf7-submit { width: 100%; }
}

/* ---- status messages, restyled to match the design tokens ---------------- */
.wpcf7 form .wpcf7-response-output {
	margin: 18px 0 0;
	padding: 12px 16px;
	border-radius: var(--r-s);
	border-width: 1px;
	font-size: 14.5px;
}
.wpcf7 form.sent .wpcf7-response-output { border-color: #2E9E6B; color: #1c6b48; background: #EFF9F4; }
.wpcf7 form.invalid .wpcf7-response-output,
.wpcf7 form.unaccepted .wpcf7-response-output,
.wpcf7 form.failed .wpcf7-response-output { border-color: #D0555B; color: #9c2f34; background: #FDF1F1; }
.wpcf7-not-valid-tip { color: #c0392b; font-size: 13px; margin-top: 6px; display: block; }
.wpcf7-not-valid { border-color: #D0555B !important; }

/* ---- validation inside the navy bands -------------------------------------
   These bands sit in a two-column panel whose height is set by the taller
   column. A per-field tip and the summary box together add roughly 90px, so
   the whole panel jumped the moment someone submitted an empty form.

   Neither message is allowed to affect layout here:
   - the per-field tips stay in the DOM, and keep being announced through the
     aria-describedby CF7 puts on each input, but are visually clipped; the red
     border on the field carries the same meaning on screen;
   - the summary is lifted out of the flow and floats under the form, inside
     the padding the panel already has, restyled as a line of text rather than
     a bordered box so it fits there. */

.le-band-form .wpcf7-form,
.art-cta .wpcf7-form { position: relative; }

.le-band-form .wpcf7-not-valid-tip,
.art-cta .wpcf7-not-valid-tip {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

.le-band-form .wpcf7 form .wpcf7-response-output,
.art-cta .wpcf7 form .wpcf7-response-output {
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	margin: 8px 0 0;
	padding: 0;
	border: 0;
	background: none;
	color: #fff;
	font-size: 13.5px;
	line-height: 1.3;
}

.le-band-form .wpcf7 form.invalid .wpcf7-response-output,
.le-band-form .wpcf7 form.unaccepted .wpcf7-response-output,
.le-band-form .wpcf7 form.failed .wpcf7-response-output,
.art-cta .wpcf7 form.invalid .wpcf7-response-output,
.art-cta .wpcf7 form.unaccepted .wpcf7-response-output,
.art-cta .wpcf7 form.failed .wpcf7-response-output { color: #FFC9C9; }

.le-band-form .wpcf7 form.sent .wpcf7-response-output,
.art-cta .wpcf7 form.sent .wpcf7-response-output { color: #9FE3C2; }

/* The invalid field is marked by its border, so that has to read on navy. */
.le-band-form .wpcf7-not-valid,
.art-cta .wpcf7-not-valid { border-color: #FF9C9C !important; }

/* The outcome is shown in a dialog (see template-parts/form-modal.php). The
   inline line is dropped only when the script has confirmed the browser can
   open one, so a browser without <dialog> still gets its message in place. */
.le-modal-ready .wpcf7 form .wpcf7-response-output { display: none; }
