/* ==========================================================================
   GRAVITY FORMS - 12 COLUMN GRID & PREMIUM STYLING
   ========================================================================== */

:root {
    --gf-primary: var(--wp--preset--color--primary, #204ce5);
    --gf-secondary: var(--wp--preset--color--secondary, #fff);
    --gf-tertiary: var(--wp--preset--color--tertiary, #f5f5f5);
    --gf-border-color: #e2e8f0;
    --gf-border-focus: var(--gf-primary);
    --gf-radius: var(--wp--custom--border--radius--medium, 8px);
    --gf-padding: 12px 16px;
    --gf-transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 1. Grid System
   ========================================================================== */

.gform_wrapper .gform_fields {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-column-gap: 24px;
    grid-row-gap: 24px;
}

/* Default span for all fields is 12 columns */
.gform_wrapper .gfield {
    grid-column: span 12;
}

/* GF native width classes - 12-column grid */
.gform_wrapper .gfield--width-full          { grid-column: span 12; }
.gform_wrapper .gfield--width-half          { grid-column: span 6; }
.gform_wrapper .gfield--width-third         { grid-column: span 4; }
.gform_wrapper .gfield--width-two-thirds    { grid-column: span 8; }
.gform_wrapper .gfield--width-quarter       { grid-column: span 3; }
.gform_wrapper .gfield--width-three-quarters{ grid-column: span 9; }

/* Column Utilities - Add these to 'CSS Class Name' in Gravity Forms */
.gform_wrapper .col-1 {
    grid-column: span 1;
}

.gform_wrapper .col-2 {
    grid-column: span 2;
}

.gform_wrapper .col-3 {
    grid-column: span 3;
}

.gform_wrapper .col-4 {
    grid-column: span 4;
}

.gform_wrapper .col-5 {
    grid-column: span 5;
}

.gform_wrapper .col-6 {
    grid-column: span 6;
}

.gform_wrapper .col-7 {
    grid-column: span 7;
}

.gform_wrapper .col-8 {
    grid-column: span 8;
}

.gform_wrapper .col-9 {
    grid-column: span 9;
}

.gform_wrapper .col-10 {
    grid-column: span 10;
}

.gform_wrapper .col-11 {
    grid-column: span 11;
}

.gform_wrapper .col-12 {
    grid-column: span 12;
}

/* 2. Form Elements Styling
   ========================================================================== */

/* Input & Textarea Base */
.gform_wrapper input[type="text"],
.gform_wrapper input[type="email"],
.gform_wrapper input[type="tel"],
.gform_wrapper input[type="url"],
.gform_wrapper input[type="number"],
.gform_wrapper input[type="password"],
.gform_wrapper select,
.gform_wrapper textarea {
    width: 100%;
    padding: var(--gf-padding);
    border: 1px solid var(--gf-border-color);
    border-radius: var(--wp--custom--border--radius--small);
    background-color: #fff;
    font-family: inherit;
    font-size: 14px;
    color: #1a202c;
    transition: var(--gf-transition);
}

/* Hover & Focus States */
.gform_wrapper input:hover,
.gform_wrapper select:hover,
.gform_wrapper textarea:hover {
    border-color: #cbd5e0;
}

.gform_wrapper input:focus,
.gform_wrapper select:focus,
.gform_wrapper textarea:focus {
    /* Visible focus indicator: tint the border and add a solid focus ring so
       keyboard users can clearly see the active field (the previous 10%-opacity
       shadow alone failed WCAG 2.4.7 / 1.4.11). */
    outline: 2px solid transparent; /* preserved for Windows High Contrast Mode */
    outline-offset: 0;
    border-color: var(--gf-border-focus);
    box-shadow: 0 0 0 3px rgba(32, 76, 229, 0.45), 0 1px 2px rgba(0, 0, 0, 0.05);
}

.gform_wrapper textarea.small {height:100px;}

/* Placeholder Styling */
::placeholder {
    color: #a0aec0;
    opacity: 1;
}

/* 3. Labels & Typography
   ========================================================================== */

.gform_wrapper .gfield_label {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 5px;
    display: inline-block;
}

.gform_wrapper .hidden_label .gfield_label {display:none;}

.gform_wrapper .gfield_required {
    color: #e53e3e;
    font-weight: 400;
}

.gform_required_legend {
    display: none;
}

.gfield_required_text {
    font-size: 12px;
    opacity: 0.7;
}

/* Sub-labels */
.gform_wrapper .ginput_container_name .gform-field-label--type-sub,
.gform_wrapper .ginput_container_email .gform-field-label--type-sub {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #718096;
    margin-top: 6px;
    display: block;
}

/* Descriptions */
.gform_wrapper .gfield_description {
    font-size: 13px;
    color: #718096;
    margin-bottom: 12px;
    line-height: 1.5;
}

/* Visually-hidden label (overrides GF's display:none hidden_label) */
.gform_wrapper .hidden_label .gfield_label,
.gform_wrapper .hidden_label legend.gfield_label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.gform_wrapper .gfield--type-consent {
    font-size: 80%;
}

/* 4. Complex Containers (Name, Email Confirm)
   ========================================================================== */

.gform_wrapper .ginput_complex {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

/* Ensure complex inputs take full width of their span */
.gform_wrapper .ginput_complex span {
    width: 100%;
}

/* 5. Validation & Errors
   ========================================================================== */

.gform_wrapper .gfield_error input,
.gform_wrapper .gfield_error textarea,
.gform_wrapper .gfield_error select {
    border-color: #feb2b2;
    background-color: #fff5f5;
}

.gform_wrapper .validation_message {
    color: #e53e3e;
    font-size: 13px;
    margin-top: 6px;
    font-weight: 500;
}

.gform_wrapper .gform_validation_errors {
    padding: 20px;
    background-color: #fff5f5;
    border-left: 4px solid #f56565;
    border-radius: var(--gf-radius);
    margin-bottom: 30px;
}

.gform_wrapper .gform_validation_errors h2 {
    color: #c53030;
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 10px 0;
}

/* 6. Button & Footer
   ========================================================================== */

.gform_wrapper .gform_footer {
    margin-top: 25px;
    padding: 0;
}

.gform_wrapper .gform_button {
    background-color: var(--gf-primary);
    color: white;
    padding: 14px 32px;
    font-size: 16px;
    font-weight: 700;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: var(--gf-transition);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.gform_wrapper .gform_button:hover {
    background-color: var(--wp--preset--color--senary);
}

.gform_wrapper .gform_button:active {
    transform: translateY(0);
}

/* 7. Responsive Handling
   ========================================================================== */

@media (max-width: 991px) {

    .gform_wrapper .col-1,
    .gform_wrapper .col-2,
    .gform_wrapper .col-3,
    .gform_wrapper .col-4,
    .gform_wrapper .col-5 {
        grid-column: span 6;
    }

    .gform_wrapper .gfield--width-third,
    .gform_wrapper .gfield--width-quarter {
        grid-column: span 6;
    }
}

@media (max-width: 767px) {
    .gform_wrapper .gform_fields {
        grid-template-columns: 1fr;
        grid-gap: 20px;
    }

    .gform_wrapper .gfield,
    .gform_wrapper .gfield--width-full,
    .gform_wrapper .gfield--width-half,
    .gform_wrapper .gfield--width-third,
    .gform_wrapper .gfield--width-two-thirds,
    .gform_wrapper .gfield--width-quarter,
    .gform_wrapper .gfield--width-three-quarters,
    .gform_wrapper .col-1,
    .gform_wrapper .col-2,
    .gform_wrapper .col-3,
    .gform_wrapper .col-4,
    .gform_wrapper .col-5,
    .gform_wrapper .col-6,
    .gform_wrapper .col-7,
    .gform_wrapper .col-8,
    .gform_wrapper .col-9,
    .gform_wrapper .col-10,
    .gform_wrapper .col-11,
    .gform_wrapper .col-12 {
        grid-column: span 1;
    }

    .gform_wrapper .ginput_complex {
        grid-template-columns: 1fr;
    }
}

/* Hide legacy elements */
.gform-body p,
.gform-footer br,
.gform-footer p {
    display: none;
}

/* ==========================================================================
   8. Custom Checkboxes
   Applies to all GF checkbox fields and the consent field.
   Pill-style checkbox fields (.gf-pill) are intentionally excluded.
   ========================================================================== */

/* Hide native checkbox - keep in accessibility tree */
.gform_wrapper .gfield:not(.gf-pill) .gchoice input[type="checkbox"],
.gform_wrapper .ginput_container_consent input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    margin: 0;
    pointer-events: none;
}

/* Label layout - checkbox box sits left of text */
.gform_wrapper .gfield:not(.gf-pill) .gchoice label,
.gform_wrapper .ginput_container_consent label {
    display: flex;
    align-items: flex-start;
    gap: 0;
    cursor: pointer;
    font-size: 14px;
    line-height: 1.5;
}

/* Custom box via ::before */
.gform_wrapper .gfield:not(.gf-pill) .gchoice label::before,
.gform_wrapper .ginput_container_consent label::before {
    content: '';
    flex-shrink: 0;
    width: 20px;
    height: 20px;
     /* optical alignment with first text line */
    border: 2px solid var(--gf-border-color, #e2e8f0);
    border-radius: 4px;
    margin: 0 10px 0 0;
    background: #fff;
    transition: background-color 0.15s ease;
}

/* Hover */
.gform_wrapper .gfield:not(.gf-pill) .gchoice label:hover::before,
.gform_wrapper .ginput_container_consent label:hover::before {
    border-color: var(--gf-primary);
}

/* Checked - filled box with SVG tick */
.gform_wrapper .gfield:not(.gf-pill) .gchoice input[type="checkbox"]:checked + label::before,
.gform_wrapper .ginput_container_consent input[type="checkbox"]:checked + label::before {
    background-color: var(--gf-primary);
    border-color: var(--gf-primary);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 10'%3E%3Cpath d='M1 5l3.5 3.5L11 1' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 12px;
}

/* Keyboard focus ring */
.gform_wrapper .gfield:not(.gf-pill) .gchoice input[type="checkbox"]:focus-visible + label::before,
.gform_wrapper .ginput_container_consent input[type="checkbox"]:focus-visible + label::before {
    outline: 2px solid var(--gf-primary);
    outline-offset: 2px;
}

/* Validation error state */
.gform_wrapper .gfield_error .gchoice label::before,
.gform_wrapper .gfield_error .ginput_container_consent label::before {
    border-color: #e53e3e;
}

/* ==========================================================================
   GF PILL CHOICES
   Add "gf-pill" to the field's CSS Class Name in Gravity Forms.
   Optionally add a colour class: "gf-pill has-primary-color"
   Works on Checkbox and Radio field types.
   ========================================================================== */

/* Per-field accent token - defaults to ink (dark) */
.gf-pill {
    --gf-pill-accent: var(--wp--preset--color--ink, #0f0b22);
    --gf-pill-on:     #fff; /* text colour when the pill is filled */
}

/* Colour variants - match WP theme palette slugs */
.gf-pill.has-primary-color    { --gf-pill-accent: var(--wp--preset--color--primary,    #d61254); }
.gf-pill.has-secondary-color  { --gf-pill-accent: var(--wp--preset--color--secondary,  #2563eb); }
.gf-pill.has-tertiary-color   { --gf-pill-accent: var(--wp--preset--color--tertiary,   #7c3aed); }
.gf-pill.has-senary-color     { --gf-pill-accent: var(--wp--preset--color--senary,     #1e0a4f); }
.gf-pill.has-quinary-color    { --gf-pill-accent: var(--wp--preset--color--quinary,    #2fad66); }

/* Quaternary is yellow - keep text dark so contrast holds */
.gf-pill.has-quaternary-color {
    --gf-pill-accent: var(--wp--preset--color--quaternary, #f5c842);
    --gf-pill-on:     var(--wp--preset--color--ink, #0f0b22);
}

/* Choice list: flex wrap */
.gf-pill .gfield_checkbox,
.gf-pill .gfield_radio {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0;
    padding: 0;
}

/* Each choice item: shrink to content */
.gf-pill .gchoice {
    display: flex;
    flex-shrink: 0;
}

/* Visually hide the native input but keep it accessible */
.gf-pill .gfield-choice-input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    margin: 0;
    pointer-events: none;
}

/* Pill label - default (unselected) state */
.gf-pill .gchoice label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: 999px;
    border: 1.5px solid var(--wp--custom--color--neutral--400);
    color: var(--wp--preset--color--ink);
    background: transparent;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
    user-select: none;
}

/* Hover */
.gf-pill .gchoice label:hover {
    background: var(--gf-pill-accent);
    border: 1.5px solid var(--gf-pill-accent);
    color: var(--gf-pill-on);
}

/* Selected / checked */
.gf-pill .gfield-choice-input:checked + label {
    background: var(--gf-pill-accent);
    color: var(--gf-pill-on);
    border-color: var(--gf-pill-accent);
}

/* Keyboard focus ring */
.gf-pill .gfield-choice-input:focus-visible + label {
    outline: 2px solid var(--gf-pill-accent);
    outline-offset: 3px;
}

/* Validation error: outline the group not individual inputs */
.gf-pill.gfield_error .gchoice label {
    border-color: #e53e3e;
}

/* Mobile: allow full-width pills if needed (opt-in via "gf-pill-full") */
.gf-pill.gf-pill-full .gfield_checkbox,
.gf-pill.gf-pill-full .gfield_radio {
    flex-direction: column;
}

.gf-pill.gf-pill-full .gchoice label {
    width: 100%;
    justify-content: center;
}