/*
 * Global CSS that theme.json can't express. Loaded on every page and in the
 * editor canvas (see inc/assets.php). Tokens only: var(--wp--preset--…),
 * var(--wp--custom--…) and the icon properties var(--meckup-icon-<name>).
 */

/* ---------------------------------------------------------------------------
 * Page frame
 * ------------------------------------------------------------------------- */

/* Header, main, CTA band and footer sit flush; each handles its own spacing. */
:root .wp-site-blocks > * {
	margin-block: 0;
}

/* The overlay header is positioned against this. */
.wp-site-blocks {
	position: relative;
}

body {
	overflow-x: clip;
}

/*
 * The palette has a colour named "border", so WordPress's text-colour class
 * for it is .has-border-color (color: #333 !important). Core also adds that
 * class to every block with a border colour, which would turn a bordered
 * card's text grey. Undo it unless the block really has a text colour.
 */
:root .has-border-color:not(.has-text-color) {
	color: inherit !important;
}

/*
 * Sections: top-level blocks in page content are separated by the section gap
 * (148 px at 1512). A section can override it with its own top margin
 * (Dimensions → Margin in the editor, which outputs an inline style).
 *
 * --meckup-section-gap is that gap: spacing-80 × --meckup-section-scale, which
 * is 1.5 below 782 (MF-A1, client feedback: sections felt cramped on phones).
 * Use the gap wherever something stands in for the gap between sections, and
 * the scale on a section's own closer top margin (e.g. the Explore values), so
 * phones follow.
 */
:root {
	--meckup-section-scale: 1;
	--meckup-section-gap: calc(var(--meckup-section-scale) * var(--wp--preset--spacing--80));
}

@media (max-width: 781px) {
	:root {
		--meckup-section-scale: 1.5;
	}
}

:root .wp-block-post-content > * + * {
	margin-block-start: var(--meckup-section-gap);
}

/* ---------------------------------------------------------------------------
 * States. None are drawn in Figma; these are our defaults pending design.
 * ------------------------------------------------------------------------- */

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
	outline: var(--wp--custom--focus--width) solid var(--wp--preset--color--contrast);
	outline-offset: var(--wp--custom--focus--offset);
}

a {
	text-underline-offset: 0.18em;
	text-decoration-thickness: 1px;
}

@media (prefers-reduced-motion: no-preference) {
	:where(a, .wp-element-button) {
		transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
	}
}

/* ---------------------------------------------------------------------------
 * Icon decorations shared by paragraphs and headings (A9 chevron, A11 round
 * arrow). Lists have their own chevron in blocks/core-list.css.
 * ------------------------------------------------------------------------- */

/* A9: 20 px chevron-in-circle before the text, 20 px gap. */
:is(p, .wp-block-heading).is-style-chevron {
	position: relative;
	padding-inline-start: calc(var(--wp--custom--icon--bullet) + var(--wp--preset--spacing--40));
}

:is(p, .wp-block-heading).is-style-chevron::before {
	content: "";
	position: absolute;
	inset-inline-start: 0;
	top: calc((1lh - var(--wp--custom--icon--bullet)) / 2);
	width: var(--wp--custom--icon--bullet);
	height: var(--wp--custom--icon--bullet);
	background-color: currentColor;
	-webkit-mask: var(--meckup-icon-chevron-circle) center / contain no-repeat;
	mask: var(--meckup-icon-chevron-circle) center / contain no-repeat;
}

/* A11: 62 px round arrow above the text (image card title). */
:is(p, .wp-block-heading).is-style-round-arrow::before {
	content: "";
	display: block;
	width: var(--wp--custom--icon--round);
	height: var(--wp--custom--icon--round);
	margin-block-end: var(--wp--preset--spacing--50);
	background-color: currentColor;
	-webkit-mask: var(--meckup-icon-round-arrow) center / contain no-repeat;
	mask: var(--meckup-icon-round-arrow) center / contain no-repeat;
}

:is(p, .wp-block-heading).is-style-round-arrow.has-text-align-center::before {
	margin-inline: auto;
}

:is(p, .wp-block-heading).is-style-round-arrow.has-text-align-right::before {
	margin-inline-start: auto;
}

/* ==========================================================================
   Old pages kept from the previous site (GeneratePress compatibility)
   ==========================================================================
   The pages kept at go-live (/download/…, /event-qr/…, /privacy/, /live/,
   /interest_form/) are GreenShift blocks coloured with GeneratePress's global
   colours: var(--main-purple) and the like, and has-<slug>-color classes.
   GeneratePress printed those; this theme doesn't, so without this block the
   download links turn white on white. Found in the staging rehearsal,
   9 Nov 2026 (docs/deploy/go-live.md).

   The values are live's GeneratePress → Customize → Colors, so they are
   hard-coded on purpose (not theme tokens). New content must not use them.
   base and contrast are also slugs in this theme's palette (with other
   colours, used by the header and footer), so they are only remapped inside
   page content, where only old pages use them. */
