/* Aufenthalt — a quiet typographic Ghost theme for a historian
   Headings: Newsreader     (variable: weight + optical size)
   Body:     Libre Franklin (variable: weight)
   Both fonts are self-hosted under the SIL Open Font License. Each comes
   in three files per style (Latin, Latin Extended, Vietnamese); a browser
   downloads only the ones whose characters a page uses, so names, places
   and titles render in the theme fonts rather than a fallback.          */

/* ---------- Fonts ---------- */

@font-face {
    font-family: "Newsreader";
    src: url("../fonts/newsreader-vietnamese-normal.woff2") format("woff2");
    font-weight: 200 800;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
    font-family: "Newsreader";
    src: url("../fonts/newsreader-vietnamese-italic.woff2") format("woff2");
    font-weight: 200 800;
    font-style: italic;
    font-display: swap;
    unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
    font-family: "Newsreader";
    src: url("../fonts/newsreader-latin-ext-normal.woff2") format("woff2");
    font-weight: 200 800;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: "Newsreader";
    src: url("../fonts/newsreader-latin-ext-italic.woff2") format("woff2");
    font-weight: 200 800;
    font-style: italic;
    font-display: swap;
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: "Newsreader";
    src: url("../fonts/newsreader-latin-normal.woff2") format("woff2");
    font-weight: 200 800;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: "Newsreader";
    src: url("../fonts/newsreader-latin-italic.woff2") format("woff2");
    font-weight: 200 800;
    font-style: italic;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: "Libre Franklin";
    src: url("../fonts/libre-franklin-vietnamese-normal.woff2") format("woff2");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
    font-family: "Libre Franklin";
    src: url("../fonts/libre-franklin-vietnamese-italic.woff2") format("woff2");
    font-weight: 100 900;
    font-style: italic;
    font-display: swap;
    unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
    font-family: "Libre Franklin";
    src: url("../fonts/libre-franklin-latin-ext-normal.woff2") format("woff2");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: "Libre Franklin";
    src: url("../fonts/libre-franklin-latin-ext-italic.woff2") format("woff2");
    font-weight: 100 900;
    font-style: italic;
    font-display: swap;
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: "Libre Franklin";
    src: url("../fonts/libre-franklin-latin-normal.woff2") format("woff2");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: "Libre Franklin";
    src: url("../fonts/libre-franklin-latin-italic.woff2") format("woff2");
    font-weight: 100 900;
    font-style: italic;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- Tokens ---------- */

:root {
    --serif: var(--gh-font-heading, "Newsreader", Georgia, "Times New Roman", serif);
    --sans: var(--gh-font-body, "Libre Franklin", -apple-system, "Segoe UI", Helvetica, Arial, sans-serif);
    --ink: #1b1d20;
    --ink-soft: #4a4e54;
    --ink-faint: #6b7077;
    --paper: #f9f9f7;
    --rule: color-mix(in srgb, var(--ink) 11%, var(--paper));
    --rule-strong: color-mix(in srgb, var(--ink) 24%, var(--paper));
    --tint: color-mix(in srgb, var(--ink) 4.5%, var(--paper));
    --accent: var(--ghost-accent-color, #2a5080);   /* a softened Prussian blue */
    --accent-soft: color-mix(in srgb, var(--accent) 38%, transparent);
    --measure: 40rem;      /* 640px reading column */
    --measure-wide: 54rem;
    --site: 60rem;         /* the page frame: header, footer and every page */
    --gutter: 1.25rem;
    --sn-width: 15rem;     /* sidenote column */
    --sn-gap: 2.75rem;
    --title-size: clamp(1.9rem, 4.5vw, 2.3rem);   /* all page titles */
}

/* ---------- Base ---------- */

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

html { font-size: 100%; /* 16px */ -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--sans);
    font-weight: 400;
    line-height: 1.65;
    color: var(--ink);
    background: var(--paper);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.site-main { flex: 1; }

.wrap {
    max-width: calc(var(--measure) + 2 * var(--gutter));
    margin: 0 auto;
    padding: 0 var(--gutter);
}
.wrap-wide { max-width: calc(var(--measure-wide) + 2 * var(--gutter)); }

/* The site frame. Header, footer and every page share this width, so the
   name sits at its left edge and the menu at its right. Lists, the CV pages,
   About and the homepage masthead use all of it; running text keeps the
   reading measure and lines up on the frame's left edge, under the name. */
.wrap-site { max-width: calc(var(--site) + 2 * var(--gutter)); }
.post-article > *,
.page-article.reading > *,
.home-intro, .home-current, .home-selected,
.archive-description { max-width: var(--measure); }

h1, h2, h3, h4, h5, h6 {
    font-family: var(--serif);
    font-weight: 500;
    line-height: 1.2;
    letter-spacing: -0.012em;
    color: var(--ink);
    margin: 2.2em 0 0.6em;
}
h1 { font-size: 2.1rem; font-weight: 560; }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.18rem; }
h4 { font-size: 1.04rem; }

a {
    color: inherit;
    text-decoration: underline;
    text-decoration-color: var(--accent-soft);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.2em;
    transition: text-decoration-color 120ms ease, color 120ms ease;
}
a:hover { text-decoration-color: var(--accent); color: var(--accent); }

.eyebrow {
    display: block;
    font-family: var(--sans);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-faint);
    margin: 0 0 0.8rem;
}
.eyebrow a { text-decoration: none; color: inherit; }
.eyebrow a:hover { color: var(--accent); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; }
}
@media (prefers-reduced-motion: no-preference) {
    html { scroll-behavior: smooth; }
}

