/* mystical.quest — Neomorphic Obsidian / Retro-Futuristic Sanctum */

:root {
    --void: #1A1520;
    --void-2: #1E1828;
    --pillar: #242030;
    --amber: #E8C87A;
    --teal: #5E8B8A;
    --stone: #C4B8A8;
    --shadow: #0E0B14;
    --burnished: #D4A857;
    --blood: #A0522D;
    --ritual-teal: #3D6B6A;
    --muted-gold: #B8A070;
    --indigo: #2D2A3E;

    --neo-shadow-dark: 6px 6px 14px var(--shadow);
    --neo-shadow-light: -4px -4px 12px rgba(232, 200, 122, 0.035);
    --neo-shadow-dark-deep: 12px 12px 28px var(--shadow);
    --neo-shadow-light-deep: -8px -8px 24px rgba(232, 200, 122, 0.04);
    --neo-inset-dark: inset 4px 4px 10px var(--shadow);
    --neo-inset-light: inset -3px -3px 8px rgba(232, 200, 122, 0.025);

    --easing: cubic-bezier(0.25, 0.1, 0.25, 1.0);
    --pillar-width: 680px;
}

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

html { scroll-behavior: smooth; }

body {
    font-family: "Roboto Slab", Georgia, serif;
    font-weight: 300;
    font-size: 17px;
    line-height: 1.75;
    color: var(--stone);
    background: var(--void);
    overflow-x: hidden;
    min-height: 100vh;
    position: relative;
}

/* ===========================
   BACKGROUND VOID + PARALLAX
   =========================== */
.bg-void {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
    background:
        radial-gradient(ellipse 80% 60% at 50% 30%, var(--void-2) 0%, var(--void) 70%),
        var(--void);
}

.bg-radial-pulse {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 60% 50% at 50% 40%, rgba(232, 200, 122, 0.05) 0%, rgba(232, 200, 122, 0) 60%);
    animation: pulse-breath 8s ease-in-out infinite;
}

@keyframes pulse-breath {
    0%, 100% { opacity: 0.45; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.06); }
}

.bg-stars {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0.85;
    will-change: transform;
}

.bg-sigils {
    position: absolute;
    inset: 0;
    will-change: transform;
}

.sigil {
    position: absolute;
    opacity: 0;
    transition: opacity 1200ms var(--easing);
    will-change: transform, opacity;
}

.sigil.visible { opacity: 0.5; }

.sigil-1 { top: 8%; left: 6%; width: 220px; height: 220px; }
.sigil-2 { top: 35%; right: 4%; width: 180px; height: 180px; }
.sigil-3 { top: 62%; left: 8%; width: 200px; height: 200px; }
.sigil-4 { top: 88%; right: 7%; width: 160px; height: 160px; }
.sigil-5 { top: 20%; right: 8%; width: 240px; height: 240px; }

/* ===========================
   PILLAR
   =========================== */
.pillar {
    position: relative;
    z-index: 2;
    max-width: var(--pillar-width);
    margin: 0 auto;
    padding: 0 32px;
    background: linear-gradient(180deg,
        rgba(36, 32, 48, 0) 0%,
        rgba(36, 32, 48, 0.55) 6%,
        rgba(36, 32, 48, 0.7) 50%,
        rgba(36, 32, 48, 0.55) 94%,
        rgba(36, 32, 48, 0) 100%);
    box-shadow:
        2px 0 24px rgba(0, 0, 0, 0.6),
        -2px 0 24px rgba(232, 200, 122, 0.04);
}

.chamber {
    min-height: 100vh;
    padding: 140px 0;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 800ms var(--easing), transform 1000ms var(--easing);
}

.chamber.visible {
    opacity: 1;
    transform: translateY(0);
}

.chamber-tag {
    font-family: "IBM Plex Mono", monospace;
    font-size: 12px;
    font-weight: 400;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--teal);
    margin-bottom: 28px;
    padding-left: 22px;
    position: relative;
}

.chamber-tag::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 1px;
    background: var(--teal);
}

.chamber-title {
    font-family: "Zilla Slab", Georgia, serif;
    font-weight: 700;
    font-size: clamp(36px, 5.6vw, 56px);
    letter-spacing: -0.02em;
    line-height: 1.05;
    color: var(--amber);
    margin-bottom: 48px;
}

/* ===========================
   THRESHOLD (Chamber I)
   =========================== */
