/* mystery.boo - Dark Academia Occult Scholarly */
/* Colors: #F0E4CC, #C4A265, #8B2500, #D4C8B0, #1A1410, #8B7D6B, #231E18 */
/* Fonts: Playfair Display, Cormorant Garamond, Libre Baskerville */

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

body {
    background-color: #1A1410;
    color: #D4C8B0;
    font-family: 'Libre Baskerville', serif;
    font-weight: 400;
    font-size: 17px;
    line-height: 1.85;
    overflow-x: hidden;
    min-height: 100vh;
}

/* Candle glow overlay */
.candle-glow {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    background: radial-gradient(
        ellipse 60% 40% at 50% 10%,
        rgba(196, 162, 101, 0.05) 0%,
        transparent 70%
    );
    opacity: 0;
    transition: opacity 1.5s ease;
}

.candle-glow.visible {
    opacity: 1;
}

/* Dust particles */
.dust-particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.dust {
    position: absolute;
    width: 2px;
    height: 2px;
    background: #C4A265;
    border-radius: 50%;
    opacity: 0;
    animation: dustFloat linear infinite;
}

@keyframes dustFloat {
    0% {
        opacity: 0;
        transform: translateY(0) translateX(0);
    }
    20% {
        opacity: 0.3;
    }
    80% {
        opacity: 0.15;
    }
    100% {
        opacity: 0;
        transform: translateY(-100vh) translateX(var(--dust-drift));
    }
}

/* Book page container */
.book-page {
    max-width: 640px;
    margin: 0 auto;
    padding: 60px 40px 80px;
    position: relative;
    z-index: 5;
    /* Book spine shadow illusion */
    box-shadow:
        inset 8px 0 20px -8px rgba(0, 0, 0, 0.4),
        inset -8px 0 20px -8px rgba(0, 0, 0, 0.4);
}

/* Timeline spine */
.timeline-spine {
    position: fixed;
    left: calc(50% - 370px);
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 40px;
    z-index: 10;
}

.timeline-node {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1px solid #8B7D6B;
    background: transparent;
    transition: background 0.6s ease, border-color 0.6s ease, box-shadow 0.6s ease;
    cursor: pointer;
}

.timeline-node.active {
    background: #C4A265;
    border-color: #C4A265;
    box-shadow: 0 0 8px rgba(196, 162, 101, 0.4);
}

/* Title page (hero) */
.title-page {
    text-align: center;
    padding: 120px 0 80px;
    position: relative;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1s ease 0.5s, transform 1s ease 0.5s;
}

.title-page.visible {
    opacity: 1;
    transform: translateY(0);
}

.watermark-ornament {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 300px;
    height: 300px;
    pointer-events: none;
}

.book-title {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: 40px;
    letter-spacing: 0.02em;
    color: #F0E4CC;
    margin: 24px 0 16px;
    position: relative;
}

.publication-line {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 400;
    font-style: italic;
    font-size: 18px;
    color: #8B7D6B;
    margin-bottom: 24px;
}

/* Ornamental dividers */
.ornament-divider {
    width: 200px;
    height: 20px;
    display: block;
    margin: 0 auto;
}

.divider-line {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    transition: stroke-dashoffset 1.2s ease;
}

.visible .divider-line,
.ornament-divider.drawn .divider-line {
    stroke-dashoffset: 0;
}

/* Chapters */
.chapter {
    padding: 60px 0;
    border-top: none;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.chapter.visible {
    opacity: 1;
    transform: translateY(0);
}

.chapter-ornament {
    text-align: center;
    margin-bottom: 32px;
}

.chapter-ornament svg {
    width: 80px;
    height: auto;
    opacity: 0.6;
}

.metatron-ornament,
.vesica-ornament,
.flower-ornament,
.star-ornament {
    animation: ornamentGlow 8s ease-in-out infinite;
}

@keyframes ornamentGlow {
    0%, 100% { opacity: 0.5; filter: brightness(1); }
    50% { opacity: 0.8; filter: brightness(1.2); }
}

.chapter-title {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: 28px;
    letter-spacing: 0.02em;
    color: #F0E4CC;
    margin-bottom: 24px;
    text-align: center;
}

.chapter-body {
    font-family: 'Libre Baskerville', serif;
    font-weight: 400;
    font-size: 17px;
    line-height: 1.85;
    color: #D4C8B0;
    margin-bottom: 20px;
    text-indent: 2em;
}

.chapter-body.final-word {
    text-indent: 0;
    text-align: center;
    font-size: 32px;
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    color: #8B2500;
    letter-spacing: 0.1em;
    margin-top: 40px;
    animation: finalWordPulse 4s ease-in-out infinite;
}

@keyframes finalWordPulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; text-shadow: 0 0 20px rgba(139, 37, 0, 0.3); }
}

.chapter-quote {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 400;
    font-style: italic;
    font-size: 22px;
    color: #C4A265;
    margin: 32px 0;
    padding: 20px 24px;
    border-left: 2px solid rgba(196, 162, 101, 0.4);
    position: relative;
}

.quote-attribution {
    display: block;
    font-size: 14px;
    color: #8B7D6B;
    margin-top: 8px;
    font-style: normal;
}

/* Colophon / footer */
.colophon {
    text-align: center;
    padding: 60px 0 40px;
    margin-top: 40px;
}

.colophon-text {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: 16px;
    letter-spacing: 0.08em;
    color: #8B7D6B;
    margin-top: 24px;
}

.colophon-sub {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: 18px;
    color: #8B7D6B;
    margin-top: 8px;
    opacity: 0.6;
}

/* Candle flicker effect on whole page */
@keyframes candleFlicker {
    0%, 100% { filter: brightness(1); }
    5% { filter: brightness(0.97); }
    10% { filter: brightness(1.01); }
    15% { filter: brightness(0.98); }
    50% { filter: brightness(1); }
    70% { filter: brightness(0.99); }
    80% { filter: brightness(1.02); }
    90% { filter: brightness(0.98); }
}

.book-page {
    animation: candleFlicker 6s ease-in-out infinite;
}

/* Responsive */
@media (max-width: 768px) {
    .book-page {
        padding: 40px 24px 60px;
    }

    .book-title {
        font-size: 30px;
    }

    .chapter-title {
        font-size: 22px;
    }

    .timeline-spine {
        display: none;
    }

    .watermark-ornament {
        width: 200px;
        height: 200px;
    }
}

@media (max-width: 480px) {
    .book-title {
        font-size: 24px;
    }

    .chapter-quote {
        font-size: 18px;
    }
}
