/* ==========================================================================
   PRIOR KNOWLEDGE — working-paper register
   Palette + type per OG Card Specification v1.1 §2–3.
   Red belongs to parenthesis glyphs (in the marks) and link hover only.
   ========================================================================== */

/* --- Fonts (self-hosted, OFL — see /fonts/LICENSE-OFL.txt) --- */
@font-face {
    font-family: 'STIX Two Text';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/fonts/stix-two-text-latin-400-normal.woff2') format('woff2');
}
@font-face {
    font-family: 'STIX Two Text';
    font-style: italic;
    font-weight: 400;
    font-display: swap;
    src: url('/fonts/stix-two-text-latin-400-italic.woff2') format('woff2');
}
@font-face {
    font-family: 'STIX Two Text';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('/fonts/stix-two-text-latin-500-normal.woff2') format('woff2');
}
@font-face {
    font-family: 'STIX Two Text';
    font-style: italic;
    font-weight: 500;
    font-display: swap;
    src: url('/fonts/stix-two-text-latin-500-italic.woff2') format('woff2');
}
@font-face {
    font-family: 'STIX Two Text';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('/fonts/stix-two-text-latin-600-normal.woff2') format('woff2');
}
@font-face {
    font-family: 'STIX Two Text';
    font-style: italic;
    font-weight: 600;
    font-display: swap;
    src: url('/fonts/stix-two-text-latin-600-italic.woff2') format('woff2');
}
@font-face {
    font-family: 'STIX Two Text';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('/fonts/stix-two-text-latin-700-normal.woff2') format('woff2');
}
@font-face {
    font-family: 'STIX Two Text';
    font-style: italic;
    font-weight: 700;
    font-display: swap;
    src: url('/fonts/stix-two-text-latin-700-italic.woff2') format('woff2');
}

/* --- Palette & scale --- */
:root {
    --cream: #FDFCF8;
    --ink: #080703;
    --red: #681B13;
    --grey-olive: #7D786E;
    --hairline: rgba(8, 7, 3, 0.16);
    --serif: 'STIX Two Text', 'STIXGeneral', Georgia, serif;
    --measure: 42rem;
}

/* --- Reset & base --- */
*, *::before, *::after { box-sizing: border-box; }

html {
    font-size: 19px;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--cream);
    color: var(--ink);
    font-family: var(--serif);
    font-weight: 400;
    line-height: 1.68;
}

.page {
    max-width: var(--measure);
    margin: 0 auto;
    padding: 0 1.25rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.content { flex: 1 0 auto; }

img { max-width: 100%; height: auto; }

/* --- Links: ink underline; red + slight lift on hover --- */
a {
    color: var(--ink);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.15em;
    text-decoration-color: var(--grey-olive);
}
a:hover { color: var(--red); text-decoration-color: var(--red); }

/* --- Masthead --- */
.masthead {
    padding: 2.75rem 0 0.75rem;
    text-align: center;
}
.masthead-mark { display: inline-block; text-decoration: none; }
.mark-wordmark { display: block; width: min(24rem, 82vw); height: auto; }
.mark-brandmark { display: none; width: 5.5rem; height: auto; }
.masthead-tagline {
    margin: 0.9rem 0 0;
    font-size: 0.85rem;
    font-style: italic;
    color: var(--grey-olive);
}

/* Below masthead scale the wordmark's flanking rules smear — switch to the
   brandmark on small screens. */
@media (max-width: 600px) {
    .mark-wordmark { display: none; }
    .mark-brandmark { display: block; margin: 0 auto; }
}

/* --- Top nav: wrapping inline list of section units --- */
.site-nav {
    margin: 1.4rem 0 2.75rem;
    padding: 0.8rem 0;
    border-top: 1px solid var(--hairline);
    border-bottom: 1px solid var(--hairline);
    text-align: center;
}
.nav-toggle { display: none; }
.nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 0.82rem;
    line-height: 2;
}
/* A unit wraps as a whole; if a unit alone is wider than the line it wraps
   internally, but only between .nav-group spans — i.e. after an essay title,
   never inside one. */
.nav-unit { display: inline-block; max-width: 100%; }
.nav-group { white-space: nowrap; }
.nav-unit:not(:last-child)::after {
    content: '·';
    color: var(--grey-olive);
    margin: 0 0.55em;
}
.nav-section-label { color: var(--ink); }
.nav-letter { color: var(--grey-olive); }
.nav-forthcoming { color: var(--grey-olive); }
.nav-link {
    display: inline-block;         /* transform needs a box */
    text-decoration: none;
    transition: color 120ms ease, transform 120ms ease;
}
.nav-link:hover {
    color: var(--red);
    transform: translateY(-1px);
}
.nav-link.active { font-weight: 700; }

