/* ./html/style/site.css
 * Site styles, loaded after tufte.css on every page (see partials/head.php).
 *
 * Sections:
 *   0. Colours and themes     (all pages)
 *   1. Site header            (all pages)
 *   2. Catalogue              (body.page-catalogue)
 *   3. Article pages          (body.page-article)
 *
 * Page sections are scoped with :where(), so they add no specificity.
 */


/* ===================================================================
   0. Colours and themes
   =================================================================== */

/* Every colour is a variable here. The dark theme follows the reader's system setting, unless the toggle in
   the top nav (theme.js) has set <html data-theme="light|dark">. Its values are repeated for the two cases. */
:root {
    color-scheme: light;
    --page: #fffff8;
    --paper: #fdfaef;
    --paper-edge: #e7dfc9;
    --panel: #f3eedf;
    --panel-edge: #ddd3b9;
    --panel-hover: #e9e2cd;
    --ink: #1a1712;
    --ink-soft: #4a4438;
    --ink-muted: #6b6455;
    --ink-faint: #a39a87;
    --rule: #d8d2c4;
    --accent: #8a2b1d;
    --link: #0b5394;
    --scan-bg: #d6d0bf;
    --shadow-rgb: 60, 45, 10;
    /* Scans are photographs of paper: dimmed a little on a dark page, never inverted */
    --scan-dim: brightness(1);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --page: #1a1814;
        --paper: #23201a;
        --paper-edge: #3a3428;
        --panel: #2a261f;
        --panel-edge: #463f32;
        --panel-hover: #353026;
        --ink: #e8e1d1;
        --ink-soft: #c9c0ad;
        --ink-muted: #a39a87;
        --ink-faint: #7a7262;
        --rule: #3d382f;
        --accent: #d9826f;
        --link: #8db8e8;
        --scan-bg: #3a352c;
        --shadow-rgb: 0, 0, 0;
        --scan-dim: brightness(0.85);
    }
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --page: #1a1814;
    --paper: #23201a;
    --paper-edge: #3a3428;
    --panel: #2a261f;
    --panel-edge: #463f32;
    --panel-hover: #353026;
    --ink: #e8e1d1;
    --ink-soft: #c9c0ad;
    --ink-muted: #a39a87;
    --ink-faint: #7a7262;
    --rule: #3d382f;
    --accent: #d9826f;
    --link: #8db8e8;
    --scan-bg: #3a352c;
    --shadow-rgb: 0, 0, 0;
    --scan-dim: brightness(0.85);
}

/* tufte.css's own colours */
html,
body {
    background-color: var(--page);
    color: var(--ink);
}

hr {
    border-top-color: var(--rule);
}


/* ===================================================================
   1. Site header
   =================================================================== */

/* ---- Masthead: the site name as a logo, on a double-ruled plaque ---- */
.site-masthead {
    margin: 3rem 12.5% 0 0;
    text-align: center;
}

.site-logo {
    display: inline-block;
    padding: 5px;
    color: var(--ink);
    text-decoration: none;
    background: var(--paper);
    border: 1px solid var(--ink);
    box-shadow: 0 1px 0 var(--paper-edge), 0 2px 6px rgba(var(--shadow-rgb), 0.08);
}

.site-logo-name {
    display: block;
    padding: 0.55rem 1.6rem 0.6rem;
    border: 1px solid var(--ink);
    font-size: 2.1rem;
    line-height: 1;
    font-variant: small-caps;
    letter-spacing: 0.12em;
    white-space: nowrap;
}

/* Diamond ornaments flanking the name */
.site-logo-name::before,
.site-logo-name::after {
    content: "\25C6";
    display: inline-block;
    margin: 0 0.7em;
    font-size: 0.4em;
    vertical-align: middle;
    color: var(--accent);
    letter-spacing: 0;
}

.site-logo:hover .site-logo-name,
.site-logo:focus-visible .site-logo-name {
    border-color: var(--accent);
}

/* Dagger after the name, glossed by the address beneath the plaque like a footnote */
.site-logo-mark {
    margin-left: 0.08em;
    font-size: 0.5em;
    vertical-align: super;
    line-height: 0;
    letter-spacing: 0;
}

.site-masthead-note {
    margin: 0.6rem 0 0;
    font-size: 0.95rem;
    font-style: italic;
    letter-spacing: 0.03em;
    color: var(--ink-muted);
}

/* ---- Primary nav: a centred band between hairline rules ---- */
.site-nav {
    margin: 1.5rem 12.5% 0 0;
    border-top: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
}

.site-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0 2.5rem;
}

.site-nav li {
    margin: 0;
    padding: 0;
}

.site-nav a {
    display: block;
    padding: 0.55rem 0.1rem 0.45rem;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    text-decoration: none;
    background: none;
    text-shadow: none;
    color: var(--ink-muted);
    font-size: 1rem;
    font-variant: small-caps;
    letter-spacing: 0.1em;
}

.site-nav a:hover {
    color: var(--ink);
}

.site-nav a[aria-current="page"] {
    color: var(--ink);
    border-bottom-color: var(--accent);
}

@media (max-width: 760px) {
    .site-masthead,
    .site-nav {
        margin-right: 0;
    }

    .site-logo-name {
        font-size: 1.6rem;
        padding: 0.5rem 0.9rem;
    }

    .site-nav ul {
        gap: 0 1.1rem;
    }
}

/* ---- Light/dark toggle (theme.js); it shows the theme it switches to. Kept in the nav's markup but pinned to the
        bottom-left corner of the window (clear of the scans, which take the right), so it can be used anywhere in a
        text without scrolling back to the top ---- */