/* Solid button: contact form submit */
.button {
    display: inline-block;
    font-family: var(--sans);
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    line-height: 1.2;
    color: var(--paper);
    background: var(--ink);
    border: 0;
    border-radius: 4px;
    padding: 0.7em 1.5em;
    cursor: pointer;
    text-decoration: none;
    transition: background 120ms ease;
}
.button:hover { background: var(--accent); color: var(--paper); }
.button:disabled { opacity: 0.5; cursor: default; }

/* ---------- Header / footer ---------- */

.site-header { border-bottom: 1px solid var(--rule); }
/* Name on the left, menu on the right, sharing one row across the site
   frame. Where the window is too narrow for both (or the menu grows), the
   menu drops to a row of its own under the name. */
.site-header-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem 1.25rem;
    padding-top: 1.4rem;
    padding-bottom: 1.25rem;
}
.site-title {
    font-family: var(--serif);
    font-size: 1.7rem;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.015em;
    text-decoration: none;
}
@media (max-width: 620px) {
    .site-title { font-size: 1.5rem; }
}
.site-logo { max-height: 2rem; width: auto; display: block; }

.site-nav ul, .footer-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1.35rem;
}
.site-nav ul { gap: 0.45rem 1.15rem; }

/* Main nav: small tracked capitals; the current page carries a hairline. */
.site-nav a {
    font-size: 0.76rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-decoration: none;
    color: var(--ink-soft);
    padding-bottom: 0.2em;
    border-bottom: 1px solid transparent;
    white-space: nowrap;   /* "Public Engagement" stays in one piece */
}
.site-nav a:hover { color: var(--accent); }
.site-nav .nav-current a { color: var(--ink); border-bottom-color: var(--accent); }
/* Phones, where the menu sits under the name: break it into rows of even
   length (3 + 3, 4 + 4) so no item is left alone on a last row. The items
   become words in a line of text, which the browser can balance; a browser
   without text-wrap: balance wraps them in the ordinary way. */
@media (max-width: 620px) {
    .site-nav ul { display: block; text-wrap: balance; word-spacing: 0.9rem; margin-bottom: -0.45rem; }
    .site-nav li { display: inline-block; word-spacing: normal; margin-bottom: 0.45rem; }
}
/* Small phones: set the menu a touch tighter. */
@media (max-width: 420px) {
    .site-nav ul { word-spacing: 0.7rem; }
    .site-nav a { font-size: 0.72rem; letter-spacing: 0.06em; }
}

.footer-nav a {
    font-size: 0.9rem;
    text-decoration: none;
    color: var(--ink-soft);
}
.footer-nav a:hover { color: var(--accent); }

