/* ============================================
   mystical.boo - Occult Grimoire Tapestry
   ============================================ */
:root {
    --obsidian-violet: #2D1B4E;
    --astral-purple: #5B2D8E;
    --ritual-magenta: #A83279;
    --blood-amber: #C94432;
    --candle-gold: #D4A843;
    --parchment-bone: #F0E6D2;
    --ink-black: #110B1A;
    --smoke-lilac: #8E7BA8;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
    background: var(--ink-black);
    color: var(--parchment-bone);
    font-family: 'Crimson Pro', serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.1vw, 1.2rem);
    line-height: 1.72;
    overflow-x: hidden;
    /* Parchment grain texture */
    background-image:
        radial-gradient(circle at 20% 50%, rgba(45, 27, 78, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(91, 45, 142, 0.15) 0%, transparent 40%);
}

/* --- Vignette --- */
.vignette {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(ellipse at center, transparent 40%, var(--ink-black) 100%);
    opacity: 0.4;
    z-index: 0;
}

/* --- Eye Navigation --- */
.eye-nav {
    position: fixed;
    top: 24px;
    left: 24px;
    z-index: 100;
}
.eye-glyph {
    width: 40px;
    height: 40px;
    border: none;
    background: none;
    cursor: pointer;
    padding: 4px;
    animation: eyePulse 4s ease-in-out infinite;
}
@keyframes eyePulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}
.radial-menu {
    position: absolute;
    top: 0;
    left: 0;
    width: 120px;
    height: 120px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 300ms ease;
}
.eye-nav:hover .radial-menu {
    opacity: 1;
    pointer-events: auto;
}
.radial-link {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 28px;
    height: 28px;
    margin: -14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Mystery Quest', cursive;
    font-size: 0.8rem;
    color: var(--candle-gold);
    text-decoration: none;
    border: 1px solid var(--candle-gold);
    border-radius: 50%;
    transform: translate(
        calc(cos(var(--angle)) * 50px),
        calc(sin(var(--angle)) * 50px)
    );
    transition: background 200ms ease, transform 400ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
.radial-link:hover {
    background: var(--ritual-magenta);
    color: var(--parchment-bone);
}

/* --- Moon Phase Indicators --- */
.moon-phases {
    position: fixed;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 99;
    display: flex;
    flex-direction: column;
    gap: 24px;
}
.moon-phase {
    opacity: 0.3;
    transition: opacity 600ms ease;
}
.moon-phase.active {
    opacity: 1;
}

/* --- Scenes --- */
.scene {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: clamp(4rem, 8vw, 8rem) clamp(1rem, 3vw, 3rem);
}
.scene--invocation { min-height: 100vh; background: var(--ink-black); }
.scene--revelation { min-height: 120vh; background: var(--obsidian-violet); }
.scene--immersion { min-height: 150vh; background: var(--ink-black); position: relative; }
.scene--transformation { min-height: 100vh; background: var(--ink-black); position: relative; }
.scene--departure { min-height: 60vh; background: var(--ink-black); }

/* --- Invocation --- */
.eye-watermark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 0;
}
.sigil-rings {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 1;
    max-width: 90vw;
}
.ring--outer {
    animation: rotateClockwise 120s linear infinite;
    transform-origin: 300px 300px;
}
.ring--middle {
    animation: rotateCounter 80s linear infinite;
    transform-origin: 300px 300px;
}
.ring--inner {
    animation: rotateClockwise 200s linear infinite;
    transform-origin: 300px 300px;
}
.ring-text {
    font-family: 'Mystery Quest', cursive;
    font-size: 14px;
    fill: var(--candle-gold);
    opacity: 0.4;
}
/* Sigil ring draw-in */
.sigil-rings circle {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    animation: drawSigil 3s ease-out forwards;
}
@keyframes drawSigil {
    to { stroke-dashoffset: 0; }
}
@keyframes rotateClockwise {
    to { transform: rotate(360deg); }
}
@keyframes rotateCounter {
    to { transform: rotate(-360deg); }
}