.threshold {
    align-items: center;
    text-align: center;
    justify-content: center;
}

.threshold-inner {
    padding: 80px 48px;
    border-radius: 4px;
    background: linear-gradient(145deg, rgba(36, 32, 48, 0.85), rgba(30, 24, 40, 0.85));
    box-shadow:
        var(--neo-shadow-dark-deep),
        var(--neo-shadow-light-deep),
        inset 0 0 0 1px rgba(232, 200, 122, 0.04);
    max-width: 540px;
    width: 100%;
    position: relative;
}

.threshold .chamber-tag {
    justify-content: center;
    text-align: center;
    padding-left: 0;
    margin-bottom: 36px;
}

.threshold .chamber-tag::before { display: none; }

.threshold-title {
    font-family: "Zilla Slab", Georgia, serif;
    font-weight: 700;
    font-size: clamp(40px, 6.4vw, 64px);
    letter-spacing: -0.02em;
    line-height: 1;
    color: var(--amber);
    margin-bottom: 24px;
    text-shadow: 0 0 30px rgba(232, 200, 122, 0.18);
}

.threshold-invocation {
    font-family: "IBM Plex Mono", monospace;
    font-size: 12px;
    font-weight: 400;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--teal);
    margin-bottom: 56px;
}

.threshold-rune {
    width: 80px;
    height: 80px;
    margin: 0 auto;
    border-radius: 50%;
    box-shadow: var(--neo-inset-dark), var(--neo-inset-light);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    animation: rune-spin 60s linear infinite;
}

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

.scroll-indicator {
    position: absolute;
    bottom: 48px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    animation: scroll-fade 3s ease-in-out infinite;
}

.scroll-indicator svg { width: 24px; height: 24px; }

.scroll-label {
    font-family: "IBM Plex Mono", monospace;
    font-size: 10px;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--teal);
}

@keyframes scroll-fade {
    0%, 100% { opacity: 0.3; transform: translate(-50%, 0); }
    50% { opacity: 0.9; transform: translate(-50%, 6px); }
}

/* ===========================
   ARCHIVE (Chamber II)
   =========================== */
.archive { justify-content: center; }

.archive-grid {
    display: grid;
    grid-template-columns: 40% 1fr;
    gap: 36px;
    align-items: start;
}

.archive-image {
    position: relative;
    will-change: transform;
}

.duotone-frame {
    position: relative;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: var(--neo-shadow-dark), var(--neo-shadow-light);
    clip-path: polygon(0% 4%, 92% 0%, 100% 8%, 96% 92%, 100% 98%, 6% 100%, 0% 88%, 4% 12%);
    aspect-ratio: 2 / 3;
}

.duotone-svg {
    width: 100%;
    height: 100%;
    display: block;
    filter: contrast(1.1) saturate(1.05);
    mix-blend-mode: normal;
}

.archive-text {
    padding-top: 12px;
}

.archive-meta {
    font-family: "IBM Plex Mono", monospace;
    font-size: 11px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--muted-gold);
    margin-bottom: 24px;
}

.archive-paragraph {
    font-family: "Roboto Slab", Georgia, serif;
    font-weight: 300;
    font-size: 17px;
    line-height: 1.75;
    color: var(--stone);
    margin-bottom: 22px;
}

.archive-divider {
    margin-top: 36px;
    width: 200px;
}

.archive-divider svg { width: 100%; height: 16px; }

/* ===========================
   CODEX (Chamber III)
   =========================== */
.codex { justify-content: flex-start; }

.codex-block {
    margin-bottom: 56px;
}

.codex-paragraph {
    font-family: "Roboto Slab", Georgia, serif;
    font-weight: 300;
    font-size: 17px;
    line-height: 1.8;
    color: var(--stone);
    margin-bottom: 24px;
}

.codex-paragraph:first-letter {
    font-family: "Zilla Slab", Georgia, serif;
    font-weight: 700;
    font-size: 1.8em;
    line-height: 1;
    color: var(--amber);
    margin-right: 4px;
}

.codex-pullquote {
    position: relative;
    padding: 32px 36px 32px 44px;
    margin: 56px 0;
    background: rgba(14, 11, 20, 0.55);
    border-radius: 3px;
    border-left: 3px solid var(--ritual-teal);
    box-shadow: var(--neo-inset-dark), var(--neo-inset-light);
}