.site-footer { border-top: 1px solid var(--rule); margin-top: 5rem; }
.site-footer-inner {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.5rem 1.5rem;
    padding-top: 1.5rem;
    padding-bottom: 2.2rem;
}
.footer-nav-label { margin-bottom: 0.5rem; font-size: 0.64rem; }

/* Footer link groups: "#"-prefixed items in Secondary navigation become headings.
   One group keeps its links in a row; several groups become columns. */
.footer-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem 3rem;
}
.footer-group:not(:only-child) .nav {
    flex-direction: column;
    gap: 0.3rem;
}

.footer-meta {
    margin: 0;
    font-size: 0.82rem;
    color: var(--ink-faint);
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1.25rem;
}
.footer-meta:only-child { margin-left: auto; }
.footer-meta a { text-decoration: none; color: inherit; }
.footer-meta a:hover { color: var(--accent); }

/* ---------- Homepage ---------- */

.home { padding-top: 4.5rem; padding-bottom: 3rem; }

.home-name {
    font-size: clamp(2.2rem, 6vw, 3rem);
    font-weight: 600;
    letter-spacing: -0.02em;
    margin: 0;
}
.home-tagline {
    font-family: var(--sans);
    font-size: 1.05rem;
    font-weight: 450;
    color: var(--ink-soft);
    margin: 0.6rem 0 0;
}

.home-masthead.has-photo {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
}
.home-masthead-text { min-width: 0; }
.home-photo {
    flex: none;
    width: 8.5rem;
    height: 8.5rem;
    border-radius: 50%;
    object-fit: cover;
    object-position: 50% 25%;
    background: var(--rule);
}
@media (max-width: 620px) {
    .home-masthead.has-photo { gap: 1rem; }
    .home-photo { width: 5.25rem; height: 5.25rem; }
}

/* "Black-and-white portraits" setting: applies to the homepage and About
   portraits whatever the uploaded file looks like. */
.portraits-bw .home-photo,
.portraits-bw .about-photo img { filter: grayscale(1); }

.home-intro { margin-top: 2.6rem; }
.home-intro p {
    font-size: 1.1rem;
    line-height: 1.7;
    margin: 0;
}

.home-current {
    margin-top: 2.8rem;
    padding: 1.1rem 1.25rem;
    border-left: 2px solid var(--accent);
    background: var(--tint);
}
.home-current .eyebrow { margin-bottom: 0.35rem; }
.home-current p { margin: 0; font-size: 0.96rem; color: var(--ink-soft); }
.home-current-link { white-space: nowrap; font-size: 0.88rem; }

.home-selected { margin-top: 3.6rem; }
.home-selected-list { border-top: 1px solid var(--rule); }
.selected-item { padding: 1.35rem 0; border-bottom: 1px solid var(--rule); }
.selected-item-title { font-size: 1.25rem; margin: 0; }
.selected-item-title a { text-decoration: none; }
.selected-item-title a:hover { color: var(--accent); }
.selected-item-excerpt { margin: 0.4rem 0 0; color: var(--ink-soft); font-size: 0.96rem; }
.selected-item-meta { margin: 0.5rem 0 0; font-size: 0.8rem; color: var(--ink-faint); }
.home-all-link { margin-top: 1.4rem; font-size: 0.92rem; }
.home-all-link a { text-decoration: none; color: var(--ink-soft); }
.home-all-link a:hover { color: var(--accent); }

/* Home page body: whatever is written in the page whose URL is "home"
   appears under the intro. Ordinary text keeps the reading measure; the
   homepage blocks above (eyebrow, selected items, link line) can be reused
   in an HTML card and look the same as the built-in sections. */
.home-body { margin-top: 3.6rem; }
.home-body > * { max-width: var(--measure); }
.home-body > .home-selected { margin-top: 3.6rem; }
.home-body > .home-selected:first-child { margin-top: 0; }
.home-body .eyebrow { margin: 0 0 0.8rem; }
.home-body .selected-item-title { font-size: 1.25rem; margin: 0; }
.home-body .selected-item-excerpt { margin: 0.4rem 0 0; }
.home-body .selected-item-meta { margin: 0.5rem 0 0; }
.home-body .home-all-link { margin: 1.4rem 0 1em; }
.home-note, .home-body .home-note { margin: 0; color: var(--ink-soft); }