.invocation-content {
    position: relative;
    z-index: 2;
    text-align: center;
}
.hero-title {
    font-family: 'Cinzel Decorative', cursive;
    font-weight: 900;
    font-size: clamp(2.4rem, 7vw, 6.5rem);
    letter-spacing: 0.18em;
    color: var(--parchment-bone);
    opacity: 0;
    transform: scale(0.9);
    animation: titleReveal 1.2s ease-out 1s forwards;
}
@keyframes titleReveal {
    to { opacity: 1; transform: scale(1); }
}

/* Candle flame */
.candle-flame {
    position: relative;
    width: 20px;
    height: 40px;
    margin: 2rem auto;
}
.flame-inner {
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 10px;
    height: 20px;
    margin-left: -5px;
    background: var(--candle-gold);
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    animation: flicker 0.8s ease-in-out infinite alternate;
}
.flame-outer {
    position: absolute;
    bottom: -2px;
    left: 50%;
    width: 16px;
    height: 30px;
    margin-left: -8px;
    background: rgba(201, 68, 50, 0.4);
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    filter: blur(4px);
    animation: flicker 1.2s ease-in-out infinite alternate-reverse;
}
@keyframes flicker {
    0% { transform: scaleX(1) scaleY(1); opacity: 0.8; }
    50% { transform: scaleX(0.85) scaleY(1.1); opacity: 1; }
    100% { transform: scaleX(1.1) scaleY(0.9); opacity: 0.7; }
}
.scroll-chevron {
    animation: chevronPulse 2s ease-in-out infinite;
}
@keyframes chevronPulse {
    0%, 100% { opacity: 0.4; transform: translateY(0); }
    50% { opacity: 0.8; transform: translateY(6px); }
}

/* --- Section Headings --- */
.section-heading {
    font-family: 'Cinzel Decorative', cursive;
    font-weight: 700;
    font-size: clamp(1.6rem, 4vw, 3.2rem);
    letter-spacing: 0.18em;
    color: var(--parchment-bone);
    text-align: center;
    margin-bottom: 4rem;
    position: relative;
    z-index: 2;
}
.anybody-heading {
    font-family: 'Anybody', sans-serif;
    font-weight: 500;
    letter-spacing: 0.08em;
    font-stretch: 50%;
    transition: font-stretch 600ms ease-out;
}
.anybody-heading.visible {
    font-stretch: 100%;
}

/* --- Mandala Layout --- */
.mandala {
    position: relative;
    width: 500px;
    height: 500px;
    max-width: 90vw;
    max-height: 90vw;
    z-index: 2;
}
.astrolabe {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: rotateClockwise 60s linear infinite;
}
.satellite {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 180px;
    margin-left: -90px;
    margin-top: -50px;
    transform: translate(
        calc(cos(var(--angle)) * 210px),
        calc(sin(var(--angle)) * 210px)
    );
    background: rgba(45, 27, 78, 0.7);
    border: 1px solid var(--candle-gold);
    padding: 1rem;
    opacity: 0;
    transition: opacity 600ms cubic-bezier(0.34, 1.56, 0.64, 1), transform 600ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
.satellite.visible {
    opacity: 1;
}
.satellite-text {
    font-family: 'Crimson Pro', serif;
    font-weight: 400;
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--parchment-bone);
}

/* --- Veil Divider --- */
.veil {
    position: relative;
    height: 30vh;
    background: linear-gradient(180deg, var(--obsidian-violet), var(--astral-purple), var(--ink-black));
    overflow: hidden;
}
.smoke-wisp {
    position: absolute;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    filter: blur(60px);
    animation: smokeDrift 15s ease-in-out infinite;
}
.smoke-wisp--1 {
    background: rgba(142, 123, 168, 0.2);
    top: 20%;
    left: 10%;
}
.smoke-wisp--2 {
    background: rgba(142, 123, 168, 0.15);
    top: 40%;
    right: 15%;
    animation-delay: -5s;
    animation-duration: 20s;
}
.smoke-wisp--3 {
    background: rgba(168, 50, 121, 0.1);
    bottom: 10%;
    left: 40%;
    animation-delay: -10s;
    animation-duration: 25s;
}
@keyframes smokeDrift {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -20px) scale(1.2); }
    66% { transform: translate(-20px, 15px) scale(0.9); }
}

