/* ============================================
   lune.dev — Nocturnal Anti-Design
   Palette: burgundy-cream
   Fonts: Cormorant Garamond, Libre Franklin, Caveat
   ============================================ */

:root {
    --deep-bg: #1A0A0F;
    --primary-burgundy: #6B1D34;
    --accent-rose: #8A2A3F;
    --warm-cream: #F2E6D9;
    --muted-tan: #C9B8A8;
    --shadow-purple: #2D0A1F;
    --interference-cream: #E8D5C4;
    --leaf-silhouette: #4A1528;
    --darkest: #150810;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background: var(--deep-bg);
    color: var(--muted-tan);
    font-family: 'Libre Franklin', sans-serif;
    font-weight: 300;
    font-size: clamp(0.95rem, 1.8vw, 1.15rem);
    line-height: 1.85;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ============================================
   Plane 0: Deep Background (fixed)
   ============================================ */
#plane0 {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--deep-bg);
    z-index: 0;
    will-change: background-color;
}

/* ============================================
   Grain Overlay (fixed, covers viewport)
   ============================================ */
#grain-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 900;
    pointer-events: none;
    opacity: 0;
    mix-blend-mode: overlay;
    transition: opacity 1.5s ease;
}

#grain-overlay.visible {
    opacity: 0.1;
}

#grain-overlay.intensified {
    opacity: 0.2;
}

#grain-svg {
    width: 100%;
    height: 100%;
}

/* ============================================
   Scan Lines (fixed)
   ============================================ */
#scan-lines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 850;
    pointer-events: none;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 3px,
        rgba(138, 42, 63, 0.06) 3px,
        rgba(138, 42, 63, 0.06) 4px
    );
}

/* ============================================
   Vignette Overlay (Plane 4: Foreground)
   ============================================ */
#vignette {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 800;
    pointer-events: none;
    background: radial-gradient(
        ellipse 70% 70% at 35% 50%,
        transparent 30%,
        rgba(26, 10, 15, 0.6) 100%
    );
}

/* ============================================
   Glitch Container (Plane 3: Interference)
   ============================================ */
#glitch-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 750;
    pointer-events: none;
    overflow: hidden;
}

.glitch-band {
    position: absolute;
    left: 0;
    width: 100vw;
    background: var(--interference-cream);
    opacity: 0;
    will-change: transform, opacity;
}

.glitch-band.active {
    opacity: 0.4;
    animation: glitchShift 150ms steps(3) forwards;
}

@keyframes glitchShift {
    0% { transform: translateX(0); }
    25% { transform: translateX(12px); }
    50% { transform: translateX(-8px); }
    75% { transform: translateX(5px); }
    100% { transform: translateX(0); opacity: 0; }
}

/* ============================================
   Navigation: Crescent Moon
   ============================================ */
#nav-crescent {
    position: fixed;
    top: 24px;
    left: 24px;
    z-index: 1000;
    cursor: pointer;
}

.crescent-icon {
    transition: transform 0.4s ease, opacity 0.3s ease;
    opacity: 0.7;
}

#nav-crescent:hover .crescent-icon {
    transform: scale(1.2);
    opacity: 1;
}

#radial-menu {
    position: absolute;
    top: -10px;
    left: -10px;
    width: 180px;
    height: 180px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

#nav-crescent:hover #radial-menu {
    opacity: 1;
    pointer-events: auto;
}

.radial-item {
    position: absolute;
    color: var(--warm-cream);
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-size: 0.85rem;
    letter-spacing: 0.12em;
    text-decoration: none;
    opacity: 0.6;
    transition: opacity 0.3s ease;
    text-transform: uppercase;
}

.radial-item:hover {
    opacity: 1;
}

.radial-item:nth-child(1) { top: 0; left: 50px; }
.radial-item:nth-child(2) { top: 30px; left: 100px; }
.radial-item:nth-child(3) { top: 75px; left: 120px; }
.radial-item:nth-child(4) { top: 120px; left: 100px; }
.radial-item:nth-child(5) { top: 150px; left: 50px; }

/* ============================================
   Plane 1: Leaf Silhouettes (parallax, slow)
   ============================================ */
#plane1 {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 100;
    pointer-events: none;
    will-change: transform;
}

.leaf {
    position: absolute;
    opacity: 0;
    transition: opacity 2s ease;
    will-change: transform;
}

.leaf.visible {
    opacity: 0.18;
}

.leaf-1 {
    width: 350px;
    top: -5%;
    left: -5%;
    transform: rotate(-15deg);
}

.leaf-2 {
    width: 400px;
    top: 10%;
    right: -8%;
    transform: rotate(25deg);
}

.leaf-3 {
    width: 320px;
    top: 35%;
    left: 5%;
    transform: rotate(-8deg);
}

.leaf-4 {
    width: 280px;
    top: 55%;
    right: 3%;
    transform: rotate(18deg);
}

.leaf-5 {
    width: 370px;
    top: 70%;
    left: -3%;
    transform: rotate(-22deg);
}

.leaf-6 {
    width: 310px;
    top: 85%;
    right: -4%;
    transform: rotate(12deg);
}

/* ============================================
   Plane 2: Content Layer
   ============================================ */
#plane2 {
    position: relative;
    z-index: 200;
    width: 100%;
}

/* ============================================
   Sections
   ============================================ */
.section {
    position: relative;
    width: 100%;
}

/* Opening: 0-100vh */
.section-opening {
    height: 100vh;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
}

.title-container {
    position: relative;
    margin-top: 40vh;
    margin-left: 15vw;
}

