:root {
    --loam: #2d2418;
    --clay: #5c4a36;
    --sage: #8b7a62;
    --bark: #a69478;
    --mycelium: #e8dcc8;
    --dust: #f4efe5;
    --moss: #5e6b4a;
    --rust: #8b4c2a;
    --charcoal: #1a1410;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--dust);
    color: var(--loam);
    font-family: "IBM Plex Mono", monospace;
    font-weight: 400;
    font-size: 16px;
    line-height: 1.7;
    cursor: crosshair;
    overflow-x: hidden;
}

/* ===== Scroll Indicator (Soil Probe) ===== */
#scroll-indicator {
    position: fixed;
    right: 20px;
    top: 10vh;
    height: 80vh;
    width: 2px;
    background-color: var(--bark);
    opacity: 0.4;
    z-index: 100;
}

#scroll-dot {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--moss);
    transition: top 0.1s ease-out;
}

/* ===== Zone Background Texture (Dot Matrix Soil) ===== */
.zone-bg-texture {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: radial-gradient(circle, var(--bark) 1px, transparent 1px);
    background-size: 16px 16px;
    opacity: 0.12;
    pointer-events: none;
}

/* ===== Zone Base ===== */
.zone {
    position: relative;
    overflow: hidden;
}
/* ===== Zone 1: Emergence ===== */
.zone-emergence {
    min-height: 100vh;
    background-color: var(--dust);
    display: flex;
    align-items: flex-end;
    justify-content: flex-start;
}

.footprint-illustration {
    position: absolute;
    right: -5vw;
    top: 10vh;
    width: 60vw;
    max-width: 700px;
    color: var(--loam);
    opacity: 0;
    transition: opacity 1200ms ease-out;
}

.footprint-illustration.visible {
    opacity: 0.3;
}

.zone-1-content {
    position: relative;
    z-index: 2;
    padding-left: 8vw;
    padding-bottom: 25vh;
}

.domain-title {
    font-family: "Space Mono", monospace;
    font-weight: 700;
    font-size: clamp(2rem, 5vw, 4rem);
    color: var(--loam);
    letter-spacing: -0.01em;
    font-feature-settings: "liga" 0;
    opacity: 0;
    transition: opacity 800ms ease-out 600ms;
}

.domain-title.visible {
    opacity: 1;
}

.subtitle-container {
    overflow: hidden;
    margin-top: 0.8rem;
}

.subtitle-text {
    font-family: "IBM Plex Mono", monospace;
    font-weight: 300;
    font-size: 14px;
    color: var(--clay);
    display: inline-block;
    overflow: hidden;
    white-space: nowrap;
    width: 0;
    animation: typewriter 1.2s steps(15, end) 1.4s forwards;
}

@keyframes typewriter {
    from { width: 0; }
    to { width: 10em; }
}

/* ===== Zone 2: Specimens ===== */
.zone-specimens {
    min-height: 120vh;
    background-color: var(--dust);
}

.specimen-field {
    position: relative;
    width: 100%;
    height: 120vh;
}

.specimen-card {
    position: absolute;
    left: var(--card-left);
    top: var(--card-top);
    width: var(--card-width);
    background-color: var(--dust);
    border: 1px solid var(--bark);
    padding: 20px 16px 14px;
    transform: rotate(var(--card-rotate));
    opacity: 0;
    transition: opacity 600ms ease-out, transform 600ms ease-out, border-color 300ms ease, box-shadow 300ms ease;
    background-image: radial-gradient(circle, var(--bark) 1px, transparent 1px);
    background-size: 16px 16px;
    background-blend-mode: multiply;
}

.specimen-card.visible {
    opacity: 1;
}

.specimen-card:hover {
    transform: rotate(var(--card-rotate)) translateY(-4px);
    border-color: var(--moss);
    box-shadow: 0 4px 12px rgba(45, 36, 24, 0.1);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 300ms ease, box-shadow 300ms ease;
}

.specimen-card:hover .specimen-illustration svg {
    color: var(--rust);
    transition: color 300ms ease;
}

.specimen-illustration {
    display: flex;
    justify-content: center;
    margin-bottom: 12px;
}

.specimen-illustration svg {
    color: var(--loam);
    transition: color 300ms ease;
}

