/* continua.quest — Candy Continuum Styles */
:root {
    --candy-1: #FF6B9D;
    --candy-2: #FFB347;
    --candy-3: #C9F0FF;
    --candy-4: #A8E6CF;
    --candy-5: #DDA0DD;
    --twilight-ink: #4A4A6A;
    --cream-soda: #FFF8F0;
    --deep-plum: #2D1B3D;
    --hue-shift: 0deg;
    --scroll-progress: 0;
}

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: 'Nunito', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.8vw, 1.25rem);
    line-height: 1.75;
    color: var(--twilight-ink);
    background-color: var(--cream-soda);
    overflow-x: hidden;
}

/* Noise overlay */
#noise-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    opacity: 0.02;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px 256px;
}

/* Particle overlay */
#particle-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 50;
}

/* Central Spine */
#spine {
    position: fixed;
    left: 50%;
    top: 0;
    width: 1px;
    height: 100vh;
    transform: translateX(-50%);
    background: linear-gradient(
        to bottom,
        var(--candy-1),
        var(--candy-2),
        var(--candy-3),
        var(--candy-4),
        var(--candy-5)
    );
    z-index: 10;
    box-shadow:
        0 0 4px var(--candy-1),
        0 0 12px rgba(255, 107, 157, 0.3),
        0 0 24px rgba(255, 107, 157, 0.1);
    transition: width 0.6s ease, box-shadow 0.6s ease;
}

#spine.bloom-active {
    width: 3px;
    box-shadow:
        0 0 8px var(--candy-1),
        0 0 20px rgba(255, 107, 157, 0.5),
        0 0 40px rgba(255, 107, 157, 0.2);
}

/* Euler stream */
#euler-stream {
    position: fixed;
    left: 50%;
    top: 0;
    width: 20px;
    height: 100vh;
    transform: translateX(-50%);
    pointer-events: none;
    z-index: 11;
    overflow: hidden;
}

.euler-digit {
    position: absolute;
    font-family: 'Quicksand', sans-serif;
    font-weight: 500;
    font-size: 14px;
    color: var(--twilight-ink);
    opacity: 0.06;
    animation: euler-float 12s linear infinite;
}

@keyframes euler-float {
    from { transform: translateY(100vh); opacity: 0.06; }
    to { transform: translateY(-20px); opacity: 0; }
}

/* Section base */
.act {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#overture { min-height: 100vh; }
#first-passage { min-height: 120vh; }
#the-bloom { min-height: 100vh; }
#second-passage { min-height: 120vh; }
#coda { min-height: 80vh; }

/* Section halo */
.section-halo {
    position: absolute;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--halo-color) 0%, transparent 70%);
    opacity: 0.08;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 1;
}

.section-halo--large {
    width: 500px;
    height: 500px;
    opacity: 0.12;
}

/* Dark section (The Bloom) */
.act--dark {
    background-color: var(--deep-plum);
}

/* Section transitions - gradient blends */
#first-passage {
    background: linear-gradient(
        to bottom,
        var(--cream-soda) 0%,
        var(--cream-soda) 90%,
        var(--deep-plum) 100%
    );
}

#the-bloom {
    background: linear-gradient(
        to bottom,
        var(--deep-plum) 0%,
        var(--deep-plum) 90%,
        var(--cream-soda) 100%
    );
}

/* Content positioning */
.act-content {
    position: relative;
    z-index: 20;
    padding: clamp(2rem, 5vw, 6rem);
    max-width: 42ch;
}

