:root {
    --vellum: #f5f0e6;
    --walnut: #2c2418;
    --dark-umber: #3d3428;
    --muted-umber: #7a6a52;
    --honeyed-gold: #c4a86b;
    --amber-glow: #d4a24e;
    --aged-linen: #ede5d4;
    --sepia-ink: #1a1408;
}

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

html {
    scroll-behavior: smooth;
}

::selection {
    background: #c4a86b;
    color: #2c2418;
}

body {
    background-color: var(--vellum);
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M30 5 L35 15 L30 25 L25 15 Z' fill='none' stroke='%233d3428' stroke-width='0.3' opacity='0.04'/%3E%3Cpath d='M10 30 L15 40 L10 50 L5 40 Z' fill='none' stroke='%233d3428' stroke-width='0.3' opacity='0.04'/%3E%3Cpath d='M50 30 L55 40 L50 50 L45 40 Z' fill='none' stroke='%233d3428' stroke-width='0.3' opacity='0.04'/%3E%3C/svg%3E");
    color: var(--dark-umber);
    font-family: 'Libre Baskerville', serif;
    font-size: 16px;
    line-height: 1.7;
    min-height: 100vh;
}

/* Navigation Sigil */
.nav-sigil {
    position: fixed;
    top: 24px;
    left: 24px;
    z-index: 100;
    cursor: pointer;
    transition: transform 400ms ease-in-out;
}

.nav-sigil:hover {
    transform: rotate(15deg);
}

.nav-sigil:hover .sigil-icon circle,
.nav-sigil:hover .sigil-icon text {
    stroke: var(--amber-glow);
    fill: var(--amber-glow);
    transition: all 400ms ease-in-out;
}

/* Navigation Overlay */
.nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 320px;
    height: 100vh;
    background: var(--walnut);
    z-index: 90;
    transform: translateX(-100%);
    transition: transform 500ms cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    padding: 60px 40px;
}

.nav-overlay.active {
    transform: translateX(0);
}

.nav-overlay-content {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.nav-link {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--aged-linen);
    text-decoration: none;
    transition: color 250ms ease;
}

.nav-link:hover {
    color: var(--amber-glow);
}

/* Frontispiece */
.frontispiece {
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 32px;
}

.frontispiece-sigil {
    opacity: 0;
    animation: sigil-fade-in 1200ms ease-out forwards;
}

@keyframes sigil-fade-in {
    from { opacity: 0; transform: scale(1); }
    to { opacity: 1; transform: scale(1); }
}

.frontispiece-sigil.scaled {
    animation: sigil-scale 800ms ease-out forwards;
}

@keyframes sigil-scale {
    to { transform: scale(0.6) translateY(-30px); }
}

.frontispiece-tagline {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: clamp(1.2rem, 2.5vw, 1.8rem);
    color: var(--muted-umber);
    opacity: 0;
    animation: tagline-fade 800ms ease-out 1800ms forwards;
}

@keyframes tagline-fade {
    to { opacity: 1; }
}

/* Fleurons */
.fleuron {
    text-align: center;
    padding: 8px 0;
    animation: fleuron-breathe 3s ease-in-out infinite;
}

.fleuron-divider {
    margin: 40px auto;
}

@keyframes fleuron-breathe {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* Chapters */
.chapter {
    max-width: 1100px;
    margin: 0 auto;
    padding: 60px 32px;
}

.chapter-header {
    margin-bottom: 40px;
    text-align: center;
}

.chapter-number {
    font-family: 'Spectral', serif;
    font-weight: 300;
    font-size: 0.85rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--muted-umber);
    display: block;
    margin-bottom: 8px;
}

.chapter-title {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: clamp(2.4rem, 5.5vw, 4.8rem);
    letter-spacing: 0.03em;
    line-height: 1.12;
    color: var(--dark-umber);
}

/* Chapter Grids */
.chapter-grid {
    display: grid;
    gap: 24px;
}

.chapter-grid--persistence {
    grid-template-columns: 2fr 1fr;
}

.chapter-grid--archive {
    grid-template-columns: 1.5fr 1fr;
    grid-template-rows: auto auto;
}

.chapter-grid--archive .folio-block--wide {
    grid-column: 1 / -1;
}

.chapter-grid--method {
    grid-template-columns: 1fr 2fr 1fr;
    align-items: start;
}

.chapter-grid--artifacts {
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.chapter-body {
    margin-top: 32px;
}

/* Folio Blocks */
.folio-block {
    background: var(--vellum);
    border: 1px solid var(--honeyed-gold);
    padding: 32px;
    transition: border-width 200ms ease, box-shadow 200ms ease;
}

.folio-block:hover {
    border-width: 2px;
    box-shadow: 0 0 40px rgba(212, 162, 78, 0.1);
}

.folio-block--small {
    padding: 24px;
    text-align: center;
}

.block-heading {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: 1.3rem;
    margin-bottom: 12px;
    color: var(--dark-umber);
}

.block-text-small {
    font-size: 0.9rem;
    color: var(--muted-umber);
}

.artifact-ornament {
    margin-bottom: 16px;
}

/* Marginalia Blocks */
.marginalia-block {
    background: var(--aged-linen);
    padding: 24px;
    border-left: 2px solid var(--honeyed-gold);
}

.marginalia-label {
    font-family: 'Spectral', serif;
    font-weight: 300;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--honeyed-gold);
    display: block;
    margin-bottom: 8px;
}

.marginalia-text {
    font-size: 0.9rem;
    font-style: italic;
    color: var(--muted-umber);
    line-height: 1.6;
}

/* Plate Blocks */
.plate-block {
    background: var(--vellum);
    border: 1px solid var(--honeyed-gold);
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.plate-block--wide {
    padding: 32px;
}

.plate-illustration {
    width: 100%;
    max-width: 200px;
    height: auto;
}

.plate-illustration--wide {
    max-width: 300px;
}

/* Drop Cap */
.drop-cap-text::first-letter {
    float: left;
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: 4.5em;
    line-height: 0.85;
    margin-right: 0.08em;
    color: var(--sepia-ink);
}

/* Colophon */
.chapter--colophon {
    display: flex;
    justify-content: center;
    padding: 80px 32px 120px;
}

.colophon-block {
    background: var(--walnut);
    padding: 48px;
    text-align: center;
    max-width: 500px;
    width: 100%;
}

.colophon-sigil {
    margin-bottom: 24px;
}

.colophon-title {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: 1.8rem;
    color: var(--aged-linen);
    margin-bottom: 16px;
    letter-spacing: 0.03em;
}

.colophon-text {
    font-size: 0.9rem;
    color: var(--muted-umber);
    line-height: 1.7;
    margin-bottom: 24px;
}

.colophon-meta {
    font-family: 'Spectral', serif;
    font-size: 0.8rem;
    color: var(--honeyed-gold);
    letter-spacing: 0.1em;
    margin-bottom: 24px;
}

.colophon-separator {
    margin: 0 8px;
}

/* Block Reveal Animation */
.block-reveal {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 600ms ease-out, transform 600ms ease-out;
}

.block-reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Link Styles */
a {
    color: var(--dark-umber);
    transition: color 250ms ease;
}

a:hover {
    color: var(--amber-glow);
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .chapter-grid--persistence,
    .chapter-grid--archive,
    .chapter-grid--method {
        grid-template-columns: 1fr;
    }

    .chapter-grid--artifacts {
        grid-template-columns: repeat(2, 1fr);
    }

    .nav-overlay {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .chapter-grid--artifacts {
        grid-template-columns: 1fr;
    }
}