.svg-small {
    width: 100%;
    max-width: 160px;
    height: auto;
}

.svg-large {
    width: 100%;
    height: auto;
}

.specimen-label {
    display: block;
    font-family: "Space Mono", monospace;
    font-weight: 400;
    font-size: clamp(0.75rem, 1.2vw, 0.9rem);
    letter-spacing: 0.06em;
    color: var(--loam);
    font-feature-settings: "liga" 0;
    text-shadow: 0 0 0 transparent, 1px 1px 0 rgba(45,36,24,0.1);
}

.specimen-class {
    display: block;
    font-family: "Courier Prime", monospace;
    font-weight: 400;
    font-style: italic;
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--sage);
    margin-top: 4px;
}
/* ===== Drift Animations ===== */
@keyframes drift-1 {
    0%, 100% { transform: translate(0, 0) rotate(var(--card-rotate)); }
    50% { transform: translate(4px, -6px) rotate(calc(var(--card-rotate) + 1.5deg)); }
}

@keyframes drift-2 {
    0%, 100% { transform: translate(0, 0) rotate(var(--card-rotate)); }
    50% { transform: translate(-3px, 5px) rotate(calc(var(--card-rotate) - 1.5deg)); }
}

@keyframes drift-3 {
    0%, 100% { transform: translate(0, 0) rotate(var(--card-rotate)); }
    50% { transform: translate(2px, -4px) rotate(calc(var(--card-rotate) + 0.8deg)); }
}

.specimen-card.drifting[data-drift="1"] {
    animation: drift-1 10s ease-in-out infinite;
}
.specimen-card.drifting[data-drift="2"] {
    animation: drift-2 12s ease-in-out infinite;
}
.specimen-card.drifting[data-drift="3"] {
    animation: drift-3 14s ease-in-out infinite;
}

.specimen-card.drifting:hover {
    animation-play-state: paused;
}

/* ===== Root Separator ===== */
.root-separator {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60px;
}

/* ===== Zone 3: Soil Layer ===== */
.zone-soil {
    min-height: 100vh;
}

.soil-stratum {
    position: sticky;
    top: 0;
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding: 8vh 10vw;
}

.stratum-topsoil {
    background-color: var(--dust);
    color: var(--loam);
    z-index: 1;
}

.stratum-subsoil {
    background: linear-gradient(180deg, var(--mycelium) 0%, var(--bark) 100%);
    color: var(--loam);
    z-index: 2;
}

.stratum-bedrock {
    background: linear-gradient(180deg, var(--clay) 0%, var(--loam) 100%);
    color: var(--mycelium);
    z-index: 3;
}

.stratum-content {
    max-width: 600px;
    position: relative;
    z-index: 2;
}

.zone-title {
    font-family: "Space Mono", monospace;
    font-weight: 700;
    font-size: clamp(1.8rem, 4vw, 4rem);
    letter-spacing: -0.01em;
    font-feature-settings: "liga" 0;
    margin-bottom: 1.5rem;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 600ms ease-out, transform 600ms ease-out;
}

.zone-title.visible {
    opacity: 1;
    transform: translateY(0);
}

.stratum-bedrock .zone-title,
.stratum-bedrock .zone-body {
    color: var(--mycelium);
}

.zone-body {
    font-family: "IBM Plex Mono", monospace;
    font-weight: 300;
    font-size: 16px;
    line-height: 1.7;
    color: var(--clay);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 600ms ease-out 200ms, transform 600ms ease-out 200ms;
}

.zone-body.visible {
    opacity: 1;
    transform: translateY(0);
}

.stratum-bedrock .zone-body {
    color: var(--bark);
}

/* Root System SVG in soil zone */
.root-system {
    position: absolute;
    right: 5vw;
    top: 0;
    height: 100%;
    width: 300px;
    color: var(--bark);
    opacity: 0.3;
}

.root-path {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 2s ease-out;
}

.root-path.drawn {
    stroke-dashoffset: 0;
}
/* ===== Zone 4: Trail Map ===== */
.zone-trail {
    min-height: 130vh;
    background-color: var(--mycelium);
}

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

#trail-svg {
    width: 80%;
    max-width: 800px;
    height: 90%;
}

