/* =====================================================================
   AI Executives — Gravity Forms brand alignment
   Loaded AFTER the Gravity Forms Orbital theme so source-order wins on
   equal specificity. Only enqueued when GF is present on the page.
   ===================================================================== */

.gform_wrapper {
    /* Override Orbital variables with brand tokens */
    --gf-color-primary:                       var(--aie-noir);
    --gf-color-primary-rgb:                   8, 8, 14;
    --gf-color-primary-contrast:              var(--aie-ivory);
    --gf-color-primary-darker:                var(--aie-charcoal);
    --gf-color-primary-lighter:               var(--aie-navy);
    --gf-color-secondary:                     var(--aie-gold-dark);
    --gf-color-secondary-rgb:                 154, 112, 48;
    --gf-color-secondary-contrast:            var(--aie-white);

    --gf-ctrl-color:                          var(--aie-charcoal);
    --gf-ctrl-bg-color:                       var(--aie-white);
    --gf-ctrl-border-color:                   #DDDDDD;
    --gf-ctrl-border-color-hover:             var(--aie-gold);
    --gf-ctrl-border-color-focus:             var(--aie-gold);

    --gf-ctrl-label-color-primary:            var(--aie-steel);
    --gf-ctrl-label-color-secondary:          var(--aie-text-soft);
    --gf-ctrl-desc-color:                     var(--aie-text-soft);

    --gf-ctrl-btn-bg-color-primary:           var(--aie-navy);
    --gf-ctrl-btn-bg-color-primary-hover:     var(--aie-noir);
    --gf-ctrl-btn-color-primary:              var(--aie-ivory);
    --gf-ctrl-btn-color-primary-hover:        var(--aie-gold-light);
    --gf-ctrl-btn-border-color-primary:       var(--aie-navy);
    --gf-ctrl-btn-border-color-primary-hover: var(--aie-noir);

    --gf-radius:                              0;

    font-family: var(--aie-body);
    color: var(--aie-text);
}

/* GF Foundation theme forces .small/.medium/.large size classes to 25%/50%/100%
   width via 3-class selectors that beat ours on specificity. Match their
   selector depth so our 100% wins. Targets both Foundation and Orbital. */
body .gform-theme .gfield input.small,
body .gform-theme .gfield input.medium,
body .gform-theme .gfield input.large,
body .gform-theme .gfield select.small,
body .gform-theme .gfield select.medium,
body .gform-theme .gfield select.large,
body .gform-theme .gfield textarea.small,
body .gform-theme .gfield textarea.medium,
body .gform-theme .gfield textarea.large,
body .gform-theme .gfield .ginput_password.small,
body .gform-theme .gfield .ginput_password.medium,
body .gform-theme .gfield .ginput_password.large,
body .gform-theme--foundation .gfield input.small,
body .gform-theme--foundation .gfield input.medium,
body .gform-theme--foundation .gfield input.large,
body .gform-theme--foundation .gfield select.small,
body .gform-theme--foundation .gfield select.medium,
body .gform-theme--foundation .gfield select.large,
body .gform-theme--foundation .gfield textarea.small,
body .gform-theme--foundation .gfield textarea.medium,
body .gform-theme--foundation .gfield textarea.large,
body .gform-theme--foundation .gfield .ginput_password.small,
body .gform-theme--foundation .gfield .ginput_password.medium,
body .gform-theme--foundation .gfield .ginput_password.large,
body .gform-theme--orbital .gfield input.small,
body .gform-theme--orbital .gfield input.medium,
body .gform-theme--orbital .gfield input.large,
body .gform-theme--orbital .gfield select.small,
body .gform-theme--orbital .gfield select.medium,
body .gform-theme--orbital .gfield select.large,
body .gform-theme--orbital .gfield textarea.small,
body .gform-theme--orbital .gfield textarea.medium,
body .gform-theme--orbital .gfield textarea.large,
body .gform-theme--orbital .gfield .ginput_password.small,
body .gform-theme--orbital .gfield .ginput_password.medium,
body .gform-theme--orbital .gfield .ginput_password.large {
    width: 100%;
    max-width: 100%;
}

/* Form layout — single column. Every field spans the full form width so
   inputs have substantial presence. GF's gf-half-left / gf-half-right
   classes are overridden so they no longer split into pairs. */