:root {
	--contrast: #222222;
	--contrast-2: #575760;
	--contrast-3: #b2b2be;
	--base: #f0f0f0;
	--base-2: #f7f8f9;
	--base-3: #ffffff;
	--accent: #bfe0dc;
	--background: #0d083d;
	--main-purple: #716298;
	--secondary-purple: #0d083d;
	--secondary-teal: #0d9488;
	--main-orange: #f54903;
}

.has-contrast-2-color { color: var(--contrast-2) !important; }
.has-contrast-3-color { color: var(--contrast-3) !important; }
.has-base-2-color { color: var(--base-2) !important; }
.has-base-3-color { color: var(--base-3) !important; }
.has-accent-color { color: var(--accent) !important; }
.has-background-color { color: var(--background) !important; }
.has-main-purple-color { color: var(--main-purple) !important; }
.has-secondary-purple-color { color: var(--secondary-purple) !important; }
.has-secondary-teal-color { color: var(--secondary-teal) !important; }
.has-main-orange-color { color: var(--main-orange) !important; }

.has-contrast-2-background-color { background-color: var(--contrast-2) !important; }
.has-contrast-3-background-color { background-color: var(--contrast-3) !important; }
.has-base-2-background-color { background-color: var(--base-2) !important; }
.has-base-3-background-color { background-color: var(--base-3) !important; }
.has-accent-background-color { background-color: var(--accent) !important; }
.has-background-background-color { background-color: var(--background) !important; }
.has-main-purple-background-color { background-color: var(--main-purple) !important; }
.has-secondary-purple-background-color { background-color: var(--secondary-purple) !important; }
.has-secondary-teal-background-color { background-color: var(--secondary-teal) !important; }
.has-main-orange-background-color { background-color: var(--main-orange) !important; }

.wp-block-post-content .has-base-color { color: var(--base) !important; }
.wp-block-post-content .has-contrast-color { color: var(--contrast) !important; }
.wp-block-post-content .has-base-background-color { background-color: var(--base) !important; }
.wp-block-post-content .has-contrast-background-color { background-color: var(--contrast) !important; }

/* ==========================================================================
   Contact Form 7 forms
   ==========================================================================
   Forms aren't in the Figma design, so these use the existing tokens: fields
   are dark surface boxes with the border colour, Submit is the A1 button
   (theme.json elements.button; an <input> can't take the trailing arrow).
   The only CF7 form at go-live is /interest_form/, kept from the old site
   (staging rehearsal, 9 Nov 2026; docs/deploy/go-live.md step 7). :root on
   the state rules beats CF7's own styles.css whatever the load order. */

.wpcf7 {
	color-scheme: dark;
}

/* 32 px between fields; paragraphs nested in a field have no margins. */
.wpcf7-form :where(p) {
	margin-block: 0;
}

.wpcf7-form > * {
	margin-block: 0;
}

.wpcf7-form > * + * {
	margin-block-start: var(--wp--preset--spacing--50);
}

.wpcf7-form label {
	display: block;
}

/* A <br> straight after a (now block) label would add an empty line. */
.wpcf7-form label + br {
	display: none;
}

.wpcf7-form-control-wrap {
	display: block;
}

/* CF7's default template: "Label<br>[field]" inside the label. */
.wpcf7-form label > br + .wpcf7-form-control-wrap {
	margin-block-start: var(--wp--preset--spacing--20);
}

/* Text fields */
.wpcf7 :is(input:is([type="text"], [type="email"], [type="tel"], [type="url"], [type="number"], [type="date"]), select, textarea) {
	box-sizing: border-box;
	width: 100%;
	max-width: 100%;
	margin: 0;
	padding: var(--wp--preset--spacing--30) var(--wp--preset--spacing--40);
	border: 1px solid var(--wp--preset--color--border);
	border-radius: var(--wp--custom--radius--card);
	background-color: var(--wp--preset--color--surface);
	color: var(--wp--preset--color--contrast);
	font-family: inherit;
	font-size: var(--wp--preset--font-size--medium);
	line-height: var(--wp--custom--line-height--normal);
}

.wpcf7 textarea {
	min-height: 10rem;
	resize: vertical;
}

.wpcf7 :is(input, select, textarea):hover:not(:disabled) {
	border-color: var(--wp--preset--color--muted);
}

