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

html {
    scroll-behavior: smooth;
}

body {
    background: #0a0a08;
    color: #d4cfc2;
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 300;
    font-size: clamp(1.05rem, 1.8vw, 1.35rem);
    line-height: 1.85;
    overflow-x: hidden;
}

/* === NOISE GRAIN OVERLAY === */
.noise-filter {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.045;
}

/* === HERO === */
.hero {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0a0a08;
    overflow: hidden;
}

.hero-network {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
}

.hero-title {
    font-family: 'Share Tech Mono', monospace;
    font-weight: 400;
    font-size: clamp(2.5rem, 7vw, 5rem);
    letter-spacing: 0.15em;
    color: #c4a24e;
    text-shadow: 0 0 60px rgba(196, 162, 78, 0.15);
}

.hero-log {
    margin-top: 2rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: clamp(0.7rem, 1vw, 0.85rem);
    letter-spacing: 0.08em;
    color: #4a6741;
}

.log-cursor {
    animation: blink 530ms step-end infinite;
    color: #c4a24e;
}

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

/* === DIVIDERS === */
.divider-wrap {
    max-width: 720px;
    margin: 0 auto;
    padding: 4vh 2rem;
}

.root-divider {
    width: 100%;
    height: auto;
    display: block;
}

/* === UNDERSTORY / NARRATIVE === */
.understory {
    max-width: 720px;
    margin: 0 auto;
    padding: 8vh 2rem;
}

.section-relative {
    position: relative;
}

.narrative-block {
    position: relative;
}

.narrative-text {
    color: #d4cfc2;
    font-weight: 300;
    max-width: 600px;
    margin: 0 auto;
}

/* === MORPH TRANSITIONS === */
[data-morph] {
    transform: scaleY(0.6) scaleX(0.95);
    opacity: 0;
    filter: blur(6px);
    transition:
        transform 800ms cubic-bezier(0.22, 1, 0.36, 1),
        opacity 800ms cubic-bezier(0.22, 1, 0.36, 1),
        filter 600ms cubic-bezier(0.22, 1, 0.36, 1) 200ms;
}

[data-morph].morphed {
    transform: scaleY(1) scaleX(1);
    opacity: 1;
    filter: blur(0px);
}

/* === LEAF SVGs === */
.leaf-svg {
    position: absolute;
    pointer-events: none;
    width: 60px;
    height: 80px;
    transform: rotate(var(--leaf-rot, 0deg)) scale(var(--leaf-scale, 1));
    opacity: var(--leaf-opacity, 0.2);
    animation: leafSway 15s ease-in-out infinite;
}

.leaf-1 { top: -20px; right: -40px; }
.leaf-2 { bottom: -10px; left: -50px; animation-duration: 18s; }
.leaf-3 { top: 10px; right: -60px; animation-duration: 12s; }
.leaf-4 { top: -30px; left: -40px; animation-duration: 20s; }
.leaf-5 { bottom: 20px; right: -50px; animation-duration: 14s; }

@keyframes leafSway {
    0%, 100% { transform: rotate(var(--leaf-rot, 0deg)) scale(var(--leaf-scale, 1)) rotate(0deg); }
    50% { transform: rotate(var(--leaf-rot, 0deg)) scale(var(--leaf-scale, 1)) rotate(3deg); }
}

/* === MYCELIUM MAP === */
.mycelium-map {
    position: relative;
    width: 100%;
    padding: 8vh 0;
    background: linear-gradient(180deg, #0a0a08 0%, #0f0e0b 30%, #111008 70%, #0a0a08 100%);
}

#networkCanvas {
    display: block;
    width: 100%;
    height: 60vh;
}

.canvas-labels {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.node-label {
    position: absolute;
    font-family: 'JetBrains Mono', monospace;
    font-size: clamp(0.6rem, 0.8vw, 0.75rem);
    letter-spacing: 0.08em;
    color: #8a7a4a;
    opacity: 0.6;
    white-space: nowrap;
}

/* === DECOMPOSITION / SPECIMEN LABELS === */
.decomposition {
    max-width: 720px;
    margin: 0 auto;
    padding: 8vh 2rem;
}

.specimen-label {
    border: 1px solid #8a7a4a;
    padding: 1.5rem 2rem;
    background: #141210;
    position: relative;
    max-width: 480px;
    margin: 6vh auto;
    box-shadow: 0 0 40px rgba(196, 162, 78, 0.05);
}

.specimen-label::before,
.specimen-label::after {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    border-color: #c4a24e;
    border-style: solid;
}

.specimen-label::before {
    top: -2px;
    left: -2px;
    border-width: 2px 0 0 2px;
}

.specimen-label::after {
    bottom: -2px;
    right: -2px;
    border-width: 0 2px 2px 0;
}

.specimen-label em {
    color: #8a4a2e;
}

.specimen-code {
    display: block;
    font-family: 'JetBrains Mono', monospace;
    font-size: clamp(0.65rem, 0.9vw, 0.8rem);
    letter-spacing: 0.12em;
    color: #8a7a4a;
    margin-bottom: 1rem;
}

.specimen-text {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 300;
    font-size: clamp(0.95rem, 1.4vw, 1.15rem);
    line-height: 1.8;
    color: #d4cfc2;
}

/* === TERMINUS (FOOTER) === */
.terminus {
    text-align: center;
    padding: 16vh 2rem 8vh;
    position: relative;
}

.leaf-footer {
    position: relative;
    display: inline-block;
    margin-bottom: 2rem;
    animation: leafRotate 20s linear infinite;
}

@keyframes leafRotate {
    from { transform: rotate(0deg) scale(var(--leaf-scale, 0.5)); }
    to { transform: rotate(360deg) scale(var(--leaf-scale, 0.5)); }
}

.terminus-domain {
    font-family: 'Share Tech Mono', monospace;
    font-weight: 400;
    font-size: clamp(0.8rem, 1.2vw, 1rem);
    letter-spacing: 0.15em;
    color: #8a7a4a;
    margin-bottom: 2rem;
}

.terminus-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
}

.pulse-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #c4a24e;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.3); }
}

.terminus-meta {
    color: #7a746a;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    margin-bottom: 1rem;
}

.watching-text {
    font-family: 'JetBrains Mono', monospace;
    font-size: clamp(0.7rem, 1vw, 0.85rem);
    letter-spacing: 0.08em;
    color: #4a6741;
    animation: watchFade 3s ease-in-out infinite;
}

@keyframes watchFade {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .understory,
    .decomposition,
    .divider-wrap {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }

    .leaf-svg {
        display: none;
    }
}
