/* ============================================================================
   Voicy.ai — 2026 Core Modular Stylesheet
   Variables, Scrollytelling Sizing, Components & Keyframes
   ============================================================================ */

:root {
    --voicy-emerald: #10B981;
    --voicy-cyan: #06B6D4;
    --voicy-teal: #00C49F;
    --voicy-blue: #0052CC;
    --voicy-dark: #070A11;

    /* Motion tokens — one vocabulary for every transition on the page */
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-out-quint: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-curtain: cubic-bezier(0.32, 0.72, 0, 1);     /* moves at once, soft landing (sheet curve) */
    --curtain-dur: 750ms;                                 /* keep in sync with scroller.js */
    /* Hover / press / toggle: one timing everywhere (Tailwind `transition` uses it too) */
    --dur-ui: 200ms;
    --ease-ui: cubic-bezier(0.2, 0, 0, 1);
}

html, body {
    margin: 0;
    padding: 0;
    background-color: rgb(var(--c-canvas));
    color: rgb(var(--c-ink));
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

.font-serif-hero {
    font-family: 'Playfair Display', Georgia, serif;
}

.font-mono {
    font-family: 'JetBrains Mono', monospace;
}

/* -------------------------------------------------------------------------
   Full-Screen Viewport Scrollytelling Sections
   Each slide is designed to fit fully in the viewport height on desktop
   ------------------------------------------------------------------------- */
.slide-section {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    justify-content: safe center; /* overflowing content stays reachable at the top */
    position: relative;
    padding-top: 4.5rem;
    padding-bottom: 2rem;
    box-sizing: border-box;
}


/* Ambient subtle grid backdrop */
.bg-grid-glow {
    background-image: 
        radial-gradient(circle at 50% 20%, rgba(16, 185, 129, 0.06) 0%, transparent 60%),
        radial-gradient(circle at 80% 50%, rgba(6, 182, 212, 0.05) 0%, transparent 55%),
        linear-gradient(to right, rgba(15, 23, 42, 0.035) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(15, 23, 42, 0.035) 1px, transparent 1px);
    background-size: 100% 100%, 100% 100%, 48px 48px, 48px 48px;
}

/* "Live" status dot: the dot stays solid and a soft ring ripples out behind it
   (replaces animate-ping, which blinked the dot itself out every second) */
.live-dot { position: relative; isolation: isolate; }
.live-dot::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    border-radius: inherit;
    background: inherit;
    animation: liveRipple 2s var(--ease-out-quint) infinite;
}
@keyframes liveRipple {
    0% { transform: scale(1); opacity: 0.55; }
    70%, 100% { transform: scale(2.4); opacity: 0; }
}

/* Soundwave equalizer bars */
@keyframes eqWave {
    0%, 100% { transform: scaleY(0.35); }
    50% { transform: scaleY(1.2); }
}
.eq-bar {
    animation: eqWave 0.8s ease-in-out infinite;
    transform-origin: center;
}

/* Pulse and Orbit Animations for Visual Stages */
@keyframes orbitSlow {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
/* Breathes by scale only: fading the opacity washed out the white label on light backgrounds */
@keyframes pulseGlow {
    0%, 100% { transform: scale(0.97); }
    50% { transform: scale(1.03); }
}
.animate-orbit {
    animation: orbitSlow 24s linear infinite;
}
.animate-pulse-glow {
    animation: pulseGlow 4s ease-in-out infinite;
}

/* -------------------------------------------------------------------------
   Section 2: Work Step Hover Styles
   ------------------------------------------------------------------------- */
.work-step-active {
    background: #FFFFFF !important;
    border-color: #10B981 !important;
    box-shadow: 0 10px 28px -12px rgba(4, 120, 87, 0.35), 0 0 0 3px rgba(16, 185, 129, 0.12);
    opacity: 1 !important;
    transform: translateX(3px);
}
.work-step-active-right {
    background: #FFFFFF !important;
    border-color: #10B981 !important;
    box-shadow: 0 10px 28px -12px rgba(4, 120, 87, 0.35), 0 0 0 3px rgba(16, 185, 129, 0.12);
    opacity: 1 !important;
    transform: translateX(-3px);
}

/* -------------------------------------------------------------------------
   Section 2 on phones & tablets: swipeable step cards (scripts/how_mobile.py)
   ------------------------------------------------------------------------- */
.how-track { scroll-padding-inline: 1rem; overscroll-behavior-x: contain; }
@media (min-width: 640px) { .how-track { scroll-padding-inline: 1.5rem; } }
.how-track:focus-visible { outline-offset: 4px; }
.how-flow-btn {
    background: rgb(var(--c-surface));
    border-color: rgb(var(--c-line));
    color: rgb(var(--c-body));
}
.how-flow-btn.is-active {
    background: rgb(var(--c-brand));
    border-color: rgb(var(--c-brand));
    color: #FFFFFF;
    box-shadow: 0 4px 12px -4px rgba(4, 120, 87, 0.45);
}
/* 24px tap target around an 8px dot; the active dot stretches into a pill */
.how-dot {
    position: relative;
    width: 1.5rem;
    height: 1.5rem;
    cursor: pointer;
}
.how-dot::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 9999px;
    background: rgb(148 163 184 / 0.6);
    translate: -50% -50%;
    transition: width var(--dur-ui) var(--ease-ui), background-color var(--dur-ui) var(--ease-ui);
}
.how-dot.is-active::before { width: 1.25rem; background: rgb(var(--c-brand)); }

