/* Forminator forms (scripts/seed-forms.php). Loaded only on pages whose content
   embeds a Forminator form (see ghn_enqueue_contextual_styles()), never globally.

   Forminator's default design draws field borders in #dbdbdb (1.4:1 on white,
   below the 3:1 WCAG 1.4.11 asks of a control's boundary), shows no focus
   indicator on most controls and leaves the submit button as an unstyled grey
   box. Everything here uses the theme tokens. The selectors carry Forminator's
   own three-class prefix so they win without !important. */

/* A form holds its space until its script has run, so nothing below it jumps,
   but stays out of reach: conditional fields and uploads don't work yet
   (IR-010). The newsletter signup has neither and is shown at once. */
.ghn-form-waiting:not(.forminator-initialized) {
	visibility: hidden;
}

.forminator-ui.forminator-custom-form {
	font-family: var(--wp--preset--font-family--sans);
	color: var(--wp--preset--color--primary-dark);
}

/* Field boundaries: primary-dark is 10:1 on white. */
.forminator-ui.forminator-custom-form.forminator-design--default .forminator-input,
.forminator-ui.forminator-custom-form.forminator-design--default .forminator-textarea,
.forminator-ui.forminator-custom-form.forminator-design--default .forminator-select2 + .forminator-select .selection .select2-selection,
.forminator-ui.forminator-custom-form.forminator-design--default .forminator-select .select2-selection {
	border: 1px solid var(--wp--preset--color--primary-dark);
	border-radius: 4px;
	background: var(--wp--preset--color--surface);
	color: var(--wp--preset--color--primary-dark);
}

/* Radio / checkbox boxes. */
.forminator-ui.forminator-custom-form.forminator-design--default .forminator-radio .forminator-radio-bullet,
.forminator-ui.forminator-custom-form.forminator-design--default .forminator-checkbox .forminator-checkbox-box {
	border: 1px solid var(--wp--preset--color--primary-dark);
}

/* Visible focus on every control (WCAG 2.4.7 / 2.4.11). */
.forminator-ui.forminator-custom-form .forminator-input:focus-visible,
.forminator-ui.forminator-custom-form .forminator-textarea:focus-visible,
.forminator-ui.forminator-custom-form .forminator-button:focus-visible,
.forminator-ui.forminator-custom-form input[type="radio"]:focus-visible + .forminator-radio-bullet,
.forminator-ui.forminator-custom-form input[type="checkbox"]:focus-visible + .forminator-checkbox-box,
.forminator-ui.forminator-custom-form .select2-selection:focus-visible,
.forminator-ui.forminator-custom-form .select2-container--focus .select2-selection {
	outline: 3px solid var(--wp--preset--color--primary-dark);
	outline-offset: 2px;
}

/* Radios, checkboxes, dropdowns and calendars. Forminator colours these only in
   a stylesheet it generates per form under uploads/; when that can't load, the
   checked dot is invisible and popups are transparent, with the fields below
   showing through (preview, 2026-11-25). The colours are set here instead, and
   :not(#x) outranks that stylesheet's form ID. Popups are appended to <body>,
   outside the form. */
