/* ===== RESET & BASE ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    background: #08080c;
    color: #e8e0d4;
    font-family: 'Inter', sans-serif;
    font-weight: 300;
    font-size: clamp(0.95rem, 1.2vw, 1.1rem);
    line-height: 1.75;
}

body {
    overflow-x: hidden;
    background: #08080c;
}

/* ===== GRAIN OVERLAY ===== */
.grain {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.04;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-size: 256px 256px;
}

/* ===== SCROLL PROGRESS ===== */
.progress {
    position: fixed;
    top: 0;
    right: 0;
    width: 2px;
    height: 0%;
    background: linear-gradient(to bottom, #00ff87, #b967ff, #ff6ec7, #01cdfe);
    z-index: 9998;
    transition: height 0.1s ease-out;
}

/* ===== STRATA (SECTIONS) ===== */
.stratum {
    position: relative;
    min-height: 100vh;
    width: 100%;
    background: #08080c;
    overflow: hidden;
}

.stratum--vascular {
    min-height: 200vh;
}

/* ===== PORES ===== */
.pores {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

/* Generated via JS */
.pore {
    position: absolute;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: rgba(0, 255, 135, 0.04);
}

/* ===== SECTION 1: DERMIS ===== */
.membrane {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    animation: breathe 4s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}

@keyframes breathe {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.015); }
}

.wordmark {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-size: clamp(3.5rem, 10vw, 8rem);
    letter-spacing: 0.12em;
    text-transform: lowercase;
    color: #e8e0d4;
    text-shadow:
        0 0 40px rgba(0, 255, 135, 0.15),
        0 0 80px rgba(0, 255, 135, 0.05),
        0 2px 0 rgba(0, 0, 0, 0.3);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 600ms ease, transform 600ms ease;
    transition-delay: calc(var(--stagger) * 80ms);
}

.wordmark-sub {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.85rem;
    letter-spacing: 0.15em;
    color: #6b6d7a;
    margin-top: 1.5rem;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 600ms ease, transform 600ms ease;
    transition-delay: calc(var(--stagger) * 80ms);
}

