/* ============================================================
   PARASITE — Homepage / vitrine
   A single living blob travels down the page as you scroll.
   Light, neumorphic, minimal. Loaded ONLY by index.html,
   on top of style.css — overrides the old hero/showcase.
   ============================================================ */

/* The page itself scrolls freely & smoothly — no hard snapping,
   so the blob can drift continuously between scenes. */
html { scroll-behavior: smooth; }

/* Softer near-black for body text on the homepage (was #17172A) */
[data-theme="light"] { --text: #383C4E; }

.page {
    scroll-snap-type: none;          /* desktop = hard-scroll controller drives position */
}
.page > section { scroll-snap-align: none; }

/* Soft light backdrop with a breathing vignette (sits under the blob) */
.page::before {
    background:
        radial-gradient(120% 120% at 50% 0%, #F3F4F8 0%, var(--bg) 55%, #E3E5EC 100%);
}

/* ---- The blob: full-viewport, fixed, behind everything ---- */
#flubber {
    position: fixed;
    inset: 0;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    max-width: none;
    aspect-ratio: auto;
    transform: none;
    z-index: 1;
    pointer-events: none;
    transition: opacity 0.7s var(--ease);   /* fade out on blob-less scenes */
}

/* ============================================================
   NAV — minimal, floats over everything
   ============================================================ */
.nav {
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-bottom: none;
    mix-blend-mode: normal;
}
.nav.is-scrolled {
    background: transparent;          /* stay fully see-through even after scrolling */
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-bottom: none;
}

/* Connect button: neumorphic raised pill, like the rest of the UI's buttons
   (instead of the frosted translucent style from style.css). */
.nav-connect {
    border: none;
    background: var(--bg);
    color: var(--text-secondary);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow:
        4px 4px 10px var(--neu-dark),
        -4px -4px 10px var(--neu-light);
}
.nav-connect:hover {
    color: var(--accent);
    background: var(--bg);
    box-shadow:
        5px 5px 12px var(--neu-dark),
        -5px -5px 12px var(--neu-light);
}
.nav-connect:active {
    box-shadow:
        inset 2px 2px 5px var(--neu-dark),
        inset -2px -2px 5px var(--neu-light);
}

/* ============================================================
   SCENES
   ============================================================ */
.v-scene {
    position: relative;
    z-index: 2;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    padding: 0 clamp(28px, 8vw, 140px);
    pointer-events: none;          /* let the blob receive the mouse */
}
.v-scene > * { pointer-events: auto; }

.v-scene--center { justify-content: center; text-align: center; }
.v-scene--left   { justify-content: flex-start; }
.v-scene--right  { justify-content: flex-end; }

/* Wide enough that the big display headings always fit inside the frosted box */
.v-block { max-width: min(92vw, 26rem); }
.v-scene--center .v-block { max-width: min(92vw, 28rem); }

/* Frosted veil behind text so it stays legible over the blob */
.v-frost {
    padding: clamp(20px, 3vw, 40px) clamp(22px, 3vw, 46px);
    border-radius: var(--radius-lg);
    background: color-mix(in srgb, var(--bg-elevated) 26%, transparent);
    backdrop-filter: blur(14px) saturate(1.3);
    -webkit-backdrop-filter: blur(14px) saturate(1.3);
}

/* ---- Typography ---- */
.v-kicker {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 18px;
}
.v-line {
    font-family: var(--font-display);
    font-weight: 700;
    line-height: 1.02;
    letter-spacing: -0.025em;
    font-size: clamp(2.2rem, 5.5vw, 4.2rem);
    color: var(--text);
    overflow-wrap: break-word;   /* never let a long word spill out of the box */
}
.v-sub {
    margin-top: 18px;
    font-size: clamp(1rem, 1.6vw, 1.2rem);
    font-weight: 300;
    line-height: 1.55;
    color: var(--text-secondary);
}

/* ============================================================
   SCENE 1 — HERO
   ============================================================ */
.v-hero {
    flex-direction: column;
    justify-content: center;
    text-align: center;
    gap: 6px;
}

/* ── Lightweight CSS "flubber" — hidden by default (desktop uses the real
     WebGL blob); shown only on mobile via the media query below. ── */
.m-blob {
    display: none;
    position: absolute;
    top: 46%;
    left: 50%;
    width: min(56vw, 260px);
    aspect-ratio: 1;
    transform: translate(-50%, -50%);
    z-index: 0;
    pointer-events: none;
    opacity: 0.42;            /* soft background presence — text stays king */
}
.m-blob-core,
.m-blob-glow {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(38% 34% at 36% 30%, rgba(255,255,255,0.6) 0%, transparent 55%),
        radial-gradient(circle at 52% 58%, #a7d96a 0%, #8bc34a 44%, #6fa838 78%, #5c9a32 100%);
    border-radius: 64% 36% 62% 38% / 58% 44% 56% 42%;
    box-shadow:
        inset -7px -9px 28px rgba(40, 80, 20, 0.32),
        inset 9px 11px 28px rgba(255, 255, 255, 0.42);
    /* strong, organic wobble — two motions layered (morph + drift) */
    animation:
        mBlobMorph 5.5s ease-in-out infinite,
        mBlobDrift 8s ease-in-out infinite;
    will-change: border-radius, transform;
}
.m-blob-glow {
    filter: blur(26px);
    opacity: 0.6;
    /* glow morphs out of sync with the core, so edges look alive */
    animation:
        mBlobMorph 5.5s ease-in-out -2.7s infinite reverse,
        mBlobBreath 4s ease-in-out infinite;
}
/* big swings in the corner radii = visible, gooey deformation */
@keyframes mBlobMorph {
    0%,100% { border-radius: 64% 36% 62% 38% / 58% 44% 56% 42%; }
    20%     { border-radius: 38% 62% 45% 55% / 62% 38% 60% 40%; }
    40%     { border-radius: 55% 45% 35% 65% / 40% 60% 42% 58%; }
    60%     { border-radius: 42% 58% 60% 40% / 55% 42% 38% 62%; }
    80%     { border-radius: 60% 40% 48% 52% / 36% 64% 58% 42%; }
}
/* slow rotation + scale pulse so the silhouette keeps shifting */
@keyframes mBlobDrift {
    0%,100% { transform: rotate(-8deg) scale(1.02, 0.96); }
    25%     { transform: rotate(4deg)  scale(0.95, 1.06); }
    50%     { transform: rotate(10deg) scale(1.05, 0.97); }
    75%     { transform: rotate(-3deg) scale(0.98, 1.04); }
}
@keyframes mBlobBreath {
    0%,100% { opacity: 0.4; }
    50%     { opacity: 0.72; }
}
@media (prefers-reduced-motion: reduce) {
    .m-blob-core, .m-blob-glow { animation: none; }
}
.v-wordmark {
    font-family: var(--font-display);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: -0.04em;
    line-height: 0.86;
    font-size: clamp(2rem, 17vw, 13rem);
    color: #9FA0B2;                /* light grey, lighter than the old near-black */
    perspective: 800px;
    white-space: nowrap;           /* always one line — scales down instead of wrapping */
}
.v-wordmark span {
    display: inline-block;
    opacity: 0;
    transform: translateY(0.4em) rotateX(60deg);
    animation: vLetter 0.7s var(--ease-out) calc(0.15s + var(--i,0) * 0.05s) forwards;
    /* frosted light-grey glyphs with a neumorphic extrusion — light edge top-left,
       dark edge bottom-right — so the letters read as raised from the surface.
       Slight translucency lets the living blob ghost through, and the backdrop blur
       frosts the blob behind the word (no bg/radius → no visible tiles; negative
       letter-spacing overlaps the letter boxes so the blur reads as one continuous band). */
    color: color-mix(in srgb, #9FA0B2 20%, transparent);
    backdrop-filter: blur(10px) saturate(1.3);
    -webkit-backdrop-filter: blur(10px) saturate(1.3);
    text-shadow:
        -1px -1px 1px var(--neu-light),   /* neumorphic highlight (top-left) */
        2px 2px 4px var(--neu-dark);      /* neumorphic shadow (bottom-right) */
}
@keyframes vLetter { to { opacity: 1; transform: none; } }

.v-tagline {
    font-size: clamp(0.95rem, 2.1vw, 1.25rem);
    font-weight: 400;
    letter-spacing: 0.1em;
    text-transform: lowercase;
    white-space: nowrap;      /* keep it on one line */
    color: #5A5A70;           /* darker grey for legibility */
    margin-top: 12px;
    animation: vFade 1s var(--ease-out) 0.7s both;
    user-select: none;
    -webkit-user-select: none;
}
.v-scrollcue {
    position: absolute;
    bottom: 34px;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-mono);
    font-size: 1.4rem;
    line-height: 1;
    color: var(--text-dim);
    animation: vFade 1s var(--ease-out) 1.2s both, vBob 2.4s ease-in-out 1.6s infinite;
    pointer-events: none;
}
@keyframes vFade { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes vBob  { 0%,100% { transform: translate(-50%, 0); } 50% { transform: translate(-50%, 7px); } }

/* ============================================================
   SCROLL REVEAL
   ============================================================ */
.v-reveal {
    opacity: 0;
    transform: translateY(56px);
    transition:
        opacity 0.55s var(--ease-out),
        transform 1s cubic-bezier(0.22, 1.5, 0.36, 1);   /* strong overshoot = springy */
    will-change: transform, opacity;
}
/* directional entrances — box swings in from its own side, tilt straightens out */
.v-scene--left  .v-reveal { transform: translateX(-170px) rotate(-2.5deg); }
.v-scene--right .v-reveal { transform: translateX(170px) rotate(2.5deg); }
.v-scene--center .v-reveal { transform: translateY(72px) scale(0.9); }
.v-reveal.visible { opacity: 1; transform: none; }

/* staggered cascade of the lines inside each box */
.v-reveal .v-kicker,
.v-reveal .v-line,
.v-reveal .v-sub {
    opacity: 0;
    transform: translateY(28px);
    transition:
        opacity 0.5s var(--ease-out),
        transform 0.7s cubic-bezier(0.22, 1.5, 0.36, 1);
}
.v-reveal.visible .v-kicker { opacity: 1; transform: none; transition-delay: 0.12s; }
.v-reveal.visible .v-line   { opacity: 1; transform: none; transition-delay: 0.22s; }
.v-reveal.visible .v-sub    { opacity: 1; transform: none; transition-delay: 0.36s; }

/* ============================================================
   SHOWCASE — coverflow media carousel (auto-advancing)
   ============================================================ */
.v-showcase {
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: clamp(20px, 4vh, 38px);
}
.v-showcase-head { text-align: center; }
.v-showcase-title { font-size: clamp(1.6rem, 4vw, 2.6rem); margin-top: 6px; }

.vs-carousel {
    position: relative;
    width: min(900px, 94vw);
    height: min(52vh, 460px);
    perspective: 1700px;
}
.vs-stage {
    position: absolute;
    inset: 0;
    transform-style: preserve-3d;
}
.vs-slide {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 70%;
    aspect-ratio: 16 / 10;
    transform: translate(-50%, -50%);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--bg);
    box-shadow:
        10px 10px 26px var(--neu-dark),
        -10px -10px 26px var(--neu-light);
    transition: transform 0.6s var(--ease), opacity 0.6s var(--ease);
    cursor: pointer;
    will-change: transform, opacity;
}
.vs-slide.is-active { cursor: grab; }
.vs-slide.is-active:active { cursor: grabbing; }
.vs-slide img,
.vs-slide video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.vs-btn { display: none; }   /* navigate by click / drag, no arrows */
.vs-btn--unused {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 20;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: none;
    background: var(--bg);
    color: var(--text-secondary);
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    box-shadow:
        5px 5px 12px var(--neu-dark),
        -5px -5px 12px var(--neu-light);
    transition: color var(--dur), box-shadow var(--dur), transform var(--dur);
}
.vs-btn:hover { color: var(--accent); }
.vs-btn:active {
    box-shadow:
        inset 2px 2px 5px var(--neu-dark),
        inset -2px -2px 5px var(--neu-light);
}
.vs-prev { left: clamp(4px, 2vw, 26px); }
.vs-next { right: clamp(4px, 2vw, 26px); }

.vs-dots { display: flex; gap: 11px; }
.vs-dot {
    width: 9px;
    height: 9px;
    padding: 0;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    background: var(--bg);
    box-shadow:
        inset 2px 2px 4px var(--neu-dark),
        inset -2px -2px 4px var(--neu-light);
    transition: background var(--dur);
}
.vs-dot.active { background: var(--accent); box-shadow: 0 0 8px var(--accent-glow); }

@media (max-width: 600px) {
    .vs-carousel { height: 40vh; }
    .vs-slide { width: 84%; }
    .vs-btn { width: 40px; height: 40px; }
}

/* ============================================================
   FINALE — waitlist
   ============================================================ */
.v-finale {
    flex-direction: column;
    justify-content: center;   /* card centered (blob is hidden on this scene) */
    align-items: center;
    text-align: center;
    gap: 0;
}
.v-card {
    width: min(440px, 90vw);
    padding: clamp(30px, 4.5vw, 46px);
    border-radius: var(--radius-lg);
    background: var(--bg);
    box-shadow:
        9px 9px 22px var(--neu-dark),
        -9px -9px 22px var(--neu-light);
}
.v-card .v-kicker { margin-bottom: 10px; }
.v-card-title {
    font-family: var(--font-display);
    font-size: clamp(1.6rem, 4vw, 2.2rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
}
.v-card-desc {
    margin-top: 14px;
    font-size: 0.95rem;
    font-weight: 300;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Early-bird price line */
.v-price {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}
.v-price-now {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
}
/* TDDisplay has no currency glyph, so the symbol uses the body font */
.v-price-cur {
    font-family: var(--font-body);
    font-size: 0.62em;
    font-weight: 500;
    margin-left: 0.05em;
    vertical-align: baseline;
}
.v-price-was {
    font-size: 1rem;
    color: var(--text-dim);
    text-decoration: line-through;
}
.v-price-tag {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent);
    padding: 4px 9px;
    border-radius: 100px;
    background: var(--bg);
    box-shadow:
        inset 2px 2px 4px var(--neu-dark),
        inset -2px -2px 4px var(--neu-light);
}
.v-reassure {
    margin-top: 12px;
    font-family: var(--font-mono);
    font-size: 0.66rem;
    letter-spacing: 0.03em;
    color: var(--text-dim);
}

/* Waitlist form — inset neumorphic field */
.waitlist-form {
    display: flex;
    flex-direction: row;   /* style.css sets column → that made flex-basis the HEIGHT (180px bug) */
    gap: 10px;
    margin-top: 28px;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;   /* don't stretch the field to the row height */
}
.waitlist-input {
    flex: 1 1 180px;
    width: auto;          /* override style.css width:100% that forced wrapping */
    min-width: 0;
    height: 46px;         /* explicit sane height — kills the oversized field */
    padding: 0 18px;
    border-radius: 100px;
    border: none;
    font-family: var(--font-body);
    font-size: 0.9rem;
    color: var(--text);
    background: var(--bg);
    box-shadow:
        inset 2px 2px 5px var(--neu-dark),
        inset -2px -2px 5px var(--neu-light);
    outline: none;
    transition: box-shadow var(--dur);
}
.waitlist-input::placeholder { color: var(--text-dim); }
.waitlist-input:focus {
    box-shadow:
        inset 3px 3px 6px var(--neu-dark),
        inset -3px -3px 6px var(--neu-light);
}
.waitlist-form .btn {
    flex: 0 0 auto;
    width: auto;          /* override style.css width:100% */
    height: 46px;         /* match the input */
    background: var(--bg);
    color: var(--text);
    border: none;
    box-shadow:
        5px 5px 12px var(--neu-dark),
        -5px -5px 12px var(--neu-light);
}
.waitlist-form .btn:hover {
    color: var(--accent);
    transform: translateY(-2px);
    box-shadow:
        6px 6px 14px var(--neu-dark),
        -6px -6px 14px var(--neu-light);
}
.waitlist-form .btn:active {
    transform: translateY(1px);
    box-shadow:
        inset 2px 2px 5px var(--neu-dark),
        inset -2px -2px 5px var(--neu-light);
}
.waitlist-msg {
    margin-top: 14px;
    font-size: 0.82rem;
    min-height: 1.1em;
    color: var(--text-secondary);
}
.waitlist-msg.is-success { color: var(--accent); }

.v-tags {
    display: flex;
    gap: 18px;
    justify-content: center;
    margin-top: 30px;
    font-family: var(--font-mono);
    font-size: 0.66rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-dim);
}

.v-footer {
    margin-top: 36px;
    display: flex;
    align-items: center;
    gap: 18px;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-dim);
}
.v-footer a { color: var(--text-dim); text-decoration: none; transition: color var(--dur); }
.v-footer a:hover { color: var(--accent); }
.v-footer .dot { opacity: 0.4; }

/* Show the "Join" nav link on narrow screens (style.css hides .nav-link
   <=768px). Desktop-narrow uses the hard-scroll controller; mobile uses the
   native-scroll anchor handler. */
@media (max-width: 768px) {
    .nav .nav-link { display: inline-block; }
}

/* ============================================================
   MOBILE — blob disabled. Clean stacked light layout, readable
   type, scenes flow at natural height (no full-viewport per line).
   ============================================================ */
@media (max-width: 600px) {
    /* ── Mobile: just hero (Parasite + tagline) + demo carousel, then the
         waitlist on scroll. The intermediate text scenes are hidden. ── */
    #flubber { display: none; }
    .m-blob { display: none; }
    html, body { overflow-x: hidden; }


    .v-scene--left,
    .v-scene--right,
    .v-scene--center { display: none; }

    /* Two full-screen pages: [hero 40vh + demo 60vh = 100vh] then [waitlist
       100vh]. Hard-scroll snaps only at the hero top and the finale top, so
       the demo never peeks onto the join page. */
    .page { scroll-snap-type: y mandatory; }
    .page > section.v-hero    { scroll-snap-align: start; scroll-snap-stop: always; }
    .page > section.v-finale  { scroll-snap-align: start; scroll-snap-stop: always; }
    .page > section.v-showcase { scroll-snap-align: none; }

    /* beat style.css's `.page > section { min-height:100vh }` (higher
       specificity) so we control section heights on mobile */
    .page > section.v-scene {
        min-height: auto;
        padding: 0 22px;
        justify-content: center;
        text-align: center;
    }

    /* Page 1 = hero (40vh) + demo (60vh) → exactly one screen */
    .page > section.v-hero {
        height: 40vh; min-height: 40vh;
        justify-content: flex-end;   /* sit near the demo below */
        padding: 0 22px 2vh;
        gap: 4px;
    }
    .page > section.v-showcase {
        height: 60vh; min-height: 60vh;
        justify-content: center;
        padding: 0 22px 2vh;
    }
    /* Page 2 = waitlist, full screen */
    .page > section.v-finale {
        min-height: 100vh;
        justify-content: center;
        padding: 9vh 22px;
    }
    .v-wordmark, .v-tagline { position: relative; z-index: 1; }
    .v-wordmark {
        font-size: 12.5vw;            /* fits PARASITE on one line with margin at any phone width */
        color: #2F3344;
    }
    /* neumorphic wordmark like the web version, but opaque (no blob behind):
       raised letters on the surface via a light/dark text-shadow pair */
    .v-wordmark { color: var(--bg); }
    .v-wordmark span {
        color: var(--bg);
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        text-shadow:
            -1px -1px 2px var(--neu-light),
            2px 2px 4px color-mix(in srgb, var(--neu-dark) 70%, transparent);
    }
    .v-tagline { font-size: clamp(0.66rem, 3.4vw, 0.82rem); letter-spacing: 0.06em; }

    /* Text scenes — centered, no frosted card, gentle vertical reveal */
    .v-block { max-width: none; margin-inline: auto; }
    .v-line { font-size: clamp(1.9rem, 8vw, 2.6rem); }
    .v-sub { font-size: 0.98rem; line-height: 1.55; }
    .v-frost { background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; padding: 0; }
    .v-scene--left .v-reveal,
    .v-scene--right .v-reveal { transform: translateY(34px); }
    .v-kicker { font-size: 0.66rem; }

    /* ── Showcase: the hero of mobile. Single full-width slide, no 3D
         coverflow (the side slides look broken in portrait). ── */
    .v-showcase { gap: 18px; }
    .v-showcase-head { display: none; }   /* no "[02] in motion / See it move" on mobile */
    .vs-carousel {
        width: 100%;
        height: auto;
        aspect-ratio: 16 / 10;
        perspective: none;
        overflow: hidden;          /* off-screen slides must not cause page scroll */
    }
    .vs-stage { position: relative; height: 100%; overflow: hidden; }
    /* Flatten the JS 3D coverflow into a flat horizontal slider: the active
       slide is centered, neighbours sit just off-screen left/right, and the
       active one slides in. Swipe to move (arrows hidden). */
    .vs-slide {
        position: absolute;
        inset: 0 !important;
        width: 100% !important;
        height: 100% !important;
        aspect-ratio: auto;
        transform: translateX(110%) !important;   /* default: parked to the right */
        opacity: 0 !important;
        box-shadow: none;
        transition: transform 0.45s var(--ease), opacity 0.45s var(--ease);
        pointer-events: none;
    }
    .vs-slide.is-active {
        transform: translateX(0) !important;
        opacity: 1 !important;
        z-index: 2 !important;
        pointer-events: auto;
    }
    /* the slide just before the active one waits off to the left */
    .vs-slide.is-prev {
        transform: translateX(-110%) !important;
        opacity: 0 !important;
    }
    /* swipe replaces the arrows on touch screens */
    .vs-btn { display: none; }

    /* Finale — centered card, comfortable spacing */
    .v-finale { justify-content: center; padding: 9vh 22px; gap: 0; }
    .v-card { width: 100%; max-width: 100%; padding: 28px 22px; }
    .v-card-desc { font-size: 0.9rem; }
    .v-footer { position: static; margin-top: 28px; flex-wrap: wrap; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .v-wordmark span, .v-tagline, .v-scrollcue { animation: none; opacity: 1; transform: none; }
    .v-reveal { transition: none; }
}
