:root {
    --bg-deep: #08080f;
    --bg-surface: #12101f;
    --bg-elevated: #1c1a2e;
    --text-primary: #e0f0ff;
    --text-secondary: #7a8ba8;
    --neon-magenta: #ff006e;
    --neon-cyan: #00e5ff;
    --neon-amber: #ffbe0b;
    --candle-glow: #ff8c42;
    --ghost-indigo: #2a2a4a;
    --label-dim: #5c6f8a;
}

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

body {
    background-color: var(--bg-deep);
    color: var(--text-primary);
    font-family: 'Libre Franklin', sans-serif;
    font-weight: 400;
    font-size: 16px;
    line-height: 1.7;
    overflow-x: hidden;
}

/* ============================================
   NAVIGATION DOTS
   ============================================ */

.nav-dots {
    position: fixed;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 16px;
    z-index: 200;
}

.nav-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--ghost-indigo);
    cursor: pointer;
    transition: background 0.3s ease, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
}

.nav-dot:hover {
    transform: translateY(-3px) scale(1.4);
    box-shadow: 0 4px 12px rgba(0, 229, 255, 0.3);
}

.nav-dot.active {
    background: var(--neon-magenta);
    box-shadow: 0 0 12px rgba(255, 0, 110, 0.6);
}

/* ============================================
   CHAMBER BASE STYLES
   ============================================ */

.chamber {
    position: relative;
    width: 100vw;
    min-height: 100vh;
    overflow: hidden;
}

.chamber-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    grid-template-rows: auto 1fr auto;
    gap: 0 32px;
    width: 100%;
    height: 100vh;
    padding: 6vh 8vw;
    align-items: center;
}

.chamber--odd .chamber-grid {
    grid-template-areas:
        "headline headline . . visual visual"
        ". . . . visual visual"
        "body body . . . motif";
}

.chamber--even .chamber-grid {
    grid-template-areas:
        "visual visual . . headline headline"
        "visual visual . . . ."
        "motif . . . body body";
}

.chamber-grid--center {
    grid-template-areas:
        ". . headline headline . ."
        ". . headline headline . ."
        ". . headline headline . ." !important;
    justify-items: center;
}

.chamber-headline {
    grid-area: headline;
    z-index: 2;
}

