/* ============================================
   mujun.quest - Fairycore Circuit-Botanical
   ============================================ */
:root {
    --deep-loam: #1A1610;
    --charred-bark: #2A241C;
    --parchment-light: #E8DFD0;
    --burnished-gold: #D4AF70;
    --verdant-signal: #7DB88A;
    --ember-rust: #B5654A;
    --mycelium-white: #F5F0E8;
    --void-indigo: #1E1B2E;
}
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
    background: linear-gradient(180deg, var(--deep-loam) 0%, var(--charred-bark) 40%, var(--void-indigo) 100%);
    color: var(--parchment-light);
    font-family: 'Lora', serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.1vw, 1.15rem);
    line-height: 1.85;
    letter-spacing: 0.02em;
    overflow-x: hidden;
}
/* Noise texture overlay */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1000;
    background-image: radial-gradient(circle at 50% 50%, rgba(232, 223, 208, 0.015) 0%, transparent 1px);
    background-size: 3px 3px;
}

/* --- Navigation Dots --- */
.strata-nav {
    position: fixed;
    right: 2rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.2rem;
}
.nav-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background: rgba(212, 175, 112, 0.2);
    z-index: -1;
}
.nav-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    border: 1px solid var(--burnished-gold);
    background: transparent;
    cursor: pointer;
    transition: background 0.4s ease, box-shadow 0.4s ease;
    padding: 0;
}
.nav-dot.active {
    background: var(--burnished-gold);
    box-shadow: 0 0 8px rgba(212, 175, 112, 0.4);
}

/* --- Stratum (Section) Base --- */
.stratum {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* --- STRATUM I: THRESHOLD --- */
.stratum-threshold {
    background: var(--deep-loam);
}
.portal-ring {
    position: relative;
    width: min(60vw, 600px);
    height: min(60vw, 600px);
    display: flex;
    align-items: center;
    justify-content: center;
}
.portal-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    animation: portalSpin 120s linear infinite;
}
@keyframes portalSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
.portal-inner {
    width: 75%;
    height: 75%;
    border-radius: 50%;
    overflow: hidden;
    position: relative;
}
.forest-layers {
    position: absolute;
    inset: 0;
}
.forest-layer {
    position: absolute;
    inset: 0;
    border-radius: 50%;
}
.forest-layer--back {
    background: radial-gradient(ellipse at 50% 80%, #1a2e1a 0%, #0d1a0d 100%);
}
.forest-layer--mid {
    background: radial-gradient(ellipse at 40% 60%, rgba(42, 60, 42, 0.6) 0%, transparent 70%);
}
.forest-layer--front {
    background: radial-gradient(ellipse at 60% 40%, rgba(125, 184, 138, 0.1) 0%, transparent 50%);
}
.portal-title {
    position: absolute;
    top: 5%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
}
.portal-title--bottom {
    top: auto;
    bottom: 5%;
}
.arc-text {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 700;
    font-size: clamp(1.2rem, 2.5vw, 2rem);
    letter-spacing: 0.15em;
    color: var(--burnished-gold);
    text-shadow: 0 0 30px rgba(212, 175, 112, 0.3);
}
.arc-text--green {
    color: var(--verdant-signal);
    text-shadow: 0 0 30px rgba(125, 184, 138, 0.3);
}
.circuit-traces--radial {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at 50% 50%, transparent 30%, rgba(125, 184, 138, 0.03) 31%, transparent 32%),
        radial-gradient(circle at 50% 50%, transparent 35%, rgba(125, 184, 138, 0.02) 36%, transparent 37%),
        radial-gradient(circle at 50% 50%, transparent 42%, rgba(125, 184, 138, 0.015) 43%, transparent 44%);
}

/* --- Transition Zones --- */
.transition-zone {
    height: 15vh;
    position: relative;
    overflow: hidden;
}
.fractal-edge {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg,
        rgba(212, 175, 112, 0.05) 0%,
        rgba(125, 184, 138, 0.03) 50%,
        transparent 100%
    );
    clip-path: polygon(
        0% 0%, 5% 30%, 10% 10%, 18% 40%, 25% 15%, 32% 50%,
        40% 20%, 48% 45%, 55% 10%, 62% 35%, 70% 5%, 78% 40%,
        85% 15%, 92% 50%, 100% 20%, 100% 100%, 0% 100%
    );
}
.fractal-edge--alt {
    clip-path: polygon(
        0% 20%, 8% 50%, 15% 25%, 22% 45%, 30% 10%, 38% 35%,
        45% 5%, 52% 40%, 60% 15%, 68% 50%, 75% 20%, 82% 45%,
        90% 10%, 95% 30%, 100% 0%, 100% 100%, 0% 100%
    );
}