body .gform_wrapper .gform_fields,
body .gform_wrapper form .gform_body .gform_fields {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--aie-space-5);
}
body .gform_wrapper .gfield,
body .gform_wrapper .gfield.gf-half,
body .gform_wrapper .gfield.gf-half-left,
body .gform_wrapper .gfield.gf-half-right,
body .gform_wrapper .gfield.gf-full {
    grid-column: 1 / -1;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
}

/* Labels */
body .gform_wrapper .gfield_label,
body .gform_wrapper .gform-field-label {
    display: block;
    font-family: var(--aie-body);
    font-weight: 500;
    font-size: var(--aie-text-xs);
    letter-spacing: var(--aie-tracking-wider);
    text-transform: uppercase;
    color: var(--aie-steel);
    margin-bottom: var(--aie-space-2);
    line-height: 1.4;
}
body .gform_wrapper .gfield_required,
body .gform_wrapper .gfield_required_text {
    color: var(--aie-gold-dark);
    margin-left: 0.3em;
    font-weight: 400;
}
body .gform_wrapper .gfield_required_asterisk { display: none; }

/* Inputs (text, email, tel, number, url, password) */
body .gform_wrapper input[type="text"],
body .gform_wrapper input[type="email"],
body .gform_wrapper input[type="tel"],
body .gform_wrapper input[type="number"],
body .gform_wrapper input[type="url"],
body .gform_wrapper input[type="password"],
body .gform_wrapper select,
body .gform_wrapper textarea {
    display: block;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    font-family: var(--aie-body);
    font-weight: 400;
    font-size: 1.0625rem;
    color: var(--aie-charcoal);
    background: var(--aie-white);
    border: 1px solid #DDDDDD;
    border-radius: 0;
    padding: 1.2rem 1.25rem;
    line-height: 1.4;
    transition: border-color 500ms var(--aie-ease),
                box-shadow 500ms var(--aie-ease),
                background-color 500ms var(--aie-ease);
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    box-shadow: none;
    -webkit-font-smoothing: antialiased;
    height: auto;
    min-height: 0;
}
body .gform_wrapper input::placeholder,
body .gform_wrapper textarea::placeholder {
    color: var(--aie-text-soft);
    opacity: 0.7;
    font-weight: 300;
}
body .gform_wrapper input:hover:not(:focus),
body .gform_wrapper select:hover:not(:focus),
body .gform_wrapper textarea:hover:not(:focus) {
    border-color: rgba(154, 112, 48, 0.4);
}
/* Use background-COLOR (not background shorthand) so the select chevron
   image set by `body .gform_wrapper select` is not wiped on focus. */
body .gform_wrapper input:focus,
body .gform_wrapper select:focus,
body .gform_wrapper textarea:focus {
    outline: 0;
    border-color: var(--aie-gold);
    box-shadow: 0 0 0 3px rgba(201, 169, 110, 0.18);
    background-color: var(--aie-white);
}

/* Textarea */
body .gform_wrapper textarea {
    min-height: 9rem;
    resize: vertical;
    line-height: var(--aie-leading-loose);
}

/* Select — custom chevron, no native dropdown ornament.
   Every background property is set explicitly with !important so neither
   the generic :focus rule nor any GF orbital override can wipe the chevron
   when the dropdown is opened. */
body .gform_wrapper select,
body .gform_wrapper select:hover,
body .gform_wrapper select:focus,
body .gform_wrapper select:active,
body .gform-theme .gfield select,
body .gform-theme .gfield select:focus,
body .gform-theme--foundation .gfield select,
body .gform-theme--foundation .gfield select:focus,
body .gform-theme--orbital .gfield select,
body .gform-theme--orbital .gfield select:focus {
    background-color: var(--aie-white) !important;
    background-image:
        linear-gradient(45deg, transparent 50%, var(--aie-charcoal) 50%),
        linear-gradient(135deg, var(--aie-charcoal) 50%, transparent 50%) !important;
    background-position:
        calc(100% - 18px) 50%,
        calc(100% - 13px) 50% !important;
    background-size: 5px 5px, 5px 5px !important;
    background-repeat: no-repeat !important;
    padding-right: 2.75rem !important;
    cursor: pointer;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    /* Lock height so opening the dropdown doesn't expand the field */
    height: auto;
    min-height: 0;
    line-height: 1.4;
}
/* Focused chevron switches to gold-dark — separate rule so the locked
   chevron geometry above stays in force. */
