/* ============================================================
   continua.quest — styles.css
   Mid-century mathematical elegance × botanical organicism
   ============================================================ */

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

:root {
    --deep-ground: #0d1a0d;
    --primary-dark: #1a2e1a;
    --mid-tone: #3d5c3d;
    --accent-warm: #c4a35a;
    --accent-light: #a8c4a0;
    --text-light: #e8ede4;
    --highlight: #d4a843;
    --near-black: #1a1a14;
    --text-body-dark: #4a5043;
    --text-body-light: #c8cfc2;
    --annotation-green: #7a9e7a;
}

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

body {
    background: var(--deep-ground);
    color: var(--text-light);
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.8vw, 1.25rem);
    line-height: 1.75;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Dot Field Canvas --- */
#dot-field {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
}

/* --- Hilbert Spine SVG --- */
#hilbert-spine {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 40vw;
    height: 100vh;
    z-index: 1;
    pointer-events: none;
}

#spine-path {
    stroke: var(--accent-warm);
    stroke-linecap: round;
    stroke-linejoin: round;
    filter: drop-shadow(0 0 6px rgba(196, 163, 90, 0.4));
}

#spine-glow-path {
    stroke: var(--accent-warm);
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* --- Scroll Container --- */
#scroll-container {
    position: relative;
    z-index: 2;
    width: 100%;
    min-height: 550vh;
}

/* --- Content Zones --- */
.content-zone {
    position: relative;
    height: 150vh;
    width: 100%;
    opacity: 0;
    will-change: opacity, transform;
    transition: opacity 0.1s linear;
}

#zone-point {
    top: 0;
}

#zone-line {
    margin-top: -50vh;
}

#zone-surface {
    margin-top: -50vh;
}

#zone-manifold {
    margin-top: -50vh;
}

#zone-infinite {
    margin-top: -50vh;
}

/* --- Zone Inner Layouts --- */
.zone-inner {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 15vh 8vw;
    max-width: 1400px;
    margin: 0 auto;
}

/* Center layout (Zone 1: The Point) */
.zone-center {
    text-align: center;
}

/* Two-column layout (Zone 2: The Line) */
.zone-columns {
    flex-direction: row;
    gap: 6vw;
    align-items: center;
}

.column {
    flex: 1;
    max-width: 40vw;
}

.column-left {
    text-align: right;
}

.column-right {
    text-align: left;
}

/* Perspective layout (Zone 3: The Surface) */
.zone-perspective {
    perspective: 1200px;
    text-align: center;
}

.zone-perspective .meditation,
.zone-perspective .exposition {
    transform: rotateX(2deg);
    transform-origin: center bottom;
}

/* Layered layout (Zone 4: The Manifold) */
.zone-layered {
    position: relative;
}

.manifold-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 15vh 8vw;
}

.manifold-back {
    transform: translateZ(-80px) scale(1.08);
    opacity: 0.5;
}

.manifold-mid {
    z-index: 1;
}

.manifold-front {
    z-index: 2;
    justify-content: flex-end;
    padding-bottom: 20vh;
}

/* Convergence layout (Zone 5: The Infinite) */
.zone-convergence {
    text-align: center;
}

/* --- Typography: Meditation (Display) --- */
.meditation {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(2.5rem, 7vw, 6rem);
    font-weight: 300;
    letter-spacing: 0.03em;
    line-height: 1.2;
    color: var(--text-light);
    margin-bottom: 4vh;
    max-width: 80vw;
}

.meditation .word {
    display: inline-block;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.meditation .word.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Deepen font weight as zones progress */
#zone-surface .meditation {
    font-weight: 400;
}

#zone-manifold .meditation {
    font-weight: 600;
}

#zone-infinite .meditation {
    font-weight: 600;
    font-size: clamp(2rem, 5vw, 4.5rem);
}

/* --- Typography: Exposition (Body) --- */
.exposition {
    font-family: 'Nunito Sans', sans-serif;
    font-size: clamp(1rem, 1.8vw, 1.25rem);
    font-weight: 400;
    line-height: 1.75;
    color: var(--text-body-light);
    max-width: 55ch;
    margin: 0 auto;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

/* --- Typography: Annotations --- */
.annotation {
    font-family: 'Fira Code', monospace;
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--annotation-green);
    opacity: 0;
    transition: opacity 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    margin-top: 3vh;
}