.pullquote-spiral {
    position: absolute;
    top: -12px;
    right: -12px;
    width: 80px;
    height: 80px;
    opacity: 0.7;
}

.spiral-path {
    stroke-dasharray: 600;
    stroke-dashoffset: 600;
    transition: stroke-dashoffset 2400ms var(--easing);
}

.codex-pullquote.visible .spiral-path { stroke-dashoffset: 0; }

.codex-pullquote blockquote {
    font-family: "Zilla Slab", Georgia, serif;
    font-style: italic;
    font-weight: 400;
    font-size: 28px;
    line-height: 1.6;
    color: var(--burnished);
    margin-bottom: 16px;
}

.codex-pullquote figcaption {
    font-family: "IBM Plex Mono", monospace;
    font-size: 11px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--teal);
}

.codex-divider {
    margin: 56px auto;
    width: 320px;
    max-width: 100%;
}

.codex-divider svg { width: 100%; height: 60px; }

.divider-arc {
    stroke-dasharray: 500;
    stroke-dashoffset: 500;
    transition: stroke-dashoffset 1800ms var(--easing);
}

.codex.visible .divider-arc { stroke-dashoffset: 0; }
.codex.visible .divider-arc-2 { transition-delay: 200ms; }

.codex-stanzas {
    display: flex;
    flex-direction: column;
    gap: 28px;
    padding: 32px;
    background: rgba(14, 11, 20, 0.4);
    border-radius: 4px;
    box-shadow: var(--neo-inset-dark), var(--neo-inset-light);
}

.stanza {
    display: grid;
    grid-template-columns: 60px 1fr;
    gap: 18px;
    align-items: start;
}

.stanza-mark {
    font-family: "Zilla Slab", Georgia, serif;
    font-weight: 700;
    font-size: 28px;
    color: var(--muted-gold);
    line-height: 1.3;
}

.stanza p {
    font-family: "Roboto Slab", Georgia, serif;
    font-weight: 300;
    font-size: 16px;
    line-height: 1.7;
    color: var(--stone);
}

/* ===========================
   OBSERVATORY (Chamber IV)
   =========================== */
.observatory { justify-content: center; padding: 120px 0; }

.observatory-frame {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    max-height: 80vh;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: var(--neo-shadow-dark-deep), var(--neo-shadow-light-deep);
}

.observatory-image {
    position: absolute;
    inset: -4%;
    will-change: transform;
    transition: transform 600ms var(--easing);
}

.observatory-image svg { width: 100%; height: 100%; }

.ring {
    transform-origin: 300px 300px;
    transform-box: fill-box;
}

.observatory.visible .ring-1 { animation: ring-expand 4s var(--easing) infinite; }
.observatory.visible .ring-2 { animation: ring-expand 4s var(--easing) 0.6s infinite; }
.observatory.visible .ring-3 { animation: ring-expand 4s var(--easing) 1.2s infinite; }
.observatory.visible .ring-4 { animation: ring-expand 4s var(--easing) 1.8s infinite; }

@keyframes ring-expand {
    0% { opacity: 0; transform: scale(0.4); }
    40% { opacity: 0.6; }
    100% { opacity: 0; transform: scale(1.4); }
}

.observatory-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 48px;
    background: rgba(36, 32, 48, 0.85);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.observatory-overlay::before {
    content: "";
    position: absolute;
    inset: 16px;
    border: 1px solid rgba(184, 160, 112, 0.18);
    border-radius: 2px;
    pointer-events: none;
}

.observatory-title {
    font-size: clamp(32px, 4.4vw, 44px);
    margin-bottom: 28px;
}

.observatory-text {
    font-family: "Zilla Slab", Georgia, serif;
    font-style: italic;
    font-weight: 400;
    font-size: 22px;
    line-height: 1.6;
    color: var(--burnished);
    max-width: 460px;
    margin-bottom: 28px;
}

.observatory-meta {
    font-family: "IBM Plex Mono", monospace;
    font-size: 11px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--teal);
}

/* ===========================
   ROOT (Chamber V)
   =========================== */
.root {
    align-items: center;
    text-align: center;
    justify-content: center;
}

.root-mandala {
    width: 320px;
    height: 320px;
    margin: 0 auto 48px;
    position: relative;
}

.root-mandala svg { width: 100%; height: 100%; }

.m-arc, .m-petal {
    stroke-dasharray: 1200;
    stroke-dashoffset: 1200;
    transition: stroke-dashoffset 3000ms var(--easing);
}

