/* Core Variables: Limestone, Sand, Charcoal */
:root {
    --color-bg: #111111;
    --color-text: #F2EFE9;
    --color-accent: #C4B69E;
    --color-charcoal: #1A1A1A;

    --font-serif: 'Cormorant Garamond', serif;
    --font-sans: 'Montserrat', sans-serif;
}

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

body, html {
    width: 100%;
    background-color: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-serif);
    overscroll-behavior: none;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* 3D Canvas */
#webgl-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none; /* Let clicks pass through to content */
}

/* Cinematic Noise Overlay */
.noise-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 1;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    opacity: 0.04;
}

/* Content Layout */
main {
    position: relative;
    z-index: 2;
}

.section {
    min-height: 100vh;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 2rem;
    position: relative;
}

.content-block {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

/* Typography */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.align-left { align-items: flex-start; display: flex; flex-direction: column; }
.align-right { align-items: flex-end; display: flex; flex-direction: column; }

.title {
    font-family: var(--font-serif);
    font-size: clamp(3rem, 10vw, 7rem);
    font-weight: 300;
    line-height: 1.1;
    letter-spacing: -0.02em;
    margin-bottom: 1rem;
    text-transform: lowercase;
}

.title.italic {
    font-style: italic;
}

.subtitle {
    font-family: var(--font-sans);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.3em;
    margin-bottom: 2rem;
    color: var(--color-accent);
}

.chapter-marker {
    font-family: var(--font-sans);
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    margin-bottom: 1rem;
    color: var(--color-accent);
    border-bottom: 1px solid var(--color-accent);
    padding-bottom: 0.5rem;
}

.body-text {
    font-family: var(--font-serif);
    font-size: clamp(1.2rem, 3vw, 1.8rem);
    font-weight: 300;
    line-height: 1.5;
    color: rgba(242, 239, 233, 0.7);
}

.small-text {
    font-family: var(--font-sans);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(242, 239, 233, 0.4);
}

.mt-2 { margin-top: 2rem; }

/* Interactive Elements */
.minimal-btn {
    background: transparent;
    border: 1px solid var(--color-accent);
    color: var(--color-accent);
    padding: 1rem 3rem;
    font-family: var(--font-sans);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    cursor: pointer;
    transition: all 0.4s ease;
}

.minimal-btn:hover {
    background: var(--color-accent);
    color: var(--color-bg);
}

/* GSAP Initial States */
.fade-up {
    opacity: 0;
    transform: translateY(30px);
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    .section {
        padding: 1.5rem;
    }

    .align-left, .align-right {
        align-items: center;
        text-align: center;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .fade-up {
        opacity: 1;
        transform: none;
    }
    #webgl-canvas {
        display: none;
    }
}

/* =========================================
   CINEMATIC ENTRY OVERLAY
   ========================================= */
#entry-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #1a1816; /* Deep warm black to match your 3D fog */
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 1.5s cubic-bezier(0.4, 0, 0.2, 1);
}

#entry-overlay.fade-out {
    opacity: 0;
    pointer-events: none;
}

.minimal-enter-btn {
    background: transparent;
    border: 1px solid rgba(226, 203, 176, 0.4);
    color: #E2CBB0; /* Sun-bleached stone color */
    padding: 1rem 3rem;
    font-family: 'Montserrat', sans-serif; /* Or your existing sans-serif */
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.3em;
    cursor: pointer;
    transition: all 0.5s ease;
}

.minimal-enter-btn:hover {
    background: rgba(226, 203, 176, 0.1);
    border-color: #E2CBB0;
}

/* =========================================
   FLOATING MUSIC CONTROL
   ========================================= */
#music-toggle {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: transparent;
    border: 1px solid rgba(226, 203, 176, 0.3);
    cursor: pointer;
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.4s ease;
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
}

#music-toggle.visible {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0);
}

#music-toggle:hover {
    border-color: rgba(226, 203, 176, 0.8);
    background: rgba(226, 203, 176, 0.05);
}

/* Subtle Sound Wave Animation */
.sound-wave {
    display: flex;
    align-items: center;
    gap: 3px;
    height: 12px;
}

.sound-wave span {
    display: block;
    width: 2px;
    background-color: rgba(226, 203, 176, 0.8);
    border-radius: 2px;
    transition: height 0.3s ease;
    height: 2px; /* Paused state */
}

/* Playing State Animation */
#music-toggle.playing .sound-wave span {
    animation: soundPulse 1.2s infinite ease-in-out alternate;
}

#music-toggle.playing .sound-wave span:nth-child(1) { animation-delay: 0.0s; }
#music-toggle.playing .sound-wave span:nth-child(2) { animation-delay: 0.3s; }
#music-toggle.playing .sound-wave span:nth-child(3) { animation-delay: 0.6s; }
#music-toggle.playing .sound-wave span:nth-child(4) { animation-delay: 0.9s; }

@keyframes soundPulse {
    0% { height: 3px; }
    100% { height: 12px; }
}

@media (max-width: 768px) {
    #music-toggle {
        bottom: 1.5rem;
        right: 1.5rem;
        width: 38px;
        height: 38px;
    }
}