/* =====================================================
   mujun.quest -- A Descent Through Contradiction
   Vertical parallax storytelling journey
   ===================================================== */

:root {
    --abyss-indigo: #0d0b1a;
    --deep-layer: #1a1535;
    --quest-violet: #2d1f5e;
    --quest-violet-deep: #3a2d6b;
    --scroll-parchment: #d4c5a9;
    --mystic-purple: #8b6cc1;
    --torch-amber: #c49a6c;

    --font-display: "Cinzel", "Lora", Georgia, serif;
    --font-body: "Crimson Pro", "Lora", Georgia, serif;
    --font-ui: "Alegreya Sans", "Inter", "Space Grotesk", system-ui, sans-serif;

    --section-max: 540px;

    --scroll: 0;
}

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

html {
    scroll-behavior: smooth;
    background: var(--abyss-indigo);
}

body {
    font-family: var(--font-body);
    color: var(--scroll-parchment);
    background: var(--abyss-indigo);
    line-height: 1.85;
    overflow-x: hidden;
    position: relative;
    min-height: 100vh;
    font-feature-settings: "liga", "kern";
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* =====================================================
   Parallax Fog Layers
   ===================================================== */
.fog-layer {
    position: fixed;
    inset: -20vh -20vw;
    pointer-events: none;
    will-change: transform;
    transition: transform 0.05s linear;
}

.fog-layer-1 {
    z-index: 1;
    background:
        radial-gradient(ellipse 60vw 40vh at 20% 30%, rgba(139, 108, 193, 0.10), transparent 60%),
        radial-gradient(ellipse 50vw 35vh at 80% 70%, rgba(139, 108, 193, 0.08), transparent 60%);
    transform: translate3d(0, calc(var(--scroll) * 0.35px), 0);
}

.fog-layer-2 {
    z-index: 2;
    background:
        radial-gradient(ellipse 45vw 30vh at 70% 20%, rgba(196, 154, 108, 0.06), transparent 65%),
        radial-gradient(ellipse 55vw 40vh at 30% 80%, rgba(45, 31, 94, 0.18), transparent 60%);
    transform: translate3d(0, calc(var(--scroll) * 0.6px), 0);
}

.fog-layer-3 {
    z-index: 3;
    background:
        radial-gradient(ellipse 35vw 25vh at 50% 50%, rgba(139, 108, 193, 0.07), transparent 70%),
        radial-gradient(ellipse 30vw 25vh at 10% 60%, rgba(196, 154, 108, 0.04), transparent 65%);
    transform: translate3d(0, calc(var(--scroll) * 0.9px), 0);
}

/* =====================================================
   Floating Particles (dust motes)
   ===================================================== */
.particles {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 4;
    overflow: hidden;
}

.particle {
    position: absolute;
    border-radius: 50%;
    background: rgba(196, 154, 108, 0.32);
    box-shadow: 0 0 6px rgba(196, 154, 108, 0.25);
    will-change: transform, opacity;
    opacity: 0;
}

.particle-1  { width: 4px; height: 4px; left: 8%;  top: 20%; animation: drift 22s ease-in-out infinite;          animation-delay: -1s; }
.particle-2  { width: 3px; height: 3px; left: 18%; top: 65%; animation: drift 28s ease-in-out infinite reverse;  animation-delay: -4s; }
.particle-3  { width: 5px; height: 5px; left: 32%; top: 35%; animation: drift 26s ease-in-out infinite;          animation-delay: -8s; }
.particle-4  { width: 3px; height: 3px; left: 44%; top: 80%; animation: drift 32s ease-in-out infinite reverse;  animation-delay: -12s; }
.particle-5  { width: 4px; height: 4px; left: 56%; top: 15%; animation: drift 24s ease-in-out infinite;          animation-delay: -3s; }
.particle-6  { width: 3px; height: 3px; left: 68%; top: 55%; animation: drift 30s ease-in-out infinite reverse;  animation-delay: -6s; }
.particle-7  { width: 5px; height: 5px; left: 78%; top: 25%; animation: drift 27s ease-in-out infinite;          animation-delay: -10s; }
.particle-8  { width: 4px; height: 4px; left: 88%; top: 70%; animation: drift 33s ease-in-out infinite reverse;  animation-delay: -14s; }
.particle-9  { width: 3px; height: 3px; left: 24%; top: 50%; animation: drift 29s ease-in-out infinite;          animation-delay: -2s; }
.particle-10 { width: 4px; height: 4px; left: 62%; top: 88%; animation: drift 31s ease-in-out infinite reverse;  animation-delay: -7s; }

@keyframes drift {
    0%   { transform: translate3d(0,    0, 0); opacity: 0; }
    10%  {                                     opacity: 0.7; }
    50%  { transform: translate3d(12px, -60px, 0); opacity: 1; }
    90%  {                                     opacity: 0.5; }
    100% { transform: translate3d(-6px, -120px, 0); opacity: 0; }
}

/* =====================================================
   Quest Depth Progress Bar
   ===================================================== */
.quest-progress {
    position: fixed;
    right: 12px;
    top: 10vh;
    width: 3px;
    height: 80vh;
    background: var(--deep-layer);
    z-index: 50;
    border-radius: 2px;
    box-shadow: 0 0 8px rgba(58, 45, 107, 0.4);
}

.quest-progress-fill {
    position: absolute;
    top: 0;
    left: -1px;
    width: 5px;
    height: 0%;
    background: linear-gradient(180deg, var(--mystic-purple), var(--torch-amber));
    border-radius: 2px;
    box-shadow: 0 0 12px rgba(139, 108, 193, 0.7);
    transition: height 0.15s ease-out;
}

.quest-progress-label {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%) rotate(180deg);
    writing-mode: vertical-rl;
    font-family: var(--font-ui);
    font-size: 0.7rem;
    letter-spacing: 0.32em;
    color: var(--mystic-purple);
    text-transform: uppercase;
    opacity: 0.7;
    white-space: nowrap;
}

