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

:root {
    --warm-parchment: #f0ebe3;
    --deep-space: #1c1e2a;
    --teal-tendril: #5a8a7a;
    --dusty-sand: #d9cdb8;
    --celestial-amber: #c4943a;
    --muted-rose: #a0706a;
    --font-display: 'Bebas Neue', sans-serif;
    --font-mono: 'IBM Plex Mono', monospace;
}

html {
    scroll-behavior: smooth;
    scroll-snap-type: y mandatory;
    overflow-x: hidden;
}

body {
    background: var(--deep-space);
    color: var(--warm-parchment);
    font-family: var(--font-mono);
    font-size: 16px;
    line-height: 1.65;
    overflow-x: hidden;
}

/* ===== STAR CANVAS ===== */
#stars-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
}

/* ===== NAV DOTS ===== */
#nav-dots {
    position: fixed;
    right: 2rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.nav-dot {
    width: 14px;
    height: 14px;
    border-radius: 50% 45% 55% 48%;
    background: rgba(90, 138, 122, 0.25);
    border: 1.5px solid var(--teal-tendril);
    cursor: pointer;
    transition: all 0.4s ease;
}

.nav-dot.active {
    background: var(--teal-tendril);
    transform: scale(1.3);
    border-radius: 48% 52% 46% 54%;
}

.nav-dot:hover {
    background: rgba(90, 138, 122, 0.6);
}

/* ===== LESSONS (SECTIONS) ===== */
.lesson {
    position: relative;
    width: 100vw;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    scroll-snap-align: start;
    z-index: 1;
    padding: 4rem 6rem;
}

.lesson-content {
    max-width: 1200px;
    width: 100%;
    position: relative;
}

/* ===== F-LAYOUT ===== */
.f-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}

.f-primary {
    z-index: 2;
}

.f-visual {
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===== TYPOGRAPHY ===== */
.hero-title {
    font-family: var(--font-display);
    font-size: clamp(3rem, 8vw, 7rem);
    letter-spacing: 0.08em;
    line-height: 0.95;
    color: var(--warm-parchment);
    position: relative;
    z-index: 2;
}

.hero-sub {
    font-family: var(--font-mono);
    font-size: clamp(0.85rem, 1.2vw, 1.05rem);
    color: var(--dusty-sand);
    max-width: 520px;
    margin-top: 2rem;
    opacity: 0.85;
}

.section-heading {
    font-family: var(--font-display);
    font-size: clamp(1.8rem, 4vw, 3.5rem);
    letter-spacing: 0.08em;
    line-height: 0.95;
    color: var(--warm-parchment);
    margin-bottom: 1.5rem;
}

.body-text {
    font-family: var(--font-mono);
    font-size: clamp(0.82rem, 1vw, 0.95rem);
    color: var(--dusty-sand);
    margin-bottom: 1.2rem;
    max-width: 480px;
    opacity: 0.9;
}

.code-snippet {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--teal-tendril);
    background: rgba(90, 138, 122, 0.08);
    border-left: 2px solid var(--teal-tendril);
    padding: 1rem 1.2rem;
    margin-top: 1.5rem;
    border-radius: 0 8px 8px 0;
}

.code-comment {
    color: var(--muted-rose);
    opacity: 0.7;
}

/* ===== SCROLL HINT ===== */
.scroll-hint {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-top: 3rem;
    color: var(--teal-tendril);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    opacity: 0.6;
}

.scroll-dot {
    animation: scrollBounce 2s ease-in-out infinite;
}

@keyframes scrollBounce {
    0%, 100% { cy: 25; }
    50% { cy: 55; }
}

/* ===== HERO BLOBS ===== */
#hero-blobs {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.hero-blob-svg {
    position: absolute;
    animation: blobFloat 8s ease-in-out infinite;
    opacity: 0.3;
}

@keyframes blobFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(10px, -15px) scale(1.03); }
    66% { transform: translate(-8px, 10px) scale(0.97); }
}

/* ===== DIAGRAM SVGs ===== */
.diagram-svg {
    width: 100%;
    max-width: 400px;
    height: auto;
}

.node-blob {
    fill: rgba(196, 148, 58, 0.2);
    stroke: var(--celestial-amber);
    stroke-width: 1.5;
    transition: all 0.5s ease;
    cursor: pointer;
}

.node-blob.active {
    fill: rgba(196, 148, 58, 0.5);
}

.node-blob.dead {
    fill: rgba(160, 112, 106, 0.15);
    stroke: var(--muted-rose);
    opacity: 0.3;
}

.node-blob:hover {
    fill: rgba(196, 148, 58, 0.35);
}

.hub-blob {
    transition: all 0.6s ease;
}

.tendril-line {
    stroke: var(--teal-tendril);
    stroke-width: 1.5;
    fill: none;
    opacity: 0.4;
    filter: url(#tendril-glow);
}

.tendril-line.active {
    opacity: 0.9;
    stroke-width: 2;
}

.data-packet {
    fill: var(--celestial-amber);
    r: 4;
}

/* ===== PULSE ANIMATION ===== */
@keyframes nodePulse {
    0%, 100% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.06); opacity: 1; }
}

.pulse {
    animation: nodePulse 3s ease-in-out infinite;
    transform-origin: center;
}

/* ===== TENDRILS OVERLAY ===== */
.tendrils-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
}

/* ===== SECTION REVEAL ===== */
.lesson {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.lesson.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .lesson {
        padding: 3rem 2rem;
    }

    .f-layout {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .f-visual {
        order: -1;
    }

    .diagram-svg {
        max-width: 280px;
    }

    #nav-dots {
        right: 1rem;
    }
}