body .gform_wrapper select:focus,
body .gform-theme .gfield select:focus,
body .gform-theme--foundation .gfield select:focus,
body .gform-theme--orbital .gfield select:focus {
    background-image:
        linear-gradient(45deg, transparent 50%, var(--aie-gold-dark) 50%),
        linear-gradient(135deg, var(--aie-gold-dark) 50%, transparent 50%) !important;
}
/* The native <option> popup is browser-rendered and can't be branded,
   but we can at least normalise the colour so dark-mode browsers don't
   render the options unreadable. */
body .gform_wrapper select option {
    background-color: var(--aie-white);
    color: var(--aie-charcoal);
    font-family: var(--aie-body);
    font-size: var(--aie-text-md);
    padding: var(--aie-space-2) var(--aie-space-3);
}
body .gform_wrapper select option:checked,
body .gform_wrapper select option:hover {
    background-color: var(--aie-ivory);
    color: var(--aie-noir);
}

/* Sub-labels and descriptions */
body .gform_wrapper .gfield_description,
body .gform_wrapper .gform_fileupload_rules {
    margin-top: var(--aie-space-2);
    font-size: var(--aie-text-sm);
    color: var(--aie-text-soft);
    line-height: var(--aie-leading-normal);
}

/* Validation — burgundy, hairline border, restrained tone */
body .gform_wrapper .gfield_error input,
body .gform_wrapper .gfield_error select,
body .gform_wrapper .gfield_error textarea {
    border-color: var(--aie-burgundy);
    background: rgba(139, 46, 46, 0.03);
}
body .gform_wrapper .gfield_error .gfield_label {
    color: var(--aie-burgundy);
}
body .gform_wrapper .validation_message,
body .gform_wrapper .gfield_validation_message,
body .gform_wrapper .gform_validation_errors {
    margin-top: var(--aie-space-2);
    padding: var(--aie-space-3) 0;
    border: 0;
    background: transparent;
    color: var(--aie-burgundy);
    font-size: var(--aie-text-sm);
    font-family: var(--aie-body);
    font-weight: 400;
}
body .gform_wrapper .gform_validation_errors {
    padding: var(--aie-space-4) var(--aie-space-5);
    border-left: 0;
    border-top: 1px solid var(--aie-burgundy);
    border-bottom: 1px solid var(--aie-burgundy);
    margin-bottom: var(--aie-space-5);
    color: var(--aie-burgundy);
    background: rgba(139, 46, 46, 0.04);
}
body .gform_wrapper .gform_validation_errors > h2 {
    font-family: var(--aie-body);
    font-size: var(--aie-text-xs);
    font-weight: 500;
    letter-spacing: var(--aie-tracking-wider);
    text-transform: uppercase;
    color: var(--aie-burgundy);
    margin: 0 0 var(--aie-space-2);
}

/* Submit button — full match with .aie-btn--primary look */
body .gform_wrapper .gform_footer,
body .gform_wrapper .gform_page_footer {
    margin-top: var(--aie-space-6);
    padding: 0;
    border: 0;
    display: flex;
    flex-wrap: wrap;
    gap: var(--aie-space-4);
}
/* Submit + nav buttons — match .gform-theme--* selector depth so we beat
   Foundation/Orbital's own button rules on specificity. */
