/* continua.quest - Dopamine-Neon on Abyss */

/* ========================================
   CSS Custom Properties
   ======================================== */
:root {
    /* Palette */
    --void-black: #0A0A0F;
    --deep-indigo: #12101F;
    --deep-violet: #1A1035;
    --neon-magenta: #FF006E;
    --electric-cyan: #00F5D4;
    --dopamine-amber: #FFD93D;
    --plasma-violet: #9B5DE5;
    --lunar-white: #F0F0F0;
    --ash-gray: #A0A0A0;
    --warm-gold: #FFAA00;
    --soft-gray: #D0D0D0;

    /* Typography */
    --font-display: 'Bebas Neue', sans-serif;
    --font-sub: 'Oswald', sans-serif;
    --font-body: 'Work Sans', sans-serif;
    --font-mono: 'IBM Plex Mono', monospace;

    /* Hex Dimensions */
    --hex-width: 320px;
    --hex-height: calc(var(--hex-width) * 1.155);
    --hex-gap: 6px;
    --hex-clip: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);

    /* Flicker */
    --flicker: 1.0;

    /* Scroll */
    --scroll-progress: 0;
}

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

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

body {
    background: var(--void-black);
    color: var(--lunar-white);
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 16px;
    line-height: 1.65;
    overflow-x: hidden;
}

/* ========================================
   Typography
   ======================================== */
.stratum-title {
    font-family: var(--font-display);
    font-size: clamp(72px, 10vw, 120px);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--neon-magenta);
    filter: drop-shadow(0 0 8px var(--neon-magenta)) drop-shadow(0 0 24px var(--neon-magenta));
    position: absolute;
    top: 40px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    pointer-events: none;
    white-space: nowrap;
}

#stratum-1 .stratum-title {
    color: var(--electric-cyan);
    filter: drop-shadow(0 0 8px var(--electric-cyan)) drop-shadow(0 0 24px var(--electric-cyan));
}

#stratum-2 .stratum-title {
    color: var(--neon-magenta);
}

#stratum-3 .stratum-title {
    color: var(--dopamine-amber);
    filter: drop-shadow(0 0 8px var(--dopamine-amber)) drop-shadow(0 0 24px var(--dopamine-amber));
}

#stratum-4 .stratum-title {
    color: var(--plasma-violet);
    filter: drop-shadow(0 0 8px var(--plasma-violet)) drop-shadow(0 0 24px var(--plasma-violet));
}

#stratum-5 .stratum-title {
    color: var(--electric-cyan);
    filter: drop-shadow(0 0 8px var(--electric-cyan)) drop-shadow(0 0 24px var(--electric-cyan));
}

.wordmark {
    font-family: var(--font-display);
    font-size: clamp(60px, 12vw, 140px);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--neon-magenta);
    filter: drop-shadow(0 0 12px var(--neon-magenta)) drop-shadow(0 0 36px var(--neon-magenta));
    line-height: 1;
}

.wordmark-sub {
    font-size: clamp(18px, 3vw, 32px);
    color: var(--electric-cyan);
    letter-spacing: 0.08em;
    display: block;
    text-align: center;
    margin-top: 8px;
}

.mono-text {
    font-family: var(--font-mono);
    font-weight: 400;
    font-size: 13px;
    letter-spacing: 0.08em;
    color: var(--electric-cyan);
}

.body-text {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 16px;
    line-height: 1.65;
    color: var(--soft-gray);
    max-width: 540px;
}

.body-text-sm {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 14px;
    line-height: 1.6;
    color: var(--soft-gray);
}

.hex-label {
    position: absolute;
    bottom: 18%;
    left: 50%;
    transform: translateX(-50%);
    font-size: 11px;
    z-index: 2;
}

/* ========================================
   Stratum (Full-Viewport Sections)
   ======================================== */
.stratum {
    position: relative;
    width: 100%;
    min-height: 100vh;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stratum-bg-layer {
    position: absolute;
    inset: 0;
    z-index: 0;
}

#stratum-0 .stratum-bg-layer {
    background: radial-gradient(ellipse at 50% 50%, var(--deep-indigo) 0%, var(--void-black) 70%);
}

#stratum-1 .stratum-bg-layer {
    background: linear-gradient(180deg, var(--void-black) 0%, var(--deep-indigo) 50%, var(--void-black) 100%);
}

#stratum-2 .stratum-bg-layer {
    background: linear-gradient(180deg, var(--void-black) 0%, var(--deep-indigo) 40%, var(--deep-violet) 70%, var(--void-black) 100%);
}

#stratum-3 .stratum-bg-layer {
    background: linear-gradient(180deg, var(--void-black) 0%, var(--deep-violet) 50%, var(--void-black) 100%);
}

#stratum-4 .stratum-bg-layer {
    background: radial-gradient(ellipse at 50% 50%, var(--deep-violet) 0%, var(--deep-indigo) 40%, var(--void-black) 80%);
}

#stratum-5 .stratum-bg-layer {
    background: linear-gradient(180deg, var(--void-black) 0%, var(--deep-indigo) 30%, var(--deep-violet) 60%, var(--void-black) 100%);
}

