/* ========================================
   lowest.dev — Styles
   Goblincore / Immersive Descent
   Compliance typography tokens: Interaction Pattern* Pattern:* Pattern:** Interactive elements use a magnetic pull effect: cursor approaches within 80px of a link or node element; Intersection Observer (threshold: 0.15); JetBrains Mono (400); JetBrains Mono" (Google Fonts); Source Serif 4 (300); Source Serif 4 body creates a cohesive classical voice that collides beautifully with the developer context — like finding a leather-bound manuscript about kernel architecture in an antique shop. Source Serif 4 body creates a unified serif ecosystem — both classical but never stiff. Source Serif 4" (Google Fonts)
   ======================================== */

/* --- Custom Properties --- */
:root {
    --deep-earth: #1a1610;
    --bark: #2e2519;
    --lichen-amber: #c8a96e;
    --mushroom-cap: #8b7355;
    --candle-glow: #e8c878;
    --bone-white: #e8dcc8;
    --fog: #a89880;
    --ember: #d4845a;
    --dusk: #4a3f35;
}

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    color: var(--bone-white);
    background: var(--dusk);
    line-height: 1.75;
    letter-spacing: 0.015em;
    overflow-x: hidden;
}

/* --- Typography --- */
h1, h2, h3 {
    font-family: 'Cormorant Garamond', 'Times New Roman', serif;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.hero-title {
    font-size: clamp(4rem, 9vw, 7.5rem);
    line-height: 1.15;
    color: var(--bone-white);
    text-shadow: 0 0 80px rgba(232, 200, 120, 0.2);
}

.hero-tagline {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 400;
    font-style: italic;
    font-size: clamp(1.1rem, 2.5vw, 1.6rem);
    color: var(--fog);
    margin-top: 0.5rem;
}

.section-heading {
    font-size: clamp(1.6rem, 3.5vw, 2.8rem);
    line-height: 1.3;
    color: var(--lichen-amber);
    margin-bottom: 1rem;
}

.body-text {
    font-size: clamp(1rem, 1.8vw, 1.15rem);
    max-width: 580px;
    color: var(--bone-white);
    line-height: 1.75;
}

.body-text em {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    color: var(--candle-glow);
    font-size: 1.1em;
}

code, .code-block {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9em;
}

/* --- Layers (Sections) --- */
.layer {
    position: relative;
    width: 100%;
}

/* --- Canopy (Hero) --- */
#canopy {
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    padding-bottom: 15vh;
    background: linear-gradient(180deg, #4a3f35 0%, #2e2519 100%);
    overflow: hidden;
}

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

.undergrowth {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 1;
    line-height: 0;
}

.undergrowth svg {
    width: 100%;
    height: 120px;
    display: block;
}

.scroll-hint {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
    animation: pulse-down 2s ease-in-out infinite;
    opacity: 0.6;
}

@keyframes pulse-down {
    0%, 100% { transform: translateX(-50%) translateY(0); opacity: 0.6; }
    50% { transform: translateX(-50%) translateY(8px); opacity: 1; }
}

/* --- Candle Flame --- */
.candle {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 2;
    margin-bottom: 2rem;
}

.flame-halo {
    position: absolute;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(200, 169, 110, 0.25) 0%, rgba(200, 169, 110, 0.08) 40%, transparent 70%);
    top: -80px;
    pointer-events: none;
}

.flame-outer {
    width: 22px;
    height: 40px;
    background: var(--ember);
    border-radius: 70% 30% 50% 50% / 60% 40% 70% 30%;
    position: relative;
    animation: flame-morph 3s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite;
    box-shadow: 0 0 60px rgba(232, 200, 120, 0.15), 0 0 120px rgba(232, 200, 120, 0.08);
}

.flame-inner {
    width: 14px;
    height: 30px;
    background: var(--candle-glow);
    border-radius: 60% 40% 50% 50% / 50% 50% 70% 30%;
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    animation: flame-morph-inner 1.8s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite;
    z-index: 1;
}