.act-content--center {
    text-align: center;
    max-width: 60ch;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.act-content--left {
    margin-right: auto;
    margin-left: 15%;
}

.act-content--right {
    margin-left: auto;
    margin-right: 15%;
}

/* Title - main */
.title-main {
    font-family: 'Quicksand', sans-serif;
    font-weight: 700;
    font-size: clamp(3rem, 8vw, 7rem);
    letter-spacing: 0.04em;
    line-height: 1.1;
    margin-bottom: 1.5rem;
}

.title-main .char {
    display: inline-block;
    background: linear-gradient(90deg, var(--candy-1), var(--candy-2), var(--candy-5));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    opacity: 0;
    transform: scale(0.5);
    transition: opacity 0.5s cubic-bezier(0.34, 1.56, 0.64, 1),
                transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.title-main .char.revealed {
    opacity: 1;
    transform: scale(1);
}

.title-main .char[data-index='0'] { color: var(--candy-1); }
.title-main .char[data-index='1'] { color: var(--candy-2); }
.title-main .char[data-index='2'] { color: var(--candy-3); }
.title-main .char[data-index='3'] { color: var(--candy-4); }
.title-main .char[data-index='4'] { color: var(--candy-5); }
.title-main .char[data-index='5'] { color: var(--candy-1); }
.title-main .char[data-index='6'] { color: var(--candy-2); }
.title-main .char[data-index='7'] { color: var(--candy-4); }

/* Title - quest (coda) */
.title-quest {
    font-family: 'Quicksand', sans-serif;
    font-weight: 700;
    font-size: clamp(3rem, 8vw, 7rem);
    letter-spacing: 0.04em;
    line-height: 1.1;
    margin-bottom: 1.5rem;
}

.title-quest .char {
    display: inline-block;
    opacity: 0;
    transform: scale(1) translateY(0);
    transition: opacity 0.8s ease, transform 1.2s ease;
}

.title-quest .char.dissolving {
    opacity: 0;
    transform: scale(0.5) translateY(-60px);
}

.title-quest .char.revealed {
    opacity: 1;
    transform: scale(1) translateY(0);
    background: linear-gradient(90deg, var(--candy-3), var(--candy-4), var(--candy-5));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Subtitle */
.subtitle {
    font-family: 'Baloo 2', cursive;
    font-weight: 600;
    font-size: clamp(0.75rem, 1.2vw, 0.9rem);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--candy-5);
    opacity: 0;
    transition: opacity 1s ease 0.8s;
}

.subtitle.visible {
    opacity: 1;
}

.subtitle--coda {
    color: var(--candy-4);
}

/* Section headers */
.section-header {
    font-family: 'Quicksand', sans-serif;
    font-weight: 700;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    letter-spacing: 0.04em;
    margin-bottom: 2rem;
    background: linear-gradient(90deg, var(--candy-1), var(--candy-2), var(--candy-5));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.section-header.visible {
    opacity: 1;
    transform: translateY(0);
}

.section-header--bloom {
    font-size: clamp(2rem, 5vw, 4rem);
    background: linear-gradient(90deg, var(--candy-5), var(--candy-1), var(--candy-2));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.section-header--bloom.pulse {
    animation: bloom-pulse 0.6s ease;
}

@keyframes bloom-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.08); }
    100% { transform: scale(1); }
}

/* Body text */
.body-text {
    font-family: 'Nunito', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.8vw, 1.25rem);
    line-height: 1.75;
    color: var(--twilight-ink);
    margin-bottom: 1.5rem;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.body-text.visible {
    opacity: 1;
    transform: translateY(0);
}

.body-text--light {
    color: var(--cream-soda);
}

/* Orbit animation (CSS-only Lottie replacement) */
.lottie-companion {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 250px;
    height: 250px;
    opacity: 0.5;
    z-index: 15;
}

.lottie-companion--right {
    right: 8%;
}

.lottie-companion--left {
    left: 8%;
}

.orbit-animation {
    position: relative;
    width: 100%;
    height: 100%;
}

.orbit-circle {
    position: absolute;
    border-radius: 50%;
    top: 50%;
    left: 50%;
}

.orbit-circle--1 {
    width: 20px;
    height: 20px;
    background: var(--candy-1);
    box-shadow: 0 0 8px var(--candy-1), 0 0 20px rgba(255,107,157,0.4);
    animation: orbit1 6s linear infinite;
}

.orbit-circle--2 {
    width: 14px;
    height: 14px;
    background: var(--candy-2);
    box-shadow: 0 0 8px var(--candy-2), 0 0 20px rgba(255,179,71,0.4);
    animation: orbit2 8s linear infinite;
}

.orbit-circle--3 {
    width: 10px;
    height: 10px;
    background: var(--candy-4);
    box-shadow: 0 0 8px var(--candy-4), 0 0 20px rgba(168,230,207,0.4);
    animation: orbit3 5s linear infinite;
}

.orbit-circle--4 {
    width: 16px;
    height: 16px;
    background: var(--candy-5);
    box-shadow: 0 0 8px var(--candy-5), 0 0 20px rgba(221,160,221,0.4);
    animation: orbit4 7s linear infinite reverse;
}

.orbit-circle--5 {
    width: 8px;
    height: 8px;
    background: var(--candy-3);
    box-shadow: 0 0 8px var(--candy-3), 0 0 20px rgba(201,240,255,0.4);
    animation: orbit5 9s linear infinite;
}

@keyframes orbit1 {
    from { transform: translate(-50%,-50%) rotate(0deg) translateX(80px) rotate(0deg); }
    to { transform: translate(-50%,-50%) rotate(360deg) translateX(80px) rotate(-360deg); }
}
@keyframes orbit2 {
    from { transform: translate(-50%,-50%) rotate(72deg) translateX(60px) rotate(-72deg); }
    to { transform: translate(-50%,-50%) rotate(432deg) translateX(60px) rotate(-432deg); }
}
@keyframes orbit3 {
    from { transform: translate(-50%,-50%) rotate(144deg) translateX(100px) rotate(-144deg); }
    to { transform: translate(-50%,-50%) rotate(504deg) translateX(100px) rotate(-504deg); }
}
@keyframes orbit4 {
    from { transform: translate(-50%,-50%) rotate(216deg) translateX(50px) rotate(-216deg); }
    to { transform: translate(-50%,-50%) rotate(576deg) translateX(50px) rotate(-576deg); }
}
@keyframes orbit5 {
    from { transform: translate(-50%,-50%) rotate(288deg) translateX(110px) rotate(-288deg); }
    to { transform: translate(-50%,-50%) rotate(648deg) translateX(110px) rotate(-648deg); }
}

/* Morph animation */
.morph-animation {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.morph-shape {
    width: 120px;
    height: 120px;
    background: linear-gradient(135deg, var(--candy-5), var(--candy-1));
    animation: morph 10s ease-in-out infinite;
    opacity: 0.6;
    box-shadow: 0 0 20px rgba(221,160,221,0.4), 0 0 40px rgba(255,107,157,0.2);
}

@keyframes morph {
    0%   { border-radius: 50%; transform: rotate(0deg) scale(1); background: linear-gradient(135deg, var(--candy-5), var(--candy-1)); }
    25%  { border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%; transform: rotate(90deg) scale(0.9); background: linear-gradient(135deg, var(--candy-2), var(--candy-4)); }
    50%  { border-radius: 10%; transform: rotate(180deg) scale(1.05); background: linear-gradient(135deg, var(--candy-3), var(--candy-5)); }
    75%  { border-radius: 50% 20% 50% 20% / 20% 50% 20% 50%; transform: rotate(270deg) scale(0.95); background: linear-gradient(135deg, var(--candy-1), var(--candy-2)); }
    100% { border-radius: 50%; transform: rotate(360deg) scale(1); background: linear-gradient(135deg, var(--candy-5), var(--candy-1)); }
}

/* Bloom burst container */
.bloom-burst {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

/* Cascade effect container */
.cascade-effect {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

/* Particle styles */
.particle {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    will-change: transform, opacity;
}

.particle.interactive:hover {
    cursor: default;
}

/* Responsive */
@media (max-width: 768px) {
    #spine {
        left: 15%;
    }

    .act-content--left,
    .act-content--right {
        margin-left: auto;
        margin-right: auto;
        max-width: 90%;
    }

    .lottie-companion {
        width: 150px;
        height: 150px;
        opacity: 0.3;
    }

    .lottie-companion--right {
        right: 2%;
    }

    .lottie-companion--left {
        left: 2%;
    }
}

@media (max-width: 480px) {
    .lottie-companion {
        display: none;
    }

    .title-main {
        font-size: 2.5rem;
    }

    .title-quest {
        font-size: 2.5rem;
    }

    .act-content {
        padding: 2rem 1.5rem;
    }
}