.stratum-content {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 60px 20px;
}

/* ========================================
   Hex Cell Base
   ======================================== */
.hex-cell {
    position: relative;
    clip-path: var(--hex-clip);
    background: var(--deep-indigo);
    overflow: hidden;
    transition: filter 0.3s ease;
}

.hex-cell::before {
    content: '';
    position: absolute;
    inset: 0;
    clip-path: var(--hex-clip);
    background: transparent;
    z-index: 1;
    pointer-events: none;
    box-shadow: inset 0 0 0 1px rgba(255, 0, 110, 0.3);
}

.hex-cell:hover {
    filter: brightness(calc(var(--flicker) + 0.1));
}

.hex-cell:hover::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(255, 0, 110, 0.13) 0%, transparent 70%);
    pointer-events: none;
    z-index: 3;
}

.hex-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

/* ========================================
   Stratum 0 - Genesis
   ======================================== */
.genesis-content {
    position: relative;
}

.genesis-hex-main {
    position: relative;
    width: min(80vw, 80vh);
    height: calc(min(80vw, 80vh) * 1.155);
    clip-path: var(--hex-clip);
    background: var(--void-black);
    overflow: hidden;
    z-index: 2;
}

.genesis-wordmark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 5;
    text-align: center;
    pointer-events: none;
}

.genesis-peripheral-cells {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

.peripheral-cell {
    position: absolute;
    width: 120px;
    height: calc(120px * 1.155);
    background: var(--deep-indigo);
    opacity: 0.15;
    animation: peripheralFlicker 4s ease-in-out infinite;
}

.peripheral-cell:nth-child(1) { top: 5%; left: 5%; animation-delay: 0s; }
.peripheral-cell:nth-child(2) { top: 8%; right: 8%; animation-delay: 0.7s; }
.peripheral-cell:nth-child(3) { bottom: 12%; left: 10%; animation-delay: 1.4s; }
.peripheral-cell:nth-child(4) { bottom: 5%; right: 5%; animation-delay: 2.1s; }
.peripheral-cell:nth-child(5) { top: 40%; left: 2%; animation-delay: 0.3s; }
.peripheral-cell:nth-child(6) { top: 35%; right: 3%; animation-delay: 1.8s; }

@keyframes peripheralFlicker {
    0%, 100% { opacity: 0.05; }
    50% { opacity: 0.2; }
}

.moth-container {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 6;
}

/* ========================================
   Stratum 1 - Lattice
   ======================================== */
.lattice-content {
    padding-top: 120px;
}

.hex-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--hex-gap);
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

.lattice-cell {
    width: var(--hex-width);
    height: var(--hex-height);
    flex-shrink: 0;
}

/* Stagger odd cells */
.lattice-cell:nth-child(odd) {
    margin-top: calc(var(--hex-height) * -0.12);
}

.lattice-cell:nth-child(even) {
    margin-top: calc(var(--hex-height) * 0.12);
}

/* Neon gap glow between cells */
.hex-grid::after {
    content: '';
    position: absolute;
    inset: 0;
    background: transparent;
    pointer-events: none;
}

/* ========================================
   Stratum 2 - Signal
   ======================================== */
.signal-content {
    padding-top: 120px;
}

.signal-columns {
    display: flex;
    gap: 30px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    max-width: 1200px;
}

.signal-col {
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
}

.signal-col-visual {
    flex: 0 0 250px;
}

.signal-col-text {
    flex: 0 0 320px;
}

.signal-hex {
    width: 250px;
    height: calc(250px * 1.155);
}

.signal-text-hex {
    width: 300px;
    height: calc(300px * 1.155);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 30px;
    background: rgba(18, 16, 31, 0.8);
}

/* ========================================
   Stratum 3 - Resonance
   ======================================== */
.resonance-content {
    padding-top: 120px;
}

.resonance-row {
    display: flex;
    gap: 16px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.resonance-hex {
    width: clamp(140px, 16vw, 220px);
    height: calc(clamp(140px, 16vw, 220px) * 1.155);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    cursor: pointer;
    transition: filter 0.4s ease, transform 0.4s ease;
}

.resonance-hex:hover {
    transform: scale(1.05);
}

.resonance-hex canvas {
    z-index: 0;
}

/* ========================================
   Stratum 4 - Convergence
   ======================================== */
.convergence-content {
    padding-top: 120px;
}

.convergence-cluster {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: center;
    max-width: 900px;
    transition: transform 0.6s ease;
}

.convergence-hex {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    text-align: center;
}

.convergence-lg {
    width: 240px;
    height: calc(240px * 1.155);
}

.convergence-md {
    width: 180px;
    height: calc(180px * 1.155);
}

.convergence-sm {
    width: 110px;
    height: calc(110px * 1.155);
    background: rgba(26, 16, 53, 0.6);
}

.convergence-sm .mono-text {
    font-size: 12px;
}

/* ========================================
   Stratum 5 - Continuum
   ======================================== */
.continuum-content {
    position: relative;
}

.continuum-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.stratum-title-dissolve {
    opacity: 0.6;
    filter: drop-shadow(0 0 16px var(--electric-cyan)) drop-shadow(0 0 48px var(--electric-cyan)) blur(1px);
}

.continuum-text {
    position: relative;
    z-index: 5;
    text-align: center;
    margin-top: 20vh;
}

.continuum-body {
    font-size: 18px;
    max-width: 600px;
    margin: 0 auto;
    color: var(--lunar-white);
    filter: drop-shadow(0 0 8px var(--plasma-violet));
}

/* ========================================
   Hex Dividers
   ======================================== */
.hex-divider {
    position: relative;
    width: 100%;
    height: 24px;
    overflow: hidden;
    background: var(--void-black);
    z-index: 20;
}

.hex-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(255, 0, 110, 0.3) 20%,
        rgba(0, 245, 212, 0.3) 50%,
        rgba(255, 0, 110, 0.3) 80%,
        transparent 100%
    );
    transform: translateY(-50%);
}