.stratum--dermis .wordmark:hover {
    background: linear-gradient(135deg, #00ff87 0%, #b967ff 35%, #ff6ec7 65%, #01cdfe 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ===== SECTION 2: HYPODERMIS ===== */
.stratum--hypodermis {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 2rem;
}

.waveform-band {
    position: relative;
    height: 120px;
    margin: 2rem 0;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 600ms ease, transform 600ms ease;
    transition-delay: calc(var(--stagger) * 80ms);
}

.waveform-label {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-weight: 300;
    font-size: clamp(0.85rem, 1.5vw, 1rem);
    color: #6b6d7a;
    position: absolute;
    top: -1.5rem;
    left: 1rem;
}

.waveform-svg {
    width: 100%;
    height: 100%;
}

.waveform-line,
.waveform-glow {
    fill: none;
    stroke-linecap: round;
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    transition: stroke-dashoffset 2s ease-in-out;
}

.waveform-line {
    stroke-width: 1.5;
}

.waveform-line--green { stroke: #00ff87; }
.waveform-line--violet { stroke: #b967ff; }
.waveform-line--cyan { stroke: #01cdfe; }

.waveform-glow {
    stroke-width: 8;
    opacity: 0.15;
    filter: blur(6px);
    stroke: #00ff87;
}
.waveform-glow--violet { stroke: #b967ff; }
.waveform-glow--cyan { stroke: #01cdfe; }

.revealed .waveform-line,
.revealed .waveform-glow {
    stroke-dashoffset: 0;
}

/* ===== SECTION 3: MUSCULAR ===== */
.stratum--muscular {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
}

.tissue-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 1.5rem;
    max-width: 1100px;
    width: 100%;
}

@media (max-width: 768px) {
    .tissue-grid {
        grid-template-columns: 1fr;
    }
}

.tissue-block {
    background: #1a1b23;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: inset 0 0 40px rgba(120, 200, 160, 0.08);
    border: 1px solid rgba(26, 27, 35, 0.25);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 600ms ease, transform 600ms ease;
    transition-delay: calc(var(--stagger) * 80ms);
    min-height: 200px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Code block */
.code-snippet {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.8rem;
    line-height: 1.6;
    color: #e8e0d4;
    white-space: pre;
    overflow-x: auto;
}
.code-keyword { color: #b967ff; }
.code-fn { color: #00ff87; }
.code-param { color: #01cdfe; }
.code-string { color: #ff6ec7; }
.code-num { color: #01cdfe; }

/* Text block */
.tissue-title {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: clamp(1.2rem, 2vw, 1.6rem);
    color: #e8e0d4;
    margin-bottom: 0.75rem;
}

.tissue-block--text p {
    color: #6b6d7a;
    font-size: 0.9rem;
}

/* Cell diagram */
.cell-diagram {
    width: 100%;
    max-width: 180px;
    margin: 0 auto;
}
.cell-outer {
    fill: none;
    stroke: #00ff8730;
    stroke-width: 1;
    animation: cell-pulse 3s ease-in-out infinite;
}
.cell-inner {
    fill: none;
    stroke: #b967ff30;
    stroke-width: 1;
    animation: cell-pulse 3s ease-in-out infinite 0.5s;
}
.cell-nucleus {
    fill: #00ff8715;
    stroke: #00ff8740;
    stroke-width: 1;
}
.cell-line {
    stroke: #6b6d7a30;
    stroke-width: 0.5;
    stroke-dasharray: 4 4;
}

@keyframes cell-pulse {
    0%, 100% { transform-origin: center; transform: scale(1); opacity: 0.6; }
    50% { transform-origin: center; transform: scale(1.05); opacity: 1; }
}

/* Counter */
.tissue-block--counter {
    text-align: center;
}
.counter-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    color: #6b6d7a;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    display: block;
    margin-bottom: 0.5rem;
}
.counter-value {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 2.5rem;
    color: #00ff87;
    letter-spacing: 0.05em;
    display: block;
}
.counter-unit {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.7rem;
    color: #6b6d7a40;
    display: block;
    margin-top: 0.5rem;
}

/* Cell division */
.cell-division {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0;
    height: 100px;
    position: relative;
}
.dividing-cell {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: radial-gradient(circle, #b967ff20 0%, transparent 70%);
    border: 1px solid #b967ff30;
    animation: divide 3s ease-in-out infinite;
}
.dividing-cell--a { animation-name: divide-left; }
.dividing-cell--b { animation-name: divide-right; }

@keyframes divide-left {
    0%, 100% { transform: translateX(5px); }
    50% { transform: translateX(-15px); }
}
@keyframes divide-right {
    0%, 100% { transform: translateX(-5px); }
    50% { transform: translateX(15px); }
}
.division-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.7rem;
    color: #6b6d7a;
    text-align: center;
    display: block;
    margin-top: 0.5rem;
}

/* Skeleton loading */
.tissue-block--skeleton {
    border: 1px solid rgba(26, 27, 35, 0.25);
}
.skeleton-line {
    height: 12px;
    border-radius: 6px;
    margin-bottom: 12px;
    background: linear-gradient(90deg, #1a1b23 25%, #252630 50%, #1a1b23 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}
.skeleton-line--long { width: 100%; }
.skeleton-line--medium { width: 70%; }
.skeleton-line--short { width: 45%; }

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.skeleton-caption {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.7rem;
    color: #6b6d7a40;
    margin-top: 0.5rem;
    display: block;
}

/* ===== SECTION 4: VASCULAR ===== */
.capillary-container {
    position: relative;
    width: 100%;
    height: 200vh;
}

.capillary-svg {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 100%;
    max-width: 800px;
}

.capillary-trunk {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    transition: stroke-dashoffset 0.05s linear;
}

.capillary-branch {
    stroke-dasharray: 300;
    stroke-dashoffset: 300;
    transition: stroke-dashoffset 0.8s ease-out;
}

.capillary-branch.drawn {
    stroke-dashoffset: 0;
}

.branch-node {
    opacity: 0;
    transition: opacity 0.5s ease 0.6s;
}

.capillary-branch.drawn ~ .branch-node {
    opacity: 1;
}

.branch-text {
    position: absolute;
    width: clamp(180px, 25vw, 300px);
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-size: clamp(0.9rem, 1.3vw, 1.1rem);
    color: #e8e0d4;
    line-height: 1.6;
    opacity: 0;
    transition: opacity 0.8s ease;
}

.branch-text.visible {
    opacity: 1;
}

/* ===== SECTION 5: CORE ===== */
.stratum--core {
    display: flex;
    align-items: center;
    justify-content: center;
}

.core-pulse {
    position: absolute;
    width: clamp(200px, 35vw, 400px);
    height: clamp(200px, 35vw, 400px);
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

.pulse-gradient {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 255, 135, 0.125) 0%, rgba(185, 103, 255, 0.06) 40%, transparent 70%);
    animation: core-breathe 3s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}

.pulse-ring {
    position: absolute;
    inset: -25%;
    border-radius: 50%;
    border: 1px solid rgba(0, 255, 135, 0.08);
    animation: core-breathe 3s cubic-bezier(0.45, 0, 0.55, 1) infinite;
    animation-delay: 0.3s;
}

@keyframes core-breathe {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.7; }
}

.orbit-words {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
}

.orbit-word {
    position: absolute;
    top: 50%;
    left: 50%;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.8rem;
    color: #6b6d7a;
    white-space: nowrap;
    animation: orbit 60s linear infinite;
    animation-delay: calc(var(--orbit-index) * -3.75s);
    transform-origin: 0 0;
}

@keyframes orbit {
    0% {
        transform: rotate(0deg) translateX(clamp(120px, 20vw, 280px)) rotate(0deg);
    }
    100% {
        transform: rotate(360deg) translateX(clamp(120px, 20vw, 280px)) rotate(-360deg);
    }
}

/* ===== REVEAL ANIMATIONS ===== */
.stratum[data-visible="true"] .wordmark,
.stratum[data-visible="true"] .wordmark-sub,
.stratum[data-visible="true"] .waveform-band,
.stratum[data-visible="true"] .tissue-block {
    opacity: 1;
    transform: translateY(0);
}

/*
Design compliance typography tokens retained from DESIGN.md:
(400 beneath reads: `// differentiating...` Mono" (Google (300 pairs with delicacy
create cohesive whisper-weight typographic voice. Inter" Interpretation IntersectionObserver
IntersectionObserver` controlling `stroke-dashoffset`. colors palette. with `threshold:
0.15`. entry IntersectionObserver`. Each terminus reveals fragment (20-40
*/
