/* Interstitial layout */
.chapter {
    position: relative;
    height: 220vh;
}

.stage {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: hidden;
}

/* Background layers */
.bg {
    position: absolute;
    inset: 0;
    opacity: 1;
    transition: opacity 0.05s linear;
}

/* Parallax elements */
.shape {
    position: absolute;
    border-radius: 999px;
    transform: translate3d(0, 0, 0);
    will-change: transform, opacity;
}

.star {
    width: 3px;
    height: 3px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.85);
    opacity: 0.7;
}

.ribbon {
    position: absolute;
    left: -10%;
    width: 120%;
    border-radius: 999px;
    transform: translate3d(0, 0, 0);
    will-change: transform;
}

/* Palette (interstitial-specific visuals) */
.universe {
    background: radial-gradient(1200px 800px at 50% 30%, #2d3b7a 0%, #0b0f1a 65%, #070a12 100%);
}

.clouds {
    background: linear-gradient(#f7cfd6 0%, #bcd7ff 55%, #fbf7ef 100%);
}

.mountain {
    background: linear-gradient(#cfe3ff 0%, #f6d5df 50%, #fbf7ef 100%);
}

.earth {
    background: linear-gradient(#e7f7e9 0%, #cfe6ff 55%, #fbf7ef 100%);
}

.underground {
    background: linear-gradient(#fbf7ef 0%, #a88b7d 30%, #352722 100%);
}

.core {
    background: radial-gradient(1000px 700px at 50% 70%, #ffb84a 0%, #ff6a3d 30%, #2a1412 70%, #120707 100%);
}

@media (prefers-reduced-motion: reduce) {
    .shape {
        will-change: auto;
    }
}

/* Ensure next backgrounds start hidden, JS fades them in */
.chapter [data-next-bg] {
    opacity: 0;
}

/* A small wrapper, optional */
.shapes {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 5;
}

/* -------------------------
   Floating decorative assets
   (outer element is [data-parallax], inner spans animate)
-------------------------- */

.floaties {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 6;
    /* above blobs, below content */
}

.floaty {
    position: absolute;
    width: var(--size, 180px);
    height: auto;
    opacity: var(--opacity, 0.95);
    transform: translate3d(0, 0, 0);
    will-change: transform, opacity;
}

.floaty img {
    display: block;
    width: 100%;
    height: auto;
    user-select: none;
    -webkit-user-drag: none;
}

.floaty-bob {
    animation: floaty-bob var(--bob-dur, 10s) ease-in-out infinite;
    will-change: transform;
}

.floaty-spin {
    animation: floaty-spin var(--spin-dur, 42s) linear infinite;
    will-change: transform;
}

/* optional drift layer (nice for comets) */
.floaty-drift {
    animation: floaty-drift var(--drift-dur, 18s) ease-in-out infinite;
    will-change: transform;
}

@keyframes floaty-bob {
    0% {
        transform: translate3d(0, 0, 0) rotate(-0.6deg);
    }

    50% {
        transform: translate3d(0, calc(var(--bob-amp, 14px) * -1), 0) rotate(0.8deg);
    }

    100% {
        transform: translate3d(0, 0, 0) rotate(-0.6deg);
    }
}

@keyframes floaty-spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes floaty-drift {
    0% {
        transform: translate3d(0, 0, 0);
    }

    50% {
        transform: translate3d(10px, -6px, 0);
    }

    100% {
        transform: translate3d(0, 0, 0);
    }
}

@media (prefers-reduced-motion: reduce) {

    .floaty-bob,
    .floaty-spin,
    .floaty-drift {
        animation: none !important;
    }
}

/* -------- Universe -------- */
.u-star-1 {
    left: 10%;
    top: 20%;
}

.u-star-2 {
    left: 25%;
    top: 35%;
}

.u-star-3 {
    left: 60%;
    top: 22%;
}

.u-star-4 {
    left: 76%;
    top: 40%;
}

.u-star-5 {
    left: 86%;
    top: 18%;
}

.u-blob-1 {
    left: -6%;
    top: 18%;
    width: 360px;
    height: 220px;
    background: rgba(116, 166, 255, 0.18);
}

.u-blob-2 {
    left: 62%;
    top: 10%;
    width: 420px;
    height: 260px;
    background: rgba(255, 182, 193, 0.14);
}

.u-blob-3 {
    left: 78%;
    top: 18%;
    width: 140px;
    height: 140px;
    background: rgba(255, 255, 255, 0.22);
}

/* Universe floaties (images) */
.u-f-galaxy {
    left: 56%;
    top: 56%;
    --size: clamp(240px, 22vw, 460px);
    --bob-amp: 10px;
    --bob-dur: 14s;
    --spin-dur: 120s;
    --opacity: 0.88;
}

.u-f-planet {
    left: 64%;
    top: 22%;
    --size: clamp(120px, 12vw, 220px);
    --bob-amp: 12px;
    --bob-dur: 10s;
    --spin-dur: 80s;
    --opacity: 0.95;
}

.u-f-moon {
    left: 10%;
    top: 58%;
    --size: clamp(110px, 11vw, 210px);
    --bob-amp: 14px;
    --bob-dur: 11s;
    --spin-dur: 96s;
    --opacity: 0.92;
}

.u-f-satelit {
    left: 26%;
    top: 22%;
    --size: clamp(70px, 6.8vw, 120px);
    --bob-amp: 10px;
    --bob-dur: 9s;
    --spin-dur: 70s;
    --opacity: 0.92;
}

.u-f-rocket {
    left: 78%;
    top: 44%;
    --size: clamp(78px, 7.8vw, 140px);
    --bob-amp: 10px;
    --bob-dur: 8.5s;
    --spin-dur: 999s;
    /* basically no spin, but keeps structure consistent */
    --opacity: 0.95;
}

.u-f-comet {
    left: 34%;
    top: 68%;
    --size: clamp(90px, 8vw, 150px);
    --bob-amp: 8px;
    --bob-dur: 7.5s;
    --spin-dur: 999s;
    --drift-dur: 16s;
    --opacity: 0.92;
}

/* -------- Clouds -------- */
.c-blob-1 {
    left: -10%;
    top: 18%;
    width: 520px;
    height: 220px;
    background: rgba(255, 255, 255, 0.75);
}

.c-blob-2 {
    left: 55%;
    top: 20%;
    width: 560px;
    height: 240px;
    background: rgba(255, 255, 255, 0.68);
}

.c-blob-3 {
    left: 18%;
    top: 46%;
    width: 220px;
    height: 90px;
    background: rgba(255, 255, 255, 0.55);
}

.c-blob-4 {
    left: 70%;
    top: 48%;
    width: 240px;
    height: 92px;
    background: rgba(255, 255, 255, 0.50);
}

.c-ribbon-1 {
    bottom: -6vh;
    height: 34vh;
    background: rgba(255, 255, 255, 0.55);
}

/* -------- Mountains -------- */
.m-blob-1 {
    left: -8%;
    top: 48%;
    width: 520px;
    height: 280px;
    border-radius: 48px;
    background: rgba(185, 164, 255, 0.35);
}

.m-blob-2 {
    left: 45%;
    top: 46%;
    width: 620px;
    height: 320px;
    border-radius: 56px;
    background: rgba(255, 160, 190, 0.28);
}

.m-ribbon-1 {
    bottom: -10vh;
    height: 40vh;
    background: rgba(70, 125, 90, 0.38);
}

/* -------- Earth -------- */
.e-blob-1 {
    left: -6%;
    top: 56%;
    width: 520px;
    height: 240px;
    border-radius: 80px;
    background: rgba(56, 140, 92, 0.32);
}

.e-blob-2 {
    left: 56%;
    top: 58%;
    width: 520px;
    height: 240px;
    border-radius: 80px;
    background: rgba(56, 140, 92, 0.28);
}

.e-pillar-1 {
    left: 42%;
    top: 48%;
    width: 220px;
    height: 520px;
    border-radius: 90px;
    background: rgba(255, 255, 255, 0.55);
}

.e-band-1 {
    left: 28%;
    top: 72%;
    width: 520px;
    height: 160px;
    background: rgba(255, 255, 255, 0.45);
}

/* -------- Underground -------- */
.ug-wall-1 {
    left: -10%;
    top: 38%;
    width: 680px;
    height: 420px;
    border-radius: 120px;
    background: rgba(35, 22, 18, 0.55);
}

.ug-wall-2 {
    left: 46%;
    top: 40%;
    width: 680px;
    height: 420px;
    border-radius: 120px;
    background: rgba(35, 22, 18, 0.50);
}

.ug-glow-1 {
    left: 18%;
    top: 46%;
    width: 120px;
    height: 120px;
    background: rgba(255, 195, 90, 0.38);
}

.ug-glow-2 {
    left: 74%;
    top: 52%;
    width: 140px;
    height: 140px;
    background: rgba(255, 195, 90, 0.30);
}

.ug-star-1 {
    left: 30%;
    top: 30%;
    opacity: 0.28;
}

.ug-star-2 {
    left: 58%;
    top: 26%;
    opacity: 0.22;
}

.ug-star-3 {
    left: 82%;
    top: 34%;
    opacity: 0.18;
}

/* -------- Core -------- */
.core-glow-1 {
    left: 18%;
    top: 44%;
    width: 520px;
    height: 520px;
    background: rgba(255, 120, 70, 0.45);
}

.core-glow-2 {
    left: 32%;
    top: 54%;
    width: 340px;
    height: 340px;
    background: rgba(255, 210, 120, 0.35);
}

.core-heat-1 {
    left: -6%;
    top: 18%;
    width: 240px;
    height: 140px;
    background: rgba(255, 120, 70, 0.18);
}

.core-heat-2 {
    left: 70%;
    top: 22%;
    width: 260px;
    height: 150px;
    background: rgba(255, 210, 120, 0.14);
}

.floaty {
    transform: var(--drift-transform, translate3d(0, 0, 0));
}

/* Compose parallax + drift safely (no transform overrides) */
[data-parallax] {
    transform:
        translate3d(0, var(--parallax-y, 0px), 0) translate3d(var(--drift-x, 0px), var(--drift-y, 0px), 0);
}

/* keep your existing optimization */
.shape,
.floaty {
    will-change: transform, opacity;
}