:root {
    --deep-bg: #0E0E10;
    --surface: #1B1B1E;
    --bone-white: #E8E0D4;
    --stone-gray: #A09B93;
    --meridian-gold: #C9A84C;
    --season-warm: #8B4513;
    --season-cool: #2E4057;
    --muted-taupe: #6B6560;
    --dark-umber: #3A3632;

    --font-display: 'Bebas Neue', sans-serif;
    --font-body: 'Libre Baskerville', serif;
    --font-mono: 'Space Mono', monospace;

    --ease-enter: cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
    background: var(--deep-bg);
    color: var(--stone-gray);
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(1rem, 1.8vw, 1.25rem);
    line-height: 1.72;
    overflow: hidden;
    height: 100vh;
}

/* Grain */
.grain-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    pointer-events: none;
    opacity: 0.03;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Meridian Line */
.meridian {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 1px;
    background: var(--meridian-gold);
    z-index: 40;
    transform: translateX(-50%);
    animation: meridianPulse 4s ease-in-out infinite;
}

@keyframes meridianPulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.7; }
}

/* Progress Bar */
.progress-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--surface);
    z-index: 60;
    transition: height 200ms ease;
}

.progress-bar:hover {
    height: 24px;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: var(--meridian-gold);
    transition: width 100ms linear;
}

.progress-labels {
    position: absolute;
    inset: 0;
    display: flex;
    opacity: 0;
    transition: opacity 200ms ease;
}

.progress-bar:hover .progress-labels {
    opacity: 1;
}

.progress-labels span {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--muted-taupe);
    border-right: 1px solid var(--deep-bg);
}

/* Scroll Wrapper */
.scroll-wrapper {
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

.timeline {
    display: flex;
    height: 100vh;
    transition: transform 50ms linear;
}

/* Month Chapters */
.month-chapter {
    min-width: 100vw;
    height: 100vh;
    position: relative;
    display: flex;
    align-items: center;
    padding: 0 8vw;
    background: var(--deep-bg);
}

.inverted {
    background: var(--bone-white);
    color: var(--dark-umber);
}

.inverted .month-title { color: var(--surface); }
.inverted .chapter-body p { color: var(--dark-umber); }

.ch-oct { background: color-mix(in srgb, var(--season-warm) 8%, var(--deep-bg)); }
.ch-nov { background: color-mix(in srgb, var(--deep-bg) 95%, var(--surface)); }

/* Ghost Numerals */
.ghost-numeral {
    position: absolute;
    font-family: var(--font-display);
    font-size: clamp(40rem, 80vw, 100rem);
    color: var(--bone-white);
    opacity: 0.03;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    line-height: 1;
}

.ghost-dark {
    color: var(--surface);
}

/* Chapter Content */
.chapter-content {
    display: flex;
    align-items: center;
    gap: 5vw;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

.month-title {
    font-family: var(--font-display);
    font-size: clamp(5rem, 15vw, 18rem);
    letter-spacing: -0.02em;
    color: var(--bone-white);
    line-height: 0.85;
    flex: 0 0 40%;
    opacity: 0;
    transition: opacity 600ms var(--ease-enter), transform 600ms var(--ease-enter), filter 600ms var(--ease-enter);
}

.month-title[data-animate="slide"] { transform: translateY(60px); }
.month-title[data-animate="scale"] { transform: scale(2); }
.month-title[data-animate="blur"] { filter: blur(12px); }

.month-title.visible {
    opacity: 1;
    transform: none;
    filter: none;
}

.chapter-body {
    flex: 1;
    max-width: 38ch;
}

.chapter-body p {
    margin-bottom: 1rem;
    color: var(--stone-gray);
}

.closing-mark {
    font-family: var(--font-display);
    font-size: 2rem;
    color: var(--meridian-gold);
    margin-top: 2rem;
}

/* Numeral Gates */
.numeral-gate {
    min-width: 50vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--deep-bg);
}

.gate-num {
    font-family: var(--font-display);
    font-size: clamp(10rem, 30vw, 30rem);
    color: var(--bone-white);
    opacity: 0.08;
    display: block;
    transition: transform 100ms linear;
}

/* Responsive */
@media (max-width: 768px) {
    body { overflow-y: auto; overflow-x: hidden; height: auto; }
    .scroll-wrapper { height: auto; overflow: visible; }
    .timeline { flex-direction: column; }
    .month-chapter { min-width: 100vw; min-height: 100vh; }
    .numeral-gate { min-width: 100vw; min-height: 30vh; }
    .chapter-content { flex-direction: column; gap: 2rem; }
    .month-title { flex: none; font-size: clamp(3rem, 10vw, 8rem); }
    .meridian { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .month-title { opacity: 1; transform: none; filter: none; }
}
