/* =============================================
   a6c.boo - Kinetic Typography Experience
   ============================================= */

/* Custom Properties */
:root {
    --void: #0a0a0a;
    --phantom-white: #e8e4df;
    --spectral-blue: #4a6fa5;
    --ghost-green: #7fb685;
    --ember-orange: #d4784a;
    --ash-gray: #6b6b6b;
    --deep-indigo: #1a1a3e;
    --ease-organic: cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --font-display: 'Cormorant Garamond', serif;
    --font-secondary: 'Space Grotesk', sans-serif;
    --font-mono: 'Fira Code', monospace;
}

/* Reset & Base */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    background: var(--void);
    scroll-behavior: smooth;
}

body {
    background: var(--void);
    color: var(--phantom-white);
    font-family: var(--font-secondary);
    overflow-x: hidden;
    cursor: default;
}

/* Scroll Container */
#scroll-container {
    scroll-snap-type: y proximity;
    overflow-y: auto;
    overflow-x: hidden;
}

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

/* Progress Spine */
#progress-spine {
    position: fixed;
    top: 10vh;
    right: 24px;
    width: 2px;
    height: 80vh;
    background: rgba(106, 106, 106, 0.15);
    z-index: 100;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

#progress-fill {
    width: 100%;
    height: 0%;
    background: var(--spectral-blue);
    transition: height 0.3s var(--ease-organic);
    box-shadow: 0 0 8px rgba(74, 111, 165, 0.5);
}

#progress-label {
    position: absolute;
    right: 12px;
    top: 0;
    font-family: var(--font-secondary);
    font-size: 0.65rem;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.3em;
    color: var(--ash-gray);
    opacity: 0.6;
    transform: translateY(-50%);
    transition: top 0.3s var(--ease-organic);
    white-space: nowrap;
}

/* Cursor Trail */
#cursor-trail {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 99;
    overflow: hidden;
}

.cursor-ghost {
    position: absolute;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--ghost-green);
    opacity: 0;
    pointer-events: none;
    animation: cursorFade 0.8s var(--ease-organic) forwards;
}

@keyframes cursorFade {
    0% {
        opacity: 0.4;
        transform: scale(1) translateY(0);
    }
    100% {
        opacity: 0;
        transform: scale(0.5) translateY(-20px);
    }
}

/* Sections */
.section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    scroll-snap-align: start;
}

/* Interstitials - black breathing rooms */
.interstitial {
    min-height: 100vh;
    background: var(--void);
}

.interstitial-small {
    min-height: 30vh;
    background: var(--void);
}

/* =============================================
   Hero Section
   ============================================= */
#hero {
    min-height: 100vh;
    flex-direction: column;
    gap: 2rem;
}

.hero-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2.5rem;
}

.hero-letters {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
}

.hero-letter {
    font-family: var(--font-mono);
    font-weight: 300;
    font-size: clamp(6rem, 18vw, 30rem);
    color: var(--phantom-white);
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 1.2s var(--ease-organic), transform 1.2s var(--ease-organic);
    text-shadow: 0 0 40px rgba(74, 111, 165, 0.3);
    line-height: 1;
}

.hero-letter.visible {
    opacity: 1;
    transform: translateY(0);
}

.hero-six {
    display: inline-block;
    color: var(--spectral-blue);
    text-shadow: 0 0 60px rgba(74, 111, 165, 0.5);
}

.hero-subtitle {
    font-family: var(--font-secondary);
    font-size: clamp(0.8rem, 1.5vw, 1.2rem);
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.3em;
    color: var(--ash-gray);
    display: flex;
    align-items: center;
    min-height: 2em;
}

.subtitle-text {
    display: inline;
}

