/**
 * Gravity Forms overrides — match the .form-* design system used on the
 * static contact mockup. Loads AFTER Gravity Forms' Orbital theme so our
 * rules win on equal specificity.
 *
 * @package STSC
 */

.gform_wrapper {
    --gf-color-primary: var(--color-yellow);
    --gf-color-primary-rgb: 255, 255, 0;
    --gf-color-primary-darker: var(--color-yellow-muted);
    --gf-ctrl-border-color-focus: var(--color-yellow);
    font-family: var(--font-body);
    font-weight: var(--font-weight-light);
    color: var(--color-text-primary);
}

.gform_wrapper .gform-body { padding: 0; }
.gform_wrapper .gform_required_legend { display: none; }
.gform_wrapper .gform_validation_errors {
    background: #fdecec;
    border: 1px solid var(--color-error);
    color: var(--color-error);
    border-radius: var(--border-radius);
    padding: var(--space-4) var(--space-5);
    margin-bottom: var(--space-5);
}

/* Two-column grid by default (matches the static .form-row layout).
   The foundation theme also uses `display: grid` on .gform_fields with
   `repeat(12, 1fr)` at the SAME specificity as a plain `.gform_wrapper
   .gform_fields` selector. Since stsc-gforms now loads before foundation,
   we'd lose the source-order tiebreak — so we force the layout with
   !important and match the orbital theme chain to be safe. */
.gform-theme--foundation .gform_fields,
.gform_wrapper .gform_fields {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    column-gap: var(--space-5) !important;
    row-gap: var(--space-5) !important;
    list-style: none;
    padding: 0;
    margin: 0;
}

.gform-theme--foundation .gform_fields .gfield,
.gform_wrapper .gfield {
    grid-column: span 2 !important;
    margin: 0;
    padding: 0;
}

.gform-theme--foundation .gform_fields .gfield.gf-half,
.gform-theme--foundation .gform_fields .gfield.gfield--width-half,
.gform_wrapper .gfield.gf-half,
.gform_wrapper .gfield.gfield--width-half {
    grid-column: span 1 !important;
}

/* Labels — mirror .form-group label */
.gform_wrapper .gfield_label {
    display: block;
    font-family: var(--font-heading);
    font-size: var(--text-xs);
    font-weight: var(--font-weight-medium);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin: 0 0 var(--space-2);
    color: var(--color-text-primary);
    line-height: 1.3;
}

.gform_wrapper .gfield_required {
    color: var(--color-error);
    margin-left: var(--space-1);
}

.gform_wrapper .gfield_required .gfield_required_text { display: none; }
.gform_wrapper .gfield_required::after {
    content: '*';
    color: var(--color-error);
    margin-left: var(--space-1);
}

/* Inputs — mirror .form-input / .form-select / .form-textarea.
   The orbital framework styles every control via a deep selector chain
   `.gform-theme--framework <element>:where(...)` AND assigns a fixed
   `block-size: var(--gf-ctrl-size)` (= 38px @ md). We have to match that
   selector specificity AND override `block-size` to a single, consistent
   48px so text inputs and selects stand the same height with their
   labels lined up across the two-column row. */
.gform_wrapper {
    --gf-ctrl-size: 48px;
    --gf-ctrl-size-md: 48px;
}

.gform-theme--framework input[type="text"],
.gform-theme--framework input[type="email"],
.gform-theme--framework input[type="tel"],
.gform-theme--framework input[type="url"],
.gform-theme--framework input[type="number"],
.gform-theme--framework input[type="password"],
.gform-theme--framework select,
.gform-theme--framework textarea,
.gform_wrapper .ginput_container input[type="text"],
.gform_wrapper .ginput_container input[type="email"],
.gform_wrapper .ginput_container input[type="tel"],
.gform_wrapper .ginput_container input[type="url"],
.gform_wrapper .ginput_container input[type="number"],
.gform_wrapper .ginput_container input[type="password"],
.gform_wrapper .ginput_container select,
.gform_wrapper .ginput_container textarea {
    width: 100%;
    height: 48px;
    min-height: 48px;
    block-size: 48px;
    box-sizing: border-box;
    font-family: var(--font-body);
    font-weight: var(--font-weight-light);
    font-size: var(--text-base);
    line-height: 1.2;
    padding: 0 var(--space-4);
    padding-block: 0;
    padding-inline: var(--space-4);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-sm);
    background: var(--color-white);
    color: var(--color-text-primary);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    box-shadow: none;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    vertical-align: middle;
}

/* Placeholder colour — uses the brand grey across every input/textarea so
   form fields read consistently with the rest of the design system. */