.site-nav .site-nav-theme {
    position: fixed;
    left: max(1rem, env(safe-area-inset-left));
    bottom: max(1rem, env(safe-area-inset-bottom));
    z-index: 30;
    display: flex;
    align-items: center;
}

.site-nav .site-nav-theme[hidden] {
    display: none;
}

.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.4rem;
    height: 2.4rem;
    padding: 0;
    color: var(--ink-muted);
    line-height: 0;
    background: var(--panel);
    border: 1px solid var(--panel-edge);
    border-radius: 50%;
    box-shadow: 0 6px 16px -10px rgba(var(--shadow-rgb), 0.5);
    cursor: pointer;
}

.theme-toggle svg {
    width: 1.05rem;
    height: 1.05rem;
}

.theme-toggle:hover {
    color: var(--ink);
}

.theme-icon-light {
    display: none;
}

:root[data-theme="dark"] .theme-icon-light {
    display: inline;
}

:root[data-theme="dark"] .theme-icon-dark {
    display: none;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-icon-light {
        display: inline;
    }

    :root:not([data-theme="light"]) .theme-icon-dark {
        display: none;
    }
}

/* Pinned to the window, it would land on every printed page */
@media print {
    .site-nav .site-nav-theme {
        display: none;
    }
}

/* ---- The date a page was printed and its URL (topnav.php), under the masthead ---- */
.print-stamp {
    display: none;
}

@media print {
    .print-stamp:not(:empty) {
        display: block;
        margin: 0.4rem 0 0;
        font-size: 0.85rem;
        font-style: italic;
        color: var(--ink-muted);
        overflow-wrap: anywhere;
    }
}

/* ---- Sidenote markers: an inline block, which would otherwise take its paragraph's first-line indent and
        leave a gap before the number ---- */
label.sidenote-number {
    text-indent: 0;
}

/* ---- Margin-note figures (mn() in data.php): image above its caption ---- */
.marginnote > img {
    display: block;
    filter: var(--scan-dim);
    max-width: 100%;
    height: auto;
    margin-bottom: 0.5rem;
}

/* ---- About page: embedded talk video ---- */
.about-video video {
    display: block;
    width: 100%;
    height: auto;
}


/* ===================================================================
   2. Catalogue
   =================================================================== */

/* ---- "Newly added" and "Last edited" ($newly_added and $last_edited in data.php), above the cards ---- */
:where(.page-catalogue) .spotlight {
    margin: 0 12.5% 2rem 0;
    padding: 0 0 0 1.25rem;
    border-left: 3px solid var(--accent);
}
:where(.page-catalogue) .spotlight-byline {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1rem;
    margin: 0;
    font-size: 0.8rem;
    color: var(--ink-muted);
}
:where(.page-catalogue) .spotlight-label {
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--accent);
}
:where(.page-catalogue) .spotlight-title {
    margin: 0.35rem 0 0.4rem;
    font-size: 1.6rem;
    font-style: normal;
    line-height: 1.25;
}
:where(.page-catalogue) .spotlight-title a {
    color: var(--ink);
    text-decoration: none;
}
:where(.page-catalogue) .spotlight-title a:hover {
    text-decoration: underline;
}
:where(.page-catalogue) .spotlight-summary {
    margin: 0;
    width: auto;
    font-size: 1.05rem;
    line-height: 1.5;
    color: var(--ink-soft);
}

/* ---- Toolbar: a card holding search, the Filters toggle, its panel and the count ---- */
:where(.page-catalogue) .catalogue-tools {
    margin: 0 12.5% 2.5rem 0;
    padding: 1.25rem 1.5rem 1rem;
    background: var(--panel);
    border: 1px solid var(--panel-edge);
    border-radius: 6px;
}
:where(.page-catalogue) .tools-row {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
}
:where(.page-catalogue) .search-field {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
}
:where(.page-catalogue) .search-field label {
    display: block;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--ink-muted);
    margin-bottom: 0.35rem;
}
:where(.page-catalogue) .search-field input {
    width: 100%;
    box-sizing: border-box;
    font: inherit;
    font-family: et-book, Palatino, "Palatino Linotype", "Book Antiqua", Georgia, serif;
    font-size: 1.25rem;
    color: var(--ink);
    background: transparent;
    border: 0;
    border-bottom: 2px solid var(--ink);
    border-radius: 0;
    padding: 0.35rem 2rem 0.35rem 0;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}
:where(.page-catalogue) .search-field input::placeholder {
    color: var(--ink-faint);
    font-style: italic;
}
:where(.page-catalogue) .search-field input:focus {
    border-bottom-color: var(--accent);
}
:where(.page-catalogue) .search-field input::-webkit-search-cancel-button {
    cursor: pointer;
}
:where(.page-catalogue) .search-field kbd {
    position: absolute;
    right: 0;
    bottom: 0.55rem;
    font-family: inherit;
    font-size: 0.75rem;
    color: var(--ink-muted);
    border: 1px solid var(--panel-edge);
    border-radius: 3px;
    padding: 0 0.35rem;
    pointer-events: none;
}
:where(.page-catalogue) .search-field input:focus ~ kbd,
:where(.page-catalogue) .search-field input:not(:placeholder-shown) ~ kbd {
    display: none;
}