/* --- Immersion --- */
.scroll-column {
    position: relative;
    z-index: 2;
    max-width: 38rem;
    padding: 0 2rem;
}
.flowing-border {
    position: absolute;
    top: 10%;
    height: 80%;
    width: 40px;
    z-index: 1;
    pointer-events: none;
}
.flowing-border--left { left: calc(50% - 22rem); }
.flowing-border--right { right: calc(50% - 22rem); }
.vine-path {
    stroke-dasharray: 12 8;
    animation: crawl 60s linear infinite;
}
@keyframes crawl {
    to { stroke-dashoffset: -2000; }
}
.body-paragraph {
    font-family: 'Crimson Pro', serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.1vw, 1.2rem);
    line-height: 1.72;
    color: var(--parchment-bone);
    margin-bottom: 2rem;
}
.drop-cap {
    font-family: 'Mystery Quest', cursive;
    font-size: 3.5rem;
    float: left;
    line-height: 0.8;
    margin-right: 0.5rem;
    margin-top: 0.15rem;
    color: var(--candle-gold);
}
.inline-sigil {
    text-align: center;
    margin: 2rem 0;
    opacity: 0.5;
}

/* --- Transformation --- */
.star-field {
    position: absolute;
    inset: 0;
    z-index: 0;
}
.star-point {
    position: absolute;
    width: 2px;
    height: 2px;
    border-radius: 50%;
    background: var(--parchment-bone);
}
.ouroboros-svg {
    position: relative;
    z-index: 1;
    margin-bottom: 3rem;
}
.ouroboros-path {
    stroke-dasharray: 820;
    stroke-dashoffset: 820;
    transition: stroke-dashoffset 3s ease-out;
}
.ouroboros-svg.drawn .ouroboros-path {
    stroke-dashoffset: 0;
}
.transformation-text {
    font-family: 'Cinzel Decorative', cursive;
    font-weight: 700;
    font-size: clamp(1.4rem, 3vw, 2.8rem);
    letter-spacing: 0.18em;
    color: var(--parchment-bone);
    text-align: center;
    position: relative;
    z-index: 2;
}

/* --- Departure --- */
.constellation {
    margin-bottom: 3rem;
    opacity: 0;
    transition: opacity 1.5s ease;
}
.constellation.visible {
    opacity: 1;
}
.constellation-line {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    transition: stroke-dashoffset 2s ease-out;
}
.constellation.visible .constellation-line {
    stroke-dashoffset: 0;
}
.departure-title {
    font-family: 'Cinzel Decorative', cursive;
    font-weight: 700;
    font-size: clamp(1.6rem, 4vw, 3rem);
    letter-spacing: 0.18em;
    color: var(--parchment-bone);
    text-align: center;
    opacity: 0.6;
}

/* --- Reveal Animation --- */
[data-reveal] {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 600ms ease-out, transform 600ms ease-out;
}
[data-reveal].visible {
    opacity: 1;
    transform: translateY(0);
}

/* ============================
   RESPONSIVE
   ============================ */
@media (max-width: 768px) {
    .eye-nav { top: 12px; left: 12px; }
    .moon-phases { display: none; }
    .mandala { width: 300px; height: 300px; }
    .satellite {
        width: 140px;
        margin-left: -70px;
        margin-top: -40px;
        transform: translate(
            calc(cos(var(--angle)) * 120px),
            calc(sin(var(--angle)) * 120px)
        );
        font-size: 0.75rem;
        padding: 0.6rem;
    }
    .flowing-border { display: none; }
    .sigil-rings { width: 300px; height: 300px; }
}