.gform-theme--framework input::placeholder,
.gform-theme--framework textarea::placeholder,
.gform_wrapper .ginput_container input::placeholder,
.gform_wrapper .ginput_container textarea::placeholder {
    color: var(--color-grey);
    opacity: 1;
}

.gform-theme--framework input::-webkit-input-placeholder,
.gform_wrapper .ginput_container input::-webkit-input-placeholder { color: var(--color-grey); }
.gform-theme--framework input::-moz-placeholder,
.gform_wrapper .ginput_container input::-moz-placeholder { color: var(--color-grey); opacity: 1; }
.gform-theme--framework input:-ms-input-placeholder,
.gform_wrapper .ginput_container input:-ms-input-placeholder { color: var(--color-grey); }

/* Textarea is a multi-line control, so it needs vertical padding and a
   tall min-height — block-size: auto frees it from the framework's fixed
   38px and lets the user resize. */
.gform-theme--framework textarea,
.gform_wrapper .ginput_container textarea {
    height: auto;
    min-height: 160px;
    block-size: auto;
    line-height: 1.5;
    padding: var(--space-3) var(--space-4);
    padding-block: var(--space-3);
    padding-inline: var(--space-4);
    resize: vertical;
}

.gform_wrapper .ginput_container input:focus,
.gform_wrapper .ginput_container select:focus,
.gform_wrapper .ginput_container textarea:focus {
    outline: none;
    border-color: var(--color-yellow);
    box-shadow: 0 0 0 3px rgba(255, 255, 0, 0.15);
}

/* Custom select chevron — match .form-select */
.gform_wrapper .ginput_container_select select {
    display: flex;
    align-items: center;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%239D9D9D' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right var(--space-4) center;
    padding-right: var(--space-8);
}

/* Validation state */
.gform_wrapper .gfield_error .ginput_container input,
.gform_wrapper .gfield_error .ginput_container select,
.gform_wrapper .gfield_error .ginput_container textarea {
    border-color: var(--color-error);
    background: var(--color-white);
}

.gform_wrapper .gfield_validation_message,
.gform_wrapper .validation_message {
    font-family: var(--font-body);
    font-size: var(--text-xs);
    color: var(--color-error);
    margin-top: var(--space-2);
    background: transparent;
    border: 0;
    padding: 0;
}

/* Field description */
.gform_wrapper .gfield_description {
    font-family: var(--font-body);
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
    margin-top: var(--space-2);
    padding: 0;
}

/* Submit button — mirror .btn--primary */
.gform_wrapper .gform_footer {
    padding: 0;
    margin: var(--space-6) 0 0;
    justify-content: flex-start;
}

/* Mirror .btn / .btn--primary (yellow bg, black text, yellow border).
   stsc-gforms now loads on every page (regardless of whether GF has
   rendered yet). On pages where GF renders late, orbital framework CSS
   will load AFTER stsc-gforms, so the colour-critical declarations need
   !important to win the cascade. */
.gform-theme--framework.gform-theme.gform_wrapper input[type="submit"].button.gform_button,
.gform-theme--framework.gform-theme.gform_wrapper input[type="button"].button.gform_button,
.gform_wrapper .gform_footer input[type="submit"],
.gform_wrapper .gform_footer input[type="button"],
.gform_wrapper .gform_button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    width: auto;
    font-family: var(--font-heading);
    font-size: var(--text-xs);
    font-weight: var(--font-weight-semibold);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    text-decoration: none;
    padding: var(--space-4) var(--space-6);
    min-height: 48px;
    background: var(--color-yellow) !important;
    background-color: var(--color-yellow) !important;
    color: var(--color-black) !important;
    border: 2px solid var(--color-yellow) !important;
    border-color: var(--color-yellow) !important;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    line-height: 1;
    transition: all var(--transition-base);
    box-shadow: none;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

.gform-theme--framework.gform-theme.gform_wrapper input[type="submit"].button.gform_button:hover,
.gform-theme--framework.gform-theme.gform_wrapper input[type="submit"].button.gform_button:focus,
.gform-theme--framework.gform-theme.gform_wrapper input[type="submit"].button.gform_button:focus-visible,
.gform-theme--framework.gform-theme.gform_wrapper input[type="button"].button.gform_button:hover,
.gform-theme--framework.gform-theme.gform_wrapper input[type="button"].button.gform_button:focus-visible,
.gform_wrapper .gform_footer input[type="submit"]:hover,
.gform_wrapper .gform_footer input[type="submit"]:focus-visible,
.gform_wrapper .gform_footer input[type="button"]:hover,
.gform_wrapper .gform_footer input[type="button"]:focus-visible,
.gform_wrapper .gform_button:hover,
.gform_wrapper .gform_button:focus-visible {
    background: var(--color-yellow-muted) !important;
    background-color: var(--color-yellow-muted) !important;
    border-color: var(--color-yellow-muted) !important;
    color: var(--color-black) !important;
    outline: none;
}

