/* ═══════════════════════════════════════
   mysterious.day — Cinematic Split-Screen Sanctuary
   ═══════════════════════════════════════ */

/* ── Palette Reference ──
   Warm Dark:      #2A2018
   Warm Brown:     #4A3828
   Warm Grey:      #8A7860
   Star Gold:      #B0A080
   Marble Vein:    #D0C8B8
   Spotlight Warm:  #E0D0B0
   Panel Marble:   #F0ECE4
   Panel Warm:     #F4EEE4
── */

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

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

body {
    background: #F4EEE4;
    color: #4A3828;
    font-family: 'Lora', Georgia, serif;
    font-size: clamp(0.95rem, 1.2vw, 1.1rem);
    line-height: 1.9;
    overflow-x: hidden;
}

/* ── Cursor-Follow Spotlight ── */
#cursor-spotlight {
    position: fixed;
    width: 320px;
    height: 320px;
    border-radius: 50%;
    background: radial-gradient(circle, #E0D0B01F 0%, transparent 70%);
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
    transition: left 0.08s ease-out, top 0.08s ease-out;
    will-change: left, top;
    mix-blend-mode: screen;
}

/* ── Cinematic Stage ── */
#cinematic-stage {
    width: 100%;
}

/* ── Scene (each 100vh split-screen pair) ── */
.scene {
    display: flex;
    min-height: 100vh;
    width: 100%;
    position: relative;
}

/* ── Panels ── */
.panel {
    width: 50%;
    min-height: 100vh;
    position: relative;
    overflow: hidden;
}

.panel-left {
    background: #F4EEE4;
    display: flex;
    align-items: center;
    justify-content: center;
}

#opening-left {
    justify-content: flex-end;
    padding-right: 0.3em;
}

.panel-right {
    background: #F0ECE4;
    display: flex;
    align-items: center;
    justify-content: center;
}

#opening-right {
    justify-content: flex-start;
    padding-left: 0.3em;
    flex-direction: column;
}

/* ── Marble Texture (right panels) ── */
.panel-marble {
    position: relative;
}

.panel-marble::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(
            78deg,
            transparent,
            transparent 120px,
            #D0C8B80F 120px,
            #D0C8B80F 121px
        ),
        repeating-linear-gradient(
            156deg,
            transparent,
            transparent 200px,
            #D0C8B80D 200px,
            #D0C8B80D 201px
        ),
        repeating-linear-gradient(
            34deg,
            transparent,
            transparent 160px,
            #D0C8B80A 160px,
            #D0C8B80A 161px
        ),
        repeating-linear-gradient(
            112deg,
            transparent,
            transparent 90px,
            #D0C8B812 90px,
            #D0C8B812 91px
        );
    pointer-events: none;
    z-index: 1;
}

.panel-marble::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 600px 300px at 20% 30%, #D0C8B80F, transparent),
        radial-gradient(ellipse 400px 500px at 70% 60%, #D0C8B80D, transparent),
        radial-gradient(ellipse 300px 200px at 50% 80%, #D0C8B80A, transparent);
    pointer-events: none;
    z-index: 1;
}

/* ── Constellation Canvases ── */
.constellation-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 1.8s ease;
}

.constellation-canvas.visible {
    opacity: 1;
}

/* ── SCENE I: OPENING ── */

#opening {
    position: relative;
}

.opening-title-half {
    font-family: 'Cormorant Garamond', 'Cormorant', Georgia, serif;
    font-weight: 600;
    font-size: clamp(2.4rem, 5.5vw, 4.2rem);
    color: #2A2018;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    position: relative;
    z-index: 10;
    opacity: 0;
    transition: opacity 2s ease 0.6s;
}

.opening-title-half.revealed {
    opacity: 1;
}

.opening-title-left {
    text-align: right;
    padding-right: 0;
    margin-right: -1px;
}

.opening-title-right {
    text-align: left;
    padding-left: 0;
    margin-left: -1px;
}

.opening-whisper {
    position: absolute;
    bottom: 18%;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Josefin Sans', 'Inter', sans-serif;
    font-weight: 300;
    font-size: clamp(0.7rem, 0.9vw, 0.85rem);
    color: #8A7860;
    letter-spacing: 0.35em;
    text-transform: lowercase;
    z-index: 10;
    opacity: 0;
    transition: opacity 2.4s ease 1.6s;
}

.opening-whisper.revealed {
    opacity: 1;
}

/* Vertical divider between panels in opening */
#opening::after {
    content: '';
    position: absolute;
    top: 15%;
    bottom: 15%;
    left: 50%;
    width: 1px;
    background: linear-gradient(
        to bottom,
        transparent,
        rgba(176, 160, 128, 0.25) 20%,
        rgba(176, 160, 128, 0.35) 50%,
        rgba(176, 160, 128, 0.25) 80%,
        transparent
    );
    z-index: 5;
}

/* ── SCENE II: THRESHOLD ── */

.threshold-figure {
    position: relative;
    z-index: 10;
}

.threshold-numeral {
    font-family: 'Cormorant Garamond', 'Cormorant', Georgia, serif;
    font-weight: 400;
    font-size: clamp(6rem, 12vw, 10rem);
    color: #B0A080;
    opacity: 0.18;
    letter-spacing: 0.1em;
    user-select: none;
}

.threshold-text-block {
    position: relative;
    z-index: 10;
    max-width: 380px;
    padding: 3rem 2.5rem;
    margin-top: -8vh;
}