.forminator-ui.forminator-custom-form:not(#x) .forminator-radio .forminator-radio-bullet,
.forminator-ui.forminator-custom-form:not(#x) .forminator-radio input:checked + .forminator-radio-bullet,
.forminator-ui.forminator-custom-form:not(#x) .forminator-checkbox .forminator-checkbox-box,
.forminator-ui.forminator-custom-form:not(#x) .forminator-checkbox input:checked + .forminator-checkbox-box,
.forminator-ui.forminator-custom-form:not(#x) .forminator-consent .forminator-checkbox-box,
.forminator-ui.forminator-custom-form:not(#x) .forminator-consent input:checked + .forminator-checkbox-box {
	border-color: var(--wp--preset--color--primary-dark);
	background-color: var(--wp--preset--color--surface);
	color: var(--wp--preset--color--primary-dark);
}

.forminator-ui.forminator-custom-form:not(#x) [class~="forminator-has_error"] :is(.forminator-radio-bullet, .forminator-checkbox-box) {
	border-color: var(--wp--preset--color--accent-2);
}

.forminator-ui.forminator-custom-form:not(#x) .forminator-radio .forminator-radio-bullet::before {
	background-color: var(--wp--preset--color--primary-dark);
}

.forminator-select-dropdown-container--open .forminator-select-dropdown.forminator-dropdown--default:not(#x) {
	border-color: var(--wp--preset--color--primary-dark);
	background-color: var(--wp--preset--color--surface);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
	font-family: var(--wp--preset--font-family--sans);
}

.forminator-select-dropdown.forminator-dropdown--default:not(#x) .select2-results__option,
.forminator-select-dropdown.forminator-dropdown--default:not(#x) .select2-results__option span:not(.forminator-checkbox-box) {
	background-color: var(--wp--preset--color--surface);
	color: var(--wp--preset--color--primary-dark);
}

.forminator-select-dropdown.forminator-dropdown--default:not(#x) .select2-results__option.select2-results__option--highlighted,
.forminator-select-dropdown.forminator-dropdown--default:not(#x) .select2-results__option.select2-results__option--highlighted span:not(.forminator-checkbox-box) {
	background-color: var(--wp--preset--color--surface-warm);
	color: var(--wp--preset--color--primary-dark);
}

.forminator-select-dropdown.forminator-dropdown--default:not(#x) .select2-results__option.select2-results__option--highlighted {
	outline: 2px solid var(--wp--preset--color--primary-dark);
	outline-offset: -2px;
}

.forminator-select-dropdown.forminator-dropdown--default:not(#x) .select2-results__option.select2-results__option--selected,
.forminator-select-dropdown.forminator-dropdown--default:not(#x) .select2-results__option.select2-results__option--selected span:not(.forminator-checkbox-box) {
	background-color: var(--wp--preset--color--primary-dark);
	color: var(--wp--preset--color--surface);
}

/* Forminator draws the calendar's box on ::before. */
.ui-datepicker.forminator-calendar--default:not(#x)::before {
	border-color: var(--wp--preset--color--primary-dark);
	background-color: var(--wp--preset--color--surface);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.ui-datepicker.forminator-calendar--default:not(#x),
.ui-datepicker.forminator-calendar--default:not(#x) :is(select, th, td, a, span) {
	font-family: var(--wp--preset--font-family--sans);
}

.ui-datepicker.forminator-calendar--default:not(#x) .ui-datepicker-header .ui-corner-all {
	background-color: var(--wp--preset--color--primary-dark);
	color: var(--wp--preset--color--surface);
}

.ui-datepicker.forminator-calendar--default:not(#x) .ui-datepicker-title select {
	border-color: var(--wp--preset--color--primary-dark);
	background-color: var(--wp--preset--color--surface);
	color: var(--wp--preset--color--primary-dark);
}

.ui-datepicker.forminator-calendar--default:not(#x) .ui-datepicker-calendar thead th {
	color: var(--wp--preset--color--primary-dark);
}

.ui-datepicker.forminator-calendar--default:not(#x) .ui-datepicker-calendar tbody td a.ui-state-default {
	border-color: transparent;
	background-color: var(--wp--preset--color--surface);
	color: var(--wp--preset--color--primary-dark);
}

.ui-datepicker.forminator-calendar--default:not(#x) .ui-datepicker-calendar tbody td.ui-state-disabled span {
	border-color: transparent;
	background-color: var(--wp--preset--color--surface);
	color: var(--wp--preset--color--text-muted);
}

.ui-datepicker.forminator-calendar--default:not(#x) .ui-datepicker-calendar tbody td a.ui-state-default.ui-state-highlight {
	border-color: var(--wp--preset--color--primary-dark);
}

.ui-datepicker.forminator-calendar--default:not(#x) .ui-datepicker-calendar tbody td a.ui-state-default:is(:hover, .ui-state-hover) {
	background-color: var(--wp--preset--color--surface-warm);
}

.ui-datepicker.forminator-calendar--default:not(#x) .ui-datepicker-calendar tbody td a.ui-state-default:is(:active, .ui-state-active) {
	background-color: var(--wp--preset--color--primary-dark);
	color: var(--wp--preset--color--surface);
}

.ui-datepicker.forminator-calendar--default:not(#x) :is(a, select):focus-visible {
	outline: 3px solid var(--wp--preset--color--primary-dark);
	outline-offset: 2px;
}

/* Phone numbers are US numbers (Forminator's national format, US): a flag with
   nothing to choose only looks like a country picker (owner, 2026-11-25). */
.forminator-ui.forminator-custom-form .forminator-phone .iti__country-container {
	display: none;
}

/* Turnstile runs in Invisible mode, so its row is empty: drop the open
   grid's row margin there (30px, or 20px on small forms), or the
   note-to-submit gap doubles. Each selector is one step more specific than
   Forminator's matching `[data-grid=open] .forminator-row:not(:last-child)`
   rule; a failed-check message still shows in the row. */
.forminator-ui.forminator-custom-form:not(.forminator-size--small)[data-grid="open"] > .forminator-row:has(.forminator-field-captcha):not(:last-child),
.forminator-ui.forminator-custom-form.forminator-size--small[data-grid="open"] > .forminator-row:has(.forminator-field-captcha):not(:last-child) {
	margin-bottom: 0;
}

/* Hints and descriptions: readable, not pale grey. */
.forminator-ui.forminator-custom-form .forminator-description {
	color: var(--wp--preset--color--primary-dark);
	font-size: var(--wp--preset--font-size--small);
}

/* Submit: same treatment as the theme's primary buttons. */
.forminator-ui.forminator-custom-form .forminator-button-submit {
	padding: 14px 28px;
	font-family: var(--wp--preset--font-family--sans);
	font-size: var(--wp--preset--font-size--medium);
	font-weight: 700;
	color: var(--wp--preset--color--surface);
	background: var(--wp--preset--color--primary-dark);
	border: 0;
	border-radius: 4px;
	cursor: pointer;
	position: relative;
}

/* Pressing Submit takes focus from a field, which adds or removes its error,
   and everything below moves while the button is held. Without this the release
   lands beside the button and no click fires. Transparent, and only while
   pressed. */
.forminator-ui.forminator-custom-form .forminator-button-submit:active::after {
	content: "";
	position: absolute;
	inset: -200px 0;
}

.forminator-ui.forminator-custom-form .forminator-button-submit:hover {
	background: var(--wp--preset--color--primary-dark);
	text-decoration: underline;
}

/* Error text must not rely on colour alone and must keep 4.5:1. */
.forminator-ui.forminator-custom-form .forminator-error-message {
	color: var(--wp--preset--color--accent-2-hover, #952d1f);
	font-weight: 700;
}

/* ------------------------------------------------------------------
   Inline newsletter form inside the shared cta-newsletter card (FC-10;
   front-page band and end of single posts). forms.css is enqueued by
   ghn_enqueue_newsletter_cta_style() when the card renders the form.
   The card is accent-1 yellow: field and button keep the primary-dark
   border/fill (10:1 and 9:1 against the yellow), the submit matches
   Donate's button (16px/32px, medium), and the required-fields note and
   Turnstile note read as the card's small print.
   ------------------------------------------------------------------ */

.cta-newsletter .ghn-newsletter-form {
	width: 100%;
	max-width: 480px;
	margin-left: auto;
	margin-right: auto;
	text-align: left;
}

.site-cta-band .cta-newsletter .ghn-newsletter-form {
	margin-left: 0;
	margin-right: 0;
}

.cta-newsletter .forminator-ui.forminator-custom-form {
	margin: 0;
}

.cta-newsletter .forminator-ui.forminator-custom-form .forminator-label {
	color: var(--wp--preset--color--primary-dark);
	font-weight: 700;
}

.cta-newsletter .forminator-ui.forminator-custom-form .forminator-button-submit {
	/* Hugs its text like Donate's, never stretched full width. */
	width: auto;
	padding: 16px 32px;
}

/* Forminator writes per-form CSS keyed on the form's #id (14px button text).
   The wrapper's anchor id (patterns/cta-newsletter.php) lets this out-rank it
   without !important so the button's text (size and bold weight; Forminator
   sets 500) and 4px corners (2px from Forminator) match Donate's button block. */
:is(#ghn-newsletter-form, #ghn-newsletter-form-sidebar) .forminator-ui.forminator-custom-form.forminator-design--default .forminator-button-submit {
	font-size: var(--wp--preset--font-size--medium);
	font-weight: 700;
	line-height: 1.4;
	border-radius: 4px;
}

.cta-newsletter .forminator-ui.forminator-custom-form .forminator-error-message {
	color: var(--wp--preset--color--accent-2-hover, #952d1f);
}

/* Focus ring: the outer primary-dark ring is 9:1 on the yellow card. */
.cta-newsletter .forminator-ui.forminator-custom-form .forminator-input:focus-visible,
.cta-newsletter .forminator-ui.forminator-custom-form .forminator-button:focus-visible {
	outline-offset: 3px;
}

.cta-newsletter .forminator-ui.forminator-custom-form .forminator-response-message {
	color: var(--wp--preset--color--primary-dark);
}

/* Compact layout (homepage band, end-of-article and sidebar cards): the email
   field takes the full width, Sign Up sits below it at its own width (like the
   Donate button in the neighbouring card), then the Turnstile note (and the
   empty, invisible check). Forminator always renders Sign Up last; flex
   `order` moves the Turnstile rows below it without reordering the DOM. The
   Invisible check takes no focus, so focus goes email → Sign Up, the visual
   order. (Only a non-invisible key that escalates to an interactive
   challenge would add a stop between them: enter email, verify, submit.)
   Prefixed with the wrapper ids because Forminator's per-form CSS sets row
   margins on its own #id selector. */
:is(#ghn-newsletter-form, #ghn-newsletter-form-sidebar) .forminator-ui.forminator-custom-form {
	position: relative;
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	gap: 12px 8px;
	margin: 0; /* Forminator's per-form #id rule adds 30px above and below */
}

/* The signup needs JavaScript, so without it it doesn't offer to work. */
@media (scripting: none) {

	:is(#ghn-newsletter-form, #ghn-newsletter-form-sidebar) .forminator-ui.forminator-custom-form {
		display: none;
	}
}

/* The shortcode block's auto-paragraphs wrap the form in a <p>; the browser
   closes it before the form, leaving an empty <p> on each side that would
   otherwise take a gap in the card's stack. */
:is(#ghn-newsletter-form, #ghn-newsletter-form-sidebar) > p:empty {
	display: none;
}

/* Vertical margins only: Forminator's open grid pulls rows out by their
   column gutter with negative side margins and puts it back as column padding. */
:is(#ghn-newsletter-form, #ghn-newsletter-form-sidebar) .forminator-ui.forminator-custom-form > *,
:is(#ghn-newsletter-form, #ghn-newsletter-form-sidebar) .forminator-ui.forminator-custom-form .forminator-row {
	margin-top: 0;
	margin-bottom: 0;
}

/* Every row is full width and below the email field and Sign Up by default
   (Turnstile note, Turnstile check, any future field)... */
:is(#ghn-newsletter-form, #ghn-newsletter-form-sidebar) .forminator-ui.forminator-custom-form > .forminator-row {
	flex: 0 0 100%;
	order: 2;
}

/* ...except the email field and Sign Up, which come first: the field takes
   the full width, so Sign Up wraps below it at its own width, left-aligned
   (owner, 2026-10-08: the cards are too narrow for them side by side). */
:is(#ghn-newsletter-form, #ghn-newsletter-form-sidebar) .forminator-ui.forminator-custom-form > .forminator-row:has(.forminator-field-email) {
	flex: 0 0 100%;
	order: 0;
	min-width: 0;
	margin-inline: 0; /* the open grid's -15px gutters (wide forms, e.g. the band at >=1201px) */
}

:is(#ghn-newsletter-form, #ghn-newsletter-form-sidebar) .forminator-ui.forminator-custom-form > .forminator-row:has(.forminator-field-email) > .forminator-col {
	padding-inline: 0; /* ...and the matching column padding, so the field spans the card */
}

:is(#ghn-newsletter-form, #ghn-newsletter-form-sidebar) .forminator-ui.forminator-custom-form > .forminator-row-last {
	flex: 0 0 auto;
	order: 0;
}

/* Line break after Sign Up, so the Turnstile note (which may sit beside the
   check, below) never fills the leftover space beside the button. The
   negative margin cancels the row gap the empty line would add. */
:is(#ghn-newsletter-form, #ghn-newsletter-form-sidebar) .forminator-ui.forminator-custom-form::after {
	content: "";
	display: block;
	flex: 0 0 100%;
	order: 1;
	height: 0;
	margin-top: -12px;
}

/* Turnstile runs in Invisible widget mode (forms-definitions.php; the real
   key must be created that way): it renders nothing and takes no focus, so
   its row is empty. It shares the line of the "protected by Cloudflare
   Turnstile" note (after it, zero width) instead of opening an empty line
   and a row gap of its own, at every width: the note's zero flex basis
   leaves room for it even when the note wraps. Should a visible challenge
   ever render (a non-invisible key), the compact 150px widget sits beside
   the note and fits the narrowest card (WCAG 1.4.10). */
/* Zero flex basis: the note never fills the line, so the empty check row
   always fits beside it. The open grid's -15px row margins (and matching
   column padding) come off this row, or its outer width goes negative and
   the note squeezes onto the line above. Text alignment is unchanged. */
:is(#ghn-newsletter-form, #ghn-newsletter-form-sidebar) .forminator-ui.forminator-custom-form > .forminator-row:has(.forminator-field-html) {
	flex: 1 1 0%;
	min-width: 0;
	margin-inline: 0;
}

:is(#ghn-newsletter-form, #ghn-newsletter-form-sidebar) .forminator-ui.forminator-custom-form > .forminator-row:has(.forminator-field-html) > .forminator-col {
	padding-inline: 0;
}

/* A failed-check message fills the row: capped at the card width it wraps
   (WCAG 1.4.10), and without the grid's side margins its full width forces
   its own line, so the note beside it is never squeezed. */
:is(#ghn-newsletter-form, #ghn-newsletter-form-sidebar) .forminator-ui.forminator-custom-form > .forminator-row:has(.forminator-field-captcha) {
	flex: 0 0 auto;
	max-width: 100%;
	min-width: 0;
	margin-inline: 0;
}

:is(#ghn-newsletter-form, #ghn-newsletter-form-sidebar) .forminator-ui.forminator-custom-form > .forminator-row:has(.forminator-field-captcha) > .forminator-col {
	padding-inline: 0;
}

/* Without a Turnstile key Forminator renders the check's row empty. With the
   open grid's -15px side margins it was narrower than the card, so the
   zero-basis note squeezed in beside it, a few characters wide, until
   Forminator's script removed the margins. */
:is(#ghn-newsletter-form, #ghn-newsletter-form-sidebar) .forminator-ui.forminator-custom-form > .forminator-row:empty {
	display: none;
}

/* Status / error message above everything. */
:is(#ghn-newsletter-form, #ghn-newsletter-form-sidebar) .forminator-ui.forminator-custom-form > .forminator-response-message {
	flex: 0 0 100%;
	order: -1;
}

/* Field and button the same height (as Donate's button): same font size, line height
   and vertical padding as Sign Up (16px/1.4, 16px block padding; 15px + 1px
   border on the field). 16px text also stops iOS zooming into the field. */
:is(#ghn-newsletter-form, #ghn-newsletter-form-sidebar) .forminator-ui.forminator-custom-form .forminator-input {
	font-size: var(--wp--preset--font-size--medium);
	line-height: 1.4;
	padding-block: 15px;
	box-sizing: border-box;
}

/* Required-fields note: kept for assistive tech (the field is also marked
   required and labelled), hidden visually in this compact card. The hook is the
   class set on the note field in scripts/lib/forms-definitions.php. */
/* Take the note's whole row out of flow too, so the empty row doesn't keep a
   flex gap above the Email field. */
:is(#ghn-newsletter-form, #ghn-newsletter-form-sidebar) .forminator-ui.forminator-custom-form .forminator-row:has(.ghn-form-required-note),
:is(#ghn-newsletter-form, #ghn-newsletter-form-sidebar) .forminator-ui.forminator-custom-form .ghn-form-required-note {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

/* Required marker: accent-2 (#bd3928) is ~3.4:1 on the accent-1 card; the
   darker accent-2-hover (#952d1f) is ~4.75:1. */
:is(#ghn-newsletter-form, #ghn-newsletter-form-sidebar) .forminator-ui.forminator-custom-form .forminator-field .forminator-label .forminator-required {
	color: var(--wp--preset--color--accent-2-hover);
}

:is(#ghn-newsletter-form, #ghn-newsletter-form-sidebar) .forminator-ui.forminator-custom-form .forminator-field p {
	margin: 0;
	font-size: var(--wp--preset--font-size--small);
}

:is(#ghn-newsletter-form, #ghn-newsletter-form-sidebar) .forminator-ui.forminator-custom-form .forminator-col .forminator-field {
	margin-bottom: 0;
}