/* =====================================================
   Sigil Header (top brand)
   ===================================================== */
.sigil-header {
    position: fixed;
    top: 28px;
    left: 32px;
    z-index: 40;
    display: flex;
    align-items: center;
    gap: 14px;
    pointer-events: none;
}

.sigil-mark {
    width: 38px;
    height: 38px;
    border: 1px solid var(--mystic-purple);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(13, 11, 26, 0.65);
    box-shadow: 0 0 18px rgba(139, 108, 193, 0.25);
    backdrop-filter: blur(2px);
}

.sigil-glyph {
    font-family: var(--font-display);
    font-size: 0.78rem;
    color: var(--torch-amber);
    letter-spacing: 0;
    line-height: 1;
}

.sigil-domain {
    font-family: var(--font-ui);
    font-size: 0.78rem;
    letter-spacing: 0.36em;
    color: var(--scroll-parchment);
    text-transform: uppercase;
    opacity: 0.78;
}

/* =====================================================
   Quest Sections (full-bleed parallax)
   ===================================================== */
main {
    position: relative;
    z-index: 10;
}

.quest-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8vh 6vw;
    position: relative;
    overflow: hidden;
}

.section-inner {
    max-width: var(--section-max);
    width: 100%;
    text-align: center;
    position: relative;
    z-index: 2;
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 1.2s ease-out, transform 1.2s ease-out;
}

.quest-section.in-view .section-inner {
    opacity: 1;
    transform: translateY(0);
}

