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

:root {
    --abyssal-ink: #0a1628;
    --deep-indigo: #0d1b2a;
    --midnight-cobalt: #162a4a;
    --oxidized-copper: #4a7c6f;
    --mycelium-amber: #c9a84c;
    --spore-dust: #b8a77a;
    --specimen-cream: #e8dfd0;
    --tarnished-brass: #8a7a52;
    --bioluminescent-teal: #2a8f7a;
    --fungal-violet: #3d2a5c;
}

html, body {
    width: 100%;
    height: 100%;
    overflow-x: hidden;
}

body {
    background: linear-gradient(180deg, var(--abyssal-ink) 0%, var(--deep-indigo) 40%, var(--midnight-cobalt) 100%);
    color: var(--specimen-cream);
    font-family: 'EB Garamond', Georgia, serif;
    font-size: clamp(1rem, 1.6vw, 1.15rem);
    line-height: 1.72;
    letter-spacing: 0.01em;
    position: relative;
}

/* Grain Overlay */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 9999;
    filter: url(#grain);
    opacity: 0.04;
    mix-blend-mode: overlay;
}

/* Hero Section */
.hero {
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: var(--abyssal-ink);
}

.hero-content {
    text-align: center;
    max-width: 90vw;
}

.site-title {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: clamp(2.8rem, 7vw, 6rem);
    font-weight: 700;
    font-style: italic;
    color: var(--specimen-cream);
    letter-spacing: 0.02em;
    line-height: 1.15;
    opacity: 0;
    transform: translateY(30px);
    animation: fadeInDown 1.2s ease-out 0.5s forwards;
}

.site-subtitle {
    font-family: 'EB Garamond', Georgia, serif;
    font-size: clamp(1rem, 2vw, 1.3rem);
    font-style: italic;
    color: var(--spore-dust);
    margin-top: 1.5rem;
    opacity: 0;
    transform: translateY(18px);
    animation: fadeInDown 1.2s ease-out 0.9s forwards;
}