/* iPhone mock-up rising from the bottom edge of each step card.
   The full phone is drawn; .iphone-crop shows only its top part. */
/* Grows to fill the card (cards share the tallest card's height), so cards
   with shorter text show more of the phone instead of an empty gap. */
.iphone-crop {
    flex: 1 0 18rem;
    overflow: hidden;
    display: flex;
    justify-content: center;
    padding-top: 0.75rem;
}
.iphone {
    position: relative;
    width: min(84%, 16.5rem);
    height: 33rem;
    padding: 0.45rem;
    border-radius: 2.6rem;
    background: #0B0B0F;
    box-shadow:
        0 0 0 1.5px #3A3A40,                       /* titanium edge */
        0 18px 40px -14px rgba(15, 23, 42, 0.45);
}
/* side buttons: action + volume (left), power (right) */
.iphone::before,
.iphone::after {
    content: '';
    position: absolute;
    width: 3px;
    border-radius: 2px;
    background: #3A3A40;
}
.iphone::before { left: -4px; top: 5.2rem; height: 1.6rem; box-shadow: 0 2.6rem 0 #3A3A40, 0 5rem 0 #3A3A40; }
.iphone::after  { right: -4px; top: 7rem; height: 3.6rem; }
.iphone-screen {
    position: relative;
    height: 100%;
    border-radius: 2.15rem;
    overflow: hidden;
    background: #FFFFFF;
    color: #0F172A;
    display: flex;
    flex-direction: column;
}
.iphone-screen.is-dark {
    background: linear-gradient(180deg, #273244 0%, #0F172A 55%, #0B1120 100%);
    color: #FFFFFF;
}
.iphone-status {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    column-gap: 0.4rem;
    padding: 0.5rem 0.95rem 0.3rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #0F172A;
}
.iphone-status > :last-child { justify-self: end; }
.iphone-status.is-dark { color: #FFFFFF; }
.iphone-island {
    width: 4.4rem;
    height: 1.3rem;
    border-radius: 9999px;
    background: #000000;
}
.iphone-avatar {
    width: 2.5rem;
    height: 2.5rem;
    flex-shrink: 0;
    border-radius: 9999px;
    background: linear-gradient(180deg, #A5B4C8 0%, #7C8AA0 100%);
    color: #FFFFFF;
    font-size: 0.875rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}
.iphone-avatar.is-large { width: 4rem; height: 4rem; font-size: 1.375rem; }

/* Messages app */
.iphone-msg-header {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.2rem 0 0.45rem;
    background: #F6F6F8;
    border-bottom: 1px solid #E5E7EB;
}
.iphone-back { position: absolute; left: 0.5rem; top: 0.85rem; color: #0A66E0; }
.iphone-thread {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 0.55rem 0.65rem;
}
.imsg {
    max-width: 82%;
    padding: 0.45rem 0.7rem;
    border-radius: 1.1rem;
    font-size: 0.8125rem;
    line-height: 1.3;
}
.imsg-in  { align-self: flex-start; background: #E9E9EB; color: #0F172A; border-bottom-left-radius: 0.35rem; }
/* iMessage blue, a shade deeper than Apple's so white text passes 4.5:1 */
.imsg-out { align-self: flex-end; background: #0A66E0; color: #FFFFFF; border-bottom-right-radius: 0.35rem; }
.imsg-meta { align-self: flex-end; font-size: 0.625rem; color: #6B7280; margin-top: -0.15rem; }
.iphone-receipt-total {
    border-top: 1px solid rgba(15, 23, 42, 0.12);
    margin-top: 0.25rem;
    padding-top: 0.25rem;
    font-weight: 700;
}

/* Phone app: calling / in call */
.iphone-call {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 0.75rem 0.85rem 0;
}
.iphone-call-buttons { display: flex; gap: 0.9rem; margin-top: 0.9rem; }
.iphone-call-buttons span,
.iphone-end {
    width: 2.9rem;
    height: 2.9rem;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.iphone-call-buttons span { background: rgba(255, 255, 255, 0.16); }
.iphone-end { margin-top: 0.75rem; background: #FF3B30; }
.iphone-caption {
    font-size: 0.8125rem;
    line-height: 1.3;
    text-align: left;
    padding: 0.45rem 0.65rem;
    border-radius: 0.9rem;
    background: rgba(255, 255, 255, 0.09);
    color: #E5E7EB;
}
.iphone-caption.is-business { background: rgba(16, 185, 129, 0.2); color: #ECFDF5; }

/* Messages input bar (bottom of the Messages screen) */
.iphone-input {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.6rem 1.35rem;
}
.iphone-input-plus {
    width: 1.75rem;
    height: 1.75rem;
    flex-shrink: 0;
    border-radius: 9999px;
    background: #E9E9EB;
    color: #6B7280;
    display: flex;
    align-items: center;
    justify-content: center;
}
.iphone-input-field {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 1.9rem;
    padding: 0 0.7rem;
    border-radius: 9999px;
    border: 1px solid #D1D5DB;
    font-size: 0.75rem;
    color: #6B7280;
}

/* Desktop: one full iPhone whose screen swaps per step */
.iphone.is-desktop {
    width: 15rem;
    height: 31rem;
}
.iphone-view {
    flex: 1;
    min-height: 0;
    flex-direction: column;
    background: #FFFFFF;
    color: #0F172A;
}
.iphone-view:not(.hidden) { display: flex; }
/* Full phone: the calling screen's buttons sit low, like the real Phone app */
.iphone.is-desktop .iphone-call { flex: 1; padding-bottom: 1.9rem; }
.iphone.is-desktop .iphone-call .iphone-call-buttons { margin-top: auto; }
.iphone-view.is-dark {
    background: linear-gradient(180deg, #273244 0%, #0F172A 55%, #0B1120 100%);
    color: #FFFFFF;
}
.iphone-home {
    position: absolute;
    left: 50%;
    bottom: 0.4rem;
    width: 35%;
    height: 0.28rem;
    border-radius: 9999px;
    background: #0F172A;
    translate: -50% 0;
    pointer-events: none;
}
.iphone-screen:has(.iphone-view.is-dark:not(.hidden)) .iphone-home { background: rgba(255, 255, 255, 0.85); }
.iphone-caption-who {
    display: block;
    font-size: 0.625rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.65);
    margin-bottom: 0.1rem;
}

/* -------------------------------------------------------------------------
   Section 4: About Voicy Tab Active State (Matches Screenshot 3)
   Fix: Clean left-pointer triangle and zero overlap with text
   ------------------------------------------------------------------------- */
.about-tab-item {
    position: relative;
    transition-property: background-color, border-color, color, box-shadow;
    transition-duration: var(--dur-ui);
    transition-timing-function: var(--ease-ui);
}

.about-tab-active {
    background-color: rgb(var(--c-brand)) !important;
    color: #FFFFFF !important;
    border-color: rgb(var(--c-brand)) !important;
    box-shadow: 0 10px 24px -8px rgba(4, 120, 87, 0.45);
    position: relative;
}
.about-tab-active .about-tab-title { color: #FFFFFF; }

.about-tab-active::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-top: 7px solid transparent;
    border-bottom: 7px solid transparent;
    border-right: 8px solid rgb(var(--c-brand));
}

/* Screen transition fade */
.screen-fade {
    transition: opacity 0.2s ease, transform 0.2s ease;
}

/* Hero Waveform Visualizer */
@keyframes heroWavePulseActive {
    0%, 100% { transform: scaleY(0.25); opacity: 0.6; }
    50% { transform: scaleY(1.0); opacity: 1; }
}

@keyframes heroWavePulseIdle {
    0%, 100% { transform: scaleY(0.4); opacity: 0.4; }
    50% { transform: scaleY(0.7); opacity: 0.6; }
}

.hero-wave-active .hero-wave-bar {
    animation: heroWavePulseActive 0.5s infinite ease-in-out alternate;
    transform-origin: center;
}

.hero-wave-idle .hero-wave-bar {
    animation: heroWavePulseIdle 2s infinite ease-in-out alternate;
    transform-origin: center;
}



/* -------------------------------------------------------------------------
   Discrete Layered Curtain Slide & Card Stacking (fullPage.js Style)
   ------------------------------------------------------------------------- */
@media (min-width: 1024px) {
    html, body {
        overflow: hidden !important;
        height: 100vh !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .slide-section-fit,
    .chapter-viewport {
        height: 100vh !important;
        max-height: 100vh !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        /* Short laptop screens: a chapter taller than the viewport scrolls internally
           (scroller.js advances only once its edge is reached). */
        overflow-x: hidden !important;
        overflow-y: auto !important;
        overscroll-behavior: contain;
        scrollbar-width: thin;
        scrollbar-color: rgba(16, 185, 129, 0.35) transparent;
        /* Soft lift so each sliding section still reads as a layer on white */
        box-shadow: 0 -24px 48px -20px rgba(15, 23, 42, 0.22);
        will-change: transform, opacity;
        backface-visibility: hidden;
        /* Opacity runs for the full move: fading faster than the incoming card
           arrives is what left a blank frame after the hero. */
        transform-origin: 50% 40%;
        transition:
            transform var(--curtain-dur) var(--ease-curtain),
            opacity var(--curtain-dur) var(--ease-curtain);
    }

    .chapter-viewport::-webkit-scrollbar { width: 6px; }
    .chapter-viewport::-webkit-scrollbar-thumb { background: rgba(16, 185, 129, 0.35); border-radius: 3px; }
    .chapter-viewport::-webkit-scrollbar-track { background: transparent; }

    /* Used on first paint / breakpoint changes to place layers without animating */
    .curtain-instant .chapter-viewport { transition: none !important; }
}

@media (max-width: 1023px) {
    html, body {
        overflow-y: auto !important;
        height: auto !important;
    }

    .chapter-viewport {
        position: relative !important;
        height: auto !important;
        min-height: 100vh !important;
        max-height: none !important;
        overflow: visible !important;
        transform: none !important;
        opacity: 1 !important;
    }
}

/* 3D backdrop fades in on its first rendered frame instead of popping in */
#three-bg {
    opacity: 0;
    transition: opacity 1.2s var(--ease-out-quint);
}
#three-bg.is-live { opacity: 1; }
/* Leaving the hero: fade out, then three-engine.js stops the render loop */
#three-bg.is-paused { opacity: 0; transition-duration: 0.45s; }

/* Top progress bar — scaled, not resized */
#scroll-progress-bar {
    transform-origin: 0 50%;
    transform: scaleX(0);
    transition: transform var(--curtain-dur) var(--ease-curtain);
}
@media (max-width: 1023px) {
    #scroll-progress-bar { transition: none; }
}

/* -------------------------------------------------------------------------
   Chapter entrance choreography (driven by motion.js)
   Uses the individual `translate` / `scale` properties so Tailwind `transform`
   utilities (hover lifts, scale-[1.01] etc.) keep working on the same nodes.
   ------------------------------------------------------------------------- */
@keyframes fxReveal {
    from { opacity: 0; translate: 0 16px; }
    to   { opacity: 1; translate: 0 0; }
}
@keyframes fxRevealScale {
    from { opacity: 0; translate: 0 12px; scale: 0.97; }
    to   { opacity: 1; translate: 0 0; scale: 1; }
}
@keyframes fxSwap {
    from { opacity: 0; translate: 0 8px; }
    to   { opacity: 1; translate: 0 0; }
}

.chapter-viewport.is-entering [data-reveal],
.chapter-viewport.is-entering [data-reveal-group] > * {
    /* First visit only (motion.js). Starts while the card is still sliding in,
       so the card never arrives empty. Last item done by ~1.3s. */
    animation: fxReveal 0.7s var(--ease-out-expo) both;
    animation-delay: calc(var(--ri, 0) * 45ms + 120ms);
}
.chapter-viewport.is-entering [data-reveal="scale"] {
    animation-name: fxRevealScale;
    animation-duration: 0.8s;
}

/* Content swaps inside a chapter (tabs, dossiers, phone screens) */
.fx-swap {
    animation: fxSwap 0.5s var(--ease-out-expo) both;
    animation-delay: var(--swap-delay, 0ms);
}
.fx-swap [data-reveal-group] > * {
    animation: fxSwap 0.6s var(--ease-out-expo) both;
    animation-delay: calc(var(--si, 0) * 55ms + var(--swap-delay, 0ms));
}

/* -------------------------------------------------------------------------
   Navigation chrome
   ------------------------------------------------------------------------- */
#chapter-dock-dots .dock-dot {
    width: 10px;
    height: 10px;
    border-radius: 9999px;
    background-color: rgb(148 163 184 / 0.6);
    transition:
        transform 0.5s var(--ease-out-expo),
        background-color 0.3s ease,
        box-shadow 0.4s var(--ease-out-expo);
}
#chapter-dock-dots .dock-dot:hover { background-color: rgb(71 85 105); transform: scale(1.15); }
#chapter-dock-dots .dock-dot.is-active {
    background-color: #10B981;
    transform: scale(1.3);
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.18);
}

/* Compact dock on laptop widths so it never sits on top of content */
@media (max-width: 1699px) {
    #chapter-dock {
        right: 0.5rem;
        padding: 0.55rem 0.4rem;
    }
    #chapter-dock .dock-counter,
    #chapter-dock .dock-divider { display: none; }
}

/* Active section in the header nav */
.nav-link { position: relative; }
.nav-link.is-current { color: rgb(var(--c-brand)); }
header nav[aria-label="Primary"] .nav-link::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -7px;
    height: 2px;
    border-radius: 2px;
    background: #10B981;
    transform: scaleX(0);
    transition: transform 0.45s var(--ease-out-expo);
}
header nav[aria-label="Primary"] .nav-link.is-current::after { transform: scaleX(1); }
.nav-menu-panel .nav-link.is-current { background: rgb(236 253 245); }

/* Compact header menu */
.nav-menu-panel {
    opacity: 0;
    visibility: hidden;
    translate: 0 -6px;
    pointer-events: none;
    transition: opacity 0.2s ease, translate 0.3s var(--ease-out-expo), visibility 0s linear 0.3s;
}
.nav-menu-panel.is-open {
    opacity: 1;
    visibility: visible;
    translate: 0 0;
    pointer-events: auto;
    transition: opacity 0.2s ease, translate 0.3s var(--ease-out-expo), visibility 0s;
}

/* -------------------------------------------------------------------------
   Hero: live AI agent demo (hero-personas.js)
   ------------------------------------------------------------------------- */
.persona-tab { color: rgb(var(--c-body)); }
.persona-tab:hover { color: rgb(var(--c-ink)); background: rgb(255 255 255 / 0.7); }
.persona-tab.is-active {
    background: rgb(var(--c-brand));
    color: #FFFFFF;
    box-shadow: 0 4px 12px -4px rgba(4, 120, 87, 0.45);
}

/* Personas stacked; the active one cross-fades in on tab switch */
.agent-portrait .persona-media {
    position: absolute;
    inset: 0;
    opacity: 0;
    scale: 1.04;
    transition: opacity 0.5s var(--ease-out-quint), scale 0.7s var(--ease-out-expo);
}
.agent-portrait .persona-media.is-active { opacity: 1; scale: 1; }
.persona-media video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Talking copy sits on the still (frame 0) and is shown only while speaking.
   Appearing is instant (it starts on the identical frame); leaving blurs it
   away to the still before it silently rewinds. */
.persona-talk { opacity: 0; }
.persona-talk.is-talking { opacity: 1; }
.persona-talk.is-fading {
    opacity: 0;
    filter: blur(14px);
    transform: scale(1.03);
    transition: opacity 0.55s ease-out, filter 0.55s ease-out, transform 0.55s ease-out;
}

/* Voice ring: grows with the speaking level */
.agent-portrait {
    --voice-level: 0;
    box-shadow:
        0 0 0 calc(var(--voice-level) * 5px) rgba(16, 185, 129, 0.35),
        0 0 calc(10px + var(--voice-level) * 34px) rgba(16, 185, 129, calc(0.15 + var(--voice-level) * 0.45));
    transition: box-shadow 0.12s linear;
}
#agent-demo { --voice-level: 0; }
#agent-demo .agent-portrait { --voice-level: inherit; }

/* State indicator */
.agent-state-bars span {
    width: 3px;
    height: 30%;
    border-radius: 2px;
    background: #CBD5E1;
    transition: background 0.3s;
}
#agent-demo[data-state="listening"] .agent-state-bars span { background: #64748B; animation: eqWave 0.9s ease-in-out infinite; }
#agent-demo[data-state="speaking"] .agent-state-bars span { background: #10B981; animation: eqWave 0.55s ease-in-out infinite; }
#agent-demo[data-state="thinking"] .agent-state-bars span { background: #F59E0B; animation: paThink 1s ease-in-out infinite; }
#agent-demo[data-state="done"] .agent-state-bars span { background: #10B981; height: 60%; }
.agent-state-bars span:nth-child(1) { height: 50%; animation-delay: 0s; }
.agent-state-bars span:nth-child(2) { height: 90%; animation-delay: 0.15s !important; }
.agent-state-bars span:nth-child(3) { height: 65%; animation-delay: 0.3s !important; }
.agent-state-bars span:nth-child(4) { height: 40%; animation-delay: 0.45s !important; }
@keyframes paThink { 0%, 100% { opacity: 0.3; } 50% { opacity: 1; } }

/* Transcript */
.agent-transcript {
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, rgba(0, 0, 0, 0.25) 22px, #000 56px);
    mask-image: linear-gradient(to bottom, transparent 0, rgba(0, 0, 0, 0.25) 22px, #000 56px);
}
.agent-line {
    max-width: 92%;
    padding: 0.4rem 0.6rem;
    border-radius: 0.75rem;
    font-size: 0.75rem;
    line-height: 1.4;
    animation: fxSwap 0.4s var(--ease-out-expo) both;
}
.agent-line--caller {
    align-self: flex-start;
    background: rgb(var(--c-subtle));
    border: 1px solid rgb(var(--c-line));
    color: #334155;
}
.agent-line--agent {
    align-self: flex-end;
    background: #ECFDF5;
    border: 1px solid #A7F3D0;
    color: #064E3B;
}
.agent-line--action {
    align-self: center;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: #D1FAE5;
    border: 1px solid #6EE7B7;
    color: #065F46;
    font-size: 0.6875rem;
}
.agent-line-meta { color: rgb(var(--c-muted)); font-size: 0.625rem; }
.agent-line-who {
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: rgb(var(--c-muted));
    margin-bottom: 1px;
}
.agent-line--agent .agent-line-who { color: rgb(var(--c-brand)); }
.agent-line-text .w { opacity: 0.2; transition: opacity 0.18s ease-out; }
.agent-line-text .w.on { opacity: 1; }

/* -------------------------------------------------------------------------
   Section backgrounds (scripts/section_bg.py): shared base + voice signature
   ------------------------------------------------------------------------- */
.section-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}
.chapter-viewport > :not(.section-bg) { position: relative; z-index: 1; }
.section-bg > * { position: absolute; }
.bg-glow {
    inset: 0;
    background: radial-gradient(ellipse 45% 38% at 50% 18%, rgba(16, 185, 129, 0.11), transparent 72%);
}
.bg-dots {
    inset: 0;
    background-image: radial-gradient(rgba(15, 118, 110, 0.16) 1.1px, transparent 1.25px);
    background-size: 22px 22px;
    -webkit-mask-image: radial-gradient(ellipse 72% 62% at 50% 42%, #000 0%, transparent 78%);
    mask-image: radial-gradient(ellipse 72% 62% at 50% 42%, #000 0%, transparent 78%);
}
/* Sound-wave lines along the bottom; the 2x-wide track slides by half its
   width, and the waves repeat every half, so the loop has no seam. */
.bg-waves {
    left: 0;
    right: 0;
    bottom: 0;
    height: 30%;
    opacity: 0.6;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 14%, #000 86%, transparent);
    mask-image: linear-gradient(90deg, transparent, #000 14%, #000 86%, transparent);
}
.bg-waves-track {
    position: absolute;
    inset: 0 auto 0 0;
    width: 200%;
    animation: bgWaveDrift 90s linear infinite;
    will-change: transform;
}
.bg-waves svg { width: 100%; height: 100%; display: block; }
@keyframes bgWaveDrift { to { transform: translateX(-50%); } }
/* Voice ripples from a corner */
.bg-ripples {
    width: 36rem;
    height: 36rem;
}
.bg-ripples.is-br { right: -18rem; bottom: -18rem; }
.bg-ripples.is-tl { left: -18rem; top: -18rem; }
.bg-ripples.is-tr { right: -18rem; top: -18rem; }
.bg-ripples > span {
    position: absolute;
    inset: 0;
    margin: auto;
    border-radius: 9999px;
}
.bg-core {
    width: 18%;
    height: 18%;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.16), rgba(16, 185, 129, 0) 70%);
}
.bg-ring {
    width: calc(var(--r, 1) * 100%);
    height: calc(var(--r, 1) * 100%);
    border: 1px solid rgba(16, 185, 129, 0.16);
}
.bg-ring.is-wave {
    width: 100%;
    height: 100%;
    border-color: rgba(16, 185, 129, 0.35);
    opacity: 0;
    animation: bgRipple 10.2s cubic-bezier(0.25, 0.6, 0.3, 1) infinite;
    will-change: transform, opacity;
}
@keyframes bgRipple {
    0%   { transform: scale(0.18); opacity: 0; }
    12%  { opacity: 0.9; }
    100% { transform: scale(1); opacity: 0; }
}
/* Only the chapter on screen animates (inactive chapters are inert) */
.chapter-viewport[inert] .section-bg * { animation-play-state: paused; }

/* -------------------------------------------------------------------------
   About panel (scripts/about_panel.py). Each view's un-animated state is its
   finished picture; .is-playing runs the animation from the start.
   ------------------------------------------------------------------------- */
.about-anim-view:not(.hidden) { display: flex; }

/* auto-advance progress on the active tab (about-mission.js adds .is-auto) */
.about-progress {
    position: absolute;
    left: 0.875rem;
    right: 0.875rem;
    bottom: 0.4rem;
    height: 2px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.75);
    transform: scaleX(0);
    transform-origin: left;
    pointer-events: none;
}
/* the pointer arrow aims at the panel beside the tabs; stacked below it on phones */
@media (max-width: 1023px) { .about-tab-active::before { display: none; } }
.is-auto .about-tab-active .about-progress { animation: aboutProgress var(--about-auto, 7s) linear forwards; }
@keyframes aboutProgress { to { transform: scaleX(1); } }

.am-bubble {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    max-width: 85%;
    padding: 0.5rem 0.8rem;
    border-radius: 1rem;
    font-size: 0.8125rem;
    line-height: 1.3;
}
.am-in { align-self: flex-start; background: rgb(var(--c-subtle)); border: 1px solid rgb(var(--c-line)); color: rgb(var(--c-ink)); border-bottom-left-radius: 0.3rem; }
.am-out { align-self: flex-end; background: rgb(var(--c-brand)); color: #FFFFFF; border-bottom-right-radius: 0.3rem; }
.am-mic {
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 9999px;
    background: #ECFDF5;
    color: rgb(var(--c-brand));
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.am-track { position: relative; padding: 0 0.5rem; }
.am-line {
    position: absolute;
    left: 12.5%;
    right: 12.5%;
    top: 1.125rem;
    height: 2px;
    background: linear-gradient(90deg, #A7F3D0, #99F6E4);
}
.am-pulse {
    position: absolute;
    top: 50%;
    left: 0;
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 9999px;
    background: #10B981;
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.2), 0 0 14px rgba(16, 185, 129, 0.7);
    translate: -50% -50%;
    opacity: 0;
}
.am-nodes { position: relative; display: grid; grid-template-columns: repeat(4, 1fr); }
.am-node { display: flex; flex-direction: column; align-items: center; gap: 0.35rem; }
.am-node-dot {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 9999px;
    background: #FFFFFF;
    border: 1.5px solid #A7F3D0;
    color: rgb(var(--c-brand));
    display: flex;
    align-items: center;
    justify-content: center;
}
.am-node-label { font-size: 0.6875rem; font-weight: 600; color: rgb(var(--c-body)); }
/* static (finished) look: every stage lit */
.am-node-dot { background: rgb(var(--c-brand)); border-color: rgb(var(--c-brand)); color: #FFFFFF; }

.am-mission.is-playing .am-in { animation: amIn 6s ease-out infinite; }
.am-mission.is-playing .am-pulse { animation: amPulse 6s cubic-bezier(0.45, 0, 0.55, 1) infinite; }
.am-mission.is-playing .am-node:nth-child(1) .am-node-dot { animation: amNode1 6s infinite; }
.am-mission.is-playing .am-node:nth-child(2) .am-node-dot { animation: amNode2 6s infinite; }
.am-mission.is-playing .am-node:nth-child(3) .am-node-dot { animation: amNode3 6s infinite; }
.am-mission.is-playing .am-node:nth-child(4) .am-node-dot { animation: amNode4 6s infinite; }
.am-mission.is-playing .am-out { animation: amOut 6s ease-out infinite; }
@keyframes amIn {
    0% { opacity: 0; translate: 0 6px; }
    6%, 90% { opacity: 1; translate: 0 0; }
    100% { opacity: 0; }
}
@keyframes amPulse {
    0%, 12% { left: 0%; opacity: 0; }
    15% { left: 0%; opacity: 1; }
    58% { left: 100%; opacity: 1; }
    62%, 100% { left: 100%; opacity: 0; }
}
/* a stage lights when the pulse reaches it, and all reset at the loop end */
@keyframes amNode1 { 0%, 18% { background: #FFF; border-color: #A7F3D0; color: rgb(var(--c-brand)); } 21%, 90% { background: rgb(var(--c-brand)); border-color: rgb(var(--c-brand)); color: #FFF; box-shadow: 0 0 0 5px rgba(16,185,129,.15); } 96%, 100% { background: #FFF; border-color: #A7F3D0; color: rgb(var(--c-brand)); } }
@keyframes amNode2 { 0%, 30% { background: #FFF; border-color: #A7F3D0; color: rgb(var(--c-brand)); } 33%, 90% { background: rgb(var(--c-brand)); border-color: rgb(var(--c-brand)); color: #FFF; box-shadow: 0 0 0 5px rgba(16,185,129,.15); } 96%, 100% { background: #FFF; border-color: #A7F3D0; color: rgb(var(--c-brand)); } }
@keyframes amNode3 { 0%, 41% { background: #FFF; border-color: #A7F3D0; color: rgb(var(--c-brand)); } 44%, 90% { background: rgb(var(--c-brand)); border-color: rgb(var(--c-brand)); color: #FFF; box-shadow: 0 0 0 5px rgba(16,185,129,.15); } 96%, 100% { background: #FFF; border-color: #A7F3D0; color: rgb(var(--c-brand)); } }
@keyframes amNode4 { 0%, 52% { background: #FFF; border-color: #A7F3D0; color: rgb(var(--c-brand)); } 55%, 90% { background: rgb(var(--c-brand)); border-color: rgb(var(--c-brand)); color: #FFF; box-shadow: 0 0 0 5px rgba(16,185,129,.15); } 96%, 100% { background: #FFF; border-color: #A7F3D0; color: rgb(var(--c-brand)); } }
@keyframes amOut {
    0%, 60% { opacity: 0; clip-path: inset(0 100% 0 0 round 1rem); }
    63% { opacity: 1; clip-path: inset(0 100% 0 0 round 1rem); }
    74%, 90% { opacity: 1; clip-path: inset(0 0 0 0 round 1rem); }
    100% { opacity: 0; clip-path: inset(0 0 0 0 round 1rem); }
}

/* History timeline */
.am-timeline { position: relative; }
.am-tl-line {
    position: absolute;
    left: 12.5%;
    right: 12.5%;
    top: 0.45rem;
    height: 2px;
    background: rgb(var(--c-line));
}
.am-tl-fill { position: absolute; inset: 0; background: linear-gradient(90deg, #10B981, #0891B2); transform-origin: left; }
.am-tl-items { position: relative; display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.5rem; }
.am-ms { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 0.3rem; }
.am-ms-dot {
    width: 0.9rem;
    height: 0.9rem;
    border-radius: 9999px;
    background: #FFFFFF;
    border: 3px solid #10B981;
}
.am-ms.is-today .am-ms-dot { background: #10B981; box-shadow: 0 0 0 5px rgba(16, 185, 129, 0.18); }
.am-ms-year { font-size: 0.75rem; font-weight: 800; color: rgb(var(--c-brand)); }
.am-ms-text { font-size: 0.6875rem; line-height: 1.35; color: rgb(var(--c-body)); }
.am-counter {
    align-self: center;
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0 0.35rem;
    font-size: 1.75rem;
    font-weight: 800;
    color: rgb(var(--c-ink));
    letter-spacing: -0.02em;
}
.am-counter-label { flex-basis: 100%; text-align: center; font-size: 0.75rem; font-weight: 500; color: rgb(var(--c-body)); letter-spacing: 0; }
.am-history.is-playing .am-tl-fill { animation: amDraw 1.6s cubic-bezier(0.65, 0, 0.35, 1) both; }
.am-history.is-playing .am-ms { animation: amPop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both; animation-delay: calc(0.25s + var(--i) * 0.4s); }
.am-history.is-playing .am-ms.is-today .am-ms-dot { animation: amGlow 2s ease-in-out 2s infinite; }
@keyframes amDraw { from { transform: scaleX(0); } }
@keyframes amPop { from { opacity: 0; scale: 0.6; translate: 0 8px; } }
@keyframes amGlow { 50% { box-shadow: 0 0 0 9px rgba(16, 185, 129, 0.08); } }

/* People constellation */
.am-constellation { position: relative; height: 12.5rem; }
.am-links { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.am-links line {
    stroke: #A7F3D0;
    stroke-width: 1.5;
    stroke-dasharray: 0.02 0.03;
    vector-effect: non-scaling-stroke;
}
.am-hub {
    position: absolute;
    left: 50%;
    top: 50%;
    translate: -50% -50%;
    width: 4.5rem;
    height: 4.5rem;
    border-radius: 9999px;
    background: rgb(var(--c-brand));
    color: #FFFFFF;
    box-shadow: 0 0 0 6px rgba(16, 185, 129, 0.15);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.1rem;
    font-size: 0.5625rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}
.am-chip {
    position: absolute;
    translate: -50% -50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.35rem 0.6rem;
    border-radius: 0.6rem;
    background: #FFFFFF;
    border: 1px solid rgb(var(--c-line));
    box-shadow: 0 6px 16px -10px rgba(15, 23, 42, 0.35);
    white-space: nowrap;
}
.am-people.is-playing .am-hub { animation: amPop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
.am-people.is-playing .am-links line {
    animation: amLink 0.6s ease-out both, amMarch 1.6s linear infinite;
    animation-delay: calc(0.35s + var(--i) * 0.18s), 0s;
}
.am-people.is-playing .am-chip {
    animation:
        amPop 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) both,
        amFloat 4s ease-in-out infinite alternate;
    animation-delay: calc(0.55s + var(--i) * 0.18s), calc(1.6s + var(--i) * 0.4s);
}
@keyframes amLink { from { opacity: 0; } }
@keyframes amMarch { from { stroke-dashoffset: 0.05; } to { stroke-dashoffset: 0; } }  /* dots flow hub -> chip */
@keyframes amFloat { to { transform: translateY(-4px); } }

/* Focus: live examples */
.am-focus-card {
    padding: 0.7rem;
    border-radius: 0.9rem;
    background: rgb(var(--c-subtle));
    border: 1px solid rgb(var(--c-line));
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.am-chat {
    padding: 0.35rem 0.55rem;
    border-radius: 0.75rem;
    font-size: 0.6875rem;
    line-height: 1.3;
}
.am-chat-in { align-self: flex-start; background: #FFFFFF; border: 1px solid rgb(var(--c-line)); color: rgb(var(--c-ink)); border-bottom-left-radius: 0.25rem; }
.am-chat-out { align-self: flex-end; display: flex; align-items: center; gap: 0.25rem; background: rgb(var(--c-brand)); color: #FFFFFF; border-bottom-right-radius: 0.25rem; }
.am-outcome-bar { height: 0.4rem; border-radius: 9999px; background: rgb(var(--c-line)); overflow: hidden; }
.am-outcome-bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #10B981, #0891B2); transform-origin: left; }
.am-focus.is-playing .am-focus-card { animation: amPop 0.5s ease-out both; animation-delay: calc(var(--i) * 0.15s); }
.am-focus.is-playing .am-chat-in { animation: amPop 0.45s ease-out both; animation-delay: calc(0.5s + var(--i) * 0.7s); }
.am-focus.is-playing .am-chat-out { animation: amPop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) both; animation-delay: calc(0.95s + var(--i) * 0.7s); }
.am-focus.is-playing .am-outcome-bar span { animation: amDraw 1.1s cubic-bezier(0.65, 0, 0.35, 1) 2.6s both; }

/* -------------------------------------------------------------------------
   Reduced motion: keep the content, drop the choreography
   ------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    .chapter-viewport,
    #scroll-progress-bar {
        transition-duration: 0.01ms !important;
    }
    .chapter-viewport.is-entering [data-reveal],
    .chapter-viewport.is-entering [data-reveal-group] > *,
    .fx-swap,
    .fx-swap [data-reveal-group] > *,
    .eq-bar,
    .persona-talk.is-fading,
    .agent-state-bars span,
    .agent-line,
    .animate-orbit,
    .animate-pulse-glow,
    .animate-ping,
    .live-dot::after,
    .section-bg *,
    .about-anim-view *,
    .about-progress,
    .animate-pulse {
        animation: none !important;
    }
}

/* NO-SCROLLBAR UTILITY */
.no-scrollbar::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
}
.no-scrollbar {
    -ms-overflow-style: none !important;
    scrollbar-width: none !important;
}