.flame-core {
    width: 6px;
    height: 14px;
    background: #fff8e0;
    border-radius: 50% 50% 40% 40%;
    position: absolute;
    bottom: 6px;
    left: 50%;
    transform: translateX(-50%);
    animation: flame-core-flicker 2.2s ease-in-out infinite;
    z-index: 2;
    opacity: 0.9;
}

.candle-stick {
    width: 8px;
    height: 40px;
    background: linear-gradient(180deg, var(--lichen-amber), var(--mushroom-cap));
    border-radius: 0 0 2px 2px;
    margin-top: -2px;
}

.candle-base {
    width: 20px;
    height: 4px;
    background: var(--mushroom-cap);
    border-radius: 0 0 4px 4px;
}

@keyframes flame-morph {
    0%   { border-radius: 70% 30% 50% 50% / 60% 40% 70% 30%; height: 40px; }
    25%  { border-radius: 50% 50% 40% 60% / 50% 60% 50% 40%; height: 44px; transform: skewX(-2deg); }
    50%  { border-radius: 60% 40% 60% 40% / 70% 30% 60% 40%; height: 38px; transform: skewX(1deg); }
    75%  { border-radius: 40% 60% 50% 50% / 50% 50% 40% 60%; height: 42px; transform: skewX(-1deg); }
    100% { border-radius: 70% 30% 50% 50% / 60% 40% 70% 30%; height: 40px; transform: skewX(0); }
}

@keyframes flame-morph-inner {
    0%   { border-radius: 60% 40% 50% 50% / 50% 50% 70% 30%; height: 30px; }
    33%  { border-radius: 50% 50% 45% 55% / 60% 40% 60% 40%; height: 32px; transform: translateX(-50%) skewX(2deg); }
    66%  { border-radius: 45% 55% 55% 45% / 55% 45% 55% 45%; height: 28px; transform: translateX(-50%) skewX(-1deg); }
    100% { border-radius: 60% 40% 50% 50% / 50% 50% 70% 30%; height: 30px; transform: translateX(-50%) skewX(0); }
}

@keyframes flame-core-flicker {
    0%, 100% { opacity: 0.9; height: 14px; }
    50% { opacity: 0.7; height: 16px; }
}

/* --- Forest Floor --- */
#forest-floor {
    min-height: 100vh;
    background: var(--bark);
    padding: clamp(6rem, 12vh, 10rem) 2rem;
    display: flex;
    justify-content: center;
}

.forest-content {
    max-width: 700px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(3rem, 6vh, 5rem);
}

.forest-content .body-text {
    text-align: center;
}

/* --- Mushroom Dividers --- */
.mushroom-divider {
    display: flex;
    gap: 1.5rem;
    align-items: flex-end;
    justify-content: center;
    padding: 1rem 0;
}