.hero-chevron {
    color: var(--oxidized-copper);
    margin-top: 3rem;
    opacity: 0;
    animation: pulse 2s ease-in-out 2.1s infinite;
    animation-fill-mode: forwards;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(var(--translateY, 30px));
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* Timeline Container */
.timeline-container {
    position: relative;
    padding: 100px 0;
    min-height: 400vh;
}

/* SVG Spine Styles */
.timeline-spine {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.spine {
    stroke: var(--oxidized-copper);
    filter: drop-shadow(0 0 4px rgba(74,124,111,0.4));
}

.spine-glow {
    stroke: var(--bioluminescent-teal);
    filter: blur(4px);
}

/* Timeline Nodes */
.timeline-node {
    position: relative;
    display: grid;
    align-items: flex-start;
    margin-bottom: 300px;
    opacity: 0;
    transform: translateX(60px);
}

.timeline-node-left {
    grid-template-columns: 1fr 50px;
    justify-items: end;
}

.timeline-node-left .specimen-drawer {
    grid-column: 1;
}

.timeline-node-right {
    grid-template-columns: 50px 1fr;
    justify-items: start;
    margin-left: auto;
    margin-right: 0;
}

.timeline-node-right .specimen-drawer {
    grid-column: 2;
}

.timeline-node-right {
    transform: translateX(-60px);
}

.timeline-node.visible {
    opacity: 1;
    transform: translateX(0);
    animation: slideIn 0.6s ease-out forwards;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(var(--translateX, 60px));
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Epoch Marker */
.epoch-marker {
    width: 16px;
    height: 16px;
    background: var(--mycelium-amber);
    border: 2px solid var(--oxidized-copper);
    border-radius: 50%;
    position: absolute;
    left: 50%;
    top: 0;
    transform: translateX(-50%);
    opacity: 0;
    animation: scaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.timeline-node.visible .epoch-marker {
    opacity: 1;
}

@keyframes scaleIn {
    from {
        transform: translateX(-50%) scale(0);
    }
    to {
        transform: translateX(-50%) scale(1);
    }
}

.epoch-marker::after {
    content: '';
    position: absolute;
    width: 1px;
    height: 6px;
    background: var(--oxidized-copper);
    left: 50%;
    top: 50%;
    transform-origin: center top;
    transform: translateX(-50%) translateY(-50%) rotate(var(--angle, 0deg));
}

.timeline-node:hover .epoch-marker {
    box-shadow: 0 0 8px 2px rgba(201,168,76,0.5);
}

/* Specimen Drawer */
.specimen-drawer {
    max-width: 520px;
    padding: 2.5rem 2rem;
    background: var(--deep-indigo);
    border: 1px solid var(--tarnished-brass);
    border-right: 1px solid var(--tarnished-brass);
    border-bottom: 1px solid var(--tarnished-brass);
    border-top: 1px solid var(--tarnished-brass);
    position: relative;
    background-image: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200"><filter id="noise"><feTurbulence type="fractalNoise" baseFrequency="0.65" numOctaves="4" stitchTiles="stitch"/><feColorMatrix type="saturate" values="0"/></filter><rect width="200" height="200" fill="%230d1b2a" filter="url(%23noise)" opacity="0.06"/></svg>');
    background-size: 200px 200px;
    transition: all 0.25s ease-in-out;
    opacity: 0;
    transform: translateY(12px);
}

.timeline-node.visible .specimen-drawer {
    opacity: 1;
    transform: translateY(0);
    animation: drawerSlideIn 0.6s ease-out 0.15s forwards;
}

@keyframes drawerSlideIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.timeline-node:hover .specimen-drawer {
    background-color: var(--midnight-cobalt);
    border-color: var(--mycelium-amber);
}

/* Oscilloscope Header */
.oscilloscope-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1.5rem;
    opacity: 0;
}

.timeline-node.visible .oscilloscope-header {
    opacity: 0.4;
    animation: fadeInContent 0.4s ease-out 0.75s forwards;
}

.timeline-node:hover .oscilloscope-header {
    opacity: 0.8;
    transition: opacity 0.25s ease-in-out;
}

.waveform {
    color: var(--oxidized-copper);
}

/* Drawer Content */
.drawer-title {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: clamp(1.4rem, 3vw, 2.2rem);
    font-weight: 600;
    font-style: italic;
    letter-spacing: 0.02em;
    line-height: 1.15;
    margin-bottom: 1.25rem;
    color: var(--specimen-cream);
    opacity: 0;
}

.timeline-node.visible .drawer-title {
    opacity: 1;
    animation: fadeInContent 0.4s ease-out 0.85s forwards;
}

.drawer-text {
    text-indent: 1.5em;
    margin-bottom: 1.5rem;
    opacity: 0;
}

.timeline-node.visible .drawer-text {
    opacity: 1;
    animation: fadeInContent 0.4s ease-out 0.95s forwards;
}

.drawer-text:first-of-type {
    text-indent: 0;
}

@keyframes fadeInContent {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Specimen Label */
.specimen-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: clamp(0.7rem, 1.1vw, 0.8rem);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--spore-dust);
    opacity: 0.6;
    position: absolute;
    bottom: 1.5rem;
    left: 2rem;
    opacity: 0;
}

.timeline-node.visible .specimen-label {
    opacity: 0.6;
    animation: fadeInContent 0.4s ease-out 1.05s forwards;
}

/* Mycelium Branches */
.mycelium-branch {
    position: absolute;
    left: 50%;
    width: 80px;
    height: 1px;
    background: linear-gradient(
        to right,
        var(--oxidized-copper) 0%,
        transparent 100%
    );
    opacity: 0.2;
    transform-origin: left center;
    transform: translateX(-1px) rotate(var(--angle, 0deg));
    --breathe-duration: 5s;
    animation: breathe var(--breathe-duration) ease-in-out infinite;
}

@keyframes breathe {
    0%, 100% {
        opacity: 0.15;
    }
    50% {
        opacity: 0.35;
    }
}

/* Mushroom Elements */
.mushroom {
    position: absolute;
    width: 8px;
    height: 8px;
    background: var(--tarnished-brass);
    border-radius: 50% 50% 0 0;
    opacity: 0.25;
    left: 50%;
    transform: translateX(-50%);
}

/* Specimen Tags */
.specimen-tag {
    position: fixed;
    width: 120px;
    height: 32px;
    border: 1px dotted var(--spore-dust);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--spore-dust);
    transform: rotate(var(--rotation, 0deg));
    pointer-events: none;
    z-index: 100;
    opacity: 0;
    animation: tagFadeIn 0.6s ease-out forwards;
}

.tag-1 {
    top: 25%;
    right: 5%;
    --rotation: -3deg;
    animation-delay: 2.5s;
}

.tag-2 {
    top: 40%;
    left: 8%;
    --rotation: 4deg;
    animation-delay: 3s;
}

.tag-3 {
    top: 60%;
    right: 6%;
    --rotation: -5deg;
    animation-delay: 3.5s;
}

.tag-4 {
    top: 75%;
    left: 10%;
    --rotation: 2deg;
    animation-delay: 4s;
}

.tag-5 {
    top: 85%;
    right: 8%;
    --rotation: -4deg;
    animation-delay: 4.5s;
}

@keyframes tagFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Epoch Indicator */
.epoch-indicator {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 48px;
    height: 120px;
    border: 1px solid var(--oxidized-copper);
    background: rgba(13, 27, 42, 0.8);
    border-radius: 2px;
    z-index: 50;
    overflow: hidden;
}

.indicator-bar {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 0%;
    background: var(--oxidized-copper);
    transition: height 0.1s linear;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .timeline-node,
    .timeline-node-left,
    .timeline-node-right {
        grid-template-columns: 50px 1fr !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        justify-items: start !important;
    }

    .timeline-node .specimen-drawer {
        grid-column: 2 !important;
    }

    .timeline-node,
    .timeline-node-right {
        transform: translateX(60px);
    }

    .timeline-node.visible {
        transform: translateX(0);
    }

    .specimen-drawer {
        margin-left: 48px;
        max-width: 100%;
    }

    .timeline-spine {
        left: 24px;
    }

    .spine, .spine-glow {
        x1: 24px;
        x2: 24px;
    }

    .mycelium-branch {
        display: none;
    }

    .epoch-indicator {
        bottom: 50%;
        right: 50%;
        transform: translateX(50%) translateY(50%);
    }

    .site-title {
        font-size: clamp(1.8rem, 5vw, 3rem);
    }

    body {
        font-size: 1rem;
    }
}

/* Typography Enhancement */
p {
    margin-bottom: 1rem;
}

p:last-of-type {
    margin-bottom: 0;
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* Link Styles */
a {
    color: var(--bioluminescent-teal);
    text-decoration: underline;
    text-decoration-color: var(--oxidized-copper);
    transition: color 0.25s ease-in-out;
}

a:hover {
    color: var(--specimen-cream);
    text-decoration-color: var(--bioluminescent-teal);
}
