:root {
    --ink: #24301f;
    --muted: #667052;
    --quiet: #8c765d;
    --paper: #fffcf3;
    --page: #fff7e8;
    --soft: #f9ead2;
    --panel: #fff3d8;
    --line: #d5cdb1;
    --leaf: #527b33;
    --leaf-dark: #2f5125;
    --soil: #6d4a31;
    --flower: #d94e8f;
    --shadow: 0 18px 50px rgba(109, 74, 49, 0.14);
}

* {
    box-sizing: border-box;
}

html {
    background: var(--page);
    color: var(--ink);
    font-family: Manrope, Inter, ui-sans-serif, system-ui, sans-serif;
    font-size: 18px;
    line-height: 1.7;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        linear-gradient(90deg, rgba(213, 205, 177, 0.28) 1px, transparent 1px) 0 0 / 46px 46px,
        var(--page);
}

a {
    color: var(--leaf-dark);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.18em;
}

img {
    display: block;
    max-width: 100%;
}

.skip-link {
    position: absolute;
    left: 1rem;
    top: -4rem;
    z-index: 10;
    background: var(--ink);
    color: var(--paper);
    padding: 0.5rem 0.75rem;
}

.skip-link:focus {
    top: 1rem;
}

.book-header {
    align-items: center;
    backdrop-filter: blur(14px);
    background: rgba(255, 247, 232, 0.86);
    border-bottom: 1px solid rgba(213, 205, 177, 0.8);
    display: flex;
    justify-content: space-between;
    min-height: 76px;
    padding: 0.85rem clamp(1rem, 4vw, 3rem);
    position: sticky;
    top: 0;
    z-index: 5;
}

.book-mark {
    color: var(--ink);
    display: grid;
    gap: 0.05rem;
    text-decoration: none;
}

.book-mark span {
    font-family: Fraunces, Georgia, "Times New Roman", serif;
    font-size: 1.1rem;
    font-weight: 900;
}

.book-mark small,
.eyebrow,
.chapter-nav,
.chapter-number {
    color: var(--quiet);
    font-size: 0.74rem;
    font-weight: 900;
    letter-spacing: 0.12em;
    line-height: 1.2;
    text-transform: uppercase;
}

.top-nav {
    display: flex;
    gap: 1rem;
}

.top-nav a,
.chapter-nav a {
    color: var(--leaf-dark);
    font-size: 0.9rem;
    font-weight: 800;
}

.cover-page {
    align-items: center;
    display: grid;
    gap: clamp(2rem, 5vw, 5rem);
    grid-template-columns: minmax(0, 0.95fr) minmax(280px, 0.7fr);
    margin: 0 auto;
    max-width: 1120px;
    min-height: calc(100vh - 76px);
    padding: clamp(2rem, 7vw, 6rem) clamp(1rem, 4vw, 3rem);
}

.cover-copy {
    max-width: 640px;
}

h1,
h2 {
    font-family: Fraunces, Georgia, "Times New Roman", serif;
    letter-spacing: 0;
}

h1 {
    font-size: clamp(3.2rem, 11vw, 6.8rem);
    line-height: 0.97;
    margin: 0;
}

.subtitle {
    color: var(--leaf-dark);
    font-family: Fraunces, Georgia, "Times New Roman", serif;
    font-size: clamp(1.5rem, 4vw, 2.6rem);
    font-weight: 900;
    line-height: 1.05;
    margin: 0.65rem 0 0;
}

.lede,
.reading-head p {
    color: var(--muted);
    font-size: 1.15rem;
    line-height: 1.65;
    margin: 1.5rem 0 0;
}

.cover-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 2rem;
}

.button {
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    display: inline-flex;
    font-weight: 900;
    justify-content: center;
    min-height: 46px;
    padding: 0.62rem 0.9rem;
    text-decoration: none;
}

.button.primary {
    background: var(--leaf);
    border-color: var(--leaf);
    color: var(--paper);
}

.button.quiet {
    background: var(--paper);
    color: var(--leaf-dark);
}

.cover-image {
    margin: 0;
}

.cover-image a {
    display: block;
}

.cover-image img {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    width: 100%;
}

.cover-image a:focus-visible img {
    outline: 3px solid var(--leaf);
    outline-offset: 4px;
}

.cover-detail-page {
    margin: 0 auto;
    max-width: 1040px;
    padding: clamp(2.2rem, 6vw, 5rem) clamp(1rem, 4vw, 2rem);
}

.cover-detail-head {
    align-items: end;
    border-bottom: 1px solid var(--line);
    display: grid;
    gap: 0.75rem;
    grid-template-columns: 1fr auto;
    margin-bottom: 2rem;
    padding-bottom: 1.25rem;
}

.cover-detail-head .eyebrow {
    grid-column: 1 / -1;
    margin: 0;
}

.cover-detail-head h1 {
    font-size: clamp(2.25rem, 7vw, 4.4rem);
}