/* Per-section gradient shifts */
.section-hero {
    background: linear-gradient(180deg, #0d0b1a 0%, #1a1535 100%);
}

.section-layer-1 {
    background: linear-gradient(180deg, #1a1535 0%, #1f1846 100%);
}

.section-layer-2 {
    background: linear-gradient(180deg, #1f1846 0%, #251c54 100%);
}

.section-layer-3 {
    background: linear-gradient(180deg, #251c54 0%, #2d1f5e 100%);
}

.section-layer-4 {
    background: linear-gradient(180deg, #2d1f5e 0%, #261850 100%);
}

.section-layer-5 {
    background: linear-gradient(180deg, #261850 0%, #150f30 100%);
}

.section-closing {
    background: linear-gradient(180deg, #150f30 0%, #0d0b1a 100%);
}

/* Subtle radial vignette over each section */
.quest-section::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, transparent 40%, rgba(13, 11, 26, 0.55) 100%);
    pointer-events: none;
    z-index: 1;
}

/* =====================================================
   Section Typography
   ===================================================== */
.section-label {
    font-family: var(--font-ui);
    font-size: 0.78rem;
    letter-spacing: 0.42em;
    text-transform: uppercase;
    color: var(--torch-amber);
    margin-bottom: 2.4rem;
    opacity: 0.86;
}

.hero-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(2.4rem, 6vw, 4.4rem);
    line-height: 1.1;
    color: var(--scroll-parchment);
    letter-spacing: 0.04em;
    margin-bottom: 1.6rem;
    text-shadow: 0 0 30px rgba(139, 108, 193, 0.35);
}

.hero-dot {
    color: var(--torch-amber);
    text-shadow: 0 0 20px rgba(196, 154, 108, 0.6);
}

.hero-subtitle {
    font-family: var(--font-body);
    font-style: italic;
    font-size: 1.15rem;
    color: var(--scroll-parchment);
    margin-bottom: 1rem;
    opacity: 0.92;
}

.hero-tagline {
    font-family: var(--font-ui);
    font-size: 0.84rem;
    letter-spacing: 0.22em;
    color: var(--mystic-purple);
    text-transform: lowercase;
    margin-bottom: 4rem;
    opacity: 0.85;
}

.scroll-cue {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    font-family: var(--font-ui);
    font-size: 0.78rem;
    letter-spacing: 0.36em;
    text-transform: uppercase;
    color: var(--torch-amber);
    opacity: 0.78;
}

.scroll-cue-arrow {
    font-size: 1.3rem;
    color: var(--mystic-purple);
    animation: descend-pulse 2.6s ease-in-out infinite;
}

@keyframes descend-pulse {
    0%, 100% { transform: translateY(0);    opacity: 0.6; }
    50%      { transform: translateY(8px);  opacity: 1; }
}

.section-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(2rem, 5vw, 3.5rem);
    line-height: 1.18;
    color: var(--scroll-parchment);
    letter-spacing: 0.02em;
    margin-bottom: 2.4rem;
    text-shadow: 0 0 20px rgba(139, 108, 193, 0.25);
}

.section-body {
    font-family: var(--font-body);
    font-size: 1.05rem;
    line-height: 1.85;
    color: var(--scroll-parchment);
    margin-bottom: 2.6rem;
    opacity: 0.92;
}

.section-quote {
    font-family: var(--font-body);
    font-style: italic;
    font-size: 1rem;
    color: var(--torch-amber);
    line-height: 1.7;
    padding: 1.4rem 0;
    border-top: 1px solid rgba(196, 154, 108, 0.28);
    border-bottom: 1px solid rgba(196, 154, 108, 0.28);
    opacity: 0.95;
}

/* =====================================================
   Closing Section
   ===================================================== */
.closing-title {
    color: var(--torch-amber);
    text-shadow: 0 0 24px rgba(196, 154, 108, 0.32);
}

.closing-body {
    margin-bottom: 3.2rem;
}

.closing-sigil {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.2rem;
    font-family: var(--font-display);
    font-size: 1.6rem;
    color: var(--mystic-purple);
    margin-bottom: 2.4rem;
}

.closing-glyph {
    display: inline-block;
    width: 44px;
    height: 44px;
    line-height: 42px;
    text-align: center;
    border: 1px solid rgba(139, 108, 193, 0.5);
    border-radius: 50%;
    color: var(--torch-amber);
    font-size: 1.1rem;
    box-shadow: 0 0 18px rgba(139, 108, 193, 0.3);
    background: rgba(26, 21, 53, 0.5);
}

.closing-divider {
    color: var(--scroll-parchment);
    opacity: 0.6;
    font-size: 1.4rem;
}

.closing-attribution {
    font-family: var(--font-ui);
    font-size: 0.78rem;
    letter-spacing: 0.4em;
    text-transform: uppercase;
    color: var(--mystic-purple);
    opacity: 0.78;
}

/* =====================================================
   Footer
   ===================================================== */
.quest-footer {
    position: relative;
    z-index: 10;
    text-align: center;
    padding: 4rem 2rem 5rem;
    background: var(--abyss-indigo);
    color: var(--mystic-purple);
    font-family: var(--font-ui);
    font-size: 0.74rem;
    letter-spacing: 0.36em;
    text-transform: uppercase;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    opacity: 0.7;
}

.footer-line {
    color: var(--torch-amber);
    opacity: 0.6;
}

.footer-meta {
    color: var(--scroll-parchment);
    opacity: 0.6;
}

/* =====================================================
   Responsive
   ===================================================== */
@media (max-width: 720px) {
    .sigil-header {
        top: 18px;
        left: 18px;
    }

    .sigil-domain {
        font-size: 0.68rem;
        letter-spacing: 0.28em;
    }

    .quest-progress {
        right: 8px;
        width: 2px;
    }

    .quest-progress-label {
        display: none;
    }

    .quest-section {
        padding: 10vh 8vw;
    }

    .section-label {
        font-size: 0.7rem;
        letter-spacing: 0.32em;
        margin-bottom: 1.8rem;
    }

    .section-title {
        font-size: clamp(1.7rem, 8vw, 2.6rem);
    }

    .hero-title {
        font-size: clamp(2rem, 12vw, 3.4rem);
    }

    .section-body {
        font-size: 1rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .fog-layer {
        transform: none !important;
        transition: none;
    }

    .particle {
        animation: none;
        opacity: 0.4;
    }

    .scroll-cue-arrow {
        animation: none;
    }

    .section-inner {
        transition: none;
    }
}