/* --- STRATUM II: THE ARCHIVE --- */
.stratum-archive {
    background: var(--charred-bark);
    padding: 8vh 0;
}
.archive-grid {
    display: flex;
    gap: 2rem;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 3rem;
}
.quest-card {
    flex: 1;
    background: rgba(42, 36, 28, 0.35);
    backdrop-filter: blur(16px) saturate(1.2);
    border: 1px solid rgba(212, 175, 112, 0.15);
    border-radius: 2px;
    padding: 2rem;
    box-shadow: inset 0 0 20px rgba(212, 175, 112, 0.05);
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s cubic-bezier(0.23, 1, 0.32, 1);
    will-change: transform, opacity;
}
.quest-card:nth-child(2) { margin-top: 4rem; transition-delay: 0.1s; }
.quest-card:nth-child(3) { margin-top: 8rem; transition-delay: 0.2s; }
.quest-card.visible {
    opacity: 1;
    transform: translateY(0);
}
.quest-card:hover {
    border-color: rgba(212, 175, 112, 0.4);
    backdrop-filter: blur(20px) saturate(1.3);
    box-shadow: inset 0 0 40px rgba(212, 175, 112, 0.08);
}
.quest-card:hover .quest-text {
    color: var(--mycelium-white);
}
.drop-cap-wrapper {
    float: left;
    margin-right: 0.5rem;
    margin-bottom: 0.2rem;
}
.drop-cap {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 700;
    font-size: 3.5em;
    line-height: 0.8;
    color: var(--burnished-gold);
    background: radial-gradient(circle, rgba(212, 175, 112, 0.1) 0%, transparent 70%);
    padding: 0.1em;
}
.quest-title {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: clamp(1.3rem, 2vw, 1.8rem);
    letter-spacing: 0.04em;
    color: var(--burnished-gold);
    text-shadow: 0 0 20px rgba(212, 175, 112, 0.2);
    margin-bottom: 0.8rem;
}
.quest-text {
    font-family: 'Lora', serif;
    font-size: clamp(0.9rem, 1vw, 1rem);
    line-height: 1.85;
    color: var(--parchment-light);
    transition: color 0.4s ease;
}

