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

body {
    font-family: 'Lora', serif;
    background: #1C1917;
    color: #B8A898;
    font-size: 17px;
    line-height: 1.8;
    font-weight: 400;
    overflow-x: hidden;
}

/* Scroll Progress Bar */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 2px;
    width: 0%;
    background: #9B3D2B;
    z-index: 1000;
    transition: width 0.1s linear;
}

/* Noise Overlay */
.noise-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
    opacity: 0.03;
    background-image: 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' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
    background-repeat: repeat;
}

/* Hero */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 80px 24px;
}

.hero-inner {
    opacity: 0;
    transition: opacity 0.6s ease;
}

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

.hero-title {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: 56px;
    color: #E8DDD0;
    letter-spacing: 0.02em;
    margin-bottom: 16px;
    line-height: 1.2;
}

.hero-subtitle {
    font-family: 'Lora', serif;
    font-style: italic;
    font-size: 18px;
    color: #7A6B5D;
    margin-bottom: 32px;
}

.ornament-rule {
    display: block;
    margin: 0 auto;
}

.ornament-path {
    stroke-dasharray: 220;
    stroke-dashoffset: 220;
    transition: stroke-dashoffset 0.8s ease;
}

.ornament-path.drawn {
    stroke-dashoffset: 0;
}

/* Content */
.content {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 24px 120px;
}

/* Chapter */
.chapter {
    margin-bottom: 80px;
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

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

/* Chapter Divider */
.chapter-divider {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-bottom: 40px;
}

.chapter-rule {
    flex: 1;
    border: none;
    height: 1px;
    background: #5C4A3A;
}

.chapter-number {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: 36px;
    color: #E8DDD0;
    font-variant: small-caps;
    flex-shrink: 0;
}

.chapter-title {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: 42px;
    color: #E8DDD0;
    letter-spacing: 0.02em;
    margin-bottom: 32px;
    line-height: 1.2;
}

/* Two Column Layout */
.two-column {
    display: grid;
    grid-template-columns: 65% 35%;
    gap: 32px;
}

.main-column {
    /* primary content */
}

.body-text {
    font-family: 'Lora', serif;
    font-size: 17px;
    font-weight: 400;
    line-height: 1.8;
    color: #B8A898;
    margin-bottom: 24px;
}

.margin-column {
    padding-top: 4px;
}

.marginalia {
    border-left: 2px solid #5C4A3A;
    padding-left: 16px;
    margin-bottom: 24px;
    opacity: 0;
    transform: translateX(8px);
    transition: opacity 0.5s ease 0.2s, transform 0.5s ease 0.2s;
}

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

.annotation {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: 12px;
    line-height: 1.5;
    color: #7A6B5D;
}

/* Pull Quote */
.pull-quote {
    margin: 32px 0;
    padding: 24px 0;
    border-top: 1px solid #5C4A3A;
    border-bottom: 1px solid #5C4A3A;
}

.pull-quote p {
    font-family: 'Playfair Display', serif;
    font-style: italic;
    font-weight: 700;
    font-size: 28px;
    color: #E8DDD0;
    line-height: 1.4;
}

/* Footnote Markers */
.footnote-marker {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    color: #9B3D2B;
    cursor: pointer;
    text-decoration: none;
    vertical-align: super;
    line-height: 0;
    transition: color 0.2s ease;
}

.footnote-marker:hover {
    color: #E8DDD0;
}

/* Footnote Panel */
.footnote-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 360px;
    height: 100%;
    background: #2A2420;
    z-index: 500;
    transform: translateX(100%);
    transition: transform 0.3s ease-out;
    padding: 48px 32px;
    overflow-y: auto;
}

.footnote-panel.open {
    transform: translateX(0);
}

.footnote-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    font-size: 24px;
    color: #7A6B5D;
    cursor: pointer;
    font-family: 'Lora', serif;
}

.footnote-content {
    font-family: 'Lora', serif;
    font-size: 15px;
    line-height: 1.8;
    color: #B8A898;
}

/* Colophon */
.colophon {
    text-align: center;
    padding: 80px 0 40px;
}

.ornament-bottom {
    margin-bottom: 24px;
}

.colophon-text {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: 12px;
    color: #7A6B5D;
}

/* Responsive */
@media (max-width: 700px) {
    .two-column {
        grid-template-columns: 1fr;
    }

    .hero-title {
        font-size: 40px;
    }

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

    .pull-quote p {
        font-size: 22px;
    }

    .footnote-panel {
        width: 100%;
    }

    .margin-column {
        border-top: 1px solid #5C4A3A;
        padding-top: 24px;
        margin-top: 8px;
    }
}