/* ---- Filters toggle ---- */
:where(.page-catalogue) .filter-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    flex: none;
    font: inherit;
    font-size: 0.9rem;
    color: var(--ink);
    background: var(--paper);
    border: 1px solid var(--panel-edge);
    border-radius: 999px;
    padding: 0.4rem 0.95rem;
    cursor: pointer;
}
:where(.page-catalogue) .filter-toggle:hover {
    border-color: var(--ink-muted);
}
:where(.page-catalogue) .filter-toggle:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
:where(.page-catalogue) .filter-toggle::after {
    content: "";
    width: 0.4em;
    height: 0.4em;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: translateY(-0.15em) rotate(45deg);
    transition: transform 0.15s ease;
}
:where(.page-catalogue) .filter-toggle[aria-expanded="true"]::after {
    transform: translateY(0.1em) rotate(-135deg);
}
/* The full-text search's submit button: the toggle's look, without its chevron */
:where(.page-search) .search-submit::after {
    content: none;
}
:where(.page-catalogue) .filter-badge {
    min-width: 1.3em;
    padding: 0 0.3em;
    font-size: 0.75rem;
    line-height: 1.3em;
    text-align: center;
    color: var(--paper);
    background: var(--accent);
    border-radius: 999px;
}
:where(.page-catalogue) .filter-badge[hidden] {
    display: none;
}

/* ---- Filter panel: sort and category ---- */
:where(.page-catalogue) .filter-panel {
    display: grid;
    gap: 0.75rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--panel-edge);
}
:where(.page-catalogue) .filter-panel[hidden] {
    display: none;
}
:where(.page-catalogue) .filter-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 1rem;
}
:where(.page-catalogue) .filter-label {
    flex: 0 0 5.5rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--ink-muted);
}
:where(.page-catalogue) .sort-controls,
:where(.page-catalogue) .category-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
:where(.page-catalogue) .sort-link,
:where(.page-catalogue) .category-filter button {
    font: inherit;
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--ink);
    text-decoration: none;
    background: var(--paper);
    border: 1px solid var(--panel-edge);
    border-radius: 999px;
    padding: 0.2rem 0.8rem;
    cursor: pointer;
}
:where(.page-catalogue) .sort-link:hover,
:where(.page-catalogue) .category-filter button:hover:not(:disabled) {
    border-color: var(--ink-muted);
}
:where(.page-catalogue) .sort-link.active,
:where(.page-catalogue) .category-filter button[aria-pressed="true"] {
    color: var(--paper);
    background: var(--ink);
    border-color: var(--ink);
}
:where(.page-catalogue) .sort-link.active {
    pointer-events: none;
}
:where(.page-catalogue) .category-filter button:disabled {
    color: var(--ink-faint);
    background: transparent;
    cursor: default;
}
:where(.page-catalogue) .category-filter .n {
    color: var(--ink-muted);
    margin-left: 0.2rem;
}
:where(.page-catalogue) .category-filter button[aria-pressed="true"] .n {
    color: inherit;
    opacity: 0.7;
}
:where(.page-catalogue) .result-count {
    margin: 0.85rem 0 0;
    font-size: 0.85rem;
    color: var(--ink-muted);
}

/* ---- Card grid ---- */
:where(.page-catalogue) section > ul.clip-grid {
    width: auto;
    padding: 0;
    margin: 0 12.5% 0 0;
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr));
    grid-auto-flow: dense;
    gap: 2rem 1.75rem;
}
:where(.page-catalogue) .clip-grid > li {
    margin: 0;
}
:where(.page-catalogue) .clip-grid > li[hidden] {
    display: none;
}

