:root {
    --vellum: #f5ede0;
    --parchment: #e8dfd0;
    --lignite: #2b2018;
    --soot: #1a1610;
    --graphite: #6b6358;
    --ochre: #c4a56a;
    --iron: #8b4a2b;
    --slate: #5a6b7a;
    --chalite: #4a6b52;
    --dried-ink: #3d3028;
    --gold: #b8942e;
}

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

html {
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    font-size: 18px;
}

body {
    background-color: var(--vellum);
    color: var(--soot);
    font-family: 'IBM Plex Sans KR', sans-serif;
    font-weight: 400;
    line-height: 1.75;
    letter-spacing: 0.01em;
    overflow-x: hidden;
}

/* ===================== PROGRESS BAR ===================== */
.progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 3px;
    height: 0%;
    background-color: var(--dried-ink);
    z-index: 100;
    transition: none;
}

/* ===================== MASTHEAD ===================== */
.masthead {
    padding: 4rem 4rem 2rem 4rem;
}

.masthead-grid {
    display: flex;
}

.masthead-title {
    width: 60%;
}

.masthead-void {
    width: 40%;
}

.masthead-name {
    font-family: 'Noto Serif KR', Georgia, serif;
    font-weight: 900;
    font-size: 12vw;
    line-height: 1.0;
    color: var(--soot);
    letter-spacing: -0.02em;
}

.masthead-rule {
    width: 60vw;
    height: 1px;
    background-color: var(--dried-ink);
    margin: 1.5rem 0 1rem 0;
}

.masthead-meta {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.7rem;
    font-weight: 400;
    letter-spacing: 0.08em;
    color: var(--graphite);
}

.meta-separator {
    margin: 0 0.5rem;
}

/* ===================== EPIGRAPH BAND ===================== */
.epigraph-band {
    background-color: var(--vellum);
    min-height: 30vh;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    padding: 6rem 4rem;
}

.epigraph-proverb {
    font-family: 'Nanum Myeongjo', serif;
    font-weight: 700;
    font-size: clamp(2rem, 5vw, 4rem);
    line-height: 1.3;
    color: var(--soot);
    font-style: italic;
    margin-bottom: 1rem;
}

.epigraph-translation {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--soot);
    opacity: 0.4;
}

/* ===================== PRIMARY SECTION (GRID) ===================== */
.primary-section {
    padding: 8rem 0;
}

.primary-grid {
    display: grid;
    grid-template-columns: 15% 55% 15% 15%;
    min-height: auto;
}

.grid-left-margin {
    /* Structural margin */
}

.grid-content {
    padding: 0 2rem;
}

.grid-margin {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 2rem;
}

.grid-right-margin {
    /* Structural margin */
}

.section-heading {
    font-family: 'Noto Serif KR', Georgia, serif;
    font-weight: 700;
    font-size: clamp(1.8rem, 4vw, 3rem);
    line-height: 1.15;
    letter-spacing: -0.01em;
    color: var(--soot);
    margin-bottom: 2rem;
}

.grid-content p {
    margin-bottom: 1.5rem;
    color: var(--soot);
}

.marginal-glyph {
    font-family: 'Nanum Myeongjo', serif;
    font-size: 2rem;
    font-weight: 700;
    color: var(--soot);
    opacity: 0;
    transition: opacity 400ms ease-in;
}

.marginal-glyph.visible {
    opacity: 0.15;
}

/* ===================== STRATIGRAPHY SECTION ===================== */
.stratigraphy-section {
    padding: 8rem 0;
    position: relative;
    overflow: hidden;
}

.stratigraphy-hatching {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg width='8' height='8' xmlns='http://www.w3.org/2000/svg'%3E%3Cline x1='0' y1='8' x2='8' y2='0' stroke='%233d3028' stroke-width='0.5' opacity='0.06'/%3E%3C/svg%3E");
    background-repeat: repeat;
    pointer-events: none;
}

.strata-container {
    position: relative;
    z-index: 1;
}

.stratum {
    display: flex;
    align-items: center;
    padding-left: 4rem;
    overflow: hidden;
    opacity: 0;
    transform: translateX(-100%);
    transition: transform 600ms ease-out, opacity 600ms ease-out;
}

.stratum.revealed {
    opacity: 1;
    transform: translateX(0);
}

.stratum-1 {
    height: 80px;
    background-color: var(--ochre);
    clip-path: polygon(0 0, 100% 0.5%, 100% 99%, 0 100%);
}