/* --- STRATUM III: CONTRADICTION ENGINE --- */
.stratum-contradiction {
    background: var(--deep-loam);
}
.split-screen {
    display: flex;
    width: 100%;
    height: 100vh;
}
.split-organic {
    flex: 1;
    background: var(--deep-loam);
    padding: 10vh 5vw;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.split-synthetic {
    flex: 1;
    background: var(--void-indigo);
    padding: 10vh 5vw;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.split-divider {
    width: 4px;
    flex-shrink: 0;
    display: flex;
    align-items: stretch;
    position: relative;
    overflow: hidden;
}
.split-divider svg {
    width: 4px;
    height: 100%;
}
.split-title {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 700;
    font-size: clamp(2rem, 5vw, 4rem);
    letter-spacing: 0.15em;
    margin-bottom: 2rem;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}
.split-title.visible {
    opacity: 1;
    transform: translateY(0);
}
.split-title--warm {
    color: var(--burnished-gold);
    text-shadow: 0 0 30px rgba(212, 175, 112, 0.3);
}
.split-title--cool {
    color: var(--verdant-signal);
    text-shadow: 0 0 30px rgba(125, 184, 138, 0.3);
    font-family: 'Fira Code', monospace;
    font-weight: 400;
    font-size: clamp(1.5rem, 3.5vw, 2.5rem);
    letter-spacing: 0.06em;
}
.split-body {
    font-size: clamp(0.95rem, 1.1vw, 1.1rem);
    line-height: 1.85;
    max-width: 500px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out 0.2s, transform 0.6s ease-out 0.2s;
}
.split-body.visible {
    opacity: 1;
    transform: translateY(0);
}
.split-body--warm {
    color: var(--parchment-light);
    font-family: 'Lora', serif;
}
.split-body--cool {
    color: var(--verdant-signal);
    font-family: 'Fira Code', monospace;
    font-size: 0.85rem;
    letter-spacing: 0.06em;
    line-height: 1.7;
}
.split-motif {
    margin-top: 2rem;
    opacity: 0.5;
}

/* --- STRATUM IV: UNDERGROWTH --- */
.stratum-undergrowth {
    background: var(--charred-bark);
    padding: 5vh 0;
}
.layer-stack {
    position: relative;
    max-width: 800px;
    margin: 0 auto;
    padding: 0 3rem;
    min-height: 70vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.layer-panel {
    background: rgba(42, 36, 28, 0.4);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(212, 175, 112, 0.12);
    border-radius: 2px;
    padding: 2.5rem;
    margin-bottom: 1.5rem;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s cubic-bezier(0.23, 1, 0.32, 1), transform 0.8s cubic-bezier(0.23, 1, 0.32, 1);
    will-change: transform, opacity;
}
.layer-panel.visible {
    opacity: 1;
    transform: translateY(0);
}
.layer-panel--back {
    transform: rotate(-2deg) translateY(30px);
    transition-delay: 0s;
}
.layer-panel--back.visible {
    transform: rotate(-2deg) translateY(0);
}
.layer-panel--mid {
    transform: rotate(0deg) translateY(30px);
    transition-delay: 0.15s;
}
.layer-panel--mid.visible {
    transform: rotate(0deg) translateY(0);
}
.layer-panel--front {
    transform: rotate(3deg) translateY(30px);
    transition-delay: 0.3s;
}
.layer-panel--front.visible {
    transform: rotate(3deg) translateY(0);
}
.undergrowth-title {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 700;
    font-size: clamp(1.8rem, 4vw, 3rem);
    color: var(--burnished-gold);
    letter-spacing: 0.1em;
    text-shadow: 0 0 20px rgba(212, 175, 112, 0.2);
    margin-bottom: 1rem;
}
.layer-text {
    font-family: 'Lora', serif;
    font-size: clamp(0.95rem, 1.1vw, 1.1rem);
    line-height: 1.85;
    color: var(--parchment-light);
}

/* --- STRATUM V: THE SIGNAL --- */
.stratum-signal {
    background: var(--deep-loam);
}
.signal-particles {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}
.signal-particles .mote {
    position: absolute;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--burnished-gold);
}
.signal-content {
    position: relative;
    z-index: 5;
    text-align: center;
    padding: 0 5vw;
}
.signal-text {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 400;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    letter-spacing: 0.3em;
    color: var(--burnished-gold);
    opacity: 0;
    transition: opacity 2s ease;
}
.signal-text.visible {
    opacity: 1;
}
.signal-text .char {
    opacity: 0;
    transition: opacity 0.15s ease;
}
.signal-text .char.shown {
    opacity: 1;
}

/* --- STRATUM VI: THE RETURN --- */
.stratum-return {
    background: var(--void-indigo);
    flex-direction: column;
    gap: 3rem;
}
.portal-ring--inverted .portal-svg {
    animation-direction: reverse;
}
.portal-inner--tech {
    background: var(--void-indigo);
}
.circuit-scene {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.circuit-node {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--verdant-signal);
    animation: nodePulse 3s ease-in-out infinite;
}
.circuit-node--1 { top: 30%; left: 40%; animation-delay: 0s; }
.circuit-node--2 { top: 50%; left: 60%; animation-delay: -0.6s; }
.circuit-node--3 { top: 70%; left: 35%; animation-delay: -1.2s; }
.circuit-node--4 { top: 40%; left: 70%; animation-delay: -1.8s; }
.circuit-node--5 { top: 60%; left: 50%; animation-delay: -2.4s; }
@keyframes nodePulse {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.5); box-shadow: 0 0 12px rgba(125, 184, 138, 0.5); }
}
.return-btn {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: 1.1rem;
    letter-spacing: 0.1em;
    color: var(--verdant-signal);
    background: none;
    border: 1px solid rgba(125, 184, 138, 0.3);
    padding: 0.8rem 2rem;
    cursor: pointer;
    transition: all 0.4s ease;
    position: relative;
    z-index: 10;
}
.return-btn:hover {
    border-color: var(--verdant-signal);
    color: var(--mycelium-white);
    box-shadow: 0 0 20px rgba(125, 184, 138, 0.2);
}

/* --- Responsive --- */
@media (max-width: 900px) {
    .archive-grid {
        flex-direction: column;
    }
    .quest-card:nth-child(2), .quest-card:nth-child(3) { margin-top: 0; }
    .split-screen {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
    }
    .split-divider {
        width: 100%;
        height: 4px;
    }
    .split-divider svg { width: 100%; height: 4px; }
    .strata-nav { display: none; }
    .portal-ring {
        width: min(80vw, 400px);
        height: min(80vw, 400px);
    }
}
@media (max-width: 600px) {
    .portal-ring {
        width: min(90vw, 300px);
        height: min(90vw, 300px);
    }
    .signal-text {
        letter-spacing: 0.1em;
    }
}
