/* ============================================================
   P2P Calculator — gating (Step 2)
   Locked (default): calculator blurred + inert, form card overlaid.
   Unlocked (body.p2p-unlocked): form hidden, calculator live.
   Geometry matched to Figma 4340:1160 / 4340:1859 (1366 frame):
   label 30px below section top, divider at 69, blurred heading
   ~147, card top 272, section height ~1044.
   Enqueued from functions.php on the Calculator page only.
   ============================================================ */

/* ---------- Page title — native Astra entry-title variant ----------
   On prod the title is the page's own Astra title (enabled in page
   settings). This stylesheet only loads on the calculator page, so
   the selectors are safe. Matches Figma 4340:1160 / 4528:1334. */
.entry-header {
    max-width: 1246px;
    margin: 0 auto;
    padding: 90px 0 0;
    border-bottom: 1px solid #DBEAFE;
}
.entry-header .entry-title {
    margin: 0 0 40px;
    font-size: 44px;
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.5px;
    color: #1E293B;
}
/* Breakeven section carries a large top pad for the no-title layout —
   tighten it now that a title sits above (Figma: ~45px below divider) */
.p2p-breakeven--wrapper {
    padding-top: 45px !important;
}
@media (max-width: 781px) {
    .entry-header {
        padding-top: 48px;
    }
    .entry-header .entry-title {
        font-size: 28px;
        margin-bottom: 24px;
    }
    .p2p-breakeven--wrapper {
        padding-top: 32px !important;
    }
}

/* ---------- Page title (Figma 4340:1160 / 4528:1334) ----------
   Injected by a the_content filter in functions.php. */
.p2p-page-title {
    max-width: 1246px;
    margin: 0 auto;
    padding: 90px 0 0;
    border-bottom: 1px solid #DBEAFE;
}
.p2p-page-title h1 {
    margin: 0 0 40px;
    font-size: 44px;
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.5px;
    color: #1E293B;
}
/* Breakeven section carries a large top pad for the no-title layout —
   tighten it when the title sits above (Figma: ~45px below divider) */
.p2p-page-title + .p2p-breakeven--wrapper {
    padding-top: 45px !important;
}
@media (max-width: 781px) {
    .p2p-page-title {
        padding-top: 48px;
    }
    .p2p-page-title h1 {
        font-size: 28px;
        margin-bottom: 24px;
    }
    .p2p-page-title + .p2p-breakeven--wrapper {
        padding-top: 32px !important;
    }
}

/* Locked Brundage Program inputs (95% / 65%) — styles here so they
   apply even when the older shortcode markup is live and the lock is
   performed at runtime by p2p-calculator.js */
.p2p-range-locked {
    pointer-events: none;
}
.revenue-opportunities-header-count.count-locked {
    min-width: fit-content;
}

/* Positioning context for the overlay */
.p2p-calculator--wrapper > .uagb-container-inner-blocks-wrap {
    position: relative;
}

/* Smooth unblur on unlock */
.overtune-calculator--wrapper {
    transition: filter 0.6s ease;
}

/* ---------- Overlay container (BOTH states) ----------
   Holds the "Run Your Own Numbers" label + the form card.
   Kept absolute in both states so the label/divider stays
   pinned to the section top after unlock (per Figma). */
.p2p-calculator--wrapper
    .wp-block-uagb-container:has(.unlock-contact--wrapper) {
    position: absolute;
    inset: 0;
    z-index: 10;
    margin: 0 auto; /* container carries UAG max-width — auto-center it */
    display: flex;
    flex-direction: column;
    align-items: center;      /* centers the card horizontally */
    justify-content: flex-start;
    padding-top: 197px;       /* equal ~153px gap above/below the card, measured
                                 to the next section's edge (it pulls up -50px) */
}

/* Label + divider pinned to section top (Figma: 30px below section edge) */
.p2p-calculator--wrapper
    .wp-block-uagb-container:has(.unlock-contact--wrapper)
    > .p2p-topheading {
    /* !important: Customizer Additional CSS loads after the child theme */
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    margin: 0 !important;
}

/* ---------- LOCKED (default — no JS required, no FOUC) ---------- */
body:not(.p2p-unlocked) .overtune-calculator--wrapper {
    filter: blur(14px);
    pointer-events: none;
    user-select: none;
}

/* Hide the "Unlocked for ..." banner while locked */
body:not(.p2p-unlocked) .unloack-name--wrapper {
    visibility: hidden;
}

/* Post-submit sections: fully hidden until unlock (form submit or
   restored session). Revealed by the same body.p2p-unlocked flip. */
body:not(.p2p-unlocked) .full-report--wrapper,
body:not(.p2p-unlocked) .strategy-problem--wrapper,
body:not(.p2p-unlocked) .p2p-program--wrapper {
    display: none;
}

