/* ===== GRAVITY FORMS - THEME STYLES
   Gravity Forms' own CSS is disabled (markup.php). Fields carry the theme's
   .form-row / .input-txt classes, so most styling comes from dist/css; this
   file only covers GF-specific structure. Plain CSS so it doesn't depend on
   each site's Sass build.
   ================================================================================ */

.ww-form .gform_fields {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    column-gap: 10px;
    margin: 0;
    padding: 0;
}

.ww-form .gfield {
    grid-column: span 12;
    min-width: 0;
    text-align: left;
}

@media (min-width: 640px) {
    .ww-form .gfield--width-half {
        grid-column: span 6;
    }

    .ww-form .gfield--width-third {
        grid-column: span 4;
    }
}

/* Expandable forms (theme JS animates max-height) - keep the grid from
   stretching the first row */
.ww-form .gform_fields.expandable-fields {
    align-content: start;
}

/* Hidden + honeypot fields. The heading only holds an empty required legend
   <p> (titles are never shown), whose margins can collapse into the layout. */
.ww-form_wrapper .gform_heading,
.ww-form .gfield--type-hidden,
.ww-form .gform_hidden,
.ww-form .gform_validation_container,
.ww-form .ww-hide,
.gform_wrapper .gform_validation_container {
    display: none !important;
}

.ww-form .gfield_required {
    color: inherit;
}

.ww-form .ginput_container {
    position: relative;
}

/* Section headings (survey / warranty / sash): the <h3> keeps the theme's own
   heading styles, as the legacy <h3> did */

/* The legacy templates' <br> spacer lines: one line of the form text each
   (1lh; the px value is the desktop line, for browsers without lh) - see
   ww_gf_section() and the sash product groups in forms.php */
.ww-form .gfield.ww-br-1 {
    margin-top: 25.6px;
    margin-top: 1lh;
}

.ww-form .gfield.ww-br-2 {
    margin-top: 51.2px;
    margin-top: 2lh;
}

/* Static labels: radios, checkboxes, selects with a question as their label */
.ww-form fieldset.gfield {
    border: 0;
    margin: 0 0 10px;
    padding: 0;
}

.ww-form .label-static .gfield_label:not(.label),
.ww-form .label-static legend:not(.label),
.ww-form fieldset.gfield legend:not(.label) {
    position: static;
    display: block;
    font: 500 14px/1.4 'Montserrat', Helvetica, Arial, sans-serif;
    margin-bottom: 8px;
    pointer-events: auto;
}

.ww-form .gfield_checkbox:not(.checkboxes):not(.form-check-group-inline) label {
    position: static;
    display: inline;
    pointer-events: auto;
    line-height: 1.4;
}

.ww-form .gfield_checkbox:not(.checkboxes):not(.form-check-group-inline) {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 20px;
}

.ww-form .gfield_checkbox .gchoice {
    display: flex;
    align-items: center;
    gap: 6px;
}

.ww-form .gfield--type-select .gfield_label {
    z-index: 3;
}

.ww-form .gfield_label .gfield_required_asterisk {
    margin-left: 0;
}

/* Radios use the theme's .form-check markup, and their question the legacy
   label.label + <br> (markup.php); the legend is kept for screen readers only */
.ww-form legend.ww-sr-only {
    position: absolute !important;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    margin: 0;
    padding: 0;
}

/* Some legacy labels had a space before the asterisk ("Purchase Order # *") */
.ww-form .ww-req-space .gfield_label > .gfield_required::before {
    content: " ";
}

/* Hidden-label fields (consent / newsletter / sash type) */
.ww-form .hidden_label > .gfield_label,
.ww-form .hidden_label > legend {
    position: absolute !important;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
}

/* Validation */
.ww-form .gfield_error .input-txt,
.ww-form .gfield_error .selector span {
    border-color: #eb0000;
}

.ww-form .gfield_validation_message,
.ww-form .validation_message {
    color: #eb0000;
    font: 500 12px/1.1 'Montserrat', Helvetica, Arial, sans-serif;
    padding: 6px 2px 0;
}

.gform_wrapper .gform_validation_errors {
    color: #eb0000;
    font: 500 14px/1.3 'Montserrat', Helvetica, Arial, sans-serif;
    margin-bottom: 15px;
}

.gform_wrapper .gform_validation_errors h2 {
    font-size: 14px;
    margin: 0;
}