/* ---- A card is a newspaper clipping ---- */
:where(.page-catalogue) .clip {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 1.1rem 1.3rem 0.9rem;
    background: var(--paper);
    border: 1px solid var(--paper-edge);
    box-shadow:
        0 1px 0 rgba(var(--shadow-rgb), 0.05),
        0 10px 24px -18px rgba(var(--shadow-rgb), 0.45);
    color: var(--ink);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
:where(.page-catalogue) .clip:hover,
:where(.page-catalogue) .clip:focus-within {
    transform: translateY(-3px);
    box-shadow:
        0 1px 0 rgba(var(--shadow-rgb), 0.05),
        0 18px 30px -18px rgba(var(--shadow-rgb), 0.55);
}
:where(.page-catalogue) .clip:focus-within {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

:where(.page-catalogue) .clip-byline {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    margin: 0;
    font-size: 0.72rem;
    line-height: 1.3;
    color: var(--ink-muted);
    white-space: nowrap;
    overflow: hidden;
}
:where(.page-catalogue) .clip-pub {
    font-weight: 600;
    color: var(--ink);
    overflow: hidden;
    text-overflow: ellipsis;
}
:where(.page-catalogue) .clip-date {
    flex-shrink: 0;
    margin-left: auto;
}

:where(.page-catalogue) .clip-headline {
    margin: 0.7rem 0 0;
    font-size: 1.45rem;
    font-weight: 700;
    font-style: normal;
    line-height: 1.15;
    text-align: center;
    text-wrap: balance;
}
:where(.page-catalogue) .clip-headline a {
    text-decoration: none;
    color: inherit;
    outline: none;
}
/* Whole card is clickable via the headline link */
:where(.page-catalogue) .clip-headline a::after {
    content: "";
    position: absolute;
    inset: 0;
}
:where(.page-catalogue) .clip:hover .clip-headline a {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.15em;
}

:where(.page-catalogue) .clip-dinkus {
    width: 2.5rem;
    height: 0;
    margin: 0.75rem auto 0.85rem;
    border: 0;
    border-top: 1px solid var(--ink);
}

:where(.page-catalogue) .clip-body {
    flex: 1;
    margin: 0;
    max-height: 11.5em;
    overflow: hidden;
    font-size: 0.98rem;
    line-height: 1.45;
    text-align: justify;
    -webkit-hyphens: auto; /* Safari */
    hyphens: auto;
    -webkit-mask-image: linear-gradient(to bottom, #000 65%, transparent);
    mask-image: linear-gradient(to bottom, #000 65%, transparent);
}
:where(.page-catalogue) .clip-body::first-letter {
    float: left;
    font-size: 3.1em;
    line-height: 0.85;
    padding: 0.08em 0.08em 0 0;
    font-weight: 700;
    color: var(--accent);
}
/* A card with a scan splits down the middle: text on the left, scan on the right. A fixed height and a row
   that can't outgrow it: with only a max-height, Safari lets the row grow to fit the whole text, which then
   runs out of the card. */
:where(.page-catalogue) .clip-split {
    flex: none;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: minmax(0, 1fr);
    gap: 0.75rem;
    height: 13em;
    overflow: hidden;
}
:where(.page-catalogue) .clip .clip-split .clip-body {
    max-height: none;
    columns: auto;
    column-rule: none;
}
:where(.page-catalogue) .clip-scan {
    /* Zoomed in, so the print reads as print; card_position in data.json picks the spot */
    background: var(--scan-bg) 15% 12% / 190% auto no-repeat;
    filter: grayscale(0.35) contrast(1.05) var(--scan-dim);
}
:where(.page-catalogue) .clip-body.is-summary {
    font-style: italic;
    color: var(--ink-soft);
}
:where(.page-catalogue) .clip-body.is-summary::first-letter {
    float: none;
    font-size: inherit;
    line-height: inherit;
    padding: 0;
    font-weight: inherit;
    color: inherit;
}

:where(.page-catalogue) .clip-foot {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    margin: 0.75rem 0 0;
    padding-top: 0.5rem;
    border-top: 1px solid var(--paper-edge);
    font-size: 0.78rem;
    color: var(--ink-muted);
}
:where(.page-catalogue) .clip-foot .read-more {
    color: var(--accent);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
:where(.page-catalogue) .pending-tag {
    font-style: italic;
}

/* A collection (a work in several parts) is a small stack of clippings */
:where(.page-catalogue) .is-collection .clip,
:where(.page-catalogue) .is-collection .clip:hover,
:where(.page-catalogue) .is-collection .clip:focus-within {
    box-shadow:
        4px 4px 0 -1px var(--paper),
        4px 4px 0 0 var(--paper-edge),
        8px 8px 0 -1px var(--paper),
        8px 8px 0 0 var(--paper-edge),
        0 10px 24px -18px rgba(var(--shadow-rgb), 0.45);
}

/* Featured pieces get a double-width front-page slot */
@media (min-width: 900px) {
    :where(.page-catalogue) .clip-grid > li.is-featured {
        grid-column: span 2;
    }
    :where(.page-catalogue) .is-featured .clip-headline {
        font-size: 1.9rem;
    }
    :where(.page-catalogue) .is-featured .clip-body {
        columns: 2;
        column-gap: 1.75rem;
        column-rule: 1px solid var(--paper-edge);
        max-height: 13em;
    }
}

:where(.page-catalogue) .no-results {
    width: auto;
    margin: 3rem 12.5% 0 0;
    text-align: center;
    font-style: italic;
    color: var(--ink-muted);
}

/* "Search the full text →" beside the count, once something is typed */
:where(.page-catalogue) .full-text-link {
    margin-left: 0.25em;
    color: inherit;
}

/* ---- Full-text search results (search.php): one entry per text, with its matching passages ---- */
:where(.page-search) section > ol.search-results {
    width: auto;
    margin: 0 12.5% 0 0;
    padding: 0;
    list-style: none;
}
:where(.page-search) .search-results > li {
    margin: 0 0 2.25rem;
    padding: 0 0 1.75rem;
    border-bottom: 1px solid var(--rule);
}
:where(.page-search) .search-byline {
    margin: 0 0 0.3rem;
    font-size: 0.8rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--ink-muted);
}
:where(.page-search) .search-title {
    margin: 0 0 0.75rem;
    font-size: 1.6rem;
    font-style: normal;
}
:where(.page-search) .search-title a {
    color: var(--ink);
    text-decoration: none;
}
:where(.page-search) .search-snippet {
    width: auto;
    margin: 0 0 0.9rem;
    font-size: 1.15rem;
    line-height: 1.45;
}
:where(.page-search) .search-snippet a {
    color: var(--ink-soft);
    text-decoration: none;
}
:where(.page-search) .search-snippet a:hover {
    color: var(--ink);
}
:where(.page-search) .search-heading {
    display: block;
    margin-bottom: 0.15rem;
    font-size: 0.8rem;
    color: var(--ink-muted);
}
:where(.page-search) .search-snippet mark {
    padding: 0 0.1em;
    background: var(--panel-hover);
    color: var(--ink);
    border-bottom: 2px solid var(--accent);
}
:where(.page-search) .search-more summary {
    width: fit-content;
    margin: 0 0 0.9rem;
    font-size: 0.8rem;
    color: var(--ink-muted);
    cursor: pointer;
}

@media (max-width: 760px) {
    :where(.page-search) section > ol.search-results {
        margin-right: 0;
    }
}

@media (max-width: 760px) {
    :where(.page-catalogue) section > ul.clip-grid,
    :where(.page-catalogue) .no-results {
        padding-right: 0;
        margin-right: 0;
    }
}

@media (max-width: 760px) {
    :where(.page-catalogue) .catalogue-tools {
        margin-right: 0;
        padding: 1rem 1rem 0.85rem;
    }
    :where(.page-catalogue) .spotlight {
        margin-right: 0;
        padding-left: 1rem;
    }
    :where(.page-catalogue) .filter-label {
        flex-basis: 100%;
    }    :where(.page-catalogue) .search-field kbd {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    :where(.page-catalogue) .filter-toggle::after {
        transition: none;
    }
    :where(.page-catalogue) .clip {
        transition: none;
    }
    :where(.page-catalogue) .clip:hover,
    :where(.page-catalogue) .clip:focus-within {
        transform: none;
    }
}


/* ===================================================================
   3. Article pages (articles, pending transcriptions, scans)
   =================================================================== */

/* ---- Newspaper styling for the article body ---- */
:where(.page-article) article p {
    text-indent: 1.5em;
}

:where(.page-article) .centered {
    text-align: center;
}

:where(.page-article) section>h1,
:where(.page-article) section>h2,
:where(.page-article) section>h3 {
    max-width: 500px;
    width: 100%;
    text-align: center;
    font-style: normal;
}

:where(.page-article) h1 { font-size: 2rem; }
:where(.page-article) h2 { font-size: 1.8rem; }
:where(.page-article) h3 { font-size: 1.6rem; }

/* A minor heading at the size of the text, such as the title of each recipe in a book of secrets */
:where(.page-article) section>h4 {
    max-width: 500px;
    width: 100%;
    margin: 2rem 0 0.8rem;
    font-size: 1.4rem;
    font-weight: normal;
    font-style: normal;
    line-height: 1.25;
    text-align: center;
}

:where(.page-article) p {
    max-width: 500px;
    width: 100%;
    text-align: justify;
    font-kerning: none;
    letter-spacing: -0.01em;
    line-height: 1.2;
}

:where(.page-article) section>p {
    width: 100%;
}

@media (max-width: 760px) {
    :where(.page-article) section>h1,
    :where(.page-article) section>h2,
    :where(.page-article) section>h3 {
        max-width: 100%;
    }
}

/* ---- Article pages: the header shrinks to one quiet line (name left, nav right) over the text
        column, so the article title leads; the catalogue, About and Contribute keep the full one ---- */
body:where(.page-article) > header {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.25rem 1.5rem;
    max-width: 500px;
    margin: 1.75rem 0 2.5rem;
    padding-bottom: 0.45rem;
    border-bottom: 1px solid var(--panel-edge);
}

body:where(.page-article) .site-masthead {
    margin: 0;
    text-align: left;
}

body:where(.page-article) .site-logo {
    padding: 0;
    background: none;
    border: 0;
    box-shadow: none;
}

body:where(.page-article) .site-logo-name {
    padding: 0;
    border: 0;
    font-size: 1.05rem;
    letter-spacing: 0.1em;
}

body:where(.page-article) .site-logo-name::before {
    margin: 0 0.6em 0 0;
}

body:where(.page-article) .site-logo-name::after {
    content: none;
}

body:where(.page-article) .site-logo-mark,
body:where(.page-article) .site-masthead-note {
    display: none;
}

body:where(.page-article) .site-logo:hover .site-logo-name,
body:where(.page-article) .site-logo:focus-visible .site-logo-name {
    color: var(--accent);
}

body:where(.page-article) > header .site-nav {
    margin: 0;
    border: 0;
}

body:where(.page-article) .site-nav ul {
    gap: 0 1.1rem;
}

body:where(.page-article) .site-nav a {
    padding: 0;
    margin: 0;
    border: 0;
    font-size: 0.95rem;
}

body:where(.page-article) > article {
    padding-top: 0;
}

/* ---- Title, with the cog menu beside it ---- */
:where(.page-article) .article-top {
    position: relative;
    max-width: 500px;
}

:where(.page-article) .article-top > h1,
:where(.page-article) .article-top > h2,
:where(.page-article) .article-top > h3 {
    width: auto;
    max-width: none;
    margin: 0;
    padding: 0 2.75rem;
    font-size: 2.3rem;
    line-height: 1.15;
    font-weight: 400;
    font-style: normal;
    text-align: center;
    text-wrap: balance;
}

/* ---- Cog menu: scans, source, markdown, GitHub, summary ---- */
:where(.page-article) .page-tools {
    position: absolute;
    top: 0.2rem;
    right: 0;
}

:where(.page-article) .page-tools-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    list-style: none;
    color: var(--ink-muted);
    border: 1px solid transparent;
    border-radius: 999px;
    cursor: pointer;
}

:where(.page-article) .page-tools-button::-webkit-details-marker {
    display: none;
}

:where(.page-article) .page-tools-button:hover,
:where(.page-article) .page-tools[open] > .page-tools-button {
    color: var(--ink);
    background: var(--panel);
    border-color: var(--panel-edge);
}

:where(.page-article) .page-tools-button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

:where(.page-article) .page-tools[open] svg {
    transform: rotate(45deg);
}

:where(.page-article) .page-tools svg {
    transition: transform 0.2s ease;
}

:where(.page-article) .page-tools-menu {
    position: absolute;
    top: calc(100% + 0.4rem);
    right: 0;
    z-index: 20;
    width: 19rem;
    max-width: calc(100vw - 2rem);
    padding: 0.25rem 0 0.4rem;
    background: var(--panel);
    border: 1px solid var(--panel-edge);
    border-radius: 6px;
    box-shadow: 0 10px 24px -12px rgba(var(--shadow-rgb), 0.45);
    font-size: 0.9rem;
}

:where(.page-article) .page-tools-menu p.menu-heading {
    width: auto;
    max-width: none;
    margin: 0;
    padding: 0.6rem 1rem 0.2rem;
    text-indent: 0;
    text-align: left;
    font-size: 0.68rem;
    line-height: 1.4;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-muted);
}

:where(.page-article) .page-tools-menu p.menu-heading:not(:first-child) {
    margin-top: 0.3rem;
    border-top: 1px solid var(--panel-edge);
    padding-top: 0.65rem;
}

:where(.page-article) .page-tools-menu ul {
    list-style: none;
    font-size: inherit;
    line-height: 1.4;
    width: auto;
    margin: 0;
    padding: 0;
}

:where(.page-article) .page-tools-menu li {
    margin: 0;
    padding: 0;
    font-size: inherit;
}

/* One row: a plain link, or the summary of a disclosure (chevron on the right) */
:where(.page-article) .page-tools-menu .menu-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.4rem 1rem;
    color: var(--ink);
    text-decoration: none;
    background: none;
    text-shadow: none;
    list-style: none;
    cursor: pointer;
}

:where(.page-article) .page-tools-menu .menu-item::-webkit-details-marker {
    display: none;
}

:where(.page-article) .page-tools-menu .menu-item:hover,
:where(.page-article) .page-tools-menu .menu-item:focus-visible {
    background: var(--panel-hover);
    outline: none;
}

:where(.page-article) .menu-disclosure > summary::after {
    content: "";
    width: 0.38em;
    height: 0.38em;
    margin-right: 0.15em;
    border-right: 1.5px solid var(--ink-muted);
    border-bottom: 1.5px solid var(--ink-muted);
    transform: translateY(-0.1em) rotate(45deg);
    transition: transform 0.15s ease;
}

:where(.page-article) .menu-disclosure[open] > summary::after {
    transform: translateY(0.12em) rotate(-135deg);
}

/* What a disclosure reveals: the source URL, the summary, or the citation and Copy */
:where(.page-article) .page-tools-menu .menu-reveal {
    width: auto;
    max-width: none;
    margin: 0 1rem 0.5rem;
    padding: 0.5rem 0.65rem;
    text-indent: 0;
    text-align: left;
    font-size: 0.8rem;
    line-height: 1.45;
    letter-spacing: 0;
    font-kerning: auto;
    color: var(--ink-soft);
    background: var(--paper);
    border: 1px solid var(--panel-edge);
    border-radius: 4px;
}

:where(.page-article) .menu-reveal p {
    width: auto;
    max-width: none;
    margin: 0;
    text-indent: 0;
    text-align: left;
    font-size: inherit;
    line-height: inherit;
}

:where(.page-article) .page-tools-menu .source-link {
    color: var(--link);
    overflow-wrap: anywhere;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
    background: none;
    text-shadow: none;
}

/* ---- Citation: "Cite this page" in the cog menu opens it beneath the title (cite.js; :target without JS) ---- */
:where(.page-article) .title-citation:not(.open):not(:target) {
    display: none;
}

:where(.page-article) .title-citation {
    max-width: 500px;
    margin: 0.9rem 0 0;
    padding: 0.7rem 0.9rem 0.6rem;
    background: var(--paper);
    border: 1px solid var(--panel-edge);
    font-size: 0.85rem;
    line-height: 1.5;
}

:where(.page-article) .title-citation p {
    width: auto;
    margin: 0;
    text-align: left;
    text-indent: 0;
    hyphens: none;
    font-size: inherit;
    line-height: inherit;
}

:where(.page-article) .title-citation a {
    color: inherit;
    overflow-wrap: anywhere;
    background: none;
    text-shadow: none;
}

:where(.page-article) .title-citation .cite-copy {
    display: block;
    margin: 0.5rem 0 0 auto;
    font: inherit;
    font-size: 0.8rem;
    color: var(--ink);
    background: var(--panel);
    border: 1px solid var(--panel-edge);
    border-radius: 999px;
    padding: 0.15rem 0.8rem;
    cursor: pointer;
}

:where(.page-article) .title-citation .cite-copy:hover {
    border-color: var(--ink-muted);
}

:where(.page-article) .title-citation .cite-copy[hidden] {
    display: none;
}

/* ---- Dateline under the title: publication, date and page ---- */
:where(.page-article) p.dateline {
    max-width: 500px;
    margin: 1rem 0 1.25rem;
    padding: 0.35rem 0;
    border-top: 1px solid var(--ink);
    border-bottom: 1px solid var(--ink);
    text-indent: 0;
    text-align: center;
    font-size: 0.8rem;
    line-height: 1.5;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-muted);
}

:where(.page-article) .dateline-pub {
    color: var(--ink);
}

:where(.page-article) .dateline-sep {
    margin: 0 0.5rem;
}

/* "Summary" at the end of the dateline opens the summary beneath it (cite.js; :target without JS) */
:where(.page-article) .dateline-more {
    white-space: nowrap;
}

:where(.page-article) .summary-toggle {
    color: inherit;
    text-decoration: none;
    background: none;
    text-shadow: none;
}

:where(.page-article) .summary-toggle::after {
    content: " \25BE";
}

:where(.page-article) .summary-toggle[aria-expanded="true"]::after {
    content: " \25B4";
}

:where(.page-article) .summary-toggle:hover,
:where(.page-article) .summary-toggle[aria-expanded="true"] {
    color: var(--ink);
}

:where(.page-article) .dateline-summary:not(.open):not(:target) {
    display: none;
}

:where(.page-article) p.dateline-summary {
    max-width: 500px;
    margin: -0.5rem 0 1.5rem;
    text-indent: 0;
    font-size: 1.05rem;
    font-style: italic;
    line-height: 1.5;
    color: var(--ink-muted);
}

/* ---- Editor's notes (notes.php): Tufte sidenotes, lettered a, b, c… so they don't look like the
        author's own numbered footnotes ---- */
:where(.page-article) > article {
    counter-reset: editor-note-counter;
}

:where(.page-article) label.editor-note-number {
    counter-increment: editor-note-counter;
}

/* The works the editor's notes cite, after the text: a hanging indent, no bullets */
:where(.page-article) .editor-references ul {
    list-style: none;
    padding-left: 0;
}
:where(.page-article) .editor-references li {
    padding-left: 2rem;
    text-indent: -2rem;
    font-size: 1.1rem;
    line-height: 1.5;
}

/* An author's footnote marker straight after a note's letter */
:where(.page-article) .editor-note + .footnote-ref {
    margin-left: 0.15rem;
}

:where(.page-article) label.editor-note-number::after,
:where(.page-article) .editor-note::before {
    content: counter(editor-note-counter, lower-alpha);
    color: var(--accent);
    font-style: italic;
}

:where(.page-article) .editor-note::before {
    content: counter(editor-note-counter, lower-alpha) "\00a0\00a0";
}

:where(.page-article) .editor-note {
    color: var(--ink-soft);
    font-style: normal;
    text-align: left;
    text-indent: 0;
    hyphens: none;
}

/* A note anchored in italic text (a quotation) is still set in roman */
:where(.page-article) .editor-note em {
    font-style: italic;
}

/* In verse (an indented blockquote), line the note up with those beside paragraphs: Tufte places blockquote
   sidenotes for a full-width quotation, which here would push them off the page. Phones use Tufte's toggles. */
@media (min-width: 761px) {
    :where(.page-article) blockquote:has(.editor-note) {
        max-width: 460px;
    }

    :where(.page-article) blockquote .editor-note {
        width: 250px;
        min-width: 0;
        margin-right: -300px;
        font-size: 1.1rem;
    }
}

/* ---- Collections: "Part of" under the dateline, the parts' navigation and the contents page ---- */
:where(.page-article) p.collection-line {
    max-width: 500px;
    margin: -0.75rem 0 1.25rem;
    text-align: center;
    font-size: 0.85rem;
    color: var(--ink-muted);
}

:where(.page-article) nav.part-nav {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 1rem;
    max-width: 500px;
    margin: 3rem 0 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--ink);
    font-size: 0.9rem;
}