/* Browser autofill paints fields light blue; keep them dark. */
.wpcf7 :is(input, textarea):-webkit-autofill {
	-webkit-text-fill-color: var(--wp--preset--color--contrast);
	box-shadow: inset 0 0 0 100vmax var(--wp--preset--color--surface-raised);
}

/* Checkbox and radio rows (the "I agree" acceptance box). */
.wpcf7 .wpcf7-list-item {
	display: block;
	margin: 0;
}

.wpcf7 .wpcf7-list-item > label {
	display: flex;
	align-items: flex-start;
	gap: var(--wp--preset--spacing--30);
	font-size: var(--wp--preset--font-size--small);
	cursor: pointer;
}

.wpcf7 .wpcf7-list-item-label::before,
.wpcf7 .wpcf7-list-item-label::after {
	content: none;
}

.wpcf7 input:is([type="checkbox"], [type="radio"]) {
	flex: none;
	width: var(--wp--custom--icon--bullet);
	height: var(--wp--custom--icon--bullet);
	margin: calc((1lh - var(--wp--custom--icon--bullet)) / 2) 0 0;
	accent-color: var(--wp--preset--color--primary);
	cursor: pointer;
}

/* Submit: the A1 button. CF7 disables it until the acceptance box is ticked. */
.wpcf7 .wpcf7-submit {
	appearance: none;
	margin: 0;
	padding: 0.625rem var(--wp--preset--spacing--40);
	border: 0;
	border-radius: var(--wp--custom--radius--pill);
	background-color: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--contrast);
	font-family: var(--wp--preset--font-family--body);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 700;
	line-height: var(--wp--custom--line-height--normal);
	cursor: pointer;
}

.wpcf7 .wpcf7-submit:is(:hover, :focus):not(:disabled) {
	background-color: var(--wp--custom--color--primary-hover);
}

.wpcf7 .wpcf7-submit:disabled {
	background-color: var(--wp--preset--color--border);
	color: var(--wp--preset--color--muted);
	cursor: not-allowed;
}

@media (prefers-reduced-motion: no-preference) {
	.wpcf7 .wpcf7-submit {
		transition: color 0.15s ease, background-color 0.15s ease;
	}
}

/* CF7's spinner is dark grey, invisible on black. */
.wpcf7 .wpcf7-spinner {
	margin-inline: var(--wp--preset--spacing--40) 0;
	vertical-align: middle;
	background-color: var(--wp--preset--color--muted);
	opacity: 1;
}

/* Validation */
.wpcf7 :is(input, select, textarea).wpcf7-not-valid,
.wpcf7 :is(input, select, textarea).wpcf7-not-valid:hover {
	border-color: var(--wp--preset--color--primary);
}

.wpcf7 .wpcf7-not-valid-tip {
	margin-block-start: var(--wp--preset--spacing--20);
	color: var(--wp--preset--color--primary);
	font-size: var(--wp--preset--font-size--x-small);
}

/* The message box under the form, after sending. */
:root .wpcf7 form .wpcf7-response-output {
	margin: var(--wp--preset--spacing--50) 0 0;
	padding: var(--wp--preset--spacing--30) var(--wp--preset--spacing--40);
	border: 1px solid var(--wp--preset--color--border);
	border-radius: var(--wp--custom--radius--card);
	background-color: var(--wp--preset--color--surface);
	color: var(--wp--preset--color--contrast);
	font-size: var(--wp--preset--font-size--small);
}

:root .wpcf7 form.sent .wpcf7-response-output {
	border-color: var(--wp--preset--color--secondary);
}

:root .wpcf7 form:is(.invalid, .unaccepted, .payment-required, .failed, .aborted, .spam) .wpcf7-response-output {
	border-color: var(--wp--preset--color--primary);
}

/*
 * /interest_form/'s own markup (old site): a "field-title" paragraph above
 * each field, red <font> asterisks, 12 px <font> hints under the name and
 * email fields, and the name/email pairs side by side in fixed 400 px inline
 * floats that would be cut off on a phone. Inline styles, hence !important.
 */
.wpcf7-form > .field-title {
	font-weight: 600;
}

.wpcf7-form > .field-title + * {
	margin-block-start: var(--wp--preset--spacing--20);
}

.wpcf7-form .field-title font {
	color: var(--wp--preset--color--primary) !important;
}

.wpcf7-form font[style*="font-size"] {
	display: block;
	margin-block-start: var(--wp--preset--spacing--20);
	font-size: var(--wp--preset--font-size--x-small) !important;
}

.wpcf7-form > div[style] {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
	gap: var(--wp--preset--spacing--40);
	margin-inline-start: 0 !important;
	overflow: visible !important;
}

.wpcf7-form > div[style] > div[style] {
	width: auto !important;
	margin-inline-start: 0 !important;
	float: none !important;
}
