:root {
    --soot-black: #0C0B09;
    --charcoal: #1A1815;
    --bone-white: #E8E2D9;
    --parchment-gray: #B8B2A8;
    --signal-red: #FF4136;
    --chrome-yellow: #FFD700;
    --electric-cyan: #00BFFF;
    --dim-earth: #4A4540;
    --ash: #2E2B26;

    --font-display: 'Epilogue', sans-serif;
    --font-label: 'Bebas Neue', sans-serif;
    --font-body: 'Space Grotesk', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    --ease-spring: cubic-bezier(0.175, 0.885, 0.32, 1.275);
    --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    background: var(--soot-black);
    color: var(--bone-white);
    font-family: var(--font-body);
    font-weight: 300;
    font-size: clamp(0.95rem, 1.1vw, 1.15rem);
    line-height: 1.65;
    overflow-x: hidden;
}

/* ===== Dot Grid Canvas ===== */
.dot-grid {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

/* ===== Act Sections ===== */
.act {
    position: relative;
    z-index: 1;
}

/* ===== Act I: Breathing Word ===== */
.act-1 {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.breathing-word {
    display: inline-flex;
    gap: 0;
    cursor: default;
}

.breath-letter {
    font-family: var(--font-display);
    font-size: clamp(4rem, 12vw, 16rem);
    letter-spacing: -0.04em;
    line-height: 0.85;
    color: var(--bone-white);
    display: inline-block;
    font-variation-settings: 'wght' 400;
    animation: breathe 8s ease-in-out infinite;
    transition: color 200ms ease;
}

.breath-letter:nth-child(1) { animation-delay: 0s; }
.breath-letter:nth-child(2) { animation-delay: -1.6s; }
.breath-letter:nth-child(3) { animation-delay: -3.2s; }
.breath-letter:nth-child(4) { animation-delay: -4.8s; }
.breath-letter:nth-child(5) { animation-delay: -6.4s; }

@keyframes breathe {
    0%, 100% { font-variation-settings: 'wght' 100; }
    50% { font-variation-settings: 'wght' 900; }
}

.breath-letter:hover {
    animation-play-state: paused;
    font-variation-settings: 'wght' 900;
    color: var(--chrome-yellow);
}

.scroll-hint {
    font-family: var(--font-label);
    font-size: 0.8rem;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--ash);
    position: absolute;
    bottom: 3rem;
    transition: color 500ms var(--ease-smooth);
}

.scroll-hint.visible {
    color: var(--dim-earth);
}

/* ===== Act II: Anatomy Theater ===== */
.act-2 {
    min-height: 180vh;
    padding: 10vh 5vw;
    position: relative;
}

.anatomy-panel {
    position: relative;
    background: var(--charcoal);
    border: 1px solid var(--ash);
    padding: 3rem;
    width: 55vw;
    min-height: 50vh;
    opacity: 0;
    transition: opacity 800ms var(--ease-spring), transform 800ms var(--ease-spring);
    overflow: hidden;
}

.anatomy-panel[data-reveal="left"] {
    transform: translateX(-100px) rotate(-2deg);
    margin-left: 5vw;
}
.anatomy-panel[data-reveal="right"] {
    transform: translateX(100px) rotate(1.5deg);
    margin-left: 35vw;
    margin-top: -15vh;
    z-index: 2;
}
.anatomy-panel[data-reveal="bottom"] {
    transform: translateY(100px) rotate(-0.5deg);
    margin-left: 15vw;
    margin-top: -10vh;
    z-index: 3;
}

.anatomy-panel.revealed {
    opacity: 1;
}
.anatomy-panel.revealed[data-reveal="left"] { transform: translateX(0) rotate(-2deg); }
.anatomy-panel.revealed[data-reveal="right"] { transform: translateX(0) rotate(1.5deg); }
.anatomy-panel.revealed[data-reveal="bottom"] { transform: translateY(0) rotate(-0.5deg); }

.specimen-letter {
    font-family: var(--font-display);
    font-size: 30vw;
    font-weight: 800;
    line-height: 0.85;
    color: var(--bone-white);
    opacity: 0.08;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.anatomy-svg {
    position: relative;
    width: 100%;
    height: 350px;
    z-index: 2;
}

.anatomy-line {
    stroke: var(--ash);
    stroke-width: 0.5;
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    transition: stroke-dashoffset 1.5s ease-out;
}

.anatomy-panel.revealed .anatomy-line {
    stroke-dashoffset: 0;
}

.anatomy-label {
    font-family: var(--font-mono);
    font-size: 9px;
    fill: var(--dim-earth);
    letter-spacing: 0.08em;
}

.bezier-points {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.bezier-dot {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--signal-red);
    transform: translate(-50%, -50%);
    transition: transform 200ms var(--ease-spring);
}

.bezier-dot:hover {
    transform: translate(-50%, -50%) scale(1.5);
    cursor: grab;
}

/* ===== Act III: Horizontal Specimen ===== */
.act-3 {
    height: 30vh;
    overflow: hidden;
    border-top: 1px solid var(--ash);
    border-bottom: 1px solid var(--ash);
    position: relative;
}

.specimen-strip {
    width: 100%;
    height: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    cursor: grab;
    -webkit-overflow-scrolling: touch;
}

.specimen-strip::-webkit-scrollbar {
    display: none;
}

.strip-inner {
    display: flex;
    align-items: center;
    height: 100%;
    width: max-content;
    padding: 0 2vw;
}

.exploded-letter {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: 20vw;
    line-height: 1;
    flex-shrink: 0;
    width: 15vw;
    text-align: center;
    display: inline-block;
    user-select: none;
    -webkit-text-stroke: 2px currentColor;
    color: transparent;
    position: relative;
}

.exploded-letter[data-accent="red"] { -webkit-text-stroke-color: var(--signal-red); }
.exploded-letter[data-accent="yellow"] { -webkit-text-stroke-color: var(--chrome-yellow); }
.exploded-letter[data-accent="cyan"] { -webkit-text-stroke-color: var(--electric-cyan); }

/* ===== Act IV: Variable Space ===== */
.act-4 {
    min-height: 140vh;
    padding: 10vh 5vw;
    display: flex;
    align-items: center;
    justify-content: center;
}

.variable-layout {
    display: flex;
    gap: 2rem;
    align-items: center;
    width: 100%;
    max-width: 1200px;
    flex-wrap: wrap;
}

.var-text-col {
    flex: 1;
    min-width: 200px;
    max-width: 38ch;
}

.var-text-col p {
    font-family: var(--font-body);
    font-weight: 300;
    color: var(--parchment-gray);
    margin-bottom: 1.5rem;
    line-height: 1.65;
}

.annotation {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--dim-earth);
}

.var-letter-stage {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

.var-letter {
    font-family: var(--font-display);
    font-size: clamp(10rem, 30vw, 25rem);
    line-height: 0.85;
    color: var(--bone-white);
    font-variation-settings: 'wght' 400;
    transition: font-variation-settings 50ms linear;
    cursor: crosshair;
}

.var-axes {
    display: flex;
    gap: 2rem;
}

.axis-slider {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.axis-label {
    font-family: var(--font-label);
    font-size: 0.7rem;
    letter-spacing: 0.25em;
    color: var(--signal-red);
}

.axis-track {
    width: 80px;
    height: 3px;
    background: var(--ash);
    position: relative;
    border-radius: 2px;
}

.axis-thumb {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--chrome-yellow);
    transition: left 50ms linear;
}

.axis-value {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--dim-earth);
    min-width: 3em;
}

/* ===== Act V: Dissolution ===== */
.act-5 {
    min-height: 130vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4rem;
}

.dissolution-word {
    display: inline-flex;
    gap: 0;
}

.dissolve-letter {
    font-family: var(--font-display);
    font-size: clamp(4rem, 12vw, 14rem);
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 0.85;
    color: var(--bone-white);
    display: inline-block;
    transition: transform 2s var(--ease-spring), opacity 2s ease;
}

.dissolve-letter.scattered {
    opacity: 0.15;
}

.final-line {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--dim-earth);
    letter-spacing: 0.08em;
    opacity: 0;
    transition: opacity 1s var(--ease-smooth);
}

.final-line.visible {
    opacity: 1;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .anatomy-panel {
        width: 85vw;
        margin-left: 5vw !important;
        margin-top: 2rem;
    }

    .variable-layout {
        flex-direction: column;
    }

    .var-text-col {
        max-width: 100%;
    }

    .exploded-letter {
        font-size: 30vw;
        width: 25vw;
    }
}

/* ===== Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .breath-letter {
        font-variation-settings: 'wght' 500;
    }
    .anatomy-panel {
        opacity: 1;
        transform: none !important;
    }
    .dissolve-letter {
        opacity: 1;
    }
}