.root.visible .m-arc { stroke-dashoffset: 0; }
.root.visible .m-petal { stroke-dashoffset: 0; transition-delay: 600ms; }

.m-core {
    transform-origin: 160px 160px;
    transform-box: fill-box;
    animation: core-pulse 4s ease-in-out infinite;
}

@keyframes core-pulse {
    0%, 100% { transform: scale(1); opacity: 0.7; }
    50% { transform: scale(1.25); opacity: 1; }
}

.root-title {
    margin-bottom: 32px;
}

.root-paragraph {
    font-family: "Roboto Slab", Georgia, serif;
    font-weight: 300;
    font-size: 18px;
    line-height: 1.75;
    color: var(--stone);
    max-width: 520px;
    margin: 0 auto 20px;
}

.root-closer {
    color: var(--muted-gold);
    font-style: italic;
    font-family: "Zilla Slab", Georgia, serif;
    font-size: 19px;
}

.root-signature {
    margin-top: 56px;
    padding: 16px 28px;
    display: inline-flex;
    align-items: center;
    gap: 14px;
    border-radius: 24px;
    background: rgba(14, 11, 20, 0.5);
    box-shadow: var(--neo-inset-dark), var(--neo-inset-light);
}

.sig-label {
    font-family: "IBM Plex Mono", monospace;
    font-size: 10px;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: var(--teal);
}

.sig-value {
    font-family: "IBM Plex Mono", monospace;
    font-size: 12px;
    letter-spacing: 0.16em;
    color: var(--amber);
}

/* ===========================
   CHAMBER RAIL NAVIGATION
   =========================== */
.chamber-rail {
    position: fixed;
    right: 32px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.rail-dot {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    background: rgba(36, 32, 48, 0.6);
    box-shadow: var(--neo-shadow-dark), var(--neo-shadow-light);
    transition: all 600ms var(--easing);
    position: relative;
}

.rail-dot span {
    font-family: "IBM Plex Mono", monospace;
    font-size: 10px;
    letter-spacing: 0.1em;
    color: var(--teal);
    transition: color 600ms var(--easing);
}

.rail-dot.active {
    background: rgba(36, 32, 48, 0.85);
    box-shadow: var(--neo-inset-dark), var(--neo-inset-light);
}

.rail-dot.active span {
    color: var(--amber);
}

.rail-dot:hover {
    transform: translateX(-3px);
}

.rail-dot:hover span {
    color: var(--burnished);
}

/* ===========================
   PILLAR META FOOTER
   =========================== */
.pillar-meta {
    position: fixed;
    bottom: 24px;
    left: 32px;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: "IBM Plex Mono", monospace;
    font-size: 10px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--teal);
    opacity: 0.7;
}

.meta-sep { color: var(--muted-gold); }

/* ===========================
   RESPONSIVE
   =========================== */
@media (max-width: 720px) {
    .pillar { padding: 0 22px; }
    .chamber { padding: 100px 0; }
    .threshold-inner { padding: 56px 28px; }
    .archive-grid { grid-template-columns: 1fr; gap: 32px; }
    .duotone-frame { aspect-ratio: 4 / 3; }
    .codex-pullquote { padding: 24px 22px; }
    .codex-pullquote blockquote { font-size: 22px; }
    .observatory-overlay { padding: 28px; }
    .observatory-text { font-size: 18px; }
    .stanza { grid-template-columns: 40px 1fr; gap: 12px; }
    .stanza-mark { font-size: 22px; }
    .root-mandala { width: 240px; height: 240px; }
    .chamber-rail { right: 12px; gap: 10px; }
    .rail-dot { width: 28px; height: 28px; }
    .rail-dot span { font-size: 9px; }
    .pillar-meta { left: 16px; bottom: 16px; font-size: 9px; }
    .sigil-1, .sigil-2, .sigil-3, .sigil-4, .sigil-5 {
        width: 140px; height: 140px;
    }
}

@media (max-width: 480px) {
    .threshold-title { font-size: 38px; }
    .chamber-title { font-size: 32px; }
    .observatory-title { font-size: 26px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .bg-radial-pulse,
    .threshold-rune,
    .scroll-indicator,
    .ring,
    .m-core {
        animation: none !important;
    }
    .chamber {
        opacity: 1;
        transform: none;
        transition: none;
    }
}