body .gform_wrapper input[type="submit"],
body .gform_wrapper button[type="submit"],
body .gform_wrapper .gform_button,
body .gform_wrapper .gform_button.button,
body .gform_wrapper .gform_previous_button,
body .gform_wrapper .gform_next_button,
body .gform-theme .gform_footer input[type="submit"],
body .gform-theme .gform_footer button[type="submit"],
body .gform-theme .gform_footer .gform_button,
body .gform-theme .gform_page_footer input[type="submit"],
body .gform-theme .gform_page_footer button[type="submit"],
body .gform-theme--foundation .gform_footer input[type="submit"],
body .gform-theme--foundation .gform_footer button[type="submit"],
body .gform-theme--foundation .gform_footer .gform_button,
body .gform-theme--foundation .gform_footer button.gform_button,
body .gform-theme--foundation .gform_page_footer input[type="submit"],
body .gform-theme--foundation .gform_page_footer button[type="submit"],
body .gform-theme--orbital .gform_footer input[type="submit"],
body .gform-theme--orbital .gform_footer button[type="submit"],
body .gform-theme--orbital .gform_footer .gform_button,
body .gform-theme--orbital .gform_footer button.gform_button,
body .gform-theme--orbital .gform_page_footer input[type="submit"],
body .gform-theme--orbital .gform_page_footer button[type="submit"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--aie-body);
    font-weight: 500;
    font-size: 0.7rem;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    line-height: 1;
    padding: 1.25rem clamp(1.75rem, 3.5vw, 2.25rem);
    background: var(--aie-navy);
    color: var(--aie-ivory);
    border: 1px solid var(--aie-navy);
    border-radius: 0;
    cursor: pointer;
    text-decoration: none;
    -webkit-appearance: none;
    appearance: none;
    box-shadow: none;
    transition: background-color 500ms var(--aie-ease),
                color 500ms var(--aie-ease),
                border-color 500ms var(--aie-ease);
    -webkit-font-smoothing: antialiased;
    width: auto;
    min-width: 0;
    max-width: none;
    min-height: 0;
    height: auto;
    text-shadow: none;
    margin: 0;
    outline: 0;
}

body .gform_wrapper input[type="submit"]:hover,
body .gform_wrapper button[type="submit"]:hover,
body .gform_wrapper .gform_button:hover,
body .gform_wrapper .gform_button.button:hover,
body .gform-theme .gform_footer input[type="submit"]:hover,
body .gform-theme .gform_footer button[type="submit"]:hover,
body .gform-theme .gform_footer .gform_button:hover,
body .gform-theme--foundation .gform_footer input[type="submit"]:hover,
body .gform-theme--foundation .gform_footer button[type="submit"]:hover,
body .gform-theme--foundation .gform_footer .gform_button:hover,
body .gform-theme--foundation .gform_footer button.gform_button:hover,
body .gform-theme--orbital .gform_footer input[type="submit"]:hover,
body .gform-theme--orbital .gform_footer button[type="submit"]:hover,
body .gform-theme--orbital .gform_footer .gform_button:hover,
body .gform-theme--orbital .gform_footer button.gform_button:hover {
    background: var(--aie-noir);
    color: var(--aie-gold-light);
    border-color: var(--aie-noir);
}

/* Active / focus states — sharp, no native blue ring */
body .gform_wrapper input[type="submit"]:focus-visible,
body .gform_wrapper button[type="submit"]:focus-visible,
body .gform_wrapper .gform_button:focus-visible,
body .gform-theme--foundation .gform_footer input[type="submit"]:focus-visible,
body .gform-theme--orbital .gform_footer input[type="submit"]:focus-visible {
    outline: 1px solid var(--aie-gold);
    outline-offset: 3px;
}

/* =====================================================================
   Submit button — final hardcoded override to guarantee identity with
   .aie-btn--primary regardless of which Gravity Forms theme/preset is
   active. Plugin CSS specificity is unpredictable; !important ensures
   the brand wins. Scoped tightly so nothing else is affected.
   ===================================================================== */
.gform_wrapper input[type="submit"],
.gform_wrapper button[type="submit"],
.gform_wrapper .gform_button,
.gform_wrapper .gform_button.button,
.gform_wrapper .gform_next_button,
.gform_wrapper .gform_footer input[type="submit"],
.gform_wrapper .gform_page_footer input[type="submit"] {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-family: var(--aie-body) !important;
    font-weight: 500 !important;
    font-size: 0.7rem !important;
    letter-spacing: 0.24em !important;
    text-transform: uppercase !important;
    line-height: 1 !important;
    padding: 1.25rem clamp(1.75rem, 3.5vw, 2.25rem) !important;
    background: var(--aie-navy) !important;
    background-color: var(--aie-navy) !important;
    color: var(--aie-ivory) !important;
    border: 1px solid var(--aie-navy) !important;
    border-radius: 0 !important;
    cursor: pointer !important;
    text-decoration: none !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    box-shadow: none !important;
    text-shadow: none !important;
    transition: background-color 500ms var(--aie-ease), color 500ms var(--aie-ease), border-color 500ms var(--aie-ease) !important;
    -webkit-font-smoothing: antialiased !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    min-height: 0 !important;
    height: auto !important;
    margin: 0 !important;
    outline: 0 !important;
    text-align: center !important;
    vertical-align: middle !important;
    white-space: normal !important;
    text-indent: 0 !important;
    letter-spacing: 0.24em !important;
}