/* Mobile nav: hamburger, one unit per line */
@media (max-width: 700px) {
    .nav-toggle {
        display: inline-block;
        background: none;
        border: 1px solid var(--hairline);
        border-radius: 2px;
        font-family: var(--serif);
        font-size: 0.85rem;
        color: var(--ink);
        padding: 0.35rem 0.9rem;
        cursor: pointer;
    }
    .nav-list { display: none; margin-top: 0.75rem; }
    .nav-list.open { display: block; }
    .nav-unit { display: block; padding: 0.2rem 0; }
    .nav-unit:not(:last-child)::after { content: none; }
    .nav-group { white-space: normal; }
}

/* --- Homepage --- */
.intro { margin-bottom: 3rem; }

.home-label {
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--ink);
    text-align: center;
    margin: 3rem 0 1.5rem;
}

.program-map { margin-bottom: 3rem; }
.map-section { margin-bottom: 1.9rem; }
.map-heading {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0 0 0.3rem;
}
.map-description {
    margin: 0 0 0.4rem;
    color: var(--grey-olive);
    font-size: 0.95rem;
}
.map-essays {
    list-style: none;
    margin: 0;
    padding: 0 0 0 1.25rem;
    font-size: 0.98rem;
}
.map-essays li { margin: 0.15rem 0; }
.essay-letter { color: var(--grey-olive); }
.forthcoming { color: var(--grey-olive); }

.recent-essays ul { list-style: none; margin: 0; padding: 0; }
.recent-essays li { margin-bottom: 1.1rem; }
.recent-date {
    color: var(--grey-olive);
    font-size: 0.85rem;
    margin-left: 0.5em;
}
.recent-abstract {
    margin: 0.15rem 0 0;
    color: var(--grey-olive);
    font-size: 0.95rem;
    font-style: italic;
}

/* --- Essay header --- */
.essay-header { text-align: center; margin-bottom: 2.4rem; }
.kicker {
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.2em;
    /* Section name is uppercased in the template so the position letter
       stays lowercase: "EXIT AND DISTRIBUTION · IIa". */
    margin: 0 0 0.9rem;
}
.kicker a {
    color: var(--grey-olive);
    text-decoration: none;
}
.kicker a:hover { color: var(--red); }
.essay-title {
    font-size: 2.1rem;
    font-weight: 600;
    line-height: 1.2;
    margin: 0 0 0.9rem;
}
.byline {
    font-size: 0.95rem;
    color: var(--ink);
    margin: 0 0 0.85rem;
}
.siblings {
    font-size: 0.85rem;
    color: var(--grey-olive);
    margin: 0;
}
.siblings .sibling { white-space: nowrap; }
.siblings .sibling:not(:last-child)::after {
    content: '·';
    margin: 0 0.5em;
}
.siblings strong { color: var(--ink); font-weight: 600; }

/* --- Page (About, 404) --- */
.page-header { text-align: center; margin-bottom: 1.8rem; }
.page-title { font-size: 1.9rem; font-weight: 600; margin: 0; }

/* --- Table of contents --- */
.toc-wrapper {
    border: 1px solid var(--hairline);
    padding: 0.9rem 1.2rem;
    margin: 0 auto 2.4rem;
    max-width: 30rem;
    font-size: 0.92rem;
}
.toc-wrapper summary {
    cursor: pointer;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    font-size: 0.78rem;
}
.toc-wrapper ul { list-style: none; padding-left: 1rem; margin: 0.5rem 0 0; }
.toc-wrapper > nav > ul { padding-left: 0; }
.toc-wrapper a { text-decoration: none; }
.toc-wrapper a:hover { color: var(--red); }

/* --- Essay body: working-paper register --- */
.essay-body h2, .page-body h2, .intro h2 {
    font-size: 1.28rem;
    font-weight: 600;
    line-height: 1.3;
    margin: 2.4rem 0 0.9rem;
}
.essay-body h3, .page-body h3 {
    font-size: 1.08rem;
    font-weight: 600;
    font-style: italic;
    margin: 1.9rem 0 0.7rem;
}
.essay-body p { margin: 0 0 1.1rem; }

/* Epigraph: right-aligned italic, attribution line breaks preserved */
.epigraph {
    margin: 0 0 2rem;
    padding-right: 0.25rem;
    text-align: right;
    font-style: italic;
    font-size: 0.98rem;
    color: var(--ink);
    white-space: pre-line;
}

/* Block quotes */
.essay-body blockquote, .page-body blockquote {
    margin: 1.4rem 0 1.4rem 0;
    padding: 0.1rem 0 0.1rem 1.3rem;
    border-left: 2px solid var(--ink);
    font-size: 0.98rem;
}
.essay-body blockquote p { margin-bottom: 0.6rem; }