.chamber-headline--center {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.chamber-visual-area {
    grid-area: visual;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    min-height: 300px;
}

.chamber-body {
    grid-area: body;
    z-index: 2;
    max-width: 480px;
}

.chamber-motif {
    grid-area: motif;
    z-index: 1;
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */

.headline {
    font-family: 'Fraunces', serif;
    font-weight: 900;
    font-size: clamp(48px, 7vw, 112px);
    line-height: 1.05;
    letter-spacing: -0.03em;
    font-variation-settings: 'SOFT' 100, 'WONK' 1;
    margin-bottom: 1.5rem;
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.35s ease;
}

.headline:hover {
    transform: translateY(-8px);
    text-shadow: 0 12px 40px rgba(255, 0, 110, 0.2);
}

.headline--large {
    font-size: clamp(64px, 10vw, 140px);
}

.headline--glow-cyan {
    color: var(--neon-cyan);
    text-shadow: 0 0 40px rgba(0, 229, 255, 0.3), 0 0 80px rgba(0, 229, 255, 0.15);
}

.headline--glow-magenta {
    color: var(--neon-magenta);
    text-shadow: 0 0 40px rgba(255, 0, 110, 0.3), 0 0 80px rgba(255, 0, 110, 0.15);
}

.headline--glow-amber {
    color: var(--neon-amber);
    text-shadow: 0 0 40px rgba(255, 190, 11, 0.3), 0 0 80px rgba(255, 190, 11, 0.15);
}

.dot-accent {
    color: var(--neon-magenta);
}

.text-accent-cyan {
    color: var(--neon-cyan);
}

.text-accent-magenta {
    color: var(--neon-magenta);
}

.text-accent-amber {
    color: var(--neon-amber);
}

.body-text {
    font-family: 'Libre Franklin', sans-serif;
    font-size: clamp(15px, 1.5vw, 20px);
    font-weight: 400;
    color: #c8d6e5;
    line-height: 1.7;
    letter-spacing: 0.01em;
    margin-bottom: 1.5rem;
    max-width: 480px;
}

.body-text--center {
    text-align: center;
    margin-left: auto;
    margin-right: auto;
}

.mono-accent {
    font-family: 'Azeret Mono', monospace;
    font-size: 12px;
    font-weight: 400;
    color: var(--label-dim);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    padding: 0.5rem 1rem;
    border-left: 2px solid var(--ghost-indigo);
    background: rgba(18, 16, 31, 0.5);
}

.mono-accent--center {
    border-left: none;
    text-align: center;
    background: none;
}

/* ============================================
   SCROLL HINT
   ============================================ */

.scroll-hint {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--label-dim);
    font-family: 'Azeret Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    animation: fadeInUp 1.5s ease 1s both;
}

.scroll-hint__arrow {
    animation: bobDown 2s ease-in-out infinite;
    color: var(--neon-cyan);
}

@keyframes bobDown {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(6px); }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================
   CHAMBER BACKGROUNDS
   ============================================ */

.chamber-1 {
    background: radial-gradient(ellipse at 30% 50%, rgba(0, 229, 255, 0.05) 0%, transparent 60%), var(--bg-deep);
}

.chamber-2 {
    background: radial-gradient(ellipse at 70% 50%, rgba(255, 0, 110, 0.04) 0%, transparent 60%), var(--bg-surface);
}

.chamber-3 {
    background: radial-gradient(ellipse at 30% 50%, rgba(255, 190, 11, 0.04) 0%, transparent 60%), var(--bg-deep);
}

.chamber-4 {
    background: radial-gradient(ellipse at 70% 50%, rgba(0, 229, 255, 0.04) 0%, transparent 60%), var(--bg-surface);
}

.chamber-5 {
    background: radial-gradient(ellipse at 30% 50%, rgba(255, 0, 110, 0.04) 0%, transparent 60%), var(--bg-deep);
}

.chamber-6 {
    background: radial-gradient(ellipse at 50% 50%, rgba(255, 140, 66, 0.06) 0%, transparent 50%), var(--bg-deep);
}

/* ============================================
   THRESHOLD ZONES
   ============================================ */

.threshold-zone {
    width: 100%;
    height: 20vh;
    background: #000000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.threshold-shape {
    width: 60px;
    height: 60px;
}

.threshold-spin {
    transform-origin: 50px 50px;
    animation: thresholdRotate 45s linear infinite;
    opacity: 0.4;
    transition: opacity 0.5s ease, stroke 0.5s ease;
}

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

/* ============================================
   PRISM SVG (Chamber 1)
   ============================================ */

.prism-svg {
    width: 100%;
    height: 100%;
    max-width: 400px;
    max-height: 400px;
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.35s ease;
}

.prism-svg:hover {
    transform: translateY(-8px);
    filter: drop-shadow(0 12px 40px rgba(0, 229, 255, 0.2));
}

.prism-rotate {
    transform-origin: 200px 200px;
    animation: slowRotate 30s linear infinite;
}

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

/* ============================================
   MELTING GRID (Chamber 2)
   ============================================ */

.melting-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(8, 1fr);
    gap: 4px;
    width: 100%;
    height: 100%;
    max-width: 380px;
    max-height: 380px;
    margin: auto;
}

.grid-cell {
    background: var(--bg-elevated);
    border: 1px solid var(--ghost-indigo);
    border-radius: 2px;
    transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
    position: relative;
    overflow: hidden;
}

.grid-cell::after {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--neon-cyan);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.grid-cell:hover {
    transform: translateY(-8px) scale(1.3) rotate(2deg);
    border-color: var(--neon-magenta);
    box-shadow: 0 12px 40px rgba(0, 229, 255, 0.2);
    z-index: 2;
}

.grid-cell:hover::after {
    opacity: 0.15;
}

.grid-cell.melted {
    border-radius: 50%;
    transform: scale(0.7);
    border-color: var(--neon-magenta);
    background: rgba(255, 0, 110, 0.1);
}

/* ============================================
   CONSTELLATION CANVAS (Chamber 3)
   ============================================ */

.constellation-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* ============================================
   ORBITAL RINGS (Chamber 4)
   ============================================ */