.gform_wrapper input[type="submit"]:hover,
.gform_wrapper button[type="submit"]:hover,
.gform_wrapper .gform_button:hover,
.gform_wrapper .gform_button.button:hover,
.gform_wrapper .gform_next_button:hover,
.gform_wrapper .gform_footer input[type="submit"]:hover,
.gform_wrapper .gform_page_footer input[type="submit"]:hover {
    background: var(--aie-noir) !important;
    background-color: var(--aie-noir) !important;
    color: var(--aie-gold-light) !important;
    border-color: var(--aie-noir) !important;
}

.gform_wrapper input[type="submit"]:focus-visible,
.gform_wrapper button[type="submit"]:focus-visible,
.gform_wrapper .gform_button:focus-visible {
    outline: 1px solid var(--aie-gold) !important;
    outline-offset: 3px !important;
}

/* Previous-page button on multi-page forms — outline variant */
body .gform_wrapper .gform_previous_button,
body .gform-theme--foundation .gform_footer .gform_previous_button,
body .gform-theme--orbital .gform_footer .gform_previous_button {
    background: transparent;
    color: var(--aie-navy);
    border-color: var(--aie-navy);
}
body .gform_wrapper .gform_previous_button:hover,
body .gform-theme--foundation .gform_footer .gform_previous_button:hover,
body .gform-theme--orbital .gform_footer .gform_previous_button:hover {
    background: var(--aie-navy);
    color: var(--aie-ivory);
}

/* Confirmation message after successful submit */
body .gform_confirmation_wrapper,
body .gform_confirmation_message,
body .gform_wrapper .gform_confirmation_message {
    font-family: var(--aie-display);
    font-weight: 400;
    font-size: var(--aie-text-lg);
    line-height: var(--aie-leading-snug);
    color: var(--aie-heading);
    padding: var(--aie-space-7) var(--aie-space-6);
    border: 0;
    border-top: 1px solid var(--aie-noir);
    border-bottom: 1px solid var(--aie-noir);
    background: var(--aie-bg-inset);
    text-align: left;
    max-width: 56ch;
}

/* Honeypot, hidden fields stay hidden */
body .gform_wrapper .gform_validation_container,
body .gform_wrapper input[name="gform_field_values"] { display: none !important; }

/* AJAX spinner */
body .gform_wrapper .gform_ajax_spinner {
    margin-left: var(--aie-space-3);
    height: 16px;
    width: 16px;
}

/* Complex inputs (address, name, date) — defensive flat styling */
body .gform_wrapper .ginput_complex input,
body .gform_wrapper .ginput_complex select { margin-top: var(--aie-space-2); }
body .gform_wrapper .ginput_container_address > span,
body .gform_wrapper .ginput_complex > span {
    display: block;
    margin-bottom: var(--aie-space-3);
}

/* Checkbox / radio — restrained */
body .gform_wrapper .gfield_checkbox label,
body .gform_wrapper .gfield_radio label {
    font-family: var(--aie-body);
    font-size: var(--aie-text-sm);
    color: var(--aie-text);
    text-transform: none;
    letter-spacing: 0;
    font-weight: 400;
    margin: 0 0 var(--aie-space-2) var(--aie-space-2);
    display: inline;
}
body .gform_wrapper input[type="checkbox"],
body .gform_wrapper input[type="radio"] {
    accent-color: var(--aie-gold-dark);
    margin-right: var(--aie-space-2);
}

/* Reset Orbital's autofilled background colour to keep brand white */
body .gform_wrapper input:-webkit-autofill,
body .gform_wrapper textarea:-webkit-autofill,
body .gform_wrapper select:-webkit-autofill {
    -webkit-text-fill-color: var(--aie-charcoal);
    -webkit-box-shadow: 0 0 0 1000px var(--aie-white) inset;
    box-shadow: 0 0 0 1000px var(--aie-white) inset;
    transition: background-color 5000s ease-in-out 0s;
}