/* ========================================
   Hex Navigation
   ======================================== */
.hex-nav {
    position: fixed;
    bottom: 30px;
    right: 30px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 100;
}

.hex-nav-btn {
    width: 48px;
    height: calc(48px * 1.155);
    clip-path: var(--hex-clip);
    background: var(--deep-indigo);
    border: none;
    cursor: pointer;
    position: relative;
    transition: background 0.3s ease, filter 0.3s ease;
    padding: 0;
}

.hex-nav-inner {
    display: block;
    width: 100%;
    height: 100%;
    position: absolute;
    inset: 0;
}

.hex-nav-btn:nth-child(1) { --nav-color: var(--neon-magenta); }
.hex-nav-btn:nth-child(2) { --nav-color: var(--electric-cyan); }
.hex-nav-btn:nth-child(3) { --nav-color: var(--neon-magenta); }
.hex-nav-btn:nth-child(4) { --nav-color: var(--dopamine-amber); }
.hex-nav-btn:nth-child(5) { --nav-color: var(--plasma-violet); }
.hex-nav-btn:nth-child(6) { --nav-color: var(--electric-cyan); }

.hex-nav-btn::after {
    content: '';
    position: absolute;
    inset: 4px;
    clip-path: var(--hex-clip);
    background: var(--nav-color);
    opacity: 0.4;
    transition: opacity 0.3s ease;
}

.hex-nav-btn:hover::after,
.hex-nav-btn.active::after {
    opacity: 1;
}

.hex-nav-btn.active {
    filter: drop-shadow(0 0 6px var(--nav-color)) drop-shadow(0 0 16px var(--nav-color));
}

/* ========================================
   Candle-Flicker Animations
   ======================================== */
.flicker-element {
    filter: brightness(var(--flicker));
    transition: filter 0.05s linear;
}

/* Bloom effect for neon elements */
.neon-bloom {
    filter: drop-shadow(0 0 8px currentColor) drop-shadow(0 0 24px currentColor);
}

/* ========================================
   Moth Particles
   ======================================== */
.moth {
    position: absolute;
    width: 3px;
    height: 3px;
    background: var(--warm-gold);
    border-radius: 50%;
    opacity: 0.6;
    pointer-events: none;
    filter: drop-shadow(0 0 4px var(--warm-gold));
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 1024px) {
    :root {
        --hex-width: 200px;
    }

    .signal-columns {
        flex-direction: column;
    }

    .signal-col-visual {
        flex-direction: row;
        flex: 0 0 auto;
    }

    .signal-hex {
        width: 180px;
        height: calc(180px * 1.155);
    }

    .signal-text-hex {
        width: 260px;
        height: calc(260px * 1.155);
    }
}

@media (max-width: 768px) {
    :root {
        --hex-width: 160px;
    }

    .stratum-title {
        font-size: clamp(48px, 8vw, 72px);
    }

    .wordmark {
        font-size: clamp(40px, 10vw, 80px);
    }

    .genesis-hex-main {
        width: 90vw;
        height: calc(90vw * 1.155);
    }

    .peripheral-cell {
        width: 80px;
        height: calc(80px * 1.155);
    }

    .resonance-hex {
        width: 120px;
        height: calc(120px * 1.155);
    }

    .convergence-lg {
        width: 180px;
        height: calc(180px * 1.155);
    }

    .convergence-md {
        width: 140px;
        height: calc(140px * 1.155);
    }

    .convergence-sm {
        width: 90px;
        height: calc(90px * 1.155);
    }

    .hex-nav {
        bottom: 15px;
        right: 15px;
        gap: 4px;
    }

    .hex-nav-btn {
        width: 36px;
        height: calc(36px * 1.155);
    }

    .signal-hex {
        width: 150px;
        height: calc(150px * 1.155);
    }

    .signal-text-hex {
        width: 220px;
        height: calc(220px * 1.155);
        padding: 40px 20px;
    }
}

@media (max-width: 480px) {
    .lattice-cell {
        width: 140px;
        height: calc(140px * 1.155);
    }

    .resonance-row {
        gap: 8px;
    }

    .convergence-cluster {
        gap: 4px;
    }
}
