/* =============================================
   scriptgrapher.com - Kinetic Art Landing
   Palette: Chromatic Gradient System
   Fonts: Playfair Display, Dancing Script, Source Sans 3
   ============================================= */

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

:root {
    --act1-color: #FF3C38;
    --act2-color: #FF8C42;
    --act3-color: #FFD166;
    --act4-color: #06D6A0;
    --act5-color: #118AB2;
    --bg-deep: #0D0D0D;
    --surface-glass: #1A1B2F;
    --text-primary: #F0EAD6;
    --text-secondary: #A8A4A0;
    --accent-line: #E8175D;
    --current-act-color: #FF3C38;
}

html {
    scroll-behavior: auto;
}

body {
    background: var(--bg-deep);
    color: var(--text-primary);
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 400;
    line-height: 1.7;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* =============================================
   Particle Canvas
   ============================================= */
#particle-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
}

/* =============================================
   Bezier Curve Canvas (decorative sweeps)
   ============================================= */
#curve-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
    pointer-events: none;
}

/* =============================================
   Scroll Progress Indicator
   ============================================= */
#scroll-progress {
    position: fixed;
    left: 12px;
    top: 0;
    bottom: 0;
    width: 2px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#progress-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 2px;
    height: 0%;
    background: var(--accent-line);
    transition: background-color 0.6s ease;
    box-shadow: 0 0 8px var(--accent-line), 0 0 16px rgba(232, 23, 93, 0.3);
}

.progress-dot {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-secondary);
    left: -3px;
    opacity: 0.4;
    transition: opacity 0.4s ease, box-shadow 0.4s ease, background 0.4s ease;
}

.progress-dot[data-act="1"] { top: 10%; }
.progress-dot[data-act="2"] { top: 30%; }
.progress-dot[data-act="3"] { top: 50%; }
.progress-dot[data-act="4"] { top: 70%; }
.progress-dot[data-act="5"] { top: 90%; }

.progress-dot.active {
    opacity: 1;
    background: var(--accent-line);
    box-shadow: 0 0 12px var(--accent-line), 0 0 24px var(--accent-line);
}

/* =============================================
   Scroll Container
   ============================================= */
#scroll-container {
    position: relative;
    z-index: 2;
    width: 100%;
}

/* =============================================
   Acts
   ============================================= */
.act {
    position: relative;
    min-height: 120vh;
    display: flex;
    overflow: hidden;
}

.kinetic-zone {
    flex: 0 0 62%;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.kinetic-zone--contracted {
    flex: 0 0 38%;
}

.annotation-zone {
    flex: 0 0 38%;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 2rem 3rem;
    gap: 2rem;
}

.annotation-zone--expanded {
    flex: 0 0 62%;
}

/* =============================================
   Act 1: Genesis - Kinetic Title Assembly
   ============================================= */
#title-assembly {
    position: relative;
    width: 100%;
    height: 60vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.kinetic-letter {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(3rem, 10vw, 7rem);
    color: var(--text-primary);
    position: absolute;
    opacity: 0.15;
    transition: none;
    will-change: transform, opacity;
    text-shadow: 0 0 30px rgba(255, 60, 56, 0.3);
}

#tagline {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

#tagline.visible {
    opacity: 1;
    transform: translateY(0);
}

/* =============================================
   Script Accent (Dancing Script)
   ============================================= */
.script-accent {
    font-family: 'Dancing Script', cursive;
    font-weight: 700;
    font-size: clamp(1.5rem, 4vw, 2.8rem);
    color: var(--text-primary);
}

/* =============================================
   Body Text (Source Sans 3)
   ============================================= */
.body-text {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.8vw, 1.15rem);
    line-height: 1.7;
    color: var(--text-primary);
}

.annotation-text {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.8vw, 1.15rem);
    line-height: 1.7;
    color: var(--text-secondary);
}

/* =============================================
   Annotation Panels
   ============================================= */
