/* ============================================================
   Scrollstory — the site's HERO. Opens on the MacBook/Blender
   frame with the headline overlaid, and disassembles the Bugatti
   as the visitor scrolls (inverted playback in scrollstory.js).
   The outer track provides ~350vh of scroll distance to scrub
   the 122-frame sequence in images/scrollstory/.
   ============================================================ */

.scrollstory {
    position: relative;
    background: #fff;
    /* The closed laptop does NOT scroll away: the last 100vh of the
       track keeps it pinned while the rest of the page slides up OVER
       it (negative margin pulls the next section across the hold). */
    z-index: 0;
    margin-bottom: -100vh;
}

.scrollstory__track {
    height: 660vh; /* scrub 560vh + 100vh pinned hold under the cover */
}

/* Everything after the hero rides above it with its own paint.
   Sections only — a bare div sibling can be a fixed-position widget,
   and forcing it relative rips it into the page flow. */
.scrollstory ~ section {
    position: relative;
    z-index: 1;
}
.manifesto {
    background: var(--bg-secondary);
}
.services {
    background: #fff;
}

.scrollstory__sticky {
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100svh;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.scrollstory__canvas {
    /* Absolute, not a flex item: when the DPR resize writes the bitmap
       size back onto the element, flex centering starts offsetting it
       by the intrinsic/used size mismatch (hero drifts left). Pinned to
       the sticky's box it can never leave center. */
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
}

/* Overlays build PIECE BY PIECE on scroll (badge → line 1 → line 2 →
   tagline → CTA); scrollstory.js toggles .is-in on each .ss-reveal at
   its progress threshold. The headline sits at the TOP above the
   animation, the tagline + CTA at the bottom. */
.scrollstory__head {
    position: absolute;
    top: max(9vh, 94px);
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    pointer-events: none;
    width: min(92vw, 900px);
}

.scrollstory__hero {
    position: absolute;
    left: 50%;
    bottom: 5vh;
    transform: translateX(-50%);
    text-align: center;
    pointer-events: none;
    width: min(92vw, 900px);
}

.scrollstory__head .ss-reveal {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.45s ease, transform 0.45s ease;
}

.scrollstory__head .ss-reveal.is-in {
    opacity: 1;
    transform: translateY(0);
}

.scrollstory__hero .ss-reveal {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.45s ease, transform 0.45s ease;
}

.scrollstory__hero .ss-reveal.is-in {
    opacity: 1;
    transform: translateY(0);
}

.scrollstory__cta {
    pointer-events: auto;
}

.scrollstory__badge {
    font-size: clamp(11px, 0.9vw, 13px);
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-muted, #86868b);
    margin-bottom: 12px;
}

.scrollstory__title {
    margin: 0 0 12px;
    font-size: clamp(2.3rem, 5.4vw, 4rem);
    letter-spacing: -0.025em;
    line-height: 1.04;
    color: var(--text-primary, #1d1d1f);
}

.scrollstory__title .thin-line {
    display: block;
    font-weight: 300;
}

.scrollstory__title .strong-line {
    display: block;
    font-weight: 700;
}

.scrollstory__tagline {
    margin: 0 auto 20px;
    max-width: 560px;
    font-size: clamp(0.92rem, 1.3vw, 1.05rem);
    line-height: 1.5;
    letter-spacing: -0.012em;
    color: var(--text-secondary, #6e6e73);
}

.scrollstory__tagline strong {
    color: var(--text-primary, #1d1d1f);
    font-weight: 600;
}

/* Reduced motion: no pinned scrub — single static frame + headline */
@media (prefers-reduced-motion: reduce) {
    .scrollstory__track {
        height: auto;
    }
    .scrollstory__sticky {
        position: static;
        height: auto;
        aspect-ratio: 16 / 9;
        max-height: 100vh;
    }
}

/* The showreel mapped onto the MacBook screen in the final frames. */
.scrollstory__reel {
    position: absolute;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.35s ease;
    border-radius: 4px;
    pointer-events: none;
}

.scrollstory__reel.is-on {
    opacity: 1;
}


/* Mobile: the 16:9 frames are a small centered strip, so the headline
   and tagline/CTA are ALWAYS visible around it — no staged reveal, no
   floating anchors, far less empty white. */
@media (max-width: 820px) {
    .scrollstory__head {
        top: 84px;
        width: 94vw;
    }
    .scrollstory__hero {
        bottom: 4vh !important;
        top: auto !important;
        width: 94vw;
    }
    .scrollstory__head .ss-reveal,
    .scrollstory__hero .ss-reveal {
        opacity: 1 !important;
        transform: none !important;
        transition: none;
    }
    .scrollstory__title { font-size: clamp(2rem, 9vw, 2.6rem); }
    .scrollstory__badge { margin-bottom: 8px; }
}

/* Headline bows out while the lid closes. */
.scrollstory__head { transition: opacity 0.45s ease; }
.scrollstory__head.is-out { opacity: 0 !important; }

/* Closing beat: as the lid shuts, the founders sketch + handwritten
   line take the headline's place up top, then the page covers it. */
.scrollstory__closing {
    position: absolute;
    top: auto;
    bottom: 44vh; /* rides just above the closed lid */
    left: 50%;
    transform: translateX(-50%);
    width: min(92vw, 720px);
    text-align: center;
    pointer-events: none;
}
/* Fade the CHILDREN, never the container — container opacity isolates
   the blend group and the multiply stops compositing with the canvas. */
.scrollstory__closing > * {
    opacity: 0;
    transition: opacity 0.6s ease;
}
.scrollstory__closing.is-in > * { opacity: 1; }
.closing__sketch {
    display: block;
    width: min(230px, 42vw);
    height: auto;
    margin: 0 auto -36px;
    mix-blend-mode: multiply;
}
.closing__script {
    display: block;
    width: min(360px, 62vw);
    height: auto;
    margin: 0 auto;
    mix-blend-mode: multiply;
}
.closing__clients {
    margin: 4px auto 0;
    max-width: 560px;
    font-size: 12px;
    line-height: 1.65;
    color: var(--text-secondary, #6e6e73);
    text-wrap: balance;
}

/* Scrim: the hero dims underneath as the next section slides over it,
   selling the cover as a sheet with depth. Driven by scrollstory.js. */
.scrollstory__scrim {
    position: absolute;
    inset: 0;
    background: #000;
    opacity: 0;
    pointer-events: none;
    z-index: 6;
}

/* Closing beat staggers in: sketch, then the line, then trusted-by. */
.scrollstory__closing.is-in > .closing__sketch { transition-delay: 0s; }
.scrollstory__closing.is-in > .closing__script { transition-delay: 0.4s; }
.scrollstory__closing.is-in > .closing__clients { transition-delay: 0.8s; }

/* Per-element scroll-scrubbed reveal overrides the staggered variant. */
.scrollstory__closing > * { transition-delay: 0s !important; }
.scrollstory__closing > .is-in { opacity: 1 !important; }

/* Story progress: a thin lime line pinned to the top, scaling with the
   scrub. Vanishes outside the story. */
.ss-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: #CFFF04;
    transform-origin: 0 50%;
    transform: scaleX(0);
    z-index: 10000;
    pointer-events: none;
    transition: opacity 0.25s ease;
}
.ss-progress.is-off { opacity: 0; }

/* Mobile hero copy: headline off the very top edge, tagline + CTA
   pulled up toward the laptop. */
@media (max-width: 820px) {
    .scrollstory__head { top: 17vh; }
    .scrollstory__hero { bottom: 12vh !important; }
}
