/* ============================================
   mystical.boo — Glitch-Enchanted Parallax Shrine
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@400&family=Lora:wght@400;500&family=Playfair+Display:wght@400;700&display=swap');

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

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

body {
    background: #1A0C10;
    color: #C0A898;
    font-family: 'Lora', serif;
    font-size: clamp(0.95rem, 1.2vw, 1.1rem);
    line-height: 1.9;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* --- Parallax Background Layer (50% speed) --- */
.parallax-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    will-change: transform;
}

.burgundy-wash {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 60% at 20% 30%, rgba(42, 24, 32, 0.9), transparent),
        radial-gradient(ellipse 60% 80% at 80% 70%, rgba(42, 24, 32, 0.7), transparent),
        linear-gradient(180deg, #1A0C10 0%, #2A1820 40%, #1A0C10 100%);
}

/* --- Parallax Foreground Layer (130% speed) --- */
.parallax-fg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 300vh;
    z-index: 10;
    pointer-events: none;
    will-change: transform;
}

/* --- Candle-Atmospheric Glow --- */
.candle-glow {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(208, 160, 80, 0.12), transparent);
    pointer-events: none;
    animation: candleFlicker 4s ease-in-out infinite;
}

.candle-glow-1 {
    width: 400px;
    height: 400px;
    top: 10vh;
    left: 15%;
    animation-delay: 0s;
}

.candle-glow-2 {
    width: 300px;
    height: 300px;
    top: 60vh;
    right: 10%;
    animation-delay: 1.2s;
}

.candle-glow-3 {
    width: 500px;
    height: 500px;
    top: 130vh;
    left: 5%;
    animation-delay: 2.5s;
}

.candle-glow-4 {
    width: 350px;
    height: 350px;
    top: 200vh;
    right: 20%;
    animation-delay: 0.8s;
}

.candle-glow-5 {
    width: 250px;
    height: 250px;
    top: 270vh;
    left: 40%;
    animation-delay: 3s;
}

@keyframes candleFlicker {
    0%, 100% { opacity: 0.6; transform: scale(1); }
    25% { opacity: 0.8; transform: scale(1.03); }
    50% { opacity: 0.5; transform: scale(0.97); }
    75% { opacity: 0.9; transform: scale(1.02); }
}

/* --- Chamber-local candle glows --- */
.candle-threshold {
    width: 600px;
    height: 600px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: 0.5s;
    z-index: 0;
}

.candle-offering {
    width: 400px;
    height: 400px;
    bottom: -10%;
    left: -5%;
    animation-delay: 1.8s;
}

.candle-oracle {
    width: 350px;
    height: 350px;
    top: 20%;
    right: -8%;
    animation-delay: 0.3s;
}

.candle-sanctum {
    width: 500px;
    height: 500px;
    top: 40%;
    left: -10%;
    animation-delay: 2.2s;
}

.candle-veil {
    width: 450px;
    height: 450px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: 1.5s;
}

/* --- Spirit Orbs Container --- */
#spirit-orbs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    pointer-events: none;
    overflow: hidden;
}

.spirit-orb {
    position: absolute;
    border-radius: 50%;
    border: 1px solid #C0A080;
    background: radial-gradient(circle at 40% 40%,
        rgba(192, 160, 128, 0.08),
        rgba(192, 160, 128, 0.02),
        transparent);
    pointer-events: none;
    --drift: 0px;
    animation: orbFloat linear infinite;
    will-change: transform, opacity;
}

@keyframes orbFloat {
    0% {
        transform: translateY(0) translateX(0);
        opacity: 0;
    }
    10% {
        opacity: 0.6;
    }
    50% {
        transform: translateY(-40vh) translateX(var(--drift));
        opacity: 0.4;
    }
    90% {
        opacity: 0.1;
    }
    100% {
        transform: translateY(-100vh) translateX(calc(var(--drift) * -0.5));
        opacity: 0;
    }
}

/* --- Shrine Chambers --- */
.shrine-chamber {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    overflow: hidden;
}

.chamber-content {
    position: relative;
    width: 100%;
    max-width: 1200px;
    padding: 6vh 5vw;
    z-index: 2;
}

/* --- Fade-Reveal --- */
.fade-reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 500ms ease, transform 500ms ease;
}

.fade-reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* --- Chamber I: The Threshold --- */
.chamber-threshold {
    min-height: 100vh;
    background: transparent;
}

.chamber-threshold .chamber-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    text-align: center;
}

.glitch-frame {
    position: relative;
    margin-bottom: 3rem;
}

