/* ============================================================
   SCROLLYTELLING — FRAME-SEQUENCE SCROLL STORY (Apple-style)
   Modular block: safe to include on any page with GSAP loaded.
   Depends on tokens defined in index.html's :root (falls back
   to hard-coded values if used standalone).
============================================================ */

.scroll-story {
    position: relative;
    /* Scroll distance that drives the sequence — higher = slower/smoother scrub
       through the frames, lower = faster. Raise/lower this one value to tune. */
    height: 1375vh;
    background: var(--bg-primary, #0F0F0F);
}

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

.scroll-story__canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    opacity: 0;
    transition: opacity 0.6s ease;
}
.scroll-story__canvas.is-ready { opacity: 1; }

/* Contrast scrim so overlay text stays legible over any frame */
.scroll-story__scrim {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg,
        rgba(0,0,0,0.40) 0%,
        rgba(0,0,0,0.12) 30%,
        rgba(0,0,0,0.12) 70%,
        rgba(0,0,0,0.50) 100%);
    pointer-events: none;
}

.scroll-story__overlay {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 100%;
    max-width: 1040px;
    margin: 0 auto;
    pointer-events: none;
}

.story-stage {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0 2rem;
    opacity: 0;
    will-change: opacity, transform;
}
/* Stage 1 is the page opener — visible immediately, before GSAP takes over */
.story-stage[data-stage="1"] { opacity: 1; }

.story-stage__eyebrow {
    display: block;
    font-family: var(--font-mono, 'SF Mono', monospace);
    font-size: 0.75rem;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--color-accent, #34D399);
    margin-bottom: 1rem;
}

.story-stage__title {
    font-size: clamp(1.5rem, 3.8vw, 2.75rem);
    font-weight: 900;
    letter-spacing: -0.03em;
    line-height: 1.2;
    color: #fff;
    margin: 0 0 1rem;
    max-width: 900px;
    text-shadow: 0 2px 30px rgba(0,0,0,0.5);
}

.story-stage__desc {
    font-size: clamp(1rem, 2vw, 1.25rem);
    color: rgba(255,255,255,0.8);
    max-width: 560px;
    line-height: 1.55;
    margin: 0;
}

.scroll-story__progress {
    position: absolute;
    left: 50%;
    bottom: 2.5rem;
    transform: translateX(-50%);
    width: 160px;
    height: 2px;
    background: rgba(255,255,255,0.15);
    z-index: 2;
    border-radius: 2px;
    overflow: hidden;
}
.scroll-story__progress-bar {
    display: block;
    height: 100%;
    width: 0%;
    background: var(--color-accent, #34D399);
    box-shadow: 0 0 8px var(--color-accent, #34D399);
}

/* Respect reduced-motion: drop the pin/scrub, show a static stack instead */
@media (prefers-reduced-motion: reduce) {
    .scroll-story.no-motion {
        height: auto;
    }
    .scroll-story.no-motion .scroll-story__pin {
        position: relative;
        height: 100vh;
        overflow: hidden;
    }
    .scroll-story.no-motion .story-stage {
        transition: opacity 0.5s ease;
    }
}

@media (max-width: 640px) {
    .story-stage__title { font-size: clamp(1.35rem, 6.5vw, 1.9rem); }
    .story-stage__desc { font-size: 0.95rem; }
    .scroll-story__progress { bottom: 1.5rem; }
}