#lune-title {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-size: clamp(2.8rem, 12vw, 8rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--warm-cream);
    line-height: 0.92;
    text-shadow: 0 0 40px rgba(138, 42, 63, 0.3);
}

.letter {
    display: inline-block;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.letter.revealed {
    opacity: 1;
}

.tagline {
    margin-top: 8vh;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.tagline.revealed {
    opacity: 1;
}

/* Caveat Text (annotations / handwritten) */
.caveat-text {
    font-family: 'Caveat', cursive;
    font-weight: 400;
    font-size: clamp(0.8rem, 1.4vw, 1rem);
    color: var(--accent-rose);
    transform: rotate(-3deg);
}

.caveat-annotation {
    position: absolute;
    font-family: 'Caveat', cursive;
    font-weight: 400;
    font-size: clamp(0.8rem, 1.4vw, 1rem);
    color: var(--accent-rose);
    opacity: 0;
    transition: opacity 0.5s ease;
}

.caveat-annotation.visible {
    opacity: 0.6;
}

/* First Descent: 100-250vh */
.section-descent {
    min-height: 150vh;
    padding: 10vh 0;
    position: relative;
}

.text-block {
    max-width: 50ch;
    opacity: 0;
    transition: opacity 0.3s ease;
    margin-bottom: 12vh;
    color: var(--muted-tan);
}

.text-block.visible {
    opacity: 0.88;
}

.text-block p {
    font-family: 'Libre Franklin', sans-serif;
    font-weight: 300;
    line-height: 1.85;
}

.text-block-1 {
    margin-left: 10vw;
    transform: rotate(1deg);
}

.text-block-2 {
    margin-left: 22vw;
    transform: rotate(-1.5deg);
}

.text-block-3 {
    margin-left: 14vw;
    transform: rotate(2deg);
}

.text-block-4 {
    margin-left: 18vw;
    transform: rotate(-0.5deg);
}

.annotation-1 {
    right: 8vw;
    top: 40vh;
    transform: rotate(-4deg);
}

/* The Eclipse: 250-350vh */
.section-eclipse {
    height: 100vh;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.eclipse-crescent {
    position: absolute;
    width: 80vw;
    height: 80vw;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity 1s ease;
}

.eclipse-crescent.visible {
    opacity: 1;
}

.eclipse-svg {
    width: 100%;
    height: 100%;
}

.annotation-eclipse {
    position: absolute;
    right: 6vw;
    bottom: 20vh;
    transform: rotate(-2deg);
    font-size: clamp(0.8rem, 1.4vw, 1rem);
}

/* Deep Layer: 350-500vh */
.section-deep {
    min-height: 150vh;
    padding: 10vh 0;
    position: relative;
    background: linear-gradient(to bottom, var(--shadow-purple), var(--darkest), var(--shadow-purple));
}

.text-block-5 {
    margin-left: auto;
    margin-right: 10vw;
    transform: rotate(-1deg);
}

.text-block-6 {
    margin-left: auto;
    margin-right: 18vw;
    transform: rotate(1.5deg);
}

.text-block-7 {
    margin-left: auto;
    margin-right: 12vw;
    transform: rotate(-2deg);
}

.text-block-8 {
    margin-left: auto;
    margin-right: 15vw;
    transform: rotate(0.5deg);
}

.text-block-5 p,
.text-block-6 p,
.text-block-7 p,
.text-block-8 p {
    font-size: clamp(0.88rem, 1.6vw, 1.05rem);
}

.annotation-2 {
    left: 6vw;
    top: 30vh;
    transform: rotate(-5deg);
}

.annotation-3 {
    left: 10vw;
    bottom: 15vh;
    transform: rotate(2deg);
}

/* Emergence: 500-600vh */
.section-emergence {
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    background: linear-gradient(to bottom, var(--darkest), var(--shadow-purple));
}

.emergence-text {
    opacity: 0;
    transition: opacity 1s ease;
}

.emergence-text.visible {
    opacity: 1;
}

.emergence-word {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-size: clamp(2.8rem, 8vw, 6rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--warm-cream);
    line-height: 0.92;
    text-shadow: 0 0 40px rgba(138, 42, 63, 0.3);
}

.final-crescent {
    margin-top: 8vh;
    opacity: 0;
    transition: opacity 1s ease;
}

.final-crescent.visible {
    animation: crescentPulse 4s ease-in-out infinite;
}

@keyframes crescentPulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.6; }
}

/* ============================================
   Corrupted Leaves (Deep section)
   ============================================ */
.leaf-corrupted {
    opacity: 0.15;
}

.leaf-corrupted path:nth-child(odd) {
    stroke-dasharray: 8 12;
}

/* ============================================
   Background breathing animation
   ============================================ */
@keyframes breathe {
    0%, 100% {
        background-color: var(--deep-bg);
    }
    50% {
        background-color: #1C0C11;
    }
}

#plane0 {
    animation: breathe 8s ease-in-out infinite;
}

/* ============================================
   Responsive / Mobile
   ============================================ */
@media (max-width: 768px) {
    .text-block-1,
    .text-block-2,
    .text-block-3,
    .text-block-4 {
        margin-left: 6vw;
        max-width: 80vw;
    }

    .text-block-5,
    .text-block-6,
    .text-block-7,
    .text-block-8 {
        margin-right: 6vw;
        max-width: 80vw;
    }

    .title-container {
        margin-left: 8vw;
    }

    .leaf {
        width: 200px;
    }
}