.shrine-title {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(2.8rem, 7vw, 5.5rem);
    color: #E8D8C8;
    letter-spacing: 0.15em;
    position: relative;
    text-transform: uppercase;
}

.glitch-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
    opacity: 0;
    pointer-events: none;
}

.glitch-r {
    color: rgba(192, 40, 40, 0.6);
    animation: glitchR 8s ease-in-out infinite;
}

.glitch-g {
    color: rgba(40, 192, 80, 0.4);
    animation: glitchG 8s ease-in-out infinite;
}

.glitch-b {
    color: #40C0C0;
    animation: glitchB 8s ease-in-out infinite;
}

@keyframes glitchR {
    0%, 89%, 100% { opacity: 0; transform: translate(0, 0); }
    90% { opacity: 0.7; transform: translate(-3px, 1px); }
    92% { opacity: 0; transform: translate(2px, -1px); }
    93% { opacity: 0.5; transform: translate(-1px, 2px); }
    95% { opacity: 0; }
}

@keyframes glitchG {
    0%, 88%, 100% { opacity: 0; transform: translate(0, 0); }
    89% { opacity: 0.4; transform: translate(2px, -2px); }
    91% { opacity: 0; transform: translate(-2px, 1px); }
    92.5% { opacity: 0.3; transform: translate(1px, -1px); }
    94% { opacity: 0; }
}

@keyframes glitchB {
    0%, 87%, 100% { opacity: 0; transform: translate(0, 0); }
    88% { opacity: 0.5; transform: translate(3px, 1px); }
    90% { opacity: 0; transform: translate(-1px, -2px); }
    91.5% { opacity: 0.4; transform: translate(2px, 2px); }
    93% { opacity: 0; }
}

/* --- Title Glitch on Entry --- */
.shrine-title.glitch-active .glitch-r {
    animation: glitchEntryR 0.8s steps(3) forwards;
}

.shrine-title.glitch-active .glitch-g {
    animation: glitchEntryG 0.8s steps(3) forwards;
}

.shrine-title.glitch-active .glitch-b {
    animation: glitchEntryB 0.8s steps(3) forwards;
}

@keyframes glitchEntryR {
    0% { opacity: 0.8; transform: translate(-4px, 2px); }
    33% { opacity: 0.5; transform: translate(3px, -1px); }
    66% { opacity: 0.7; transform: translate(-2px, 1px); }
    100% { opacity: 0; transform: translate(0, 0); }
}

@keyframes glitchEntryG {
    0% { opacity: 0.5; transform: translate(3px, -2px); }
    33% { opacity: 0.3; transform: translate(-2px, 2px); }
    66% { opacity: 0.4; transform: translate(1px, -1px); }
    100% { opacity: 0; transform: translate(0, 0); }
}

@keyframes glitchEntryB {
    0% { opacity: 0.6; transform: translate(4px, 1px); }
    33% { opacity: 0.4; transform: translate(-3px, -1px); }
    66% { opacity: 0.5; transform: translate(2px, 2px); }
    100% { opacity: 0; transform: translate(0, 0); }
}

.threshold-inscription {
    margin-top: 1rem;
}

/* --- Glitch Labels --- */
.glitch-label {
    font-family: 'Fira Code', monospace;
    font-weight: 400;
    font-size: 0.75rem;
    color: #80A090;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    display: inline-block;
    position: relative;
}

.glitch-label::before {
    content: '';
    position: absolute;
    top: 50%;
    left: -20px;
    width: 12px;
    height: 1px;
    background: #80A090;
    opacity: 0.4;
}

/* --- Chamber Headings --- */
.chamber-heading {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(2rem, 4.5vw, 3.5rem);
    color: #E8D8C8;
    line-height: 1.15;
    margin: 1.5rem 0 1.8rem;
}

/* --- Devotional Text --- */
.devotional-text {
    font-family: 'Lora', serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.2vw, 1.1rem);
    color: #C0A898;
    line-height: 1.9;
    max-width: 520px;
}

/* --- Chamber II: The Offering Hall --- */
.chamber-offering {
    background: linear-gradient(180deg, transparent 0%, rgba(42, 24, 32, 0.4) 30%, rgba(42, 24, 32, 0.4) 70%, transparent 100%);
}

.offering-layout {
    display: grid;
    grid-template-columns: 1fr 0.6fr;
    gap: 4vw;
    align-items: center;
    padding-left: 8vw;
}

.offering-text {
    position: relative;
}

.offering-glyph {
    display: flex;
    align-items: center;
    justify-content: center;
}