/* Submit row - same as the legacy .submit-row (no top margin; the last
   .form-row's 10px bottom margin is the gap) */
.ww-form .gform_footer,
.ww-form .gform_page_footer {
    display: flex;
    gap: 10px;
    margin-top: 0;
}

.ww-form .gform_footer button,
.ww-form .gform_page_footer button,
.ww-form .gform_page_footer input[type="button"],
.ww-form .gform_page_footer input[type="submit"] {
    width: 100%;
    min-width: auto !important;
    padding: 13px;
}

.ww-form .gform_ajax_spinner,
.ww-form .gform-loader {
    display: none;
}

/* Stepped LP: GF page steps in place of the legacy .steps-nav */
.ww-form .gf_page_steps {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}

.ww-form .gf_step {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 2px solid #1875df;
    border-radius: 50%;
    color: #1875df;
    font-weight: 700;
}

.ww-form .gf_step_active,
.ww-form .gf_step_completed {
    background: #1875df;
    color: #fff;
}

.ww-form .gf_step_label,
.ww-form .gf_step_clear {
    display: none;
}

.ww-form .gf_step_number {
    font-size: 14px;
}

/* Confirmation text (if a form is ever set to a message instead of the theme redirect) */
.gform_confirmation_message {
    padding: 20px 0;
}


/* ===== PLACEMENT WRAPPERS
   The templates' Gravity Forms branches swap the outer <form class="form-general">
   for a <div> (GF's own <form> sits inside it), so theme rules written against the
   form element ("... form .form-body") miss the wrapper and land on GF's inner form
   instead. These mirror those rules from library/css/main.css onto the wrapper div,
   and reset the inner form so its box styles aren't applied twice.
   ================================================================================ */

.gform_wrapper.ww-form_wrapper > form.ww-form {
    max-width: none;
    min-height: 0;
    margin: 0;
    background: none;
    box-shadow: none;
}

div.form-general .form-body {
    width: 100%;
}

/* Hero - in source order, so the cascade matches (rules for elements inside the
   form, e.g. its button, already reach GF's inner form) */
.hero.form-right.overlay-blue div.form-general .subtitle,
.hero.overlay-blue.full-image div.form-general .subtitle {
    color: #000;
    font-family: "Montserrat", Helvetica, Arial, sans-serif;
    margin: 0 0 30px 0;
}

@media screen and (min-width: 960px) {
    .hero.form-right.overlay-blue div.form-general .subtitle,
    .hero.overlay-blue.full-image div.form-general .subtitle {
        font-size: 24px;
    }
}

.hero.form-center div.form-general {
    background: rgba(255, 255, 255, 0.92);
}

.hero.form-center div.form-general .promotion {
    display: none;
}

.hero.form-right div.form-general,
.hero.full-image div.form-general {
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 15px 15px rgba(0, 0, 0, 0.1);
}

@media screen and (min-width: 960px) {
    .hero.form-right div.form-general,
    .hero.full-image div.form-general {
        max-width: 440px;
    }
}

.hero.form-right div.form-general .promotion,
.hero.full-image div.form-general .promotion {
    display: none;
}

.hero.form-right.overlay-blue div.form-general .subtitle,
.hero.overlay-blue.full-image div.form-general .subtitle {
    font-size: 20px;
    margin-bottom: 20px;
}

@media screen and (min-width: 640px) {
    .hero.form-right.overlay-blue div.form-general .form-body,
    .hero.overlay-blue.full-image div.form-general .form-body {
        padding: 25px 30px;
    }
}

.hero.slider .form-wrapper div.form-general {
    pointer-events: all;
    max-width: 440px;
    background: rgba(255, 255, 255, 0.92);
}

@media screen and (min-width: 960px) {
    .hero.slider .form-wrapper div.form-general .form-body {
        padding: 40px 30px;
    }
}

/* Blog index (its legacy .form-row.split rows only went side by side from 1280px) */
@media screen and (max-width: 1279px) {
    .blog article.form-block .ww-form .gfield--width-half,
    .archive article.form-block .ww-form .gfield--width-half {
        grid-column: span 12;
    }
}

.blog article.form-block div.form-general,
.archive article.form-block div.form-general {
    max-width: none;
    min-height: auto;
    background: rgba(255, 255, 255, 0);
}

