/*
 * Formie forms in the 2026 design (templates/grove/_form.twig).
 *
 * Formie's own CSS is off (form template "Grove"). Theme config gives its
 * inputs, labels and submit button the site's .field, .field-l and .btn solid
 * classes, so these rules only lay out Formie's markup to match the original
 * hand-built forms. Formie's wrappers are flattened with display: contents,
 * leaving the form a one-column grid of: the optional heading, the field rows,
 * Turnstile, the submit button, the consent line and the messages.
 *
 * Spacing is margin-top (--gf-gap, set per block), not grid gap: Turnstile's
 * container stays in the grid at zero height until Cloudflare needs a click,
 * and a gap would still open up around it. _form.twig's script adds .is-shown
 * while the widget has height.
 */

.g .formie-form { display: grid; --gf: var(--gf-gap, 10px); }

.g .formie-form-body,
.g .formie-pages,
.g .formie-page,
.g .formie-page-container,
.g .formie-page-body,
.g .formie-rows,
.g .formie-page-footer,
.g .formie-page-buttons { display: contents; }

.g .formie-form-header:empty,
.g .formie-form-messages:empty,
.g .formie-form-navigation:empty,
.g .formie-page-header:empty,
.g .formie-form-footer:empty,
.g .formie-button-container:empty,
.g .formie-field-errors:empty { display: none; }
.g .formie-form [hidden] { display: none !important; }
.g .formie-form-header { display: grid; }

/* Vertical rhythm: everything after the first item sits --gf-gap below. */
.g .formie-row,
.g .formie-button-container,
.g .formie-form-footer,
.g .formie-form-messages[data-formie-form-messages-bottom] { margin-top: var(--gf); }
.g .formie-page-captchas.is-shown { margin-top: var(--gf); }
/* Rows of only hidden fields take no space (their inputs still submit). The
   first visible row (no visible row before it) gets no top margin, unless the
   form has a heading above its fields. */
.g .formie-row[data-formie-row-hidden] { display: none; }
.g .formie-rows > .formie-row:not([data-formie-row-hidden]):not(.formie-row:not([data-formie-row-hidden]) ~ .formie-row) { margin-top: 0; }
.g .formie-form-header:not(:empty) ~ .formie-form-body .formie-rows > .formie-row:not([data-formie-row-hidden]):not(.formie-row:not([data-formie-row-hidden]) ~ .formie-row) { margin-top: var(--gf); }

/* Rows: a two-field row sits side by side; an inline-submit row is a wrapping flex row. */
.g .formie-row { display: grid; gap: 10px; }
.g .formie-row[data-formie-field-count="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g .formie-row[data-formie-row-submit-inline] { display: flex; flex-wrap: wrap; }
.g .formie-row[data-formie-row-submit-inline] .formie-field { flex: 220px; min-width: 0; }
.g .formie-row-submit { display: flex; }
/* The button matches the input's height, but not when an error line makes the field taller. */
.g .formie-row[data-formie-row-submit-inline]:has(.formie-field-errors:not(:empty)) { align-items: flex-start; }

/* Fields: label 6px above its input, which fills the cell. */
.g .formie-field-layout { display: grid; gap: 6px; }
.g .formie-field-content { display: grid; gap: 4px; }
.g .formie-form .field { display: block; width: 100%; box-sizing: border-box; }
.g .formie-form select.field { appearance: auto; }
.g .formie-form .field:focus-visible { outline: 2px solid var(--apricot); outline-offset: 2px; }
.g .formie-form .field[aria-invalid="true"] { border-color: #a3322a; }
.g .formie-sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* The email consent checkbox (an Agree field, 2026-11-18): a native checkbox
   beside its text. Theme config gives it the text inputs' .field class, so
   undo the pill styling here. Formie wraps it in a fieldset whose legend is
   screen-reader only. The "(optional)" note is dropped from the visible text:
   a consent box is optional by nature. */
.g .formie-form fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.g .formie-agree-option { display: flex; align-items: flex-start; gap: 10px; }
.g .formie-form input.formie-agree-input.field { flex: none; width: 18px; height: 18px; margin: 2px 0 0; padding: 0; border-radius: 0; accent-color: var(--ink); cursor: pointer; }
.g .formie-agree-option-label { font-size: 14.5px; line-height: 1.45; color: var(--ink); cursor: pointer; }
.g .formie-agree-option-label .formie-field-optional { display: none; }

/* Errors, in .form-error's red. */
.g .formie-field-errors { color: #a3322a; font-size: 13.5px; line-height: 1.4; padding-left: 18px; }
.g .formie-field-errors > * { margin: 0; }
.g .formie-form-messages[data-formie-form-messages-bottom] { color: #a3322a; font-size: 15px; }
.g .formie-form-messages a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }

/* The thank-you message replaces the form, in the old status line's style. */
.g .formie-message-success p { margin: 0; font-family: 'League Spartan', sans-serif; font-weight: 500; font-size: 20px; color: #325e89; }
/* Pricing's two-part message: a heading, then a muted line. */
.g .formie-success:has(h3) { display: grid; gap: 8px; }
.g .formie-message-success h3 + p { font-family: inherit; font-weight: 400; font-size: inherit; line-height: inherit; color: var(--slate); }