.trail-marker {
    opacity: 0.5;
}

.waypoint {
    position: absolute;
    left: var(--wp-left);
    top: var(--wp-top);
    opacity: 0;
    transition: opacity 300ms ease;
    max-width: 220px;
}

.waypoint.visible {
    opacity: 1;
}

.waypoint-label {
    display: block;
    font-family: "Space Mono", monospace;
    font-weight: 700;
    font-size: clamp(0.75rem, 1.2vw, 0.9rem);
    letter-spacing: 0.06em;
    color: var(--loam);
    font-feature-settings: "liga" 0;
    text-shadow: 0 0 0 transparent, 1px 1px 0 rgba(45,36,24,0.1);
}

.waypoint-note {
    display: block;
    font-family: "IBM Plex Mono", monospace;
    font-weight: 300;
    font-size: 13px;
    line-height: 1.5;
    color: var(--sage);
    margin-top: 4px;
}

/* ===== Zone 5: Sediment ===== */
.zone-sediment {
    min-height: 80vh;
    background: linear-gradient(180deg, var(--clay) 0%, var(--loam) 40%, var(--charcoal) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.sediment-content {
    width: 100%;
    max-width: 600px;
    padding: 10vh 8vw;
}

.sediment-layers {
    display: flex;
    flex-direction: column;
    gap: 4rem;
}

.sediment-text .zone-body {
    color: var(--bark);
    font-size: 14px;
}

.sediment-text-1 {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 600ms ease-out, transform 600ms ease-out;
}
.sediment-text-1.visible {
    opacity: 1;
    transform: translateY(0);
}

.sediment-text-2 {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 600ms ease-out 200ms, transform 600ms ease-out 200ms;
}
.sediment-text-2.visible {
    opacity: 1;
    transform: translateY(0);
}

.sediment-final {
    text-align: center;
    padding-top: 3rem;
}

.domain-buried {
    font-family: "Space Mono", monospace;
    font-weight: 400;
    font-size: 8px;
    letter-spacing: 0.15em;
    color: var(--sage);
    opacity: 0.4;
    font-feature-settings: "liga" 0;
}

/* ===== Spore Dust Pseudo-Elements ===== */
.zone-emergence::before,
.zone-specimens::before,
.zone-trail::before {
    content: "";
    position: absolute;
    top: 20%;
    left: 15%;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--bark);
    opacity: 0.15;
    box-shadow:
        12px 8px 0 0 var(--bark),
        -5px 15px 0 0 var(--bark),
        22px -3px 0 0 var(--bark),
        8px 22px 0 0 var(--bark),
        -10px 5px 0 0 var(--bark),
        30px 12px 0 0 var(--bark),
        15px -8px 0 0 var(--bark),
        -2px 28px 0 0 var(--bark),
        25px 20px 0 0 var(--bark),
        5px 35px 0 0 var(--bark);
    pointer-events: none;
}

.zone-specimens::before {
    top: 45%;
    left: 75%;
}

.zone-trail::before {
    top: 60%;
    left: 85%;
}
/* ===== Responsive (Mobile < 768px) ===== */
@media (max-width: 768px) {
    .footprint-illustration {
        width: 80vw;
        right: -10vw;
        top: 5vh;
    }

    .zone-1-content {
        padding-left: 6vw;
        padding-bottom: 15vh;
    }

    .specimen-field {
        display: flex;
        flex-direction: column;
        align-items: center;
        height: auto;
        padding: 8vh 4vw;
        gap: 3rem;
    }

    .specimen-card {
        position: relative;
        left: auto !important;
        top: auto !important;
        width: 85vw !important;
        max-width: 340px;
    }

    .zone-specimens {
        min-height: auto;
    }

    .soil-stratum {
        padding: 8vh 6vw;
    }

    .root-system {
        display: none;
    }

    .trail-container {
        height: auto;
        min-height: 130vh;
        flex-direction: column;
    }

    #trail-svg {
        width: 95%;
    }

    .waypoint {
        position: relative;
        left: auto !important;
        top: auto !important;
        padding: 1rem 6vw;
        max-width: 100%;
    }

    .sediment-content {
        padding: 8vh 6vw;
    }

    #scroll-indicator {
        right: 10px;
    }
}