/* historical.day - Classic Serif Revival Book */
/* Palette: #faf5ef, #2c2520, #1a1612, #7c2d12, #5c5047, #8c7e6f, #c9bfb0 */

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

body {
    background: #faf5ef;
    color: #2c2520;
    font-family: 'Lora', serif;
    font-weight: 400;
    font-size: 18px;
    line-height: 1.85;
    position: relative;
}

/* Book-spine vertical line along left margin */
.book-spine {
    position: fixed;
    left: 24px;
    top: 0;
    bottom: 0;
    width: 1px;
    background: #c9bfb0;
    opacity: 0.35;
    z-index: 0;
}

/* ========== Title Page ========== */
.title-page {
    text-align: center;
    padding: 20vh 2rem 10vh;
    max-width: 680px;
    margin: 0 auto;
    position: relative;
}

.brand {
    font-family: 'Cormorant', serif;
    font-weight: 600;
    font-size: clamp(40px, 8vw, 56px);
    color: #1a1612;
    letter-spacing: 0.01em;
    line-height: 1.1;
}

.subtitle {
    font-family: 'Lato', sans-serif;
    font-style: italic;
    font-size: 16px;
    color: #5c5047;
    margin-top: 0.75rem;
    letter-spacing: 0.02em;
}

/* ========== Ornamental Rules with Fleurons ========== */
.ornament-rule {
    position: relative;
    height: 1px;
    background: #c9bfb0;
    margin: 2rem auto;
    width: 240px;
}

.fleuron {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(45deg);
    display: inline-block;
    width: 10px;
    height: 10px;
    background: #faf5ef;
    color: #c9bfb0;
    font-size: 12px;
    line-height: 10px;
    text-align: center;
    padding: 2px 6px;
}

/* ========== Chapter Sections ========== */
.chapter-section {
    max-width: 680px;
    margin: 0 auto;
    padding: 2rem 2rem 1rem;
    position: relative;
}

.chapter-num {
    font-family: 'Cormorant', serif;
    font-weight: 600;
    font-size: 12px;
    color: #8c7e6f;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    display: block;
    margin-bottom: 0.35rem;
    font-variant: small-caps;
}

.chapter-title {
    font-family: 'Cormorant', serif;
    font-weight: 600;
    font-size: clamp(24px, 4vw, 32px);
    color: #1a1612;
    margin-bottom: 1rem;
    line-height: 1.25;
}

.chapter-body {
    position: relative;
}

/* ========== Drop Caps ========== */
.drop-cap {
    float: left;
    font-family: 'Cormorant', serif;
    font-weight: 600;
    font-size: 56px;
    color: #7c2d12;
    line-height: 1;
    margin-right: 8px;
    margin-top: 4px;
}

/* ========== Body Text ========== */
.body-text {
    font-family: 'Lora', serif;
    font-weight: 400;
    font-size: 18px;
    line-height: 1.85;
    color: #2c2520;
    margin-bottom: 1rem;
}

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

/* ========== Marginalia ========== */
.marginalia {
    position: absolute;
    right: -160px;
    top: 1rem;
    width: 130px;
    font-family: 'Inter', sans-serif;
    font-weight: 300;
    font-size: 11px;
    color: #8c7e6f;
    line-height: 1.45;
    display: none;
    padding-left: 12px;
    border-left: 1px dotted #c9bfb0;
}

.marginalia-lower {
    top: auto;
    bottom: 4rem;
}

.marginalia-lowest {
    top: auto;
    bottom: 0;
}

@media (min-width: 960px) {
    .marginalia {
        display: block;
    }

    .chapter-section {
        max-width: 680px;
        margin-right: auto;
        margin-left: auto;
        padding-right: 2rem;
    }

    .chapter-body {
        padding-right: 0;
    }
}

/* ========== Page Numbers ========== */
.page-number {
    display: block;
    text-align: center;
    font-family: 'Inter', sans-serif;
    font-weight: 300;
    font-size: 10px;
    color: #8c7e6f;
    margin-top: 2rem;
    letter-spacing: 0.1em;
}

/* ========== Endnotes ========== */
.endnotes {
    max-width: 680px;
    margin: 2rem auto 0;
    padding: 2rem 2rem 4rem;
    text-align: left;
}

.end-rule {
    height: 1px;
    background: #c9bfb0;
    width: 120px;
    margin: 0 auto 2rem;
}

.endnotes-heading {
    font-family: 'Cormorant', serif;
    font-weight: 600;
    font-size: 18px;
    color: #1a1612;
    text-align: center;
    margin-bottom: 1.5rem;
    font-variant: small-caps;
    letter-spacing: 0.1em;
}

.endnotes-list {
    font-family: 'Lora', serif;
    font-size: 14px;
    line-height: 1.7;
    color: #5c5047;
    padding-left: 1.5rem;
    margin-bottom: 2rem;
}

.endnotes-list li {
    margin-bottom: 0.75rem;
}

.endnotes-list em {
    font-style: italic;
}

.finis {
    font-family: 'Cormorant', serif;
    font-weight: 600;
    font-size: 18px;
    color: #5c5047;
    font-style: italic;
    text-align: center;
    margin-top: 1.5rem;
}

.page-label {
    font-family: 'Inter', sans-serif;
    font-weight: 300;
    font-size: 10px;
    color: #8c7e6f;
    display: block;
    margin-top: 0.75rem;
    text-align: center;
    letter-spacing: 0.1em;
}

/* ========== Fade-in Animation ========== */
.fade-in {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ========== Responsive Adjustments ========== */
@media (max-width: 600px) {
    .book-spine {
        display: none;
    }

    .title-page {
        padding: 12vh 1.5rem 6vh;
    }

    .chapter-section {
        padding: 1.5rem 1.5rem 1rem;
    }

    .body-text {
        font-size: 16px;
    }

    .drop-cap {
        font-size: 44px;
    }

    .endnotes {
        padding: 1.5rem 1.5rem 3rem;
    }

    .ornament-rule {
        width: 160px;
    }
}