.subtitle-cursor {
    display: inline-block;
    animation: blink 1s step-end infinite;
    color: var(--spectral-blue);
    margin-left: 2px;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* =============================================
   Letter Sections
   ============================================= */
.letter-section {
    min-height: 100vh;
    position: relative;
    overflow: hidden;
}

.letter-stage {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.left-anchored {
    justify-content: flex-start;
    padding-left: 5vw;
}

.right-anchored {
    justify-content: flex-end;
    padding-right: 5vw;
}

/* SVG Letters */
.letter-svg {
    width: clamp(50vw, 65vw, 70vw);
    height: auto;
    max-height: 85vh;
    position: relative;
    z-index: 2;
}

.svg-letter-stroke {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 700;
    font-size: 500px;
    fill: none;
    stroke: var(--phantom-white);
    stroke-width: 1.5;
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    transition: stroke-dashoffset 1.5s var(--ease-organic);
    filter: drop-shadow(0 0 20px rgba(74, 111, 165, 0.2));
}

.letter-section.in-view .svg-letter-stroke {
    stroke-dashoffset: 0;
    fill: var(--phantom-white);
    fill-opacity: 0;
    animation: fillIn 0.8s var(--ease-organic) 1.3s forwards;
}

@keyframes fillIn {
    to {
        fill-opacity: 1;
    }
}

/* Shadow Double */
.shadow-double {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    z-index: 1;
    transform: translate(8px, 8px);
}

.left-anchored .shadow-double {
    justify-content: flex-start;
    padding-left: 5vw;
}

.right-anchored .shadow-double {
    justify-content: flex-end;
    padding-right: 5vw;
}

.shadow-double .letter-svg {
    width: clamp(50vw, 65vw, 70vw);
}

.svg-letter-shadow {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 700;
    font-size: 500px;
    fill: var(--deep-indigo);
    opacity: 0.5;
    stroke: none;
}

/* Orbit Text */
.orbit-text {
    position: absolute;
    z-index: 3;
    font-family: var(--font-secondary);
    font-size: clamp(0.6rem, 1vw, 0.85rem);
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.3em;
    color: var(--ash-gray);
    opacity: 0;
    transition: opacity 1s var(--ease-organic) 1.5s;
}

.left-anchored .orbit-text {
    right: 15vw;
    top: 50%;
    transform: translateY(-50%);
}

.right-anchored .orbit-text {
    left: 15vw;
    top: 50%;
    transform: translateY(-50%);
}

.letter-section.in-view .orbit-text {
    opacity: 0.7;
}

.orbit-text span {
    display: inline-block;
    animation: orbitFloat 6s ease-in-out infinite;
}

@keyframes orbitFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

/* Flicker Effect */
@keyframes flicker {
    0% { opacity: 1; }
    25% { opacity: 0.3; }
    50% { opacity: 1; }
    65% { opacity: 0.3; }
    80% { opacity: 1; }
    100% { opacity: 1; }
}

.letter-section.flickering .svg-letter-stroke {
    animation: flicker 0.3s linear;
}

/* =============================================
   Closing Section
   ============================================= */
#closing {
    min-height: 100vh;
    flex-direction: column;
    gap: 3rem;
}

.closing-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4rem;
    position: relative;
}

#letter-cluster {
    position: relative;
    width: 60vw;
    height: 40vh;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0;
}

.cluster-letter {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.5rem, 3vw, 3rem);
    color: var(--phantom-white);
    opacity: 0.8;
    transition: all 2s var(--ease-organic);
    display: inline-block;
    margin: 0 0.15em;
    line-height: 1.4;
}

.cluster-letter.dispersing {
    opacity: 0;
    transform: translate(
        calc((var(--rand-x, 0) - 0.5) * 200px),
        calc((var(--rand-y, 0) - 0.5) * 200px)
    );
}

.boo-text {
    font-family: var(--font-mono);
    font-weight: 300;
    font-size: clamp(3rem, 8vw, 10rem);
    color: var(--ember-orange);
    text-shadow: 0 0 40px rgba(212, 120, 74, 0.4), 0 0 80px rgba(212, 120, 74, 0.2);
    opacity: 0;
    transition: opacity 2s var(--ease-organic);
    letter-spacing: 0.1em;
}

#closing.in-view .boo-text {
    opacity: 1;
    animation: booGlow 3s ease-in-out infinite alternate;
}

@keyframes booGlow {
    0% {
        text-shadow: 0 0 40px rgba(212, 120, 74, 0.4), 0 0 80px rgba(212, 120, 74, 0.2);
    }
    100% {
        text-shadow: 0 0 60px rgba(212, 120, 74, 0.6), 0 0 120px rgba(212, 120, 74, 0.3), 0 0 180px rgba(212, 120, 74, 0.1);
    }
}

/* =============================================
   Responsive
   ============================================= */
@media (max-width: 768px) {
    .letter-svg {
        width: 80vw;
    }

    .shadow-double .letter-svg {
        width: 80vw;
    }

    .left-anchored,
    .right-anchored {
        justify-content: center;
        padding-left: 0;
        padding-right: 0;
    }

    .shadow-double.left-anchored,
    .left-anchored .shadow-double,
    .right-anchored .shadow-double {
        justify-content: center;
        padding-left: 0;
        padding-right: 0;
    }

    .left-anchored .orbit-text,
    .right-anchored .orbit-text {
        left: 50%;
        right: auto;
        top: auto;
        bottom: 8vh;
        transform: translateX(-50%);
    }

    #progress-spine {
        right: 12px;
    }

    #progress-label {
        display: none;
    }

    .interstitial-small {
        min-height: 15vh;
    }

    #letter-cluster {
        width: 85vw;
    }
}

/* Mix-blend-mode for glow effects */
.svg-letter-stroke {
    mix-blend-mode: screen;
}

/* Selection color */
::selection {
    background: var(--spectral-blue);
    color: var(--void);
}