/* ---------- Post-submit: marketing sections fold away ----------
   Once unlocked, the four persuasion sections (clinical, per-case
   economics, capture gap, program economics) hide so the flow
   tightens to: breakeven → calculator → report → why-us → CTA.
   A single seam button (injected by the gate JS between calculator
   and Full Report) toggles body.p2p-details-open to restore them. */
body.p2p-unlocked:not(.p2p-details-open) .p2p-clinical--wrapper,
body.p2p-unlocked:not(.p2p-details-open) .p2p-economics--wrapper {
    display: none;
}

/* Cost section ("P2P Denial Program Economics") is pure pre-submit
   persuasion — gone for good once unlocked, toggle or not. */
body.p2p-unlocked .p2p-cost--wrapper {
    display: none;
}

/* Seam: only exists visually post-unlock. Bottom padding absorbs the
   next section's -50px rounded-corner pull-up in both states.
   White in both states; the following section's upward card-shadow
   is suppressed so the closed junction reads as one surface. */
.p2p-details-seam {
    display: none;
    text-align: center;
    padding: 48px 20px 104px;
    background: #ffffff;
}
body.p2p-unlocked .p2p-details-seam {
    display: block;
}
body.p2p-unlocked:not(.p2p-details-open) .full-report--wrapper {
    box-shadow: none !important;
}
body.p2p-unlocked.p2p-details-open .p2p-clinical--wrapper {
    box-shadow: none !important;
}

/* Button: clone of the site's yellow CTA (Book a Walkthrough) */
.p2p-details-seam button {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 18px 40px;
    background: #F2D06F;
    border: 0;
    border-radius: 10px;
    cursor: pointer;
    font-family: inherit;
    font-size: 16px;
    font-weight: 800;
    color: #1E293B;
    transition: background 0.15s ease, color 0.15s ease,
        transform 0.15s ease, box-shadow 0.15s ease;
}
.p2p-details-seam button:hover {
    background: #475569;
    color: #fff;
    transform: translateY(-1.5px);
    box-shadow: rgba(99, 99, 99, 0.2) 0px 2px 8px 0px;
}
.p2p-details-seam button::after {
    content: "";
    width: 8px;
    height: 8px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    margin-top: -4px;
    transition: transform 0.25s ease;
}
body.p2p-details-open .p2p-details-seam button::after {
    transform: rotate(-135deg);
    margin-top: 4px;
}

/* Section height to Figma (~1044): trim wrapper bottom padding while locked */
body:not(.p2p-unlocked) .p2p-calculator--wrapper {
    padding-bottom: 45px !important;
}

/* ---------- UNLOCKED ---------- */
/* Keep the overlay (label stays visible) but let clicks through */
body.p2p-unlocked
    .p2p-calculator--wrapper
    .wp-block-uagb-container:has(.unlock-contact--wrapper) {
    pointer-events: none;
    padding-top: 0;
}

/* Hide only the form card */
body.p2p-unlocked .unlock-contact--wrapper {
    display: none;
}

/* Balance the section: match the ~170px gap above the heading
   (block padding is 200px — locked state keeps its own 45px rule) */
body.p2p-unlocked .p2p-calculator--wrapper {
    padding-bottom: 170px !important;
}

/* ---------- CF7 states inside the gate card ----------
   Scoped to .unlock-contact--wrapper so global CF7 styling
   elsewhere on the site is untouched. Card tokens: navy
   #1e293b, input radius 12px, accent #f2d06f (submit btn). */

/* Response output: replaces CF7's bordered box. Collapsed via
   max-height (not display) so appearing/disappearing animates
   instead of jumping the card — the card's resting height sets
   the section's equal-gap geometry above. */
.unlock-contact--wrapper .wpcf7 form .wpcf7-response-output {
    display: block;
    overflow: hidden;
    max-height: 120px;
    margin: 24px 0 0;
    padding: 12px 16px;
    border: 0;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    text-align: center;
    color: #e2e8f0;
    background: rgba(148, 163, 184, 0.12);
    opacity: 1;
    transition: max-height 0.3s ease, opacity 0.3s ease,
        margin 0.3s ease, padding 0.3s ease;
}
.unlock-contact--wrapper .wpcf7 form.init .wpcf7-response-output,
.unlock-contact--wrapper .wpcf7 form.resetting .wpcf7-response-output,
.unlock-contact--wrapper .wpcf7 form.submitting .wpcf7-response-output {
    display: block; /* CF7 sets display:none — keep it animatable */
    max-height: 0;
    margin: 0;
    padding: 0 16px;
    opacity: 0;
}

/* Error states: tinted fill + light text, no bare border */
.unlock-contact--wrapper .wpcf7 form.failed .wpcf7-response-output,
.unlock-contact--wrapper .wpcf7 form.aborted .wpcf7-response-output {
    background: rgba(239, 68, 68, 0.16);
    color: #fca5a5;
}
.unlock-contact--wrapper .wpcf7 form.spam .wpcf7-response-output {
    background: rgba(245, 158, 11, 0.15);
    color: #fcd34d;
}