.stratum-2 {
    height: 60px;
    background-color: var(--iron);
    clip-path: polygon(0 1%, 100% 0, 100% 100%, 0 99.5%);
}

.stratum-3 {
    height: 100px;
    background-color: var(--slate);
    clip-path: polygon(0 0, 100% 0.8%, 100% 99.5%, 0 100%);
}

.stratum-4 {
    height: 50px;
    background-color: var(--chalite);
    clip-path: polygon(0 0.5%, 100% 0, 100% 100%, 0 99%);
}

.stratum-5 {
    height: 120px;
    background-color: var(--dried-ink);
    clip-path: polygon(0 0, 100% 1%, 100% 100%, 0 99.5%);
}

.stratum-6 {
    height: 70px;
    background-color: var(--lignite);
    clip-path: polygon(0 0.5%, 100% 0, 100% 99%, 0 100%);
}

.stratum-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    font-weight: 400;
    letter-spacing: 0.08em;
    color: var(--vellum);
    text-transform: uppercase;
    white-space: nowrap;
}

/* ===================== LEDGER SECTION ===================== */
.ledger-section {
    padding: 8rem 4rem;
    background-color: var(--parchment);
    background-image: repeating-linear-gradient(
        transparent,
        transparent calc(2rem - 1px),
        rgba(196, 165, 106, 0.2) calc(2rem - 1px),
        rgba(196, 165, 106, 0.2) 2rem
    );
}

.ledger-heading {
    margin-bottom: 4rem;
}

.ledger-container {
    display: flex;
    position: relative;
}

.ledger-left,
.ledger-right {
    flex: 1;
    padding: 0 2rem;
}

.ledger-rule {
    width: 1px;
    background-color: var(--dried-ink);
    transform: scaleY(0);
    transform-origin: top;
    transition: transform 800ms ease-out;
}

.ledger-rule.drawn {
    transform: scaleY(1);
}

.ledger-column-title {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.7rem;
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--graphite);
    margin-bottom: 2rem;
}

.ledger-entry {
    margin-bottom: 1.5rem;
    opacity: 0;
    transition: opacity 300ms ease-in;
}

.ledger-entry.visible {
    opacity: 1;
}

.ledger-term {
    font-family: 'Nanum Myeongjo', serif;
    font-weight: 700;
    font-size: 1rem;
    display: block;
    color: var(--soot);
    margin-bottom: 0.3rem;
}

.ledger-note {
    font-family: 'IBM Plex Sans KR', sans-serif;
    font-weight: 300;
    font-size: 0.8rem;
    color: var(--graphite);
    display: block;
    line-height: 1.5;
}

/* ===================== CLOSING SECTION ===================== */
.closing-section {
    padding-bottom: 20vh;
}

/* ===================== COLOPHON ===================== */
.colophon {
    padding: 4rem;
    position: relative;
}

.colophon-rule {
    width: 100%;
    height: 1px;
    background-color: var(--dried-ink);
    margin-bottom: 4rem;
}

.colophon-content {
    width: 50%;
}

.colophon-text {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.65rem;
    font-weight: 400;
    letter-spacing: 0.08em;
    color: var(--graphite);
    line-height: 1.7;
    margin-bottom: 1rem;
}

.colophon-seal {
    position: absolute;
    bottom: 4rem;
    right: 15%;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 2px solid var(--iron);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 600ms ease-out, transform 600ms ease-out;
}

.colophon-seal.stamped {
    opacity: 0.3;
    transform: scale(1.0);
}

.seal-character {
    font-family: 'Nanum Myeongjo', serif;
    font-weight: 700;
    font-size: 1.4rem;
    color: var(--iron);
}

/* ===================== RESPONSIVE ===================== */
@media (max-width: 768px) {
    .masthead {
        padding: 2rem;
    }

    .masthead-name {
        font-size: 15vw;
    }

    .primary-grid {
        grid-template-columns: 5% 80% 10% 5%;
    }

    .epigraph-band {
        padding: 4rem 2rem;
    }

    .ledger-section {
        padding: 4rem 2rem;
    }

    .ledger-container {
        flex-direction: column;
    }

    .ledger-rule {
        width: 100%;
        height: 1px;
        margin: 2rem 0;
        transform: scaleX(0);
        transform-origin: left;
    }

    .ledger-rule.drawn {
        transform: scaleX(1);
    }

    .colophon {
        padding: 2rem;
    }

    .colophon-content {
        width: 100%;
    }

    .stratum {
        padding-left: 2rem;
    }
}