:where(.page-article) .part-next {
    text-align: right;
}

:where(.page-collection) ol.collection-contents {
    padding-left: 0;
    list-style: none;
}

:where(.page-collection) .collection-contents li {
    margin-bottom: 1.25rem;
}

:where(.page-collection) .collection-contents p {
    margin: 0;
    text-indent: 0;
}

:where(.page-collection) .contents-entry {
    font-size: 1.3rem;
}

:where(.page-collection) .contents-page {
    margin-left: 0.5rem;
    font-size: 0.8rem;
    color: var(--ink-muted);
}

:where(.page-collection) .contents-summary {
    font-size: 1.05rem;
    color: var(--ink-muted);
}

/* ---- Original scans: beside the text on wide screens (open by default: body.scans-auto),
        and in place of the text on narrow screens at /<slug>/scans (body.show-scans) ---- */
body:where(.page-article):not(.show-scans):not(.scans-auto) .scan-panel {
    display: none;
}

@media (max-width: 999px) {
    body:where(.page-article).scans-auto:not(.show-scans) .scan-panel {
        display: none;
    }
}

@media (min-width: 1000px) {
    /* Fill the space left of the scans, with the 500px text column pushed right so
       only a 2.5rem gap separates it from the panel */
    body:where(.page-article):is(.show-scans, .scans-auto) {
        width: 52vw;
        max-width: none;
        margin-left: 0;
        padding-left: max(3vw, calc(52vw - 500px - 2.5rem));
        padding-right: 2.5rem;
    }

    /* --scan-top: just above where the text starts (set by article.js), so the scans begin below the title */
    :where(.page-article) .scan-panel {
        position: fixed;
        top: var(--scan-top, 0);
        right: 0;
        bottom: 0;
        width: 48vw;
        overflow-y: auto;
        padding: 0 1.5rem 2rem;
        box-sizing: border-box;
        background: var(--panel);
        border-left: 1px solid var(--rule);
        z-index: 10;
    }

    :where(.page-article) .scan-panel-bar {
        position: sticky;
        top: 0;
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: auto;
        max-width: none;
        margin: 0 -1.5rem 1rem;
        padding: 0.6rem 1.5rem;
        background: var(--panel);
        border-bottom: 1px solid var(--rule);
        font-size: 0.85rem;
        text-indent: 0;
    }
}

