/* =========================
   Base
   ========================= */

:root {
    --bg: #f6f1e8;
    --paper: #fbf8f2;
    --text: #2b2622;
    --muted: #6e655d;
    --rule: #d8cec2;
    --link: #5a3e2b;
    --link-hover: #2f2118;

    --font-body: "Literata", Georgia, "Times New Roman", serif;
    --font-ui: "Inter", "Segoe UI", Roboto, sans-serif;

    --radius: 10px;
    --shadow: 0 8px 30px rgba(30, 20, 10, 0.08);
}

/* Better box model */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-size: 18px;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    padding: 0;
    background:
        radial-gradient(circle at top, rgba(255,255,255,0.35), transparent 28%),
        var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    line-height: 1.8;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* =========================
   Layout
   ========================= */

#sidebar {
    display: none;
}

#content {
    min-height: 100vh;
}

.book {
    max-width: 40em; /* imposed */
    margin: 0 auto;
    background: var(--paper);
    margin-top: 1.5em;
    padding: 3.25rem 2.5rem;
    border: 1px solid rgba(80, 60, 40, 0.08);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    position: relative;
}

/* subtle page feeling */
.book::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    background:
        linear-gradient(to bottom, rgba(255,255,255,0.32), rgba(255,255,255,0) 10%),
        linear-gradient(to right, rgba(0,0,0,0.02), transparent 6%, transparent 94%, rgba(0,0,0,0.02));
    mix-blend-mode: multiply;
}

/* =========================
   Typography
   ========================= */

.book h1,
.book h2,
.book h3,
.book h4 {
    color: #1f1a16;
    line-height: 1.25;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin-top: 2.2em;
    margin-bottom: 0.8em;
}

.book h1 {
    font-size: clamp(2rem, 4vw, 2.6rem);
    text-align: center;
    margin-top: 0;
    margin-bottom: 1.4rem;
    text-wrap: balance;
}

.book h2 {
    font-size: 1.35rem;
    margin-top: 2.8rem;
    padding-top: 1.2rem;
    border-top: 1px solid var(--rule);
}

.book h3 {
    font-size: 1.15rem;
}

.book p {
    margin: 0;
    text-align: justify;
    text-wrap: pretty;
    hyphens: auto;
    orphans: 3;
    widows: 3;
}

/* paragraph rhythm */
.book p + p {
    text-indent: 1.35em;
    margin-top: 0.15em;
}

/* no indent after headings/nav/etc. */
.book h1 + p,
.book h2 + p,
.book h3 + p,
.book h4 + p,
.book nav + p,
.book blockquote + p {
    text-indent: 0;
    margin-top: 0.8em;
}

/* Parenthetical speaker names such as (ORI), (NÃ©stor), etc. */
.book p:has(> strong:only-child),
.book p:has(> em:only-child) {
    text-indent: 0;
}

/* =========================
   Links
   ========================= */

a {
    color: var(--link);
    text-decoration: none;
    transition: color 140ms ease, border-color 140ms ease, background-color 140ms ease;
}

a:hover,
a:focus-visible {
    color: var(--link-hover);
}

.book a {
    border-bottom: 1px solid rgba(90, 62, 43, 0.28);
}

.book a:hover,
.book a:focus-visible {
    border-bottom-color: rgba(47, 33, 24, 0.55);
}

/* =========================
   Pagination navigation
   ========================= */

.book-pagination {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    gap: 1rem;
    margin: 0 0 2.25rem;
    padding: 0 0 1.4rem;
    border-bottom: 1px solid var(--rule);
}

.book-pagination:last-of-type {
    margin: 2.5rem 0 0;
    padding: 1.4rem 0 0;
    border-top: 1px solid var(--rule);
    border-bottom: 0;
}

.book-pagination-prev,
.book-pagination-next {
    flex: 1 1 0;
}

.book-pagination-next {
    text-align: right;
}

.book-pagination .nav-link {
    display: inline-block;
    font-family: var(--font-ui);
    font-size: 0.84rem;
    line-height: 1.45;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--muted);
    border: 0;
    padding: 0.2rem 0;
}

.book-pagination .nav-link:hover,
.book-pagination .nav-link:focus-visible {
    color: var(--link-hover);
}

/* =========================
   Blockquotes / citations if added later
   ========================= */

.book blockquote {
    margin: 1.8rem 0;
    padding: 0.25rem 0 0.25rem 1.2rem;
    border-left: 3px solid var(--rule);
    color: #3c342e;
    font-style: italic;
}

.book blockquote p {
    text-indent: 0;
    text-align: left;
}

/* =========================
   Lists if they appear later
   ========================= */

.book ul,
.book ol {
    margin: 1rem 0 1rem 1.4rem;
    padding: 0;
}

.book li + li {
    margin-top: 0.4rem;
}

/* =========================
   Selection / focus
   ========================= */

::selection {
    background: rgba(120, 90, 50, 0.18);
    color: inherit;
}

a:focus-visible {
    outline: 2px solid rgba(90, 62, 43, 0.35);
    outline-offset: 3px;
    border-radius: 2px;
}

/* =========================
   Responsive
   ========================= */

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

    .book {
        padding: 2rem 1.2rem;
        border-radius: 6px;
    }

    .book h1 {
        font-size: 1.8rem;
    }

    .book h2 {
        font-size: 1.2rem;
    }

    .book p {
        text-align: left;
        hyphens: none;
    }

    .book p + p {
        text-indent: 1.1em;
    }

    .book-pagination {
        flex-direction: column;
        gap: 0.6rem;
    }

    .book-pagination-next {
        text-align: left;
    }
}

/* =========================
   Print
   ========================= */

@media print {
    body {
        background: white;
        color: black;
    }

    #content {
        padding: 0;
    }

    .book {
        max-width: 40em;
        margin: 0 auto;
        padding: 0;
        background: white;
        border: 0;
        box-shadow: none;
    }

    .book::before {
        display: none;
    }

    .book a {
        color: black;
        border: 0;
        text-decoration: none;
    }

    .book-pagination {
        display: none;
    }
}

.article {
    max-width: 50em; /* imposed */
    margin: 0 auto;
    background: var(--paper);
    margin-top: 1.5em;
    padding: 3.25rem 2.5rem;
    border: 1px solid rgba(80, 60, 40, 0.08);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.article .author {
    font-family: var(--font-ui);
    font-size: 0.9rem;
    color: var(--muted);
    margin-bottom: 0.6em;
}

.callout {
    margin: 1.8rem 0;
    padding: 1rem 1.25rem;
    border-left: 3px solid var(--rule);
    background: rgba(216, 206, 194, 0.4);
    color: #3c342e;
}

.callout.callout-note {
    border-color: rgba(216, 206, 194, 0.8);
    background: rgba(216, 206, 194, 0.6);
}