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

:root {
    --bg-deep: #1e1d2a;
    --bg-section: #2b2a3c;
    --text-primary: #e8e0d0;
    --text-secondary: #9a94a8;
    --accent-warm: #c4a45a;
    --accent-cool: #5a9e96;
    --stream-rose: #b87878;
    --highlight-gold: #d4b872;
    --scroll: 0;
    --scroll-progress: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    background: var(--bg-deep);
    color: var(--text-primary);
    font-family: 'Libre Baskerville', Georgia, serif;
    overflow-x: hidden;
}

/* ===== Grain Overlay ===== */
#grain-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 1000;
    opacity: 0.035;
}

#grain-overlay svg {
    width: 100%;
    height: 100%;
}

/* ===== Stream SVG ===== */
#stream-svg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 10;
}

/* ===== Sections ===== */
section {
    min-height: 100vh;
    width: 100%;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, var(--bg-deep) 0%, var(--bg-section) 40%, var(--bg-deep) 100%);
}

/* ===== Layers ===== */
.layer-far {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    will-change: transform;
}

.layer-mid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    will-change: transform;
}

.layer-near {
    position: relative;
    z-index: 3;
    max-width: 38em;
    padding: 4rem 2rem;
    will-change: transform;
}

/* ===== Fog Layers ===== */
.fog-layer {
    position: absolute;
    width: 120%;
    height: 120%;
    top: -10%;
    left: -10%;
    border-radius: 50%;
    opacity: 0.6;
}

.fog-1 {
    background: radial-gradient(ellipse at 30% 40%, rgba(196, 164, 90, 0.06) 0%, transparent 70%);
    animation: fog-drift 20s ease-in-out infinite alternate;
}

.fog-2 {
    background: radial-gradient(ellipse at 70% 60%, rgba(90, 158, 150, 0.05) 0%, transparent 70%);
    animation: fog-drift 25s ease-in-out infinite alternate-reverse;
}

.fog-3 {
    background: radial-gradient(ellipse at 50% 30%, rgba(212, 184, 114, 0.05) 0%, transparent 70%);
    animation: fog-drift 22s ease-in-out infinite alternate;
}

.fog-4 {
    background: radial-gradient(ellipse at 40% 70%, rgba(184, 120, 120, 0.04) 0%, transparent 70%);
    animation: fog-drift 28s ease-in-out infinite alternate-reverse;
}

.fog-5 {
    background: radial-gradient(ellipse at 60% 50%, rgba(196, 164, 90, 0.05) 0%, transparent 70%);
    animation: fog-drift 18s ease-in-out infinite alternate;
}

@keyframes fog-drift {
    0% { transform: translateX(-5%) translateY(-3%); }
    100% { transform: translateX(5%) translateY(3%); }
}

/* ===== Orbital Diagrams ===== */
.orbital-diagram {
    width: min(80vw, 600px);
    height: min(80vw, 600px);
    opacity: 0.2;
}

.orbit {
    fill: none;
    stroke: var(--accent-cool);
    stroke-width: 1;
    opacity: 0.4;
}

.orbit-outer {
    animation: orbit-rotate 60s linear infinite;
    transform-origin: center;
}

.orbit-mid {
    animation: orbit-rotate 40s linear infinite reverse;
    transform-origin: center;
}

.orbit-inner {
    animation: orbit-rotate 25s linear infinite;
    transform-origin: center;
}

@keyframes orbit-rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ===== Typography ===== */
.section-title {
    font-family: 'Righteous', cursive;
    font-size: clamp(3rem, 8vw, 7rem);
    line-height: 0.95;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-primary);
    text-shadow: 0 0 40px rgba(196, 164, 120, 0.3);
    margin-bottom: 2rem;
}

.section-prose {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-size: clamp(1rem, 1.3vw, 1.25rem);
    line-height: 1.75;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    max-width: 38em;
}

.section-prose.italic {
    font-style: italic;
    padding-left: 1.5em;
    border-left: 2px solid rgba(184, 120, 120, 0.2);
    color: var(--text-primary);
    opacity: 0.85;
}

/* ===== Path Draw SVGs ===== */
.path-draw {
    margin-top: 2rem;
    overflow: visible;
}

.path-draw path {
    transition: stroke-dashoffset 1.5s ease-out;
}

.path-draw .annotation {
    font-family: 'Share Tech Mono', monospace;
    font-size: 8px;
    fill: var(--text-secondary);
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

/* ===== Depth Gauge ===== */
#depth-gauge {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

#gauge-ring {
    display: block;
}

#gauge-progress {
    transition: stroke-dashoffset 0.3s ease;
}

#gauge-label {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.15em;
    color: var(--text-secondary);
    text-transform: uppercase;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -70%);
    white-space: nowrap;
}

.gauge-sep {
    color: var(--accent-warm);
}

#gauge-name {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.65rem;
    letter-spacing: 0.15em;
    color: var(--accent-warm);
    margin-top: 0.25rem;
    text-transform: uppercase;
}

/* ===== Radial Menu ===== */
#radial-menu {
    position: absolute;
    bottom: 70px;
    right: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
    transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform-origin: bottom right;
}

#radial-menu.hidden {
    opacity: 0;
    transform: scale(0.8);
    pointer-events: none;
}

#radial-menu.visible {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}

.radial-item {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.15em;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.3rem 0.6rem;
    background: rgba(43, 42, 60, 0.9);
    border: 1px solid rgba(154, 148, 168, 0.15);
    transition: color 0.3s, border-color 0.3s;
    white-space: nowrap;
}

.radial-item:hover {
    color: var(--accent-warm);
    border-color: var(--accent-warm);
}

/* ===== Section Transition Blur ===== */
section {
    transition: filter 0.1s linear, opacity 0.1s linear;
}
