/* historical.day - Scholarly Digital Codex */

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

:root {
    --vellum: #F8F4EB;
    --mahogany: #2C1810;
    --saddle-brown: #8B4513;
    --scroll-gold: #C9A96E;
    --marginalia-brown: #8B7355;
    --ink-black: #1A0F08;
    --pullquote-sand: #EDE4D4;
    --ruby-red: #7B1818;
}

body {
    font-family: 'Crimson Pro', serif;
    font-weight: 400;
    font-size: 1.05rem;
    line-height: 1.85;
    color: var(--ink-black);
    background: var(--vellum);
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
#sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 260px;
    height: 100vh;
    background: var(--mahogany);
    padding: 2rem 1.5rem;
    z-index: 100;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.sidebar-date {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.date-label {
    font-family: 'Alegreya Sans', sans-serif;
    font-weight: 500;
    font-size: 0.7rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--marginalia-brown);
}

.date-value {
    font-family: 'Alegreya Sans', sans-serif;
    font-weight: 400;
    font-size: 0.85rem;
    color: var(--scroll-gold);
}

.nav-title {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--marginalia-brown);
    margin-bottom: 1rem;
}

.toc {
    list-style: none;
}

.toc li {
    margin-bottom: 0.5rem;
}

.toc-link {
    font-family: 'Alegreya Sans', sans-serif;
    font-weight: 400;
    font-size: 0.85rem;
    color: var(--scroll-gold);
    text-decoration: none;
    display: block;
    padding: 0.4rem 0 0.4rem 12px;
    border-left: 1px solid transparent;
    transition: border-color 0.15s ease, color 0.15s ease;
}

.toc-link:hover {
    border-left: 1px solid rgba(201, 169, 110, 0.4);
    color: #FFFFFF;
}

.toc-link.active {
    border-left: 3px solid var(--scroll-gold);
    color: #FFFFFF;
}

/* Main Content */
#main-content {
    margin-left: 260px;
    padding: 0 3rem;
    max-width: calc(680px + 260px + 6rem);
    flex: 1;
}

/* Hero */
#hero {
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem 0;
}

.hero-frame {
    text-align: center;
    position: relative;
    padding: 3rem 4rem;
}

.frame-border {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 2px solid var(--saddle-brown);
}

.corner {
    position: absolute;
    width: 12px;
    height: 12px;
}

.corner::before,
.corner::after {
    content: '';
    position: absolute;
    background: var(--saddle-brown);
}

.corner::before {
    width: 12px;
    height: 2px;
    top: 5px;
    left: 0;
}

.corner::after {
    width: 2px;
    height: 12px;
    top: 0;
    left: 5px;
}

.corner-tl { top: -6px; left: -6px; }
.corner-tr { top: -6px; right: -6px; }
.corner-bl { bottom: -6px; left: -6px; }
.corner-br { bottom: -6px; right: -6px; }

.hero-title {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: clamp(2rem, 4vw, 3.5rem);
    letter-spacing: 0.05em;
    color: var(--mahogany);
    opacity: 0;
    transition: opacity 0.5s ease;
}

.hero-title.visible {
    opacity: 1;
}

.hero-motto {
    font-family: 'Crimson Pro', serif;
    font-weight: 400;
    font-style: italic;
    font-size: 1rem;
    color: var(--marginalia-brown);
    margin-top: 1rem;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.hero-motto.visible {
    opacity: 1;
}

/* Content Body */
.content-body {
    max-width: 680px;
    padding-bottom: 4rem;
}

.chapter {
    margin-bottom: 2rem;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

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

.chapter-heading {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 700;
    font-size: clamp(1.3rem, 2vw, 1.8rem);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--mahogany);
    margin-bottom: 1.2rem;
}

.chapter-text {
    position: relative;
}

.chapter-text p {
    margin-bottom: 1rem;
}

/* Decorated Initial */
.decorated-initial {
    float: left;
    font-family: 'Cormorant Garamond', serif;
    font-weight: 700;
    font-size: 5rem;
    line-height: 0.85;
    color: var(--ruby-red);
    margin-right: 8px;
    margin-top: 4px;
    padding: 4px 8px;
    border: 2px solid var(--saddle-brown);
}

/* Marginalia */
.marginalia {
    font-family: 'Crimson Pro', serif;
    font-weight: 400;
    font-style: italic;
    font-size: 0.8rem;
    line-height: 1.6;
    color: var(--marginalia-brown);
    margin: 1rem 0;
    padding-left: 1rem;
    border-left: 1px solid var(--scroll-gold);
}

@media (min-width: 1200px) {
    .marginalia {
        position: absolute;
        right: -220px;
        width: 200px;
        margin: 0;
        padding-left: 12px;
        border-left: 1px solid var(--scroll-gold);
    }
}

/* Pull Quotes */
.pull-quote {
    background: var(--pullquote-sand);
    padding: 1.5rem 2rem;
    margin: 1.5rem 0;
    border-left: 3px solid var(--scroll-gold);
}

.pull-quote p {
    font-family: 'Crimson Pro', serif;
    font-style: italic;
    font-size: 1.1rem;
    line-height: 1.7;
    color: var(--mahogany);
    margin: 0;
}

/* Ornamental Dividers */
.ornamental-divider {
    position: relative;
    height: 20px;
    margin: 2.5rem 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ornamental-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--saddle-brown);
}

.ornamental-divider::after {
    content: '';
    position: absolute;
    top: calc(50% - 4px);
    left: 0;
    right: 0;
    height: 0;
    border-top: 0.5px solid rgba(201, 169, 110, 0.5);
    border-bottom: 0.5px solid rgba(201, 169, 110, 0.5);
    padding: 8px 0;
}

.divider-diamond {
    position: relative;
    z-index: 1;
    width: 8px;
    height: 8px;
    background: var(--saddle-brown);
    transform: rotate(45deg);
    display: block;
}

/* Colophon */
#colophon {
    padding: 3rem 0;
    text-align: center;
    border-top: 1px solid var(--saddle-brown);
    margin-top: 2rem;
    opacity: 0;
    transition: opacity 0.5s ease;
}

#colophon.visible {
    opacity: 1;
}

.colophon-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.printer-mark {
    opacity: 0.7;
}

.colophon-text {
    font-family: 'Crimson Pro', serif;
    font-style: italic;
    font-size: 0.8rem;
    color: var(--marginalia-brown);
    max-width: 400px;
}

/* Responsive */
@media (max-width: 768px) {
    #sidebar {
        position: relative;
        width: 100%;
        height: auto;
    }

    #main-content {
        margin-left: 0;
        padding: 0 1.5rem;
    }

    body {
        flex-direction: column;
    }
}