.sacred-glyph {
    width: clamp(140px, 18vw, 220px);
    height: auto;
    animation: glyphPulse 6s ease-in-out infinite;
}

@keyframes glyphPulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 0.8; }
}

/* --- Chamber III: The Oracle Passage --- */
.chamber-oracle {
    background: linear-gradient(180deg, transparent 0%, rgba(26, 12, 16, 0.6) 20%, rgba(26, 12, 16, 0.6) 80%, transparent 100%);
}

.oracle-layout {
    padding-left: 6vw;
    padding-right: 6vw;
}

.oracle-columns {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 3vw;
    margin-top: 2rem;
    align-items: start;
}

.oracle-left {
    padding-top: 2rem;
}

.oracle-right {
    padding-top: 6rem;
}

.oracle-divider {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    padding-top: 1rem;
    height: 100%;
}

.divider-line {
    width: 1px;
    flex: 1;
    background: linear-gradient(180deg, transparent, #C0A080, transparent);
    opacity: 0.3;
}

.divider-orb {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1px solid #C0A080;
    margin: 12px 0;
    animation: candleFlicker 3s ease-in-out infinite;
}

.oracle-timestamp {
    display: block;
    margin-top: 2rem;
    opacity: 0.6;
}

/* --- Chamber IV: The Deep Sanctum --- */
.chamber-sanctum {
    background: linear-gradient(180deg, transparent 0%, rgba(42, 24, 32, 0.5) 25%, rgba(42, 24, 32, 0.5) 75%, transparent 100%);
    min-height: 110vh;
}

.sanctum-layout {
    display: grid;
    grid-template-columns: 0.45fr 1fr;
    gap: 5vw;
    align-items: start;
    padding-top: 12vh;
}

.sanctum-inscription {
    position: sticky;
    top: 30vh;
}

.sanctum-heading {
    font-size: clamp(2.2rem, 5vw, 4rem);
    line-height: 1.1;
}

.sanctum-verses {
    display: flex;
    flex-direction: column;
    gap: 6vh;
    padding-top: 4vh;
}

.verse-block {
    position: relative;
    padding-left: 3rem;
    border-left: 1px solid rgba(192, 160, 128, 0.15);
}

.verse-number {
    position: absolute;
    left: -0.5rem;
    top: -0.2rem;
    transform: translateX(-100%);
    opacity: 0.5;
    font-size: 0.65rem;
}

.verse-block .devotional-text {
    max-width: 480px;
}

/* --- Chamber V: The Closing Veil --- */
.chamber-veil {
    background: linear-gradient(180deg, transparent 0%, rgba(26, 12, 16, 0.8) 30%, #1A0C10 100%);
    min-height: 90vh;
}

.veil-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 80vh;
}

.veil-glyph-ring {
    margin-bottom: 3rem;
}

.veil-mandala {
    width: clamp(120px, 15vw, 200px);
    height: auto;
    animation: mandalaRotate 60s linear infinite;
}

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

.veil-heading {
    margin-bottom: 2rem;
}

.veil-text {
    max-width: 440px;
    text-align: center;
    margin-bottom: 3rem;
}

.veil-label {
    opacity: 0.5;
}

/* --- Glitch Scanline Overlay --- */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(26, 12, 16, 0.03) 2px,
        rgba(26, 12, 16, 0.03) 4px
    );
    pointer-events: none;
    z-index: 100;
}

/* --- Glitch Artifact Decorations --- */
.glitch-artifact {
    position: absolute;
    height: 2px;
    background: #40C0C0;
    opacity: 0;
    pointer-events: none;
    z-index: 6;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .offering-layout {
        grid-template-columns: 1fr;
        padding-left: 5vw;
    }

    .offering-glyph {
        display: none;
    }

    .oracle-columns {
        grid-template-columns: 1fr;
        gap: 3rem;
    }

    .oracle-divider {
        flex-direction: row;
        height: auto;
        width: 100%;
    }

    .divider-line {
        height: 1px;
        width: auto;
        flex: 1;
        background: linear-gradient(90deg, transparent, #C0A080, transparent);
    }

    .divider-orb {
        margin: 0 12px;
    }

    .oracle-right {
        padding-top: 0;
    }

    .sanctum-layout {
        grid-template-columns: 1fr;
        padding-top: 6vh;
    }

    .sanctum-inscription {
        position: relative;
        top: 0;
    }

    .verse-block {
        padding-left: 2rem;
    }
}

@media (max-width: 480px) {
    .shrine-title {
        letter-spacing: 0.08em;
    }

    .chamber-content {
        padding: 4vh 6vw;
    }
}