/* Validation summary + per-field tips in the card's accent amber */
.unlock-contact--wrapper .wpcf7 form.invalid .wpcf7-response-output,
.unlock-contact--wrapper .wpcf7 form.unaccepted .wpcf7-response-output {
    background: rgba(242, 208, 111, 0.14);
    color: #f2d06f;
}
.unlock-contact--wrapper .wpcf7-not-valid-tip {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    font-weight: 500;
    color: #f2d06f;
}

/* Success: styled defensively — the unlock JS hides the whole
   card on wpcf7mailsent, so this rarely paints */
.unlock-contact--wrapper .wpcf7 form.sent .wpcf7-response-output {
    background: rgba(74, 222, 128, 0.15);
    color: #86efac;
}

/* Sending: spinner inline next to the submit button (site CSS
   pins .number-submit-btn .wpcf7-spinner to the form's right
   edge), recolored to read on navy; button reads disabled */
.unlock-contact--wrapper .wpcf7 form p:has(> .wpcf7-submit) {
    display: flex;
    align-items: center;
    gap: 12px;
}
.unlock-contact--wrapper .wpcf7 form .wpcf7-spinner {
    /* relative (not static): stays in flow next to the button while
       still anchoring the absolutely-positioned orbiting dot inside */
    position: relative;
    transform: none;
    margin: 0;
    flex: none;
    background-color: rgba(248, 250, 252, 0.28);
}
.unlock-contact--wrapper .wpcf7 form.submitting .wpcf7-submit {
    opacity: 0.55;
    pointer-events: none;
}

/* ---------- Footer spacing (calculator page only) ----------
   Prod's global footer carries a 305px top pad (tablet ~220px,
   mobile ~224px) to host the homepage's overlapping card. Nothing
   overlaps the footer on this page, so match the local design.
   This file only enqueues on the calculator page, so other pages
   keep the global footer spacing. */
.site-footer .site-primary-footer-wrap[data-section="section-primary-footer-builder"] {
    padding-top: 100px !important;
    padding-bottom: 80px !important;
}
@media (max-width: 921px) {
    .site-footer .site-primary-footer-wrap[data-section="section-primary-footer-builder"] {
        padding-top: 80px !important;
        padding-bottom: 50px !important;
    }
}

/* ---------- Name row: First (25%) / Last (25%) / Organization (50%) ----
   Add the .name-row class to the first .number-field--wrapper in the
   CF7 form. flex-grow 1/1/2 over a 0 basis yields exact 25/25/50 of
   the space left after the 20px gaps. */
.unlock-contact--wrapper .number-field--wrapper.name-row > .number-field {
    flex: 1 1 0;
    min-width: 0;
}
/* Organization matches the second row's column exactly — same width as
   Title, so their left edges align. (A 3-item row has two 20px gaps vs
   the 2-item row's one, so a plain 50% would sit 10px off.) */
.unlock-contact--wrapper .number-field--wrapper.name-row > .number-field:last-child {
    flex: 0 0 calc((100% - 20px) / 2);
}
@media (max-width: 781px) {
    .unlock-contact--wrapper .number-field--wrapper.name-row {
        flex-wrap: wrap;
		column-gap: 16px;
        row-gap: 0;
    }
    /* First + Last share one line, Organization takes its own */
    .unlock-contact--wrapper .number-field--wrapper.name-row > .number-field {
        flex: 1 1 calc(50% - 10px);
    }
    .unlock-contact--wrapper .number-field--wrapper.name-row > .number-field:last-child {
        flex: 1 1 100%;
    }
}

/* ---------- Mobile ---------- */
@media (max-width: 781px) {
    .p2p-calculator--wrapper
        .wp-block-uagb-container:has(.unlock-contact--wrapper) {
        padding-top: 90px; /* clear the absolutely-pinned label */
    }
}


/* --- P2P report cards: keep dollar figures intact at any width (2026-08-25) --- */
.full-report--wrapper .wp-block-column { container-type: inline-size; }
.full-report--wrapper .wp-block-column .wp-block-group { flex-wrap: wrap; row-gap: 2px; }
.full-report--wrapper .wp-block-column .wp-block-group > .wp-block-uagb-advanced-heading { width: auto; }
.full-report--wrapper .wp-block-column .wp-block-group > .wp-block-uagb-advanced-heading:first-child { flex: 1 1 0; min-width: 55%; }
.full-report--wrapper .wp-block-column .wp-block-group > .wp-block-uagb-advanced-heading:last-child { flex: 0 0 auto; }
.full-report--wrapper .wp-block-column .wp-block-group h3.uagb-heading-text,
.full-report--wrapper .wp-block-column .wp-block-group h4.uagb-heading-text { font-size: clamp(17px, 5.8cqw, 21px); }
.full-report--wrapper .wp-block-column .wp-block-group h4.uagb-heading-text { white-space: nowrap; }