.annotation.visible {
    opacity: 0.7;
}

.annotation-left {
    align-self: flex-start;
}

.annotation-right {
    align-self: flex-end;
}

.annotation-center {
    align-self: center;
}

/* --- Topological Diagrams --- */
.topological-diagram {
    position: absolute;
    width: 50vw;
    height: 50vh;
    opacity: 0;
    transition: opacity 1.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    pointer-events: none;
    z-index: -1;
}

.topological-diagram.visible {
    opacity: 0.12;
}

.topological-diagram svg {
    width: 100%;
    height: 100%;
}

.topological-diagram path {
    stroke: var(--accent-light);
    stroke-width: 1.5;
    fill: none;
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    transition: stroke-dashoffset 3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.topological-diagram.visible path {
    stroke-dashoffset: 0;
}

/* --- Dissolving Text (Zone 5 ending) --- */
.dissolving-text span {
    display: inline;
    transition: opacity 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.dissolving-text span.dissolved {
    opacity: 0;
}

/* --- Epsilon-Delta Markers --- */
#epsilon-delta-markers {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 3;
}

.ed-marker {
    position: absolute;
    pointer-events: all;
    cursor: pointer;
}

.ed-marker circle.epsilon {
    stroke: var(--accent-warm);
    fill: transparent;
    stroke-width: 1;
    transition: r 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.ed-marker circle.delta {
    stroke: var(--accent-warm);
    fill: transparent;
    stroke-width: 0.8;
    transition: r 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.ed-marker:hover circle.epsilon {
    r: 8;
}

.ed-marker:hover circle.delta {
    r: 12;
}

/* --- Background gradient --- */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background:
        radial-gradient(ellipse at 30% 20%, rgba(26, 46, 26, 0.6) 0%, transparent 60%),
        radial-gradient(ellipse at 70% 50%, rgba(61, 92, 61, 0.2) 0%, transparent 50%),
        radial-gradient(ellipse at 40% 80%, rgba(26, 26, 20, 0.8) 0%, transparent 60%),
        linear-gradient(to bottom, var(--deep-ground) 0%, var(--primary-dark) 40%, var(--near-black) 100%);
    pointer-events: none;
}

/* --- Gradient Mesh Animation --- */
.gradient-mesh {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
    opacity: 0.5;
}

@keyframes mesh-drift-1 {
    0%, 100% { background-position: 30% 20%, 70% 80%, 50% 50%; }
    33% { background-position: 40% 30%, 60% 70%, 45% 55%; }
    66% { background-position: 25% 25%, 75% 75%, 55% 45%; }
}

@keyframes mesh-drift-2 {
    0%, 100% { background-position: 60% 30%, 30% 70%, 50% 50%; }
    33% { background-position: 55% 40%, 40% 60%, 45% 55%; }
    66% { background-position: 65% 25%, 35% 75%, 55% 45%; }
}

#zone-point .gradient-mesh {
    background:
        radial-gradient(circle at 30% 20%, rgba(26, 46, 26, 0.5) 0%, transparent 40%),
        radial-gradient(circle at 70% 80%, rgba(13, 26, 13, 0.5) 0%, transparent 40%),
        radial-gradient(circle at 50% 50%, rgba(61, 92, 61, 0.15) 0%, transparent 50%);
    animation: mesh-drift-1 25s ease-in-out infinite;
}

#zone-line .gradient-mesh {
    background:
        radial-gradient(circle at 60% 30%, rgba(26, 46, 26, 0.4) 0%, transparent 40%),
        radial-gradient(circle at 30% 70%, rgba(13, 26, 13, 0.5) 0%, transparent 40%),
        radial-gradient(circle at 50% 50%, rgba(61, 92, 61, 0.1) 0%, transparent 50%);
    animation: mesh-drift-2 30s ease-in-out infinite;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .zone-columns {
        flex-direction: column;
        gap: 4vh;
    }

    .column {
        max-width: 90vw;
        text-align: center;
    }

    .column-left {
        text-align: center;
    }

    .zone-inner {
        padding: 10vh 6vw;
    }

    .meditation {
        max-width: 95vw;
    }

    #hilbert-spine {
        width: 60vw;
    }

    .annotation {
        display: none;
    }
}

@media (max-width: 480px) {
    .meditation {
        font-size: clamp(1.8rem, 8vw, 3rem);
    }
}