.blog article.form-block div.form-general .form-body,
.archive article.form-block div.form-general .form-body {
    padding: 0;
}

/* Sticky footer */
.sticky-footer-form.mobile-button-left div.form-general .form-body,
.sticky-footer-form.mobile-button-right div.form-general .form-body {
    padding-bottom: 70px;
}

.sticky-footer-form div.form-general {
    min-height: auto;
    box-shadow: none;
}

.sticky-footer-form div.form-general .form-title .title {
    padding-bottom: 20px;
    margin-bottom: 20px;
}

.sticky-footer-form div.form-general .form-body {
    padding: 50px 20px;
}

/* The legacy sticky button isn't in a .submit-row, so it keeps the .btn padding */
.sticky-footer-form .ww-form .gform_footer button {
    padding: 13px 30px;
}

@media screen and (min-width: 960px) {
    .sticky-footer-form div.form-general {
        max-width: 1140px;
        background: rgba(255, 255, 255, 0);
    }

    .sticky-footer-form div.form-general .form-title .title {
        color: #000;
        font-size: 22px;
        padding: 0;
        margin-bottom: 20px;
    }

    .sticky-footer-form div.form-general .form-title .title:after {
        content: none;
    }

    .sticky-footer-form div.form-general .form-fields {
        display: flex;
        align-items: stretch;
        justify-content: center;
    }

    .sticky-footer-form div.form-general .form-body {
        padding: 45px 20px;
    }

    /* Let the fields and button be flex items of .form-fields, as in the legacy markup */
    .sticky-footer-form .form-fields .gform_wrapper,
    .sticky-footer-form .form-fields form.ww-form,
    .sticky-footer-form .form-fields .gform-body,
    .sticky-footer-form .form-fields .gform_fields,
    .sticky-footer-form .form-fields .gform_footer {
        display: contents;
    }

    .sticky-footer-form .ww-form .gfield {
        min-width: auto;
    }

    .sticky-footer-form .ww-form .gform_footer button {
        width: auto;
    }
}

/* Referral consent - mirrors dist's "form#referral .consent-checkbox" rules (the
   #referral wrapper is now a div). The fieldset's 2px top margin plus the previous
   row's 10px bottom margin = the legacy row's collapsed 12px. */
#referral .ww-form .gfield.consent {
    margin: 2px 0 12px;
}

#referral .ww-form .consent-checkbox {
    flex-wrap: nowrap;
    gap: 0;
    margin: 0;
}

#referral .ww-form .consent-checkbox label {
    font-size: 10px;
    line-height: 120%;
}

/* Landing pages - ww_gf_lp_script() rebuilds the legacy LP markup (split rows,
   stepped slides) inside the field list, so it lays out as plain blocks and
   landing-pages/css styles the rows */
.ww-form-lp-general .gform_fields,
.ww-form-lp-stepped .gform_fields {
    display: block;
}

/* The question legend fills the row, as the legacy div.label did (less the
   .label's 6px right margin from landing-pages/css) */
.ww-form fieldset.gfield > legend.label {
    width: calc(100% - 6px);
}

/* The landing page CSS gives the floating labels no z-index (the legacy inputs
   weren't positioned), so a positioned input container would cover them */
.ww-form-lp-general .ginput_container,
.ww-form-lp-stepped .ginput_container {
    position: static;
}

/* Landing page hero - mirrors landing-pages/css's ".block-lp-hero.size-* form" rules */
.block-lp-hero.size-large div.form-general,
.block-lp-hero.size-large div.form-stepped {
    width: 100%;
    margin: -40px auto 0 auto;
}

.block-lp-hero.size-small div.form-general,
.block-lp-hero.size-small div.form-stepped {
    margin-top: -110px;
}

@media screen and (min-width: 960px) {
    .block-lp-hero.size-large div.form-general,
    .block-lp-hero.size-large div.form-stepped,
    .block-lp-hero.size-small div.form-general,
    .block-lp-hero.size-small div.form-stepped {
        margin: 0 auto;
    }
}

/* Sash product rows: the Top / Bottom / Both radios sat in a .form-row.split
   beside "Other", centered in the row, and the theme's
   ".form-row.split :not(:last-child)" rule spaced each option 10px apart */
.ww-form-sash .gfield--type-radio .ginput_container {
    height: 100%;
}

.ww-form-sash .gfield_radio .form-check:not(:last-child) {
    margin-right: 10px;
}
