/*
 * Contact Form 7, restyled from the outside.
 *
 * CF7's markup is left untouched: rewriting its output breaks its validation
 * and its accessibility handling, and every plugin update would fight the
 * theme. So its own stylesheet is dequeued and its elements are styled here
 * against the theme tokens.
 */

.cq-cf7 .wpcf7-form { max-width: 900px; }

/*
 * CF7's autop is switched off in the form settings, but a stray paragraph can
 * still arrive from an edit made inside CF7's own editor. A <p> as a direct
 * child of the grid would occupy a cell and push everything out of line, so it
 * is neutralised rather than left to break the layout.
 */
.cq-cf7 .wpcf7-form > p:empty,
.cq-cf7 .cq-form__grid > p:empty { display: none; }
.cq-cf7 .cq-form__grid > p { grid-column: 1 / -1; margin: 0; }
.cq-cf7 .wpcf7-form br { display: none; }

/* The grid itself. Declared here as well as in sections.css because a form
   rendered by CF7 has to lay out even if only this stylesheet loads. */
.cq-cf7 .cq-form__grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 18px;
}
.cq-cf7 .cq-field {
	display: flex;
	flex-direction: column;
	gap: 8px;
	min-width: 0;
}
.cq-cf7 .cq-field--full { grid-column: 1 / -1; }

/*
 * CF7 nests four levels of inline <span> around every control, which is why an
 * untouched CF7 form ignores flex and grid entirely. Each wrapper is made a
 * block so the field it contains can size itself.
 */
.cq-cf7 .wpcf7-form-control-wrap { display: block; width: 100%; }

.cq-cf7 input[type="text"],
.cq-cf7 input[type="email"],
.cq-cf7 input[type="tel"],
.cq-cf7 input[type="url"],
.cq-cf7 input[type="number"],
.cq-cf7 input[type="date"],
.cq-cf7 select,
.cq-cf7 textarea {
	width: 100%;
	padding: 14px 16px;
	background: var(--ink3);
	border: 1px solid rgba(255,255,255,.1);
	border-radius: var(--r-btn);
	font: inherit;
	font-size: 14.5px;
	line-height: 1.5;
	color: #fff;
	transition: border-color var(--d-btn) var(--e-ui), background var(--d-btn) var(--e-ui), box-shadow var(--d-btn) var(--e-ui);
	appearance: none;
	-webkit-appearance: none;
}
.cq-cf7 textarea { resize: vertical; min-height: 130px; display: block; }

.cq-cf7 input:focus,
.cq-cf7 select:focus,
.cq-cf7 textarea:focus {
	outline: none;
	border-color: var(--green-br);
	background: #111a22;
	box-shadow: 0 0 0 3px rgba(105,185,75,.14);
}
.cq-cf7 ::placeholder { color: rgba(147,163,173,.55); }

/* A native select arrow is invisible on a dark field on most platforms. */
.cq-cf7 select {
	background-image: linear-gradient(45deg, transparent 50%, var(--green-br) 50%),
		linear-gradient(135deg, var(--green-br) 50%, transparent 50%);
	background-position: calc(100% - 20px) center, calc(100% - 14px) center;
	background-size: 6px 6px, 6px 6px;
	background-repeat: no-repeat;
	padding-inline-end: 42px;
	cursor: pointer;
}

.cq-req { color: var(--green-br); margin-inline-start: 3px; }

/* ==================================================================
 * Consent checkbox
 *
 * CF7 renders [acceptance] as:
 *   span.wpcf7-form-control-wrap > span.wpcf7-acceptance
 *     > span.wpcf7-list-item > label > input + span.wpcf7-list-item-label
 *
 * Every one of those is inline by default, so the box and the sentence do not
 * align and the sentence cannot wrap properly. The label is laid out as a grid
 * with the box in a fixed first column.
 *
 * The sentence is CF7's own label text — it must stay visible, or the input is
 * left unlabelled for a screen reader and the text cannot be clicked to tick.
 * ================================================================== */