.annotation-panel {
    background: rgba(26, 27, 47, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 1.5rem 2rem;
    border-radius: 4px;
    border-left: 2px solid var(--accent-line);
    opacity: 0;
    transform: translateX(40px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.annotation-panel.visible {
    opacity: 1;
    transform: translateX(0);
}

/* =============================================
   Act 2: Convergence - Flowing Text Blocks
   ============================================= */
.flowing-text-block {
    opacity: 0;
    transform: translateY(30px) rotate(1deg);
    transition: opacity 0.6s ease, transform 0.6s ease;
    max-width: 500px;
    margin: 1.5rem 0;
}

.flowing-text-block.visible {
    opacity: 1;
    transform: translateY(0) rotate(0deg);
}

.act-title {
    margin-bottom: 2rem;
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.act-title.visible {
    opacity: 1;
    transform: scale(1);
}

/* =============================================
   Act 3: Formation - Breathing Text
   ============================================= */
.breathing-text {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(3rem, 8vw, 6rem);
    color: var(--text-primary);
    letter-spacing: 0.02em;
    will-change: transform;
}

.concept-words {
    display: flex;
    gap: 3rem;
    margin-top: 2rem;
    flex-wrap: wrap;
    justify-content: center;
}

.concept-word {
    font-family: 'Playfair Display', serif;
    font-weight: 400;
    font-size: clamp(2rem, 5vw, 4rem);
    color: var(--act3-color);
    opacity: 0;
    transform: translateY(20px) scale(0.8);
    transition: opacity 0.6s ease, transform 0.6s ease, color 0.6s ease;
}

.concept-word.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* =============================================
   Transition Zones
   ============================================= */
.transition-zone {
    height: 20vh;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.morph-shape {
    width: clamp(150px, 40vw, 400px);
    height: clamp(150px, 40vw, 400px);
    opacity: 0.6;
    transition: opacity 0.3s ease;
}

.morph-path {
    fill: none;
    stroke: var(--accent-line);
    stroke-width: 2;
    transition: stroke 0.6s ease;
}

/* =============================================
   Act 4: Metamorphosis - Math Curves
   ============================================= */
#math-curves {
    width: 100%;
    max-width: 300px;
    margin-top: 2rem;
}

.lissajous-svg {
    width: 100%;
    height: auto;
}

.lissajous-path {
    stroke: var(--act4-color);
    stroke-width: 2;
    fill: none;
    opacity: 0.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* =============================================
   Act 5: Transcendence
   ============================================= */
#act-5 {
    min-height: 120vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
}

#act-5 .kinetic-zone {
    flex: 1;
    align-items: center;
    justify-content: center;
    text-align: center;
}

#final-line {
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 1.2s ease, transform 1.2s ease;
}

#final-line.visible {
    opacity: 1;
    transform: translateY(0);
}

#final-particle {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--act5-color);
    margin-top: 3rem;
    box-shadow: 0 0 20px var(--act5-color), 0 0 40px var(--act5-color);
    animation: pulse-particle 2s ease-in-out infinite;
    opacity: 0;
    transition: opacity 1s ease;
}

#final-particle.visible {
    opacity: 1;
}

@keyframes pulse-particle {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 20px var(--act5-color), 0 0 40px var(--act5-color);
    }
    50% {
        transform: scale(1.5);
        box-shadow: 0 0 30px var(--act5-color), 0 0 60px var(--act5-color), 0 0 90px var(--act5-color);
    }
}

#final-gradient {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 20vh;
    background: linear-gradient(to bottom, transparent, #0D0D0D);
    pointer-events: none;
    z-index: 10;
}

/* =============================================
   Gradient Overlay (scroll-driven background)
   ============================================= */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: var(--bg-deep);
    transition: background 0.8s ease;
}

/* =============================================
   Responsive
   ============================================= */
@media (max-width: 768px) {
    .act {
        flex-direction: column;
    }

    .kinetic-zone,
    .annotation-zone,
    .kinetic-zone--contracted,
    .annotation-zone--expanded {
        flex: none;
        width: 100%;
    }

    .kinetic-zone {
        min-height: 60vh;
    }

    .annotation-zone {
        min-height: 40vh;
        padding: 1.5rem;
    }

    #scroll-progress {
        left: 6px;
    }

    .concept-words {
        gap: 1.5rem;
    }

    #act-5 {
        flex-direction: column;
    }
}