.section-heading {
    font-family: 'Cormorant Garamond', 'Cormorant', Georgia, serif;
    font-weight: 600;
    font-size: clamp(2rem, 4.5vw, 3.5rem);
    color: #2A2018;
    margin-bottom: 1.8rem;
    letter-spacing: 0.04em;
    line-height: 1.15;
}

.body-text {
    font-family: 'Lora', Georgia, serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.2vw, 1.1rem);
    color: #4A3828;
    line-height: 1.9;
    margin-bottom: 1.4rem;
}

.body-text:last-of-type {
    margin-bottom: 0;
}

.caption-label {
    display: block;
    font-family: 'Josefin Sans', 'Inter', sans-serif;
    font-weight: 300;
    font-size: clamp(0.7rem, 0.85vw, 0.8rem);
    color: #8A7860;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    margin-top: 2rem;
}

/* ── SCENE III: CHAMBER ── */

.chamber-ornament {
    position: relative;
    z-index: 10;
    width: 200px;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chamber-ring {
    position: absolute;
    width: 180px;
    height: 180px;
    border: 1px solid rgba(176, 160, 128, 0.2);
    border-radius: 50%;
    animation: chamber-breathe 8s ease-in-out infinite;
}

.chamber-ring-inner {
    width: 120px;
    height: 120px;
    animation-delay: -4s;
    border-color: rgba(176, 160, 128, 0.14);
}

@keyframes chamber-breathe {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.06); opacity: 0.7; }
}

.chamber-text-block {
    position: relative;
    z-index: 10;
    max-width: 380px;
    padding: 3rem 2.5rem;
    margin-top: 6vh;
}

/* ── SCENE IV: PASSAGE ── */

.passage-veil {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        transparent 0%,
        rgba(176, 160, 128, 0.05) 30%,
        rgba(176, 160, 128, 0.08) 50%,
        rgba(176, 160, 128, 0.05) 70%,
        transparent 100%
    );
    z-index: 5;
    pointer-events: none;
}

.passage-text-block {
    position: relative;
    z-index: 10;
    max-width: 380px;
    padding: 3rem 2.5rem;
    margin-top: -5vh;
    margin-left: 8%;
}

/* ── SCENE V: CLOSE ── */

.scene-close {
    min-height: 60vh;
}

#close-left {
    min-height: 60vh;
}

#close-right {
    min-height: 60vh;
}

.close-text-block {
    position: relative;
    z-index: 10;
    text-align: center;
}

.close-domain {
    display: block;
    font-family: 'Cormorant Garamond', 'Cormorant', Georgia, serif;
    font-weight: 600;
    font-size: clamp(1.6rem, 3vw, 2.4rem);
    color: #2A2018;
    letter-spacing: 0.15em;
    margin-bottom: 1.2rem;
}

.close-text-block .caption-label {
    margin-top: 0;
    text-transform: none;
    font-style: italic;
    letter-spacing: 0.12em;
}

/* ── Scene dividers ── */
.scene + .scene::before {
    content: '';
    position: absolute;
    top: 0;
    left: 10%;
    right: 10%;
    height: 1px;
    background: linear-gradient(
        to right,
        transparent,
        rgba(176, 160, 128, 0.2) 30%,
        rgba(176, 160, 128, 0.2) 70%,
        transparent
    );
    z-index: 20;
}

/* ── Vertical scene seam (center line through all scenes) ── */
#threshold::after,
#chamber::after,
#passage::after,
#close::after {
    content: '';
    position: absolute;
    top: 12%;
    bottom: 12%;
    left: 50%;
    width: 1px;
    background: linear-gradient(
        to bottom,
        transparent,
        rgba(176, 160, 128, 0.15) 25%,
        rgba(176, 160, 128, 0.2) 50%,
        rgba(176, 160, 128, 0.15) 75%,
        transparent
    );
    z-index: 5;
}

/* ── Scroll-reveal animation ── */
.scene-reveal {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1.2s ease, transform 1.2s ease;
}

.scene-reveal.in-view {
    opacity: 1;
    transform: translateY(0);
}

/* ── Star twinkle ── */
@keyframes star-twinkle {
    0%, 100% { opacity: var(--base-opacity, 0.4); }
    50% { opacity: calc(var(--base-opacity, 0.4) * 1.8); }
}

.star-twinkle {
    animation: star-twinkle var(--twinkle-duration, 4s) ease-in-out infinite;
    animation-delay: var(--twinkle-delay, 0s);
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .scene {
        flex-direction: column;
    }

    .panel {
        width: 100%;
        min-height: 50vh;
    }

    .scene-close {
        min-height: auto;
    }

    #close-left {
        min-height: 30vh;
    }

    #close-right {
        min-height: 30vh;
    }

    .opening-title-half {
        font-size: clamp(1.8rem, 8vw, 3rem);
    }

    .opening-title-left {
        text-align: center;
        padding-right: 0;
    }

    .opening-title-right {
        text-align: center;
        padding-left: 0;
    }

    #opening::after,
    #threshold::after,
    #chamber::after,
    #passage::after,
    #close::after {
        display: none;
    }

    .scene + .scene::before {
        left: 5%;
        right: 5%;
    }

    .threshold-text-block,
    .chamber-text-block,
    .passage-text-block {
        padding: 2rem 1.5rem;
        max-width: 100%;
    }

    .threshold-numeral {
        font-size: clamp(4rem, 16vw, 7rem);
    }

    #cursor-spotlight {
        display: none;
    }
}