.cover-detail-head p {
    color: var(--quiet);
    font-weight: 900;
    margin: 0;
    text-transform: uppercase;
}

.cover-detail-image {
    margin: 0 auto;
    max-width: min(760px, 100%);
}

.cover-detail-image img {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    width: 100%;
}

.cover-detail-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    margin-top: 1.5rem;
}

.contents-page,
.chapter-page {
    margin: 0 auto;
    max-width: 860px;
    padding: clamp(2.2rem, 6vw, 5rem) clamp(1rem, 4vw, 2rem);
}

.reading-head {
    border-bottom: 1px solid var(--line);
    margin-bottom: 2rem;
    padding-bottom: 2rem;
}

.reading-head h1,
.chapter-head h1 {
    font-size: clamp(2.25rem, 8vw, 4rem);
    line-height: 1.02;
}

.chapter-list {
    counter-reset: chapters;
    display: grid;
    gap: 0.35rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.chapter-list a {
    align-items: baseline;
    background: rgba(255, 252, 243, 0.72);
    border-bottom: 1px solid var(--line);
    display: grid;
    gap: 1rem;
    grid-template-columns: 7rem 1fr;
    padding: 1rem 0.25rem;
    text-decoration: none;
}

.chapter-title {
    color: var(--ink);
    font-family: Fraunces, Georgia, "Times New Roman", serif;
    font-size: clamp(1.25rem, 4vw, 1.9rem);
    font-weight: 900;
    line-height: 1.1;
}

.chapter-nav {
    align-items: center;
    display: grid;
    gap: 0.75rem;
    grid-template-columns: 1fr auto auto auto;
    margin-bottom: 2rem;
}

.chapter-nav.bottom {
    border-top: 1px solid var(--line);
    grid-template-columns: 1fr auto 1fr;
    margin: 3rem 0 0;
    padding-top: 1.25rem;
    text-transform: none;
}

.chapter-nav.bottom div:last-child {
    text-align: right;
}

.chapter-head {
    border-bottom: 1px solid var(--line);
    margin-bottom: 2rem;
    padding-bottom: 1.35rem;
}

.chapter-body {
    background: rgba(255, 252, 243, 0.66);
    border: 1px solid rgba(213, 205, 177, 0.72);
    box-shadow: var(--shadow);
    padding: clamp(1.25rem, 4vw, 3rem);
}

.chapter-body p,
.chapter-body li {
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(1.05rem, 3.5vw, 1.22rem);
    line-height: 1.82;
}

.chapter-body p {
    margin: 0 0 1.25rem;
}

.chapter-body h2 {
    font-size: 1.5rem;
    line-height: 1.12;
    margin: 0 0 0.5rem;
}

.chapter-body figure {
    margin: 2rem 0;
}

.chapter-body figure img {
    border-radius: 8px;
    border: 1px solid var(--line);
    box-shadow: 0 12px 34px rgba(109, 74, 49, 0.16);
}

.chapter-body figcaption {
    color: var(--quiet);
    font-size: 0.9rem;
    line-height: 1.45;
    margin-top: 0.65rem;
}

.fact-box {
    background: var(--panel);
    border-left: 5px solid var(--leaf);
    margin: 2rem 0;
    padding: 1rem 1.1rem;
}

.fact-box p {
    margin-bottom: 0;
}

.timeline {
    margin: 0 0 2rem;
    padding-left: 1.25rem;
}

@media (max-width: 760px) {
    html {
        font-size: 17px;
    }

    .book-header {
        align-items: flex-start;
        gap: 0.75rem;
    }

    .cover-page {
        grid-template-columns: 1fr;
        min-height: auto;
    }

    .cover-image {
        max-width: 360px;
    }

    .cover-detail-head {
        align-items: start;
        grid-template-columns: 1fr;
    }

    .cover-detail-actions {
        flex-direction: column;
    }

    .chapter-list a {
        grid-template-columns: 4.5rem 1fr;
    }

    .chapter-nav.top {
        grid-template-columns: 1fr auto;
    }

    .chapter-nav.top a:nth-of-type(n+2) {
        display: none;
    }

    .chapter-nav.bottom {
        align-items: stretch;
        grid-template-columns: 1fr;
    }

    .chapter-nav.bottom div,
    .chapter-nav.bottom div:last-child {
        text-align: left;
    }

    .chapter-body p,
    .chapter-body li {
        font-size: 1.08rem;
        line-height: 1.72;
    }

    .button {
        width: 100%;
    }
}

@media print {
    body {
        background: #fff;
    }

    .book-header,
    .chapter-nav,
    .cover-actions,
    .skip-link {
        display: none;
    }

    .chapter-page,
    .contents-page,
    .cover-page {
        max-width: none;
        padding: 0;
    }

    .chapter-body {
        border: 0;
        box-shadow: none;
        padding: 0;
    }
}