.orbital-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.orbital-svg {
    width: 100%;
    height: 100%;
    max-width: 400px;
    max-height: 400px;
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.orbital-svg:hover {
    transform: translateY(-8px);
    filter: drop-shadow(0 12px 40px rgba(0, 229, 255, 0.2));
}

.orbit-1 { animation: orbitTilt1 12s linear infinite; transform-origin: 200px 200px; }
.orbit-2 { animation: orbitTilt2 16s linear infinite; transform-origin: 200px 200px; }
.orbit-3 { animation: orbitTilt3 20s linear infinite; transform-origin: 200px 200px; }
.orbit-4 { animation: orbitTilt4 24s linear infinite; transform-origin: 200px 200px; }

@keyframes orbitTilt1 { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes orbitTilt2 { from { transform: rotate(0deg); } to { transform: rotate(-360deg); } }
@keyframes orbitTilt3 { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes orbitTilt4 { from { transform: rotate(0deg); } to { transform: rotate(-360deg); } }

.central-orb {
    animation: orbPulse 3s ease-in-out infinite;
    transform-origin: 200px 200px;
}

@keyframes orbPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* ============================================
   FRACTURE CANVAS (Chamber 5)
   ============================================ */

.fracture-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* ============================================
   SIGNAL GLYPH (Chamber 6)
   ============================================ */

.signal-glyph {
    margin-bottom: 2rem;
}

.signal-svg {
    width: 200px;
    height: 200px;
}

.signal-pulse {
    animation: signalPulse 4s ease-in-out infinite;
    transform-origin: 100px 100px;
}

@keyframes signalPulse {
    0%, 100% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.15); opacity: 1; }
}

.signal-ring { transform-origin: 100px 100px; }
.ring-1 { animation: ringExpand 3s ease-out infinite; }
.ring-2 { animation: ringExpand 3s ease-out 0.5s infinite; }
.ring-3 { animation: ringExpand 3s ease-out 1s infinite; }
.ring-4 { animation: ringExpand 3s ease-out 1.5s infinite; }

@keyframes ringExpand {
    0% { transform: scale(0.8); opacity: 0.8; }
    100% { transform: scale(1.3); opacity: 0; }
}

/* ============================================
   CANDLE FLAME MOTIFS
   ============================================ */

.candle-flame {
    width: 40px;
    height: 60px;
    mix-blend-mode: screen;
}

.flame-flicker {
    animation: flameFlicker 2.5s ease-in-out infinite;
    transform-origin: 20px 55px;
}

.flame-1 { animation-duration: 2.1s; }
.flame-2 { animation-duration: 2.7s; }
.flame-3 { animation-duration: 3.1s; }
.flame-4 { animation-duration: 2.4s; }
.flame-5 { animation-duration: 3.7s; }

@keyframes flameFlicker {
    0%, 100% { transform: scaleX(1) scaleY(1); opacity: 0.8; }
    25% { transform: scaleX(0.9) scaleY(1.05); opacity: 1; }
    50% { transform: scaleX(1.05) scaleY(0.95); opacity: 0.7; }
    75% { transform: scaleX(0.95) scaleY(1.02); opacity: 0.9; }
}

.flame-paused .flame-flicker {
    animation-play-state: paused;
}

/* ============================================
   AMBIENT CANVAS
   ============================================ */

.ambient-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 100;
    opacity: 0.4;
}

/* ============================================
   CHAMBER REVEAL ANIMATIONS
   ============================================ */

.chamber-headline,
.chamber-body {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.chamber-visual-area {
    opacity: 0;
    transform: scale(0.85);
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.2s, transform 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.2s;
}

.chamber-body {
    transition-delay: 0.4s;
}

.chamber.in-view .chamber-headline {
    opacity: 1;
    transform: translateY(0);
}

.chamber.in-view .chamber-visual-area {
    opacity: 1;
    transform: scale(1);
}

.chamber.in-view .chamber-body {
    opacity: 1;
    transform: translateY(0);
}

.chamber-motif {
    opacity: 0;
    transition: opacity 0.5s ease 0.6s;
}

.chamber.in-view .chamber-motif {
    opacity: 1;
}

/* ============================================
   HOVER GLOW EFFECT
   ============================================ */

.chamber-visual-area:hover {
    filter: drop-shadow(0 0 60px rgba(0, 229, 255, 0.15));
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .chamber-grid {
        grid-template-columns: 1fr;
        grid-template-areas:
            "headline"
            "visual"
            "body"
            "motif" !important;
        padding: 4vh 6vw;
    }

    .chamber--odd .chamber-grid,
    .chamber--even .chamber-grid {
        grid-template-areas:
            "headline"
            "visual"
            "body"
            "motif";
    }

    .chamber-grid--center {
        grid-template-areas:
            "headline"
            "headline"
            "headline" !important;
    }

    .chamber-headline,
    .chamber-body {
        text-align: center;
    }

    .chamber-headline--center {
        align-items: center;
    }

    .chamber-visual-area {
        min-height: 200px;
        max-height: 40vh;
    }

    .headline {
        font-size: clamp(36px, 8vw, 64px);
    }

    .melting-grid {
        max-width: 280px;
        max-height: 280px;
    }

    .mono-accent {
        border-left: none;
        text-align: center;
    }

    .nav-dots {
        right: 12px;
        gap: 12px;
    }

    .nav-dot {
        width: 8px;
        height: 8px;
    }

    .chamber-motif {
        justify-content: center;
    }
}