.cq-cf7 .cq-field--check { display: block; }
.cq-cf7 .wpcf7-acceptance,
.cq-cf7 .wpcf7-acceptance .wpcf7-list-item { display: block; margin: 0; }

.cq-cf7 .wpcf7-acceptance label {
	display: grid;
	grid-template-columns: 19px minmax(0, 1fr);
	gap: 12px;
	align-items: start;
	cursor: pointer;
	font-size: 13.5px;
	line-height: 1.62;
	color: var(--muted-dark);
}
.cq-cf7 .wpcf7-list-item-label {
	display: block;
	min-width: 0;
}
.cq-cf7 .wpcf7-acceptance a {
	color: var(--green-br);
	text-decoration: underline;
	text-decoration-color: rgba(105,185,75,.4);
}
.cq-cf7 .wpcf7-acceptance a:hover { color: #fff; }

.cq-cf7 input[type="checkbox"] {
	appearance: none;
	-webkit-appearance: none;
	width: 19px;
	height: 19px;
	flex: none;
	margin: 2px 0 0;
	background: var(--ink3);
	border: 1px solid rgba(255,255,255,.22);
	border-radius: 2px;
	cursor: pointer;
	position: relative;
	transition: background var(--d-btn) var(--e-ui), border-color var(--d-btn) var(--e-ui);
}
.cq-cf7 input[type="checkbox"]::after {
	content: "";
	position: absolute;
	inset-block-start: 3px;
	inset-inline-start: 6px;
	width: 5px;
	height: 9px;
	border: solid #fff;
	border-width: 0 2px 2px 0;
	transform: rotate(45deg) scale(0);
	transition: transform 220ms var(--e-card);
}
.cq-cf7 input[type="checkbox"]:checked { background: var(--green); border-color: var(--green); }
.cq-cf7 input[type="checkbox"]:checked::after { transform: rotate(45deg) scale(1); }
.cq-cf7 input[type="checkbox"]:focus-visible { outline: 2px solid var(--green-br); outline-offset: 2px; }

/* ----------------------------------------------------------------- File */
.cq-cf7 input[type="file"] {
	width: 100%;
	padding: 11px 14px;
	background: var(--ink3);
	border: 1px dashed rgba(255,255,255,.2);
	border-radius: var(--r-btn);
	font: inherit;
	font-size: 13.5px;
	color: var(--muted-dark);
	cursor: pointer;
	transition: border-color var(--d-btn) var(--e-ui), background var(--d-btn) var(--e-ui);
}
.cq-cf7 input[type="file"]:hover { border-color: var(--green-br); background: #111a22; }
.cq-cf7 input[type="file"]::file-selector-button {
	margin-inline-end: 14px;
	padding: 8px 16px;
	background: rgba(105,185,75,.14);
	border: 1px solid rgba(105,185,75,.36);
	border-radius: 2px;
	font-family: var(--font-head);
	font-size: 11px;
	font-weight: 700;
	letter-spacing: .1em;
	text-transform: uppercase;
	color: var(--green-br);
	cursor: pointer;
	transition: background var(--d-btn) var(--e-ui);
}
.cq-cf7 input[type="file"]::file-selector-button:hover { background: rgba(105,185,75,.24); }

/* --------------------------------------------------------------- Submit */
.cq-cf7 .cq-form__foot {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 16px;
	margin-block-start: 26px;
}
.cq-cf7 .cq-form__foot p { margin: 0; display: flex; align-items: center; gap: 16px; }

/* The submit is an <input>, so the shared button styles that expect an <a>
   have to be restated for it. */
.cq-cf7 .wpcf7-submit {
	display: inline-flex;
	align-items: center;
	width: auto;
	padding: 15px 26px;
	background: var(--green);
	border: 1px solid transparent;
	border-radius: var(--r-btn);
	font-family: var(--font-head);
	font-size: 12.5px;
	font-weight: 700;
	letter-spacing: .09em;
	text-transform: uppercase;
	color: #fff;
	cursor: pointer;
	appearance: none;
	-webkit-appearance: none;
	transition: background var(--d-btn) var(--e-ui), transform 280ms var(--e-card), box-shadow 340ms var(--e-card);
}
.cq-cf7 .wpcf7-submit:hover {
	background: var(--green-br);
	transform: translate3d(0, -3px, 0);
	box-shadow: 0 16px 34px -8px rgba(45,162,55,.55);
}
.cq-cf7 .wpcf7-submit:active { transform: translate3d(0, -1px, 0); }
.cq-cf7 .wpcf7-submit:disabled { opacity: .55; cursor: not-allowed; }

/* CF7's spinner sits after the button and has no styling of its own. */
.cq-cf7 .wpcf7-spinner {
	width: 20px;
	height: 20px;
	margin: 0 0 0 14px;
	background: none;
	border: 2px solid rgba(105,185,75,.28);
	border-top-color: var(--green-br);
	border-radius: 50%;
	animation: cq-spin 720ms linear infinite;
	opacity: 1;
}
.cq-cf7 .wpcf7-spinner::before { display: none; }
@keyframes cq-spin { to { transform: rotate(360deg); } }

/* ==================================================================
 * Dead space
 *
 * CF7 always prints its response container and a screen-reader response block,
 * whether or not there is anything to say. With padding and a border on the
 * response div, an empty one occupied about sixty pixels — and the
 * screen-reader block adds more. That was the gap under the submit button.
 * ================================================================== */
.cq-cf7 .wpcf7-response-output:empty {
	display: none !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
}

/* This block must stay in the accessibility tree — a screen reader announces
   the result from it — so it is positioned away rather than hidden. */
.cq-cf7 .screen-reader-response {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

/* Stray empty paragraphs from a form built before autop was switched off. */
.cq-cf7 .wpcf7-form > p:empty,
.cq-cf7 .cq-form__grid > p:empty,
.cq-cf7 .cq-form__foot > p:empty { display: none; }

/* ==================================================================
 * The consent checkbox, hardened
 *
 * .cq-field input in sections.css sets width:100%, which catches the checkbox
 * too and stretches it across the column. That is what produced the oversized
 * empty square. The type selector plus the container gives enough specificity
 * to win without !important.
 * ================================================================== */
.cq-cf7 .cq-field input[type="checkbox"],
.cq-cf7 .cq-field--check input[type="checkbox"],
.cq-field--check input[type="checkbox"] {
	width: 19px;
	min-width: 19px;
	max-width: 19px;
	height: 19px;
	flex: 0 0 19px;
	padding: 0;
}

/* ------------------------------------------------------------- Messages */
.cq-cf7 .wpcf7-response-output {
	margin: 24px 0 0 !important;
	padding: 16px 20px !important;
	border: 1px solid rgba(255,255,255,.14) !important;
	border-radius: var(--r-card);
	font-size: 14px;
	line-height: 1.65;
	color: var(--muted-dark);
	background: var(--ink2);
}
.cq-cf7 form.sent .wpcf7-response-output {
	border-color: rgba(45,162,55,.5) !important;
	background: rgba(45,162,55,.08);
	color: #cfe8cf;
}
.cq-cf7 form.invalid .wpcf7-response-output,
.cq-cf7 form.unaccepted .wpcf7-response-output,
.cq-cf7 form.failed .wpcf7-response-output,
.cq-cf7 form.spam .wpcf7-response-output,
.cq-cf7 form.aborted .wpcf7-response-output {
	border-color: rgba(201,138,22,.5) !important;
	background: rgba(201,138,22,.08);
	color: #e8cf9a;
}

/* Per-field errors. CF7 places these inside the field wrapper, so they need to
   become a block or they sit beside the input. */
.cq-cf7 .wpcf7-not-valid-tip {
	display: block;
	margin-block-start: 7px;
	font-size: 12.4px;
	color: var(--amber);
}
.cq-cf7 .wpcf7-not-valid {
	border-color: rgba(201,138,22,.6) !important;
	box-shadow: 0 0 0 3px rgba(201,138,22,.1) !important;
}

/* The whole form dims while submitting, which is the clearest signal that a
   click registered. */
.cq-cf7 form.submitting .wpcf7-form-control { opacity: .6; pointer-events: none; }

.cq-form__gap { height: 26px; }

/* ------------------------------------------------------------ Mobile */
@media (max-width: 620px) {
	.cq-cf7 input[type="text"],
	.cq-cf7 input[type="email"],
	.cq-cf7 input[type="tel"],
	.cq-cf7 select,
	.cq-cf7 textarea {
		/* 16px stops iOS zooming the viewport when a field takes focus, which
		   is the single worst mobile form defect and is entirely avoidable. */
		font-size: 16px;
		padding: 13px 14px;
	}
	.cq-cf7 .wpcf7-submit { width: 100%; justify-content: center; }
	.cq-cf7 .wpcf7-spinner { margin: 14px auto 0; display: block; }
}

/* ==================================================================
 * The form band
 *
 * Part of the page template, not a widget. The form takes the wider column and
 * the details sit beside it — a contact page where the address is somewhere
 * further down makes a visitor scroll to find what they came for.
 * ================================================================== */
.cq-formband {
	display: grid;
	grid-template-columns: minmax(0, 1.55fr) minmax(260px, .85fr);
	gap: clamp(28px, 4vw, 72px);
	align-items: start;
}
.cq-formband.is-wide { grid-template-columns: minmax(0, 1fr); }
.cq-formband__main { min-width: 0; }

.cq-formband__aside { position: relative; }

.cq-formband__list {
	margin: 0;
	padding: 0;
	list-style: none;
	display: grid;
	border-top: 1px solid rgba(255,255,255,.09);
}
.cq-formband__i {
	padding-block: 18px;
	border-bottom: 1px solid rgba(255,255,255,.09);
	transition: padding-inline-start 420ms var(--e-card);
}
.cq-formband__i:hover { padding-inline-start: 8px; }

.cq-formband__l {
	display: block;
	font-family: var(--font-head);
	font-size: 10px;
	font-weight: 800;
	letter-spacing: .18em;
	text-transform: uppercase;
	color: var(--green-br);
}
.cq-formband__v {
	display: block;
	margin-block-start: 9px;
	font-family: var(--font-head);
	font-size: 15px;
	font-weight: 600;
	line-height: 1.55;
	color: #fff;
	transition: color var(--d-btn) var(--e-ui);
}
a.cq-formband__v:hover { color: var(--green-br); }

.cq-formband__note { margin-block-start: 22px; }
.cq-formband__note .cq-comply { padding: 18px 20px 18px 24px; }
.cq-formband__note .cq-comply__text { font-size: 12.6px; }

/* On a light band the same component has to invert. */
.cq-sec--light .cq-formband__list,
.cq-sec--soft .cq-formband__list,
.cq-sec--light .cq-formband__i,
.cq-sec--soft .cq-formband__i { border-color: var(--line); }
.cq-sec--light .cq-formband__v,
.cq-sec--soft .cq-formband__v { color: var(--text); }
.cq-sec--light .cq-formband__l,
.cq-sec--soft .cq-formband__l { color: var(--green); }
.cq-sec--light .cq-cf7 input,
.cq-sec--light .cq-cf7 select,
.cq-sec--light .cq-cf7 textarea,
.cq-sec--soft .cq-cf7 input,
.cq-sec--soft .cq-cf7 select,
.cq-sec--soft .cq-cf7 textarea {
	background: var(--paper);
	border-color: var(--line);
	color: var(--text);
}
.cq-sec--light .cq-field__label,
.cq-sec--soft .cq-field__label { color: var(--muted); }

@media (max-width: 1080px) {
	.cq-formband { grid-template-columns: minmax(0, 1fr); }
	/* The details move above the form: on one column they are the shorter
	   element, and a visitor after a phone number should not scroll past a
	   whole form to reach it. */
	.cq-formband__main { order: 2; }
	.cq-formband__aside { order: 1; }
	.cq-formband__list { display: grid; grid-template-columns: 1fr 1fr; column-gap: 24px; }
}

@media (max-width: 620px) {
	.cq-formband__list { grid-template-columns: 1fr; }
}