:where(.page-article) .scan-panel-bar button {
    font: inherit;
    color: var(--ink-muted);
    background: none;
    border: 0;
    cursor: pointer;
}

:where(.page-article) .scan-panel-bar button:hover {
    color: var(--ink);
}

:where(.page-article) .scan-panel img {
    display: block;
    filter: var(--scan-dim);
    width: 100%;
    margin: 0 0 1.5rem;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
}

@media (max-width: 999px) {
    body:where(.page-article).show-scans article > section:not(.article-head) {
        display: none;
    }

    :where(.page-article) .scan-panel-bar {
        display: flex;
        justify-content: space-between;
        align-items: center;
        max-width: 500px;
        margin: 0 0 1rem;
        text-indent: 0;
        font-size: 0.85rem;
        color: var(--ink-muted);
    }
}

/* ---- The scans button under the dateline ---- */
:where(.page-article) p.article-actions {
    max-width: 500px;
    margin: 0 0 1rem;
    text-indent: 0;
    text-align: center;
    font-size: 0.85rem;
    line-height: 1.5;
    letter-spacing: 0;
}

:where(.page-article) .scans-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--ink);
    text-decoration: none;
    background: var(--panel);
    border: 1px solid var(--panel-edge);
    border-radius: 999px;
    padding: 0.25rem 0.9rem;
    text-shadow: none;
}