.gform-theme--framework.gform-theme.gform_wrapper input[type="submit"].button.gform_button:active,
.gform-theme--framework.gform-theme.gform_wrapper input[type="button"].button.gform_button:active,
.gform_wrapper .gform_footer input[type="submit"]:active,
.gform_wrapper .gform_footer input[type="button"]:active,
.gform_wrapper .gform_button:active {
    transform: translateY(1px);
}

.gform-theme--framework.gform-theme.gform_wrapper input[type="submit"].button.gform_button[disabled],
.gform_wrapper .gform_footer input[type="submit"][disabled],
.gform_wrapper .gform_button[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Confirmation after successful submit */
.gform_confirmation_message,
.gform_confirmation_wrapper {
    font-family: var(--font-body);
    font-weight: var(--font-weight-light);
    color: var(--color-text-primary);
    background: var(--color-grey-lightest);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    padding: var(--space-5);
}

/* Mobile: stack the two-column grid. */
@media (max-width: 600px) {
    .gform_wrapper .gform_fields { grid-template-columns: 1fr; }
    .gform_wrapper .gfield.gf-half,
    .gform_wrapper .gfield.gfield--width-half {
        grid-column: span 1;
    }
}


/* ========================================
   FOOTER NEWSLETTER — scoped variant of the Gravity Form for the dark
   footer bar. The form wrapper carries the `footer-newsletter` class
   (set via the form's "CSS Class" property). Email input + Subscribe
   button render inline, like the static design.

   Most selectors below repeat `.footer__newsletter` AND the orbital-
   framework class chain — that's the only way to beat both the orbital
   theme rules (specificity 0,2,1+) and the contact-form rules earlier
   in this file (specificity 0,6,1) on the same elements.
   ======================================== */

.footer__newsletter .gform_wrapper {
    --gf-color-primary: var(--color-yellow);
    --gf-ctrl-size: 40px;
    --gf-ctrl-size-md: 40px;
    margin-top: var(--space-3);
    color: var(--color-white);
}

.footer__newsletter .gform_wrapper .gform_required_legend { display: none; }

/* Hide GF's "Email Address" label even though hidden_label is set in the
   form config — orbital sometimes leaks a 0px sibling. */
.footer__newsletter .gform_wrapper .gfield_label,
.footer__newsletter .gform_wrapper .gfield_label.gform-field-label {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: 0;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

/* Inline layout: flex on the form so .gform_body and .gform_footer sit
   side-by-side regardless of orbital's display values. */
.footer__newsletter .gform_wrapper form {
    display: flex;
    align-items: stretch;
    gap: 0;
    margin: 0;
}

.footer__newsletter .gform_wrapper .gform-body,
.footer__newsletter .gform_wrapper .gform_body {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    padding: 0;
}

.footer__newsletter .gform_wrapper .gform-footer,
.footer__newsletter .gform_wrapper .gform_footer {
    flex: 0 0 auto;
    margin: 0;
    padding: 0;
    display: block;
}

/* Drop the 2-col grid + per-field margins inside the body. !important
   here is needed because the contact-form rule above also forces the
   2-col grid with !important. */
.footer__newsletter .gform_wrapper .gform_fields {
    display: block !important;
    grid-template-columns: none !important;
    gap: 0 !important;
    row-gap: 0 !important;
}

.footer__newsletter .gform_wrapper .gfield {
    grid-column: auto !important;
    margin: 0;
    padding: 0;
}

.footer__newsletter .gform_wrapper .ginput_container { width: 100%; }

/* Email input — dark, on the dark footer band. Selector chain matches
   orbital's framework rule (.gform-theme--framework input[type]) so we
   win on equal-or-higher specificity. */
/* The contact-form input rules earlier in this file (height: 48px, white
   bg, etc.) target every Gravity Form input on the site. On pages where
   BOTH the newsletter and the contact form are present (i.e. /contact/),
   the cascade puts the contact-form rule next to the newsletter override
   at competing specificity. !important here guarantees the newsletter's
   compact dimensions and dark colour scheme apply identically on every
   page. */
.footer__newsletter .gform-theme--framework input[type="email"],
.footer__newsletter .gform-theme--framework input[type="text"],
.footer__newsletter .gform_wrapper .ginput_container input[type="email"],
.footer__newsletter .gform_wrapper .ginput_container input[type="text"] {
    width: 100% !important;
    height: 40px !important;
    min-height: 40px !important;
    block-size: 40px !important;
    padding: 0 var(--space-4) !important;
    padding-block: 0 !important;
    padding-inline: var(--space-4) !important;
    font-family: var(--font-body) !important;
    font-weight: var(--font-weight-light) !important;
    font-size: var(--text-sm) !important;
    line-height: 1.2 !important;
    background: rgba(255, 255, 255, 0.05) !important;
    background-color: rgba(255, 255, 255, 0.05) !important;
    color: var(--color-white) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    border-right: none !important;
    border-radius: var(--border-radius-sm) 0 0 var(--border-radius-sm) !important;
    box-shadow: none !important;
    appearance: none !important;
    -webkit-appearance: none !important;
}

.footer__newsletter .gform_wrapper .ginput_container input::placeholder {
    color: var(--color-grey);
}

.footer__newsletter .gform_wrapper .ginput_container input:focus {
    outline: none;
    border-color: var(--color-yellow);
    box-shadow: 0 0 0 2px rgba(255, 255, 0, 0.2);
}

/* Subscribe button — compact, matches the static contact.php footer design.
   Every declaration uses !important so the contact-form's primary-button
   rule earlier in this file (which targets every form on the site) does
   NOT take over the footer newsletter when both forms are on the same
   page (e.g. /contact/). */
.footer__newsletter .gform-theme--framework.gform-theme.gform_wrapper input[type="submit"].button.gform_button,
.footer__newsletter .gform-theme--framework.gform-theme.gform_wrapper input[type="button"].button.gform_button,
.footer__newsletter .gform_wrapper .gform_footer input[type="submit"],
.footer__newsletter .gform_wrapper .gform_footer input[type="button"],
.footer__newsletter .gform_wrapper .gform_button {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: var(--space-2) !important;
    width: auto !important;
    height: 40px !important;
    min-height: 40px !important;
    block-size: 40px !important;
    padding: 0 var(--space-4) !important;
    padding-block: 0 !important;
    padding-inline: var(--space-4) !important;
    font-family: var(--font-heading) !important;
    font-size: 0.625rem !important;
    font-weight: var(--font-weight-semibold) !important;
    letter-spacing: 0.1em !important;
    text-transform: uppercase !important;
    text-decoration: none !important;
    line-height: 1 !important;
    background: var(--color-yellow) !important;
    background-color: var(--color-yellow) !important;
    color: var(--color-black) !important;
    border: 0 !important;
    border-radius: 0 var(--border-radius-sm) var(--border-radius-sm) 0 !important;
    cursor: pointer !important;
    transition: all var(--transition-base) !important;
    box-shadow: none !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    transform: none !important;
}

.footer__newsletter .gform-theme--framework.gform-theme.gform_wrapper input[type="submit"].button.gform_button:hover,
.footer__newsletter .gform-theme--framework.gform-theme.gform_wrapper input[type="submit"].button.gform_button:focus-visible,
.footer__newsletter .gform_wrapper .gform_footer input[type="submit"]:hover,
.footer__newsletter .gform_wrapper .gform_footer input[type="submit"]:focus-visible,
.footer__newsletter .gform_wrapper .gform_button:hover,
.footer__newsletter .gform_wrapper .gform_button:focus-visible {
    background: var(--color-yellow-muted) !important;
    background-color: var(--color-yellow-muted) !important;
    border-color: var(--color-yellow-muted) !important;
    color: var(--color-black) !important;
    outline: none;
    transform: none;
}

/* Validation errors stay legible on the dark footer. */
.footer__newsletter .gform_wrapper .gform_validation_errors {
    background: rgba(211, 47, 47, 0.15);
    border-color: var(--color-error);
    color: #fff;
    margin: 0 0 var(--space-3);
}

.footer__newsletter .gform_wrapper .gfield_validation_message {
    color: var(--color-error);
    margin-top: var(--space-2);
}

/* Confirmation message after a successful signup. */
.footer .gform_confirmation_message,
.footer .gform_confirmation_wrapper {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.15);
    color: var(--color-grey);
    font-size: var(--text-sm);
    padding: var(--space-3) var(--space-4);
}

/* Mobile — stack input above button. */
@media (max-width: 480px) {
    .footer__newsletter .gform_wrapper form { flex-direction: column; }
    .footer__newsletter .gform_wrapper .gform_body,
    .footer__newsletter .gform_wrapper .gform_footer { width: 100%; }
    .footer__newsletter .gform_wrapper .ginput_container input[type="email"] {
        border-right: 1px solid rgba(255, 255, 255, 0.2);
        border-radius: var(--border-radius-sm) var(--border-radius-sm) 0 0;
    }
    .footer__newsletter .gform_wrapper .gform_footer input[type="submit"] {
        width: 100%;
        border-radius: 0 0 var(--border-radius-sm) var(--border-radius-sm);
    }
}
