/*
 * Landing v4 · before / after (lane "ba"). Static file, `nb-ba3` prefix, tokens from brand.css.
 * Benchmark: ManyChat "Your inbox: a before & after" (measured 2026-11-18, 1440x900): a 2-viewport
 * track with a 1-viewport sticky stage; over one viewport of scroll "after" takes over from "before".
 * Ours keeps the pinned stage and the two cards side by side (it is a comparison). Each card is only
 * a label, a title and its screen loop; the scroll moves the focus: "before" settles back, "after"
 * rises into place. No counters, flying dots or tags outside the screens (v3 had them; Steve 11-18:
 * less gimmick, more restraint). --p (0..1, eased) comes from before-after.js. Pinning is CSS only
 * and switches on with html.nb-motion, so no script means the static side-by-side layout.
 */

.nb-ba3 { padding-top: var(--sec); }
.nb-ba3__head { text-align: center; }
.nb-ba3__head .nb-h2 { max-width: 14em; margin: 0 auto; }
.nb-ba3__head .nb-lead { margin-left: auto; margin-right: auto; }

/* ─── Cards (stacked: phones, tablets, reduced motion, no script) ─── */
.nb-ba3__track { padding: clamp(40px, 5vw, 64px) var(--gutter) var(--sec); }
.nb-ba3__stage { position: relative; }
.nb-ba3__cards {
    display: grid; gap: 12px;
    max-width: 560px; margin: 0 auto;
}
.nb-ba3__card {
    display: flex; flex-direction: column; gap: 20px;
    padding: 24px 16px 16px;
    border-radius: var(--nb-radius-lg);
    min-width: 0;
}
.nb-ba3__card--before { background: var(--nb-mist); color: var(--nb-ink); }
.nb-ba3__card--after { background: var(--nb-ink); color: var(--nb-on-ink); }
.nb-ba3__copy { padding: 0 8px; }
.nb-ba3__label {
    display: flex; align-items: center; gap: 8px;
    font-size: 15px; font-weight: 700; color: var(--nb-ink-3);
}
.nb-ba3__label .nb-i { width: 16px; height: 16px; stroke-width: 3; }
.nb-ba3__card--after .nb-ba3__label { color: rgba(255, 255, 255, .72); }
.nb-ba3__h { margin-top: 10px; word-break: keep-all; text-wrap: balance; } /* type: .nb-h3 (landing.css) */

/* The video: poster underneath, video fades in once it really plays. Square on tablet and up,
   a 4:5 portrait cut with larger type on phones. */
.nb-ba3__media {
    position: relative; overflow: hidden;
    aspect-ratio: 4 / 5;
    border-radius: 16px;
    background: var(--nb-paper);
}
@media (min-width: 640px) { .nb-ba3__media { aspect-ratio: 1; } }
.nb-ba3__card--before .nb-ba3__media { box-shadow: 0 0 0 1px var(--nb-line); }
.nb-ba3__media picture { display: contents; }
.nb-ba3__poster, .nb-ba3__video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.nb-ba3__video { opacity: 0; transition: opacity var(--nb-dur-2, 200ms) ease; }
.nb-ba3__video.is-playing { opacity: 1; }

/* No video configured: the three lines carry the message. */
.nb-ba3__list { padding: 0 8px; }
.nb-ba3__list li {
    display: flex; align-items: center; min-height: 52px;
    border-top: 1px solid var(--nb-line);
    font-size: 17px; font-weight: 600;
}
.nb-ba3__card--after .nb-ba3__list li { border-color: rgba(255, 255, 255, .14); }

.nb-ba3__cta { display: flex; justify-content: center; margin-top: 28px; }

@media (min-width: 640px) {
    .nb-ba3__card { padding: 32px 24px 24px; gap: 24px; }
}

/* ─── Pinned stage (laptop and up, tall enough, motion allowed) ─── */
@media (min-width: 1024px) and (min-height: 640px) {
    /* Side by side even without the pin (reduced motion / no script): it is a comparison. */
    .nb-ba3 {
        --m: min(560px, 36vw, calc(100svh - 400px));
        --cw: calc(var(--m) + 56px);
        --gap: 32px;
    }
    .nb-ba3__cards {
        grid-template-columns: var(--cw) var(--cw);
        gap: var(--gap);
        max-width: none;
        justify-content: center;
        align-items: stretch;
    }
    /* If a title ever wraps to a third line, both screens still line up at the bottom. */
    .nb-ba3__media { margin-top: auto; }
    .nb-ba3__card { padding: 28px; gap: 20px; }
    .nb-ba3__copy { padding: 0 4px; }

    html.nb-motion .nb-ba3__track {
        /* Most of a viewport of scroll moves the focus, with a hold at each end. */
        height: 180svh;
        padding: 0;
    }
    html.nb-motion .nb-ba3__stage {
        position: sticky; top: 0;
        height: 100svh;
        display: flex; flex-direction: column; justify-content: center;
        padding-top: var(--nav-h);
    }
    /* The focus moves with the scroll: "before" settles back and quiets, "after" rises into place. */
    html.nb-motion .nb-ba3__card { will-change: transform; }
    html.nb-motion .nb-ba3__card--before { transform: scale(calc(1 - .025 * var(--p, 0))); }
    html.nb-motion .nb-ba3__card--before > * { opacity: calc(1 - .32 * var(--p, 0)); }
    html.nb-motion .nb-ba3__card--after { transform: translateY(calc(40px * (1 - var(--p, 0)))); }
    html.nb-motion .nb-ba3__card--after > * { opacity: calc(.5 + .5 * var(--p, 0)); }
    html.nb-motion .nb-ba3__cta { margin-top: clamp(20px, 3svh, 32px); }
}

@media (prefers-reduced-motion: reduce) {
    .nb-ba3__video { display: none; }
}