:where(.page-article) .scans-toggle::before {
    content: "";
    width: 0.75em;
    height: 0.9em;
    border: 1.5px solid currentColor;
    border-radius: 1px;
    box-shadow: 2px 2px 0 -0.5px var(--panel), 2px 2px 0 1px currentColor;
}

:where(.page-article) .scans-toggle:hover {
    border-color: var(--ink-muted);
}

:where(.page-article) .scans-toggle:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ---- Editions (e.g. reading and diplomatic) of one source ---- */
:where(.page-article) p.edition-switch {
    max-width: 500px;
    margin: 0 0 0.75rem;
    text-indent: 0;
    text-align: center;
    font-size: 0.85rem;
    line-height: 1.5;
    letter-spacing: 0;
    color: var(--ink-muted);
}

:where(.page-article) .edition-switch a {
    color: var(--ink-muted);
}

:where(.page-article) .edition-switch strong {
    color: var(--ink);
    font-weight: normal;
}

/* ---- Editorial notes in a transcription (source, conventions) ---- */
:where(.page-article) .editorial-note {
    max-width: 500px;
    margin: 0 0 2.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--rule);
}

:where(.page-article) .editorial-note p {
    text-indent: 0;
    text-align: left;
    font-size: 1.05rem;
    line-height: 1.45;
    color: var(--ink-muted);
}

