:root {
    --bg-primary: #0b0b1a;
    --bg-secondary: #12122a;
    --surface: #1c1c3a;
    --text-primary: #e0e0f0;
    --text-secondary: #8888aa;
    --accent-cyan: #00e5ff;
    --accent-magenta: #ff2d7b;
    --accent-violet: #7b2dff;
    --font-display: 'Jost', sans-serif;
    --font-body: 'Source Sans 3', sans-serif;
    --font-mono: 'Noto Sans Mono', monospace;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-weight: 300;
    font-size: clamp(1rem, 1.8vw, 1.25rem);
    line-height: 1.75;
    overflow-x: hidden;
}

/* ===== FIXED BACKGROUND GLYPH ===== */
#bg-glyph {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: var(--font-mono);
    font-size: 25vw;
    color: var(--accent-cyan);
    opacity: 0.03;
    pointer-events: none;
    z-index: 0;
    user-select: none;
}

/* ===== PROGRESS BAR ===== */
#progress-bar {
    position: fixed;
    left: 0;
    top: 0;
    width: 2px;
    height: 100vh;
    background: var(--accent-cyan);
    transform-origin: top;
    transform: scaleY(0);
    z-index: 100;
    pointer-events: none;
}

/* ===== BUBBLES SVG ===== */
#bubbles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

/* ===== GEOMETRIC SHAPES ===== */
#geo-shapes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.geo-shape {
    position: absolute;
    border: 1px solid;
    opacity: 0.1;
}

.geo-shape--hexagon {
    width: 60px;
    height: 60px;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background: none;
    border: none;
    outline: 1px solid var(--accent-magenta);
    outline-offset: -1px;
}

.geo-shape--triangle {
    width: 50px;
    height: 50px;
    border: none;
    clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
    outline: 1px solid var(--accent-violet);
    outline-offset: -1px;
}

.geo-shape--circle {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border-color: var(--accent-magenta);
}

/* ===== HERO SECTION ===== */
#hero {
    position: relative;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    z-index: 2;
}

.ripple-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.ripple-ring {
    fill: none;
    stroke: var(--accent-cyan);
    stroke-width: 2;
    opacity: 0;
}

.ripple-ring:nth-child(1) {
    animation: ripple-expand 4s ease-out infinite;
}

.ripple-ring:nth-child(2) {
    animation: ripple-expand 4s ease-out 1.33s infinite;
}

.ripple-ring:nth-child(3) {
    animation: ripple-expand 4s ease-out 2.66s infinite;
}

@keyframes ripple-expand {
    0% {
        r: 0;
        stroke-width: 2;
        opacity: 0.3;
        stroke: var(--accent-cyan);
    }
    100% {
        r: 300;
        stroke-width: 0;
        opacity: 0;
        stroke: var(--accent-violet);
    }
}

.hero-content {
    position: relative;
    text-align: center;
    z-index: 3;
    transform: translateY(5vh);
}

.hero-title {
    font-family: var(--font-display);
    font-size: clamp(3rem, 8vw, 7rem);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-primary);
    margin-bottom: 0.3em;
}

.hero-subtitle {
    font-family: var(--font-mono);
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    color: var(--accent-cyan);
    animation: glow-pulse 3s ease-in-out infinite;
}

@keyframes glow-pulse {
    0%, 100% {
        text-shadow: 0 0 20px rgba(0, 229, 255, 0.3), 0 0 40px rgba(0, 229, 255, 0.1);
    }
    50% {
        text-shadow: 0 0 30px rgba(0, 229, 255, 0.6), 0 0 60px rgba(0, 229, 255, 0.2);
    }
}

/* ===== NARRATIVE SECTIONS ===== */
.narrative-section {
    position: relative;
    z-index: 2;
    padding: 15vh 5vw;
    max-width: 38ch;
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 800ms cubic-bezier(0.16, 1, 0.3, 1),
                transform 800ms cubic-bezier(0.16, 1, 0.3, 1);
}

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

.narrative-section[data-flow="left"] {
    margin-left: calc(10vw + var(--flow-offset, 0px));
    margin-right: auto;
}

.narrative-section[data-flow="right"] {
    margin-left: auto;
    margin-right: calc(10vw + var(--flow-offset, 0px));
}

.narrative-section[data-flow="center"] {
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}

.section-label {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.narrative-section h2 {
    font-family: var(--font-display);
    font-size: clamp(1.8rem, 4vw, 3.2rem);
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    letter-spacing: 0.02em;
}

.narrative-section p {
    color: var(--text-primary);
    font-weight: 300;
    margin-bottom: 1.2em;
    max-width: 38ch;
}

/* ===== DISSOLUTION ===== */
.dissolution-section {
    max-width: 30ch;
}

.dissolution-section h2 {
    font-size: clamp(1.4rem, 3vw, 2.2rem);
}

.dissolution-section p {
    font-size: clamp(0.9rem, 1.4vw, 1.1rem);
    color: var(--text-secondary);
}

/* ===== FINAL GLYPH ===== */
#final-glyph {
    position: relative;
    z-index: 2;
    height: 150vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.final-rinji {
    font-family: var(--font-display);
    font-size: clamp(8rem, 20vw, 16rem);
    color: var(--accent-cyan);
    opacity: 1;
    transition: opacity 0.1s linear;
    user-select: none;
}

/* ===== CODA ===== */
#coda {
    height: 50vh;
    position: relative;
    z-index: 2;
}

/* ===== BUBBLE ANIMATIONS ===== */
@keyframes bubble-rise {
    from {
        transform: translateY(0) translateX(0);
        opacity: var(--bubble-opacity, 0.3);
    }
    to {
        transform: translateY(-120vh) translateX(var(--drift-x, 20px));
        opacity: 0;
    }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .narrative-section[data-flow="left"],
    .narrative-section[data-flow="right"] {
        margin-left: 5vw;
        margin-right: 5vw;
        max-width: none;
    }

    .narrative-section p {
        max-width: none;
    }

    .dissolution-section {
        max-width: none;
    }
}

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