/* ---------- Archive / writing index ---------- */

.archive { padding-top: 3.5rem; padding-bottom: 3rem; }
.archive-title { margin: 0; font-size: var(--title-size); }
.archive-description { color: var(--ink-soft); margin: 0.8rem 0 0; }
.archive-header { margin-bottom: 2.4rem; }

.post-list { border-top: 1px solid var(--rule); }
.post-item {
    display: grid;
    grid-template-columns: 9.5rem 1fr;
    gap: 1.5rem;
    padding: 1.3rem 0;
    border-bottom: 1px solid var(--rule);
}
.post-item-date {
    font-size: 0.82rem;
    color: var(--ink-faint);
    padding-top: 0.35rem;
    font-variant-numeric: tabular-nums;
}
.post-item-title { font-size: 1.2rem; margin: 0; }
.post-item-title a { text-decoration: none; }
.post-item-title a:hover { color: var(--accent); }
.post-item-excerpt { margin: 0.35rem 0 0; color: var(--ink-soft); font-size: 0.94rem; }
.post-item-tag {
    display: inline-block;
    margin-top: 0.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-faint);
}

@media (max-width: 620px) {
    .post-item { grid-template-columns: 1fr; gap: 0.2rem; }
    .post-item-date { padding-top: 0; }
}

.pagination {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-top: 2.2rem;
    font-size: 0.9rem;
}
.pagination-info { color: var(--ink-faint); font-size: 0.82rem; }
.pagination-link { text-decoration: none; color: var(--ink-soft); }
.pagination-link:hover { color: var(--accent); }

/* ---------- Post & page ---------- */

.post-article, .page-article { padding-top: 3.5rem; padding-bottom: 3rem; }

.post-header { margin-bottom: 2.2rem; }
.post-title { margin: 0; font-size: var(--title-size); }
.post-subtitle {
    font-family: var(--serif);
    font-style: italic;
    font-size: 1.15rem;
    color: var(--ink-soft);
    margin: 0.7rem 0 0;
    line-height: 1.45;
}
.post-meta { margin: 1rem 0 0; font-size: 0.85rem; color: var(--ink-faint); }

.post-feature-image { margin: 0 0 2.4rem; }
.post-feature-image img { width: 100%; height: auto; display: block; }
.post-feature-image figcaption {
    font-size: 0.8rem;
    color: var(--ink-faint);
    margin-top: 0.5rem;
    text-align: center;
}

/* ---------- Post content ---------- */

.gh-content { font-size: 1rem; }
.gh-content > * + * { margin-top: 1.15em; }
.gh-content p { margin: 1.15em 0 0; }
.gh-content > :first-child { margin-top: 0; }

.gh-content blockquote {
    margin: 1.4em 0 0;
    padding-left: 1.25rem;
    border-left: 2px solid var(--rule-strong);
    font-family: var(--serif);
    font-style: italic;
    font-size: 1.02rem;
    color: var(--ink-soft);
}
.gh-content blockquote em { font-style: normal; }

/* Section break: a short centred rule */
.gh-content hr {
    border: 0;
    height: 1px;
    width: 4rem;
    margin: 2em auto;
    background: var(--rule-strong);
}

.gh-content ul, .gh-content ol { padding-left: 1.4rem; }
.gh-content li + li { margin-top: 0.35em; }

.gh-content img { max-width: 100%; height: auto; }
.gh-content figcaption { font-size: 0.8rem; color: var(--ink-faint); text-align: center; margin-top: 0.5rem; }

.gh-content pre {
    background: var(--tint);
    border: 1px solid var(--rule);
    border-radius: 4px;
    padding: 1rem 1.1rem;
    overflow-x: auto;
    font-size: 0.85rem;
    line-height: 1.55;
}
.gh-content code { font-size: 0.88em; background: var(--tint); padding: 0.1em 0.3em; border-radius: 3px; }
.gh-content pre code { background: none; padding: 0; }

.gh-content table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}
.gh-content th, .gh-content td {
    text-align: left;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--rule);
}
.gh-content th { font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; }

/* Ghost width cards. Inside a reading column they grow to the right, into
   the free part of the site frame: "wide" to 54rem, "full" to the frame. */
.kg-width-wide, .kg-width-full { margin-left: 0; margin-right: 0; }
@media (min-width: 1000px) {
    .post-article .kg-width-wide,
    .reading .kg-width-wide {
        margin-right: calc(var(--measure) - var(--measure-wide));
        clear: both;
    }
    .post-article .kg-width-full,
    .reading .kg-width-full {
        margin-right: calc(var(--measure) - var(--site));
        clear: both;
    }
}

/* ---------- Sidenotes ---------- */

.sn-ref {
    cursor: pointer;
    vertical-align: super;
    line-height: 0;
    font-size: 0.68em;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
    padding: 0 0.1em;
}
.sn-ref:hover { text-decoration: underline; }

.sn-note {
    display: none;
    font-size: 0.8rem;
    line-height: 1.5;
    color: var(--ink-soft);
    overflow-wrap: anywhere;   /* archival URLs and shelfmarks can be long */
}
.sn-note .sn-num { font-weight: 700; color: var(--accent); margin-right: 0.35em; }
.sn-note p { margin: 0 0 0.4em; display: inline; }

/* Wide: notes float into the free part of the site frame, to the right of
   the reading column: 40rem of text + 2.75rem gap + 15rem of note = 57.75rem,
   inside the 60rem frame. The frame is at full width from 1000px (60rem +
   two gutters), so that is the breakpoint. Keep it in step with the
   matchMedia query in sidenotes.js. */
@media (min-width: 1000px) {
    body.has-sidenotes .sn-note {
        display: block;
        float: right;
        clear: right;
        width: var(--sn-width);
        margin-right: calc(-1 * (var(--sn-width) + var(--sn-gap)));
        margin-top: 0.2em;
        margin-bottom: 0.8rem;
    }
    body.has-sidenotes .footnotes,
    body.has-sidenotes .sn-source { display: none; }
}

/* Narrow: tap to reveal inline */
@media (max-width: 999.98px) {
    .sn-note.is-open {
        display: block;
        margin: 0.6rem 0;
        padding: 0.7rem 0.9rem;
        border-left: 2px solid var(--accent);
        background: var(--tint);
    }
}

/* Endnote list styling (visible on narrow screens / no-JS) */
.footnotes, .sn-source {
    margin-top: 3rem;
    padding-top: 1.2rem;
    border-top: 1px solid var(--rule);
    font-size: 0.85rem;
    color: var(--ink-soft);
    overflow-wrap: anywhere;
}
.footnotes hr, .sn-source hr { display: none; }

/* ---------- Post footer ---------- */

.post-footer {
    margin-top: 3rem;
    padding-top: 1.2rem;
    border-top: 1px solid var(--rule);
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.5rem 1.5rem;
    font-size: 0.85rem;
}
.post-tags { margin: 0; }
.post-tags a { text-decoration: none; color: var(--ink-soft); text-transform: uppercase; font-size: 0.7rem; letter-spacing: 0.1em; font-weight: 600; }
.post-tags a:hover { color: var(--accent); }
.post-back { margin: 0; }
.post-back a { text-decoration: none; color: var(--ink-soft); }
.post-back a:hover { color: var(--accent); }

/* ---------- Sectioned pages (Now, Research, CV) ----------
   Author these as: H2 for each section, then paragraphs or lists. */

.cv-body h2, .research-body h2, .now-body h2 {
    font-family: var(--sans);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-soft);
    border-bottom: 1px solid var(--rule);
    padding-bottom: 0.45rem;
    margin-top: 2.6em;
}
.cv-body h3, .research-body h3, .now-body h3 { font-size: 1.05rem; margin-top: 1.6em; }
.cv-body > :first-child, .research-body > :first-child, .now-body > :first-child { margin-top: 0; }
.cv-body h2 { scroll-margin-top: 1.5rem; }

/* CV: section buttons. On the CV template these are built from the page's
   H2 headings (assets/js/sections.js); an HTML card may also bring its own
   <nav class="cv-nav"> with hand-written links. */