/* ---- Scans as a PDF: embedded on wide screens, a link on narrow ones ---- */
:where(.page-article) .scan-pdf {
    display: block;
    width: 100%;
    height: calc(100vh - 4.5rem);
    border: 0;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
}

:where(.page-article) .scan-pdf-link {
    display: none;
}

@media (max-width: 999px) {
    :where(.page-article) .scan-pdf {
        display: none;
    }

    :where(.page-article) .scan-pdf-link {
        display: block;
        text-indent: 0;
        text-align: center;
        font-size: 1rem;
    }
}

@media (max-width: 760px) {
    :where(.page-article) .article-top > h1,
    :where(.page-article) .article-top > h2,
    :where(.page-article) .article-top > h3 {
        font-size: 1.9rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    :where(.page-article) .page-tools svg,
    :where(.page-article) .menu-disclosure > summary::after {
        transition: none;
    }
}

.toc { list-style: none; padding-left: 0; font-size: 1.1rem; }
.toc li { margin: 0.2rem 0; }
/* ---- An English translation beside the text (?view=both, body.show-translation): a row per paragraph, the
        text left and the translation right on wide screens, the translation under the text on narrow ones ---- */
:where(.page-article) .parallel-translation {
    color: var(--ink-soft);
    padding-left: 1rem;
    border-left: 2px solid var(--rule);
}

@media (min-width: 1000px) {
    body:where(.page-article).show-translation:not(.show-scans) {
        width: auto;
        max-width: none;
        margin: 0;
        padding: 0 2.5rem;
    }

    /* The header, the title block, the editorial notes and what follows the rows stay a centred 500px column */
    body:where(.page-article).show-translation:not(.show-scans) > header {
        margin-left: auto;
        margin-right: auto;
    }

    body:where(.page-article).show-translation:not(.show-scans) article > section > :not(.parallel) {
        margin-left: auto;
        margin-right: auto;
    }

    body:where(.page-article).show-translation:not(.show-scans) .footnotes {
        max-width: 500px;
    }

    body:where(.page-article).show-translation:not(.show-scans) .parallel-row {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 500px));
        justify-content: center;
        column-gap: 3rem;
    }

    body:where(.page-article).show-translation:not(.show-scans) .parallel-translation {
        padding-left: 0;
        border-left: 0;
    }
}

/* There's no margin for editor's notes beside two columns: a note opens under its line when its letter is clicked */
body:where(.page-article).show-translation .sidenote {
    display: none;
}

body:where(.page-article).show-translation .margin-toggle:checked + .sidenote {
    display: block;
    float: none;
    clear: none;
    position: static;
    width: auto;
    max-width: 500px;
    min-width: 0;
    margin: 0.5rem 0 0.75rem;
    font-size: 1.1rem;
    line-height: 1.4;
}

body:where(.page-article).show-translation label.margin-toggle {
    cursor: pointer;
}

/* ---- A collection's contents page ---- */
:where(.page-collection) .contents-entry {
    text-align: left;
}

/* ---- Commentary: an essay on one or more articles (commentary.php) ---- */
:where(.page-commentary) p.commentary-kind {
    max-width: 500px;
    margin: 0 0 0.5rem;
    text-align: center;
    font-size: 0.8rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

:where(.page-commentary) p.commentary-kind a {
    color: var(--ink-muted);
    text-decoration: none;
}

:where(.page-commentary) h1 {
    max-width: 500px;
    text-align: center;
}

:where(.page-commentary) p.commentary-about {
    max-width: 500px;
    margin: -0.75rem 0 1.5rem;
    text-align: center;
    font-size: 0.85rem;
    color: var(--ink-muted);
}

:where(.page-commentary) .commentary-draft {
    color: var(--accent);
}

:where(.page-commentary) ul.commentary-list {
    padding: 0;
    list-style: none;
}

:where(.page-commentary) ul.commentary-list li {
    margin-bottom: 2rem;
}

:where(.page-commentary) p.commentary-entry {
    margin-bottom: 0;
    font-size: 1.4rem;
}

:where(.page-commentary) ul.commentary-list p.commentary-about {
    margin-top: -0.75rem;
}

:where(.page-commentary) p.commentary-source {
    margin-top: 3rem;
    font-size: 0.85rem;
}
