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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    background-color: #f0ede6;
    color: #3a3a3a;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: clamp(0.875rem, 1.5vw, 1.1rem);
    line-height: 1.75;
    overflow-x: hidden;
    position: relative;
}

/* === DESIGN PALETTE REFERENCE ===
   #0d0d0d - Ink Black (pixel art dark)
   #8a8580 - Warm Gray (pixel art mid)
   #d9d4c9 - Paper Cream (grain overlay tint)
*/

/* === PIXEL GRID BACKGROUND === */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        repeating-linear-gradient(to right, rgba(176,172,164,0.05) 0px, rgba(176,172,164,0.05) 1px, transparent 1px, transparent 8px),
        repeating-linear-gradient(to bottom, rgba(176,172,164,0.05) 0px, rgba(176,172,164,0.05) 1px, transparent 1px, transparent 8px);
    pointer-events: none;
    z-index: 1;
}

/* === GRAIN OVERLAY === */
#grain-canvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.4;
    mix-blend-mode: multiply;
    image-rendering: pixelated;
}

/* === TYPOGRAPHY === */
.hero-title {
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    font-size: clamp(3rem, 8vw, 7rem);
    letter-spacing: 0.15em;
    color: #1a1a1a;
    text-transform: uppercase;
    line-height: 1.1;
}

.section-title {
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    letter-spacing: 0.08em;
    color: #1a1a1a;
    margin-bottom: 1.5rem;
    text-transform: uppercase;
}

.title-light {
    color: #f0ede6;
}

.label {
    font-family: 'VT323', monospace;
    font-weight: 400;
    font-size: clamp(0.75rem, 1.2vw, 1rem);
    color: #6b6b6b;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    display: inline-block;
}

.label-light {
    color: #c4c0b8;
}

.body-text {
    color: #3a3a3a;
    margin-bottom: 1.25rem;
    max-width: 55ch;
}

.text-light {
    color: #e4e1db;
}

/* === HERO SECTION === */
.hero {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    padding: 2rem;
    z-index: 2;
}

.hero-title-container {
    position: relative;
    z-index: 3;
}

.hero-title .pixel-letter {
    display: inline-block;
    opacity: 0;
    transform: translateY(-20px) scale(1.3);
    animation: stamp-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes stamp-in {
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.hero-subtitle {
    margin-top: 1.5rem;
    opacity: 0;
    animation: fade-in 1s ease 1.5s forwards;
    z-index: 3;
    position: relative;
}

@keyframes fade-in {
    to { opacity: 1; }
}

.forest-canopy {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 200px;
    z-index: 2;
}

/* === PIXEL STREAM === */
.pixel-stream {
    position: fixed;
    right: 0;
    top: 0;
    width: 60px;
    height: 100vh;
    z-index: 10;
    overflow: hidden;
    pointer-events: none;
}

.pixel-stream .glyph {
    position: absolute;
    font-family: 'VT323', monospace;
    font-size: 14px;
    color: #b0aca4;
    opacity: 0.5;
    animation: drift-down linear infinite;
    will-change: transform;
}

@keyframes drift-down {
    from { transform: translateY(-20px); }
    to { transform: translateY(100vh); }
}

/* === SPIRAL TRANSITIONS === */
.spiral-transition {
    display: block;
    width: 120px;
    height: 120px;
    margin: 2rem auto;
    overflow: visible;
    z-index: 2;
    position: relative;
}

.spiral-path {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 1.2s ease;
}

.spiral-path.drawn {
    stroke-dashoffset: 0;
}

/* === FIELD GUIDE SECTIONS === */
.field-section {
    padding: 8rem 2rem;
    position: relative;
    z-index: 2;
}

.field-section:nth-child(even of .field-section) {
    background-color: #e4e1db;
}

.section-dusk {
    background-color: #3a3a3a !important;
}

.field-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    align-items: start;
}

.section-left .field-illustration {
    grid-column: 1 / 6;
}

.section-left .field-text {
    grid-column: 7 / 12;
}

.section-right .field-text {
    grid-column: 2 / 7;
}

.section-right .field-illustration {
    grid-column: 8 / 13;
}

.section-right .field-illustration {
    margin-top: 3rem;
}

.section-left .field-illustration {
    margin-top: 0;
}

.section-left .field-text {
    margin-top: 3rem;
}

.specimen-label {
    display: block;
    margin-top: 1rem;
}

/* === PIXEL SPRITES === */
.pixel-sprite {
    width: 1px;
    height: 1px;
    background-color: #0d0d0d;
    position: relative;
    image-rendering: pixelated;
}

.pixel-sprite-mid {
    color: #8a8580;
}

.grain-tint {
    background-color: #d9d4c9;
}

/* === ENTRANCE ANIMATIONS === */
.field-section[data-entrance="left"] .field-grid {
    opacity: 0;
    transform: translate(-40px, 20px);
    transition: opacity 0.6s cubic-bezier(0.34, 1.56, 0.64, 1),
                transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.field-section[data-entrance="right"] .field-grid {
    opacity: 0;
    transform: translate(40px, -15px);
    transition: opacity 0.6s cubic-bezier(0.34, 1.56, 0.64, 1),
                transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.field-section.visible .field-grid {
    opacity: 1;
    transform: translate(0, 0);
}

/* === PIXEL RAIN === */
.pixel-rain {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 5;
    overflow: hidden;
}

.pixel-rain .drop {
    position: absolute;
    width: 1px;
    height: 3px;
    background-color: #b0aca4;
    opacity: 0.3;
    animation: rain-fall linear infinite;
}

@keyframes rain-fall {
    from { transform: translateY(-10px); }
    to { transform: translateY(100vh); }
}

/* === FOOTER === */
.footer {
    background-color: #1a1a1a;
    color: #f0ede6;
    padding: 10rem 2rem 4rem;
    position: relative;
    z-index: 2;
    text-align: center;
    overflow: hidden;
}

.root-system {
    position: relative;
    width: 100%;
    height: 200px;
    margin-bottom: 3rem;
    display: flex;
    justify-content: center;
}

.root-system .root-pixel {
    position: absolute;
    width: 1px;
    height: 1px;
    image-rendering: pixelated;
}

.footer-name {
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    letter-spacing: 0.15em;
    color: #f0ede6;
    display: block;
    margin-bottom: 1rem;
}

.footer-label {
    display: block;
    margin-top: 0.5rem;
}

.mushroom-cluster {
    position: relative;
    width: 100%;
    height: 60px;
    margin-top: 3rem;
    display: flex;
    justify-content: center;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .pixel-stream {
        display: none;
    }

    .field-grid {
        grid-template-columns: 1fr;
    }

    .section-left .field-illustration,
    .section-left .field-text,
    .section-right .field-text,
    .section-right .field-illustration {
        grid-column: 1 / -1;
        margin-top: 0;
    }

    .section-right .field-illustration {
        order: -1;
    }

    .pixel-sprite {
        transform: scale(0.6);
        transform-origin: top left;
    }

    #grain-canvas {
        opacity: 0.25;
    }

    .field-section {
        padding: 4rem 1.5rem;
    }

    .spiral-transition {
        width: 80px;
        height: 80px;
    }
}