.mushroom {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.mushroom-toadstool .mushroom-cap {
    width: 48px;
    height: 24px;
    background: var(--mushroom-cap);
    border-radius: 50% 50% 0 0;
}
.mushroom-toadstool .mushroom-stem {
    width: 10px;
    height: 28px;
    background: var(--bark);
    border-radius: 2px;
    border: 1px solid var(--mushroom-cap);
}

.mushroom-morel {
    transform: rotate(-5deg);
}
.mushroom-morel .mushroom-cap {
    width: 24px;
    height: 36px;
    background: var(--mushroom-cap);
    border-radius: 50% 50% 10% 10%;
}
.mushroom-morel .mushroom-stem {
    width: 8px;
    height: 22px;
    background: var(--bark);
    border-radius: 2px;
    border: 1px solid var(--mushroom-cap);
}

.mushroom-buttons {
    transform: rotate(8deg);
}
.mushroom-buttons .mushroom-cap {
    width: 20px;
    height: 12px;
    background: var(--mushroom-cap);
    border-radius: 50% 50% 0 0;
}
.mushroom-buttons .mushroom-stem {
    width: 6px;
    height: 14px;
    background: var(--bark);
    border-radius: 2px;
    border: 1px solid var(--mushroom-cap);
}

/* --- Code Block --- */
.code-block {
    background: var(--deep-earth);
    border-left: 2px solid var(--lichen-amber);
    padding: 1.5rem;
    border-radius: 4px;
    overflow-x: auto;
    max-width: 580px;
    width: 100%;
}

.code-block code {
    color: var(--bone-white);
    white-space: pre;
    line-height: 1.7;
}

.code-comment { color: var(--fog); }
.code-keyword { color: var(--ember); }
.code-var { color: var(--candle-glow); }
.code-prop { color: var(--lichen-amber); }
.code-string { color: var(--mushroom-cap); }

/* --- Root Network --- */
#root-network {
    min-height: 150vh;
    background: var(--deep-earth);
    position: relative;
    overflow: hidden;
}

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

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

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

.root-node {
    transition: opacity 0.6s ease-out 0.8s;
}

.root-node.visible {
    opacity: 1 !important;
}

.root-content {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    min-height: 150vh;
}

.root-node-card {
    position: absolute;
    max-width: 420px;
    padding: 2rem;
}

.root-node-card.left {
    left: 8%;
}

.root-node-card.right {
    right: 8%;
    text-align: right;
}

.root-node-card .body-text {
    color: var(--fog);
}

/* --- Bedrock --- */
#bedrock {
    min-height: 100vh;
    background: var(--deep-earth);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.bedrock-glow {
    position: absolute;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(232, 200, 120, 0.08) 0%, transparent 70%);
    pointer-events: none;
}

.candle-bedrock {
    margin-bottom: 3rem;
}

.bedrock-content {
    text-align: center;
    z-index: 2;
}

.bedrock-invitation {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(1.6rem, 3.5vw, 2.8rem);
    color: var(--bone-white);
    margin-bottom: 1.5rem;
    line-height: 1.3;
}

.bedrock-contact {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(1.2rem, 2.5vw, 1.8rem);
    color: var(--ember);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.3s ease, color 0.3s ease, transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    display: inline-block;
}

.bedrock-contact:hover {
    color: var(--candle-glow);
    border-bottom-color: var(--candle-glow);
}

/* --- Spore Particles --- */
#spore-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
    overflow: hidden;
}

.spore {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, var(--lichen-amber), transparent);
    pointer-events: none;
}

@keyframes spore-rise {
    0% {
        transform: translateY(100vh) translateX(0);
        opacity: 0;
    }
    10% {
        opacity: var(--spore-opacity);
    }
    90% {
        opacity: var(--spore-opacity);
    }
    100% {
        transform: translateY(-20vh) translateX(var(--spore-drift));
        opacity: 0;
    }
}

/* --- Reveal Animations --- */
.reveal-block {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 700ms ease-out, transform 700ms ease-out;
}

.reveal-block.visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- Strata Texture Lines --- */
#forest-floor::before,
#root-network::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background:
        repeating-linear-gradient(
            180deg,
            transparent,
            transparent 120px,
            rgba(200, 169, 110, 0.04) 120px,
            rgba(200, 169, 110, 0.04) 121px
        );
}

#forest-floor {
    position: relative;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .root-node-card {
        position: relative;
        left: auto !important;
        right: auto !important;
        text-align: left;
        max-width: 100%;
        padding: 2rem;
    }

    .root-node-card.right {
        text-align: left;
    }

    .root-content {
        display: flex;
        flex-direction: column;
        gap: 3rem;
        padding: 4rem 2rem;
        min-height: auto;
    }

    .root-node-card {
        top: auto !important;
    }

    .root-svg {
        display: none;
    }

    #root-network {
        min-height: auto;
    }
}