.cv-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0 0 2.4rem;
}
.cv-nav[hidden] { display: none; }
.cv-body .cv-nav { margin-bottom: 1rem; }
.cv-nav a {
    display: inline-block;
    font-size: 0.92rem;
    font-weight: 500;
    line-height: 1;
    padding: 0.55em 0.95em;
    border: 1px solid var(--rule);
    border-radius: 999px;
    background: var(--tint);
    color: var(--ink-soft);
    text-decoration: none;
    transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}
.cv-nav a:hover, .cv-nav a:focus-visible {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--paper);
}
@media (max-width: 620px) {
    .cv-nav { justify-content: center; }
}

/* CV: plain entries, no markers */
.cv-body ul { list-style: none; padding-left: 0; }
.cv-body li + li { margin-top: 0.5em; }

/* CV: optional date-column entries, for pages written as an HTML card:
     <div class="cv-item">
       <div class="cv-when">2024–2026</div>
       <div class="cv-what"><p class="cv-head">…</p><p class="cv-desc">…</p></div>
     </div>
   plus .cv-sub (italic subsection), .cv-cite (hanging-indent citation),
   .cv-note, and .cv-cols / .cv-tags (three short lists side by side).
   Pages written as headings and lists do not need any of these. */
.cv-body .cv-sub {
    font-family: var(--serif);
    font-style: italic;
    font-weight: 500;
    font-size: 1.05rem;
    color: var(--ink-soft);
    margin: 1.9em 0 0.2em;
}
.cv-body h2 + .cv-sub { margin-top: 1.1em; }
.cv-body .cv-item {
    display: grid;
    grid-template-columns: 8.5rem minmax(0, 1fr);
    column-gap: 1.5rem;
    margin-top: 0.95em;
}
.cv-body h2 + .cv-item, .cv-body .cv-sub + .cv-item { margin-top: 0.7em; }
.cv-body .cv-when {
    font-size: 0.82rem;
    line-height: 1.5;
    color: var(--ink-faint);
    font-variant-numeric: tabular-nums;
    padding-top: 0.28em;
    text-align: right;
}
.cv-body .cv-what p { margin: 0; }
.cv-body .cv-head { line-height: 1.5; }
.cv-body .cv-what .cv-desc {
    margin-top: 0.25em;
    font-size: 0.93rem;
    line-height: 1.55;
    color: var(--ink-soft);
}
.cv-body .cv-cite {
    margin-top: 0.7em;
    padding-left: 1.6rem;
    text-indent: -1.6rem;
    font-size: 0.97rem;
    line-height: 1.55;
}
.cv-body .cv-sub + .cv-cite { margin-top: 0.4em; }
.cv-body .cv-note {
    font-style: italic;
    color: var(--ink-soft);
    font-size: 0.93rem;
    margin-top: 0.7em;
}
.cv-body .cv-cols {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    column-gap: 2.5rem;
}
.cv-body .cv-cols h2 { margin-top: 2.6em; }
.cv-body .cv-tags { list-style: none; padding: 0; margin: 0.6em 0 0; }
.cv-body .cv-tags li { font-size: 0.93rem; line-height: 1.5; color: var(--ink-soft); margin: 0; }
.cv-body .cv-tags li + li { margin-top: 0.3em; }
@media (max-width: 760px) {
    .cv-body .cv-cols { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
    .cv-body .cv-item { grid-template-columns: 1fr; row-gap: 0.1em; }
    .cv-body .cv-when { text-align: left; padding-top: 0; }
}

/* Research: bibliographies. Bulleted lists become unnumbered entries with a
   hanging indent, so Chicago-style citations wrap under their first line;
   numbered lists keep a small grey number in the hanging position. */
.research-body ul, .research-body ol {
    list-style: none;
    padding-left: 0;
}
.research-body li {
    padding-left: 2em;
    text-indent: -2em;
}
.research-body li + li { margin-top: 0.65em; }
.research-body ol { counter-reset: pub; }
.research-body ol > li { counter-increment: pub; }
.research-body ol > li::before {
    content: counter(pub) ".";
    display: inline-block;
    width: 2em;
    text-indent: 0;
    color: var(--ink-faint);
    font-variant-numeric: tabular-nums;
}
.research-body li p { display: inline; }   /* editor sometimes wraps items */

@media print {
    .site-header, .site-footer, .post-back, .cv-print, .cv-nav { display: none !important; }
    .cv-body .cv-item { break-inside: avoid; }
    body { background: #fff; color: #000; font-size: 10.5pt; }
    .wrap, .wrap-wide, .wrap-site { max-width: none; padding: 0; }
    .post-article > *, .page-article.reading > * { max-width: none; }
    a { text-decoration: none; color: inherit; }
    .post-article, .page-article { padding-top: 0; }
}

/* ---------- About page ----------
   Portrait (the page's feature image) in a column beside the text: on the
   left by default, on the right with the internal tag #photo-right. It
   keeps its own proportions, so a tall photograph is not cropped. */

.tpl-about:not(.has-photo) .about-layout { max-width: var(--measure); }
.tpl-about.has-photo .about-layout {
    display: grid;
    grid-template-columns: 15rem minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    grid-template-areas:
        "photo header"
        "photo body";
    column-gap: 3rem;
}
.tpl-about.has-photo.photo-right .about-layout {
    grid-template-columns: minmax(0, 1fr) 15rem;
    grid-template-areas:
        "header photo"
        "body   photo";
}
.about-header { grid-area: header; }
.about-body { grid-area: body; }
.about-photo {
    grid-area: photo;
    margin: 0.45rem 0 0;   /* top edge level with the title's capitals */
}
.about-photo img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 0.25rem;
    background: var(--rule);
}
.about-photo figcaption {
    font-size: 0.8rem;
    color: var(--ink-faint);
    margin-top: 0.5rem;
}
@media (max-width: 720px) {
    .tpl-about.has-photo .about-layout,
    .tpl-about.has-photo.photo-right .about-layout {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto;
        grid-template-areas:
            "header"
            "photo"
            "body";
    }
    .tpl-about.has-photo .about-header { margin-bottom: 1.5rem; }
    .about-photo { max-width: 15rem; margin: 0 0 1.8rem; }
}

/* ---------- Contact page ---------- */

.contact-intro:empty { display: none; }
.tpl-contact .contact-form {
    display: grid;
    gap: 1.2rem;
    max-width: 34rem;
    margin-top: 2.2rem;
    justify-items: start;
}
.contact-intro:empty + .contact-form { margin-top: 0; }
.contact-field { display: grid; gap: 0.45rem; width: 100%; }
.contact-form label {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-soft);
}
.contact-form input,
.contact-form textarea {
    font-family: var(--sans);
    font-size: 1rem;
    line-height: 1.5;
    color: var(--ink);
    width: 100%;
    padding: 0.6em 0.8em;
    border: 1px solid color-mix(in srgb, var(--ink) 50%, var(--paper));
    border-radius: 4px;
    background: var(--tint);
    transition: border-color 120ms ease;
}
.contact-form input:hover,
.contact-form textarea:hover { border-color: var(--ink); }
.contact-form input:focus,
.contact-form textarea:focus {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
    border-color: var(--accent);
}
.contact-form textarea { min-height: 10em; resize: vertical; display: block; }
.contact-status { margin: 0; font-size: 0.9rem; color: var(--ink-soft); }
.contact-status:empty { display: none; }
.contact-status.is-error { color: #a3271f; }

/* ---------- Error pages ---------- */

.error-page { padding-top: 5rem; padding-bottom: 4rem; }
.error-page .post-title { font-size: 4rem; margin-bottom: 0.5rem; }

/* ---------- Post template variants & options ---------- */

/* Wide template: broader measure, endnotes instead of margin notes */
.tpl-wide { --measure: var(--measure-wide); }

/* Serif body option (headings unchanged; notes stay in the sans) */
.body-serif .gh-content { font-family: var(--serif); font-size: 1.14rem; line-height: 1.58; }
.body-serif .gh-content .sn-note,
.body-serif .footnotes, .body-serif .sn-source { font-family: var(--sans); }

/* Drop cap option */
.has-dropcap .gh-content > p:first-of-type::first-letter {
    font-family: var(--serif);
    float: left;
    font-size: 3.4em;
    line-height: 0.82;
    font-weight: 500;
    padding: 0.06em 0.1em 0 0;
}