/* Numbered figures */
.essay-figure {
    margin: 2.2rem 0;
    text-align: center;
}
.essay-figure img {
    display: block;
    margin: 0 auto;
    border: 1px solid var(--hairline);
}
.essay-figure figcaption {
    margin-top: 0.7rem;
    font-size: 0.88rem;
    color: var(--grey-olive);
    text-align: left;
}
.essay-figure .fig-label {
    font-weight: 600;
    color: var(--ink);
}
.essay-figure figcaption p { display: inline; margin: 0; }

/* Tables */
.essay-body table, .page-body table {
    border-collapse: collapse;
    margin: 1.6rem auto;
    font-size: 0.92rem;
    min-width: 60%;
}
.essay-body th, .page-body th {
    border-top: 2px solid var(--ink);
    border-bottom: 1px solid var(--ink);
    padding: 0.45rem 0.9rem;
    font-weight: 600;
    text-align: left;
}
.essay-body td, .page-body td {
    padding: 0.4rem 0.9rem;
    border-bottom: 1px solid var(--hairline);
}
.essay-body tr:last-child td { border-bottom: 2px solid var(--ink); }

/* Footnotes */
.essay-body sup { line-height: 0; }
.essay-body .footnote-ref { text-decoration: none; font-weight: 600; }
.essay-body .footnotes {
    margin-top: 3rem;
    font-size: 0.9rem;
    color: var(--ink);
}
.essay-body .footnotes hr {
    border: 0;
    border-top: 1px solid var(--ink);
    width: 8rem;
    margin: 0 0 1.2rem;
}
.essay-body .footnotes ol { padding-left: 1.4rem; }
.essay-body .footnotes li { margin-bottom: 0.6rem; }
.essay-body .footnote-backref { text-decoration: none; }

/* Citation block */
.citation-block {
    margin: 3rem 0 0;
    padding: 1.1rem 1.3rem;
    border: 1px solid var(--hairline);
    font-size: 0.9rem;
}
.citation-label, .related-label {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    margin: 0 0 0.5rem;
}
.citation-text { margin: 0; overflow-wrap: break-word; }
.citation-ssrn { margin: 0.4rem 0 0; }

/* Related essays */
.related-essays { margin: 2.4rem 0 0; }
.related-essays ul { list-style: none; margin: 0; padding: 0; }
.related-essays li { margin: 0.25rem 0; }
.related-date { color: var(--grey-olive); font-size: 0.85rem; margin-left: 0.5em; }

/* --- Footer & signup --- */
.site-footer {
    margin-top: 4rem;
    padding: 2rem 0 2.5rem;
    border-top: 1px solid var(--hairline);
    text-align: center;
}
.signup { margin-bottom: 1.8rem; }
.signup-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    margin-bottom: 0.7rem;
}
.signup-row {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.signup input[type="email"] {
    font-family: var(--serif);
    font-size: 0.95rem;
    color: var(--ink);
    background: var(--cream);
    border: 1px solid var(--grey-olive);
    border-radius: 2px;
    padding: 0.45rem 0.8rem;
    width: min(18rem, 70vw);
}
.signup input[type="email"]::placeholder { color: var(--grey-olive); }
.signup button {
    font-family: var(--serif);
    font-size: 0.95rem;
    background: var(--ink);
    color: var(--cream);
    border: 1px solid var(--ink);
    border-radius: 2px;
    padding: 0.45rem 1.1rem;
    cursor: pointer;
}
.signup button:hover { background: var(--red); border-color: var(--red); }
.signup-hp { position: absolute; left: -5000px; }

.footer-meta { font-size: 0.85rem; color: var(--grey-olive); }
.footer-links { margin: 0 0 0.3rem; }
.footer-links a { color: var(--grey-olive); text-decoration: none; }
.footer-links a:hover { color: var(--red); }
.footer-sep { margin: 0 0.4em; }
.footer-copyright { margin: 0; }

/* ==========================================================================
   Print / PDF
   ========================================================================== */
@media print {
    @page { margin: 2.2cm 2cm; }

    html { font-size: 11.5pt; }
    body { background: #fff; color: #000; }
    .page { max-width: 100%; padding: 0; display: block; }

    .site-nav, .nav-toggle, .site-footer, .toc-wrapper,
    .related-essays, .masthead-tagline { display: none !important; }

    .masthead { padding: 0 0 1.2rem; }
    .mark-wordmark { display: block !important; width: 16rem; margin: 0 auto; }
    .mark-brandmark { display: none !important; }

    a { color: #000; text-decoration: none; }
    .essay-body a[href^="http"]::after {
        content: " (" attr(href) ")";
        font-size: 0.85em;
        color: #444;
        word-break: break-all;
    }

    .essay-figure, blockquote, table { break-inside: avoid; }
    h2, h3 { break-after: avoid; }

    .citation-block { border: 1px solid #000; }
}
