/* =========================================================================
   The Complete Works of W. E. H. Lecky — base stylesheet
   Grayscale, serif, minimalist. No gradients, no drop-shadowed cards,
   no sepia tint. Inspired by Tufte-CSS / gwern.net's documented design
   principles; implemented independently.
   ========================================================================= */

@font-face {
  font-family: "Source Serif 4";
  src: url("/assets/fonts/source-serif-4-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("/assets/fonts/source-serif-4-latin-400-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("/assets/fonts/source-serif-4-latin-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("/assets/fonts/source-serif-4-latin-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("/assets/fonts/source-serif-4-latin-900-normal.woff2") format("woff2");
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Source Sans 3";
  src: url("/assets/fonts/source-sans-3-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Source Sans 3";
  src: url("/assets/fonts/source-sans-3-latin-400-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Source Sans 3";
  src: url("/assets/fonts/source-sans-3-latin-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Source Sans 3";
  src: url("/assets/fonts/source-sans-3-latin-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "UnifrakturMaguntia";
  src: url("/assets/fonts/unifraktur-maguntia.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  /* gwern.net's greyscale palette (its --GW-* colour variables) */
  --bg: #fff;
  --fg: #000;
  --fg-muted: #555;
  --fg-faint: #888;
  --border: #ccc;
  --border-strong: #aaa;
  --sidenote-bg: #f8f8f8;
  --code-bg: #f8f8f8;
  --link: #333;
  --link-underline: #aaa;
  --selection: #ccc;
  --measure: 42.5em;
  --font-serif: "Source Serif 4", "Iowan Old Style", "Palatino Linotype",
    Palatino, "Book Antiqua", Georgia, serif;
  --font-sans: "Source Sans 3", -apple-system, "Segoe UI", Helvetica, Arial,
    sans-serif;
}

:root[data-theme="dark"] {
  --bg: #000;
  --fg: #fff;
  --fg-muted: #b4b4b4;
  --fg-faint: #8a8a8a;
  --border: #5c5c5c;
  --border-strong: #6c6c6c;
  --sidenote-bg: #212121;
  --code-bg: #212121;
  --link: #dcdcdc;
  --link-underline: #6c6c6c;
  --selection: #444;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000;
    --fg: #fff;
    --fg-muted: #b4b4b4;
    --fg-faint: #8a8a8a;
    --border: #5c5c5c;
    --border-strong: #6c6c6c;
    --sidenote-bg: #212121;
    --code-bg: #212121;
    --link: #dcdcdc;
    --link-underline: #6c6c6c;
    --selection: #444;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-serif);
  font-size: 20px;
  line-height: 1.52;
  text-rendering: optimizeLegibility;
  font-kerning: normal;
}

::selection { background: var(--selection); }

a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-color: var(--link-underline);
  text-underline-offset: 0.12em;
  text-decoration-thickness: 1px;
}
a:hover { text-decoration-color: var(--fg); }
a.popup-ref { text-decoration-style: dotted; cursor: help; }

/* ---------- layout ---------- */

.site-header {
  padding: 1.4rem 1.5rem 0;
}

#floating-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 0.6rem 1.5rem;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--fg-muted);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  transform: translateY(-100%);
  transition: transform 0.2s ease;
}
#floating-header.visible { transform: translateY(0); }
#floating-header .site-mark { font-size: 1.5em; line-height: 1; flex-shrink: 0; }
#floating-header .floating-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--fg);
  font-weight: 600;
}
#floating-header .floating-sep { color: var(--fg-faint); }
#floating-header .floating-section {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-style: italic;
}
/* gwern.net header: a large blackletter logo and the links as a joined row of
   bordered small-caps buttons (a dotted-box grid on phones). */
.site-header nav {
  max-width: var(--measure);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.2rem;
}
.site-header .logo { text-decoration: none; background: none; line-height: 1; }
.site-mark {
  font-family: "UnifrakturMaguntia", var(--font-serif);
  font-weight: 400;
  color: var(--fg-muted);
}
.site-header .site-mark { font-size: 3.6rem; display: block; line-height: 0.9; }
.site-header .logo:hover .site-mark { color: var(--fg); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.site-header .site-links { display: flex; font-family: var(--font-serif); }
.site-header .site-links > * {
  border: 1px solid var(--border-strong);
  margin-left: -1px;
  padding: 0.3em 1em 0.35em;
  font-size: 1.05rem;
  font-variant-caps: small-caps;
  letter-spacing: 0.03em;
  color: var(--fg);
  text-decoration: none;
  background: none;
}
.site-header .site-links > a:hover { background: var(--sidenote-bg); }
#theme-toggle {
  font-family: var(--font-serif);
  cursor: pointer;
  border-radius: 0;
}
#theme-toggle:hover { background: var(--sidenote-bg); }
@media (max-width: 649px) {
  .site-header { padding: 0.9rem 1rem 0; }
  .site-header nav { gap: 0.8rem; }
  .site-header .site-mark { font-size: 3.2rem; }
  .site-header .site-links {
    display: grid;
    grid-template-columns: 1fr 1fr 2.4em;
    flex: 1;
  }
  .site-header .site-links > * {
    border-style: dotted;
    margin: 0 -1px -1px 0;
    text-align: center;
    padding: 0.35em 0.3em;
  }
  .site-header #theme-toggle { grid-column: 3; grid-row: 1 / span 2; }
}

main.article {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2.6rem 2rem 6rem;
}

.content {
  max-width: var(--measure);
  margin: 0 auto;
  position: relative;
}

/* page header / metadata block, gwern-style */
.page-meta {
  max-width: var(--measure);
  margin: 0 auto 2.6rem;
}
.page-meta h1 {
  /* gwern.net: centred, small caps, semibold */
  font-size: 2.5rem;
  font-weight: 600;
  font-variant-caps: small-caps;
  line-height: 1.15;
  letter-spacing: -1px;
  text-align: center;
  text-wrap: balance;
  margin: 0 0 0.6rem;
}
.page-meta h1 .subtitle {
  display: block;
  margin-top: 0.3em;
  font-size: 0.5em;
  letter-spacing: 0;
  font-variant-caps: normal; /* Source Serif 4 has no italic small caps */
}
@media (max-width: 649px) {
  .page-meta h1 { font-size: 2rem; }
}
.back-link { text-align: center; font-size: 0.9rem; }
.page-meta > .subtitle { text-align: center; }

/* chapter pages: gwern-style centred metadata lines instead of the table */
.page-metadata {
  text-align: center;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--fg-muted);
  margin: 1rem 0 2rem;
}
.page-metadata p { margin: 0 0 0.3em; }
.page-metadata .meta-label { font-variant-caps: small-caps; letter-spacing: 0.03em; color: var(--fg-faint); }
.page-meta .subtitle {
  font-style: italic;
  font-weight: 400;
  color: var(--fg-muted);
  font-size: 1.2rem;
  margin: 0 0 1rem;
}
.meta-table {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 0.6rem 0;
  font-size: 0.82rem;
  color: var(--fg-muted);
  font-family: var(--font-sans);
  display: grid;
  grid-template-columns: auto 1fr;
  row-gap: 0.3rem;
  column-gap: 0.9rem;
}
.meta-table dt { text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.78rem; }
.meta-table dd { margin: 0; }

.abstract {
  /* gwern.net: a plain bordered box, set beside the floated TOC */
  display: flow-root;
  font-size: 0.95rem;
  color: var(--fg);
  border: 1px solid var(--border-strong);
  padding: 0.8rem 1rem;
  margin-top: 1.2rem;
  position: relative;
  text-align: justify;
  hyphens: auto;
}
.abstract p { margin: 0 0 0.6em; }
.abstract p:last-child { margin-bottom: 0; }
.abstract em { color: var(--fg); }

/* ---------- typography ---------- */

.content h2 {
  font-size: 1.4rem;
  margin: 2.6rem 0 1rem;
  font-variant: small-caps;
  letter-spacing: 0.02em;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.3rem;
}
.content h3 {
  font-size: 1.12rem;
  margin: 2rem 0 0.8rem;
  font-style: italic;
  font-weight: 400;
}
.content p { margin: 0 0 1.15rem; }

/* gwern.net paragraph setting: justified, hyphenated, first-line indents and
   no space between paragraphs; no indent after a heading or other block. */
.content > p {
  margin: 0;
  text-indent: 2.5em;
  text-align: justify;
  hyphens: auto;
  -webkit-hyphens: auto;
}
.content > p * { text-indent: 0; }
.content > p:first-child,
.content > :is(h2, h3, .fleuron-head, blockquote, hr, details, ul, ol, div, pre, table, section) + p,
.content > :is(h2, h3, .section-argument) + figure + p,
.content > :is(h2, h3, .section-argument) + figure + figure + p,
.content > p.section-argument + p { text-indent: 0; }
.content > p + :is(blockquote, ul, ol, details, div, table, pre) { margin-top: 1.15rem; }
@media (max-width: 649px) {
  .content > p { text-align: left; text-indent: 1.75em; }
}

.dropcap {
  float: left;
  font-family: "UnifrakturMaguntia", var(--font-serif);
  font-size: 4.4em;
  line-height: 0.68;
  padding: 0.08em 0.1em 0 0;
  font-weight: 400;
}

.smallcaps,
.content p > .sc {
  font-variant: small-caps;
  letter-spacing: 0.02em;
}

blockquote {
  margin: 1.4rem 0 1.4rem 0;
  padding: 0.2rem 0 0.2rem 1.1rem;
  border-left: 2px solid var(--border-strong);
  color: var(--fg-muted);
  font-size: 0.97rem;
}
blockquote p:last-child { margin-bottom: 0; }

hr.chapter-break {
  width: 5em;
  margin: 2.8rem auto;
  border: none;
  border-top: 1px solid var(--border-strong);
}

/* collapsible asides — zero-JS progressive disclosure */
details.collapse {
  border: 1px solid var(--border);
  background: var(--sidenote-bg);
  border-radius: 2px;
  padding: 0.1rem 1rem;
  margin: 1.4rem 0;
  font-size: 0.95rem;
}
details.collapse summary {
  cursor: pointer;
  padding: 0.6rem 0;
  font-variant: small-caps;
  color: var(--fg-muted);
}
details.collapse[open] summary { border-bottom: 1px solid var(--border); }
details.collapse[open] summary ~ * { margin-top: 0.8rem; }

/* ---------- margin table of contents (wide screens only) ---------- */

.margin-toc {
  float: left;
  clear: left;
  width: 13em;
  margin-left: -15.5em;
  margin-top: 0.2em;
  padding-right: 1.3em;
  border-right: 1px solid var(--border);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  line-height: 1.5;
}
.margin-toc .margin-toc-label {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-faint);
  font-size: 0.7rem;
  margin: 0 0 0.5em;
}
.margin-toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
}
.margin-toc li { margin-bottom: 0.4em; }
.margin-toc a {
  text-decoration: none;
  color: var(--fg-muted);
}
.margin-toc a:hover { color: var(--fg); text-decoration: underline; }

@media (max-width: 1400px) {
  .margin-toc { display: none; }
}

/* collapsible in-text contents, for long pages on screens too narrow for the margin one */
details.inline-toc {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 0.3rem 0;
  margin: 0 0 1.8rem;
}
details.inline-toc summary {
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.72rem;
  color: var(--fg-faint);
  padding: 0.3rem 0;
}
details.inline-toc ol { columns: 2; column-gap: 2em; margin: 0.4rem 0 0.4rem; padding-left: 1.4em; }
details.inline-toc li { margin-bottom: 0.3em; break-inside: avoid; }
details.inline-toc a { color: var(--fg-muted); text-decoration: none; }
details.inline-toc a:hover { color: var(--fg); text-decoration: underline; }
@media (max-width: 600px) { details.inline-toc ol { columns: 1; } }
@media (min-width: 1401px) { details.inline-toc { display: none; } }

/* ---------- section arguments and figures ---------- */

/* Lecky's own synopsis line for a section, from his analytical table of contents */
.content > p.section-argument { text-indent: 0; text-align: left; hyphens: manual; }
.section-argument {
  font-size: 0.9rem;
  font-style: italic;
  line-height: 1.5;
  color: var(--fg-muted);
  margin: -0.35rem 0 1.5rem;
}
.abstract .editorial-note {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  color: var(--fg-faint);
  margin: 0.8rem 0 0;
}
.abstract p:first-child { margin-top: 0; }

.content h2, .content h3 {
  clear: right;        /* past right-floated figures, but beside the left TOC */
  display: flow-root;
}
.content figure.wide { clear: both; }

.content figure {
  margin: 2.2rem 0;
}
.content figure img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  border: 1px solid var(--border);
}
.content figure > a { display: block; text-decoration: none; background: none; }
.content figure.wide img { max-height: 85vh; }
.content figure.float-right {
  float: right;
  clear: right;
  width: 36%;
  max-width: 16em;
  margin: 0.4rem 0 1.2rem 1.6rem;
}
figcaption {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--fg-muted);
  margin-top: 0.6rem;
}
.content figure.wide figcaption { max-width: 34em; margin-left: auto; margin-right: auto; text-align: center; }
figcaption .credit {
  display: block;
  font-size: 0.7rem;
  color: var(--fg-faint);
  margin-top: 0.25rem;
}
figcaption .credit a { color: inherit; }
@media (min-width: 1100px) {
  .content figure.float-right { margin-right: -5.5em; }
  .content figure.wide { margin-left: -4em; margin-right: -4em; }
}
@media (max-width: 640px) {
  .content figure.float-right {
    float: none;
    width: auto;
    max-width: 75%;
    margin: 1.8rem auto;
  }
}
:root[data-theme="dark"] .content figure img { filter: brightness(0.85) contrast(1.05); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .content figure img { filter: brightness(0.85) contrast(1.05); }
}

/* ---------- footnotes ----------
   Ported from gwern.net's footnote styling (style.css: "Footnotes section",
   "Footnotes list", "Back-to-citation links"; gwern.net code is CC0/MIT --
   Gwern Branwen, Said Achmiz), remapped onto this site's grayscale palette.
   Markup is Pandoc-shaped (as gwern.net's is): a.footnote-ref > sup in the
   text, section.footnotes > hr + ol > li at the end, a.footnote-back in each. */

:root {
  --footnote-rule: var(--border-strong);   /* the section's top rule + ornament */
  --footnote-border: var(--fg-faint);      /* dotted number boxes, lines, ↑ boxes */
  --footnote-highlight: var(--fg-muted);
}

/* In-text marker */
a.footnote-ref {
  vertical-align: super;
  line-height: 0.3;
  position: relative;
  top: 0.05em;
  padding: 0 0.05em;
  margin-left: 0.125em;
  font-variant-numeric: lining-nums;
  font-weight: 600;
  text-decoration: none;
  z-index: 1;
  transition: box-shadow 0.15s ease 0.05s;
}
a.footnote-ref sup {
  font-size: 0.75em;
  vertical-align: baseline;
}
/* Expanded hover/tap area. */
a.footnote-ref::after {
  content: "";
  position: absolute;
  left: -40%;
  top: 5%;
  width: 180%;
  height: 120%;
}
/* Boxed outline on hover / while its popup is open / when jumped back to. */
a.footnote-ref.highlighted,
a.footnote-ref:hover,
a.footnote-ref:target {
  --o-v-o: 4px;
  --o-p: 4px;
  --o-h-s: 2px;
  box-shadow:
              var(--o-h-s)  var(--o-v-o) 0      var(--o-p)        var(--bg),
    calc(-1 * var(--o-h-s)) var(--o-v-o) 0      var(--o-p)        var(--bg),
              var(--o-h-s)  var(--o-v-o) 0 calc(var(--o-p) + 1px) var(--footnote-highlight),
    calc(-1 * var(--o-h-s)) var(--o-v-o) 0 calc(var(--o-p) + 1px) var(--footnote-highlight),
              var(--o-h-s)  var(--o-v-o) 0 calc(var(--o-p) + 2px) var(--bg),
    calc(-1 * var(--o-h-s)) var(--o-v-o) 0 calc(var(--o-p) + 2px) var(--bg),
              var(--o-h-s)  var(--o-v-o) 0 calc(var(--o-p) + 3px) var(--footnote-highlight),
    calc(-1 * var(--o-h-s)) var(--o-v-o) 0 calc(var(--o-p) + 3px) var(--footnote-highlight);
}

/* Footnotes section */
section.footnotes {
  position: relative;
  margin-top: 3.5rem;
  font-size: 0.92rem;
  line-height: 1.5;
}

/* Rule with the nested-square ornament in the middle. */
section.footnotes > hr:first-child {
  position: relative;
  display: flex;
  justify-content: center;
  clear: both;
  border: none;
  height: auto;
  margin: 0 0 1.5rem;
}
section.footnotes > hr:first-child::after {
  content: "";
  border: 1px solid var(--footnote-rule);
  width: 2em;
  height: 2em;
  background-color: var(--bg);
  z-index: 1;
  box-shadow:
    0 0 0 calc(0.5em - 1px) var(--bg) inset,
    0 0 0 0.5em var(--footnote-rule) inset;
}
section.footnotes > hr:first-child::before {
  content: "";
  position: absolute;
  height: 1px;
  background-color: var(--footnote-rule);
  width: 100%;
  top: 50%;
}

/* Footnotes list */
section.footnotes > ol {
  list-style: none;
  counter-reset: footnotes;
  margin: 0;
  padding-left: 2.625em;
}
section.footnotes > ol > li {
  position: relative;
  counter-increment: footnotes;
  min-height: calc(1.75em + 1px);
  padding: 6px 0 0.25em 0;
  margin-bottom: 1em;
  scroll-margin-top: 4rem; /* clear the floating header when jumped to */
}
section.footnotes > ol > li > p { margin: 0 0 0.6em; }
section.footnotes > ol > li > p:last-child { margin-bottom: 0; }

/* Footnote number box. */
section.footnotes > ol > li::before {
  content: counter(footnotes);
  position: absolute;
  right: calc(100% + 0.75em);
  top: calc(-0.125em + 5px);
  width: 1.75em;
  height: 1.75em;
  display: flex;
  justify-content: center;
  align-items: center;
  border: 1px dotted var(--footnote-border);
  border-right-color: transparent;
  line-height: 1;
  font-variant-numeric: lining-nums;
  z-index: 1;
}
/* Dotted vertical line running down from the number box. */
section.footnotes > ol > li::after {
  content: "";
  position: absolute;
  border-right: 1px dotted var(--footnote-border);
  height: calc(100% + 0.125em - 4px);
  top: calc(-0.125em + 5px);
  left: calc(-0.75em - 1px);
}

/* Highlighted: the note you just jumped to, or whose marker is hovered. */
section.footnotes > ol > li:target::before,
section.footnotes > ol > li:target::after,
section.footnotes > ol > li.highlighted::before,
section.footnotes > ol > li.highlighted::after {
  border-style: solid;
  border-color: var(--footnote-highlight);
  box-shadow:
    0 0 0 1px var(--bg) inset,
    0 0 0 2px var(--footnote-highlight) inset;
}
section.footnotes > ol > li:target::after,
section.footnotes > ol > li.highlighted::after {
  border-width: 0 3px 0 0;
  border-style: double;
  box-shadow: none;
  left: calc(-0.75em - 3px);
}

/* Boxed up-arrow back to the citation. */
section.footnotes a.footnote-back {
  position: relative;
  display: inline-block;
  margin: 0 0 0 0.5em;
  font-size: 1em;
  line-height: 0.5;
  border: 1px dotted var(--footnote-border);
  top: 0.1em;
  padding: 0.25em 0.3em;
  width: 0.7em;
  text-align: center;
  text-decoration: none;
  color: var(--fg-muted);
  font-family: var(--font-sans);
  z-index: 1;
}
section.footnotes a.footnote-back:hover {
  border-style: solid;
  border-color: var(--footnote-highlight);
  color: var(--fg);
  box-shadow:
    0 0 0 1px var(--bg) inset,
    0 0 0 2px var(--footnote-highlight) inset;
}

/* ---------- popups ----------
   Frame + title bar after gwern.net's popups (style.css: "Popup outer
   frame", "Popup title bar"; CC0/MIT). Footnote popups use the "mini"
   title bar (buttons only); cross-page previews get a full one with a title. */

.popup {
  position: absolute;
  z-index: 50;
  display: flex;
  flex-flow: column;
  max-width: min(40em, calc(100vw - 2rem));
  max-height: 480px;
  border: 3px double var(--border-strong);
  box-shadow: 1px 2px 8px 0 rgba(0, 0, 0, 0.2);
  background: var(--bg);
  color: var(--fg);
  font-size: 0.95rem;
  line-height: 1.5;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.12s ease, transform 0.12s ease;
}
:root[data-theme="dark"] .popup { box-shadow: 1px 2px 8px 0 rgba(0, 0, 0, 0.6); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .popup { box-shadow: 1px 2px 8px 0 rgba(0, 0, 0, 0.6); }
}
.popup.popup-above { transform: translateY(4px); }
.popup.popup-visible { opacity: 1; transform: translateY(0); }
.popup.pinned { border-color: var(--fg-muted); }

.popup .popframe-title-bar {
  flex: 0 0 auto;
  position: relative;
  height: calc(1.5rem + 1px);
  display: flex;
  flex-flow: row;
  align-items: center;
  border-bottom: 1px solid var(--border-strong);
  background-color: var(--bg);
  background-image: repeating-conic-gradient(var(--border) 0 25%, transparent 0 50%);
  background-size: 4px 4px;
  cursor: grab;
  user-select: none;
}
.popup.mini-title-bar .popframe-title-bar { height: calc(1rem + 1px); }
.popup.dragging .popframe-title-bar { cursor: grabbing; }

.popup .popframe-title {
  position: absolute;
  inset: 0 4.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  color: var(--fg);
  pointer-events: none;
}
.popup .popframe-title span {
  overflow: hidden;
  text-overflow: ellipsis;
  background: var(--bg);
  padding: 0 0.4em;
}
.popup.mini-title-bar .popframe-title { display: none; }

.popup .popframe-title-bar-button {
  appearance: none;
  background: var(--bg);
  border: none;
  margin: 0 0 0 1px;
  padding: 4px;
  height: 100%;
  width: 1.5rem;
  flex: 0 0 1.5rem;
  line-height: 0;
  cursor: pointer;
  color: var(--fg-faint);
  position: relative;
  z-index: 1;
}
.popup.mini-title-bar .popframe-title-bar-button {
  padding: 2px;
  width: 1rem;
  flex: 0 0 1rem;
}
.popup .popframe-title-bar-button:hover { color: var(--fg); }
.popup .popframe-title-bar-button:active { transform: scale(0.9); }
.popup .popframe-title-bar-button svg { width: 100%; height: 100%; display: block; }
.popup.pinned .pin-button { color: var(--fg); }

.popup .popframe-scroll-view {
  flex: 1 1 auto;
  overflow-y: auto;
}
.popup .popframe-content-view { padding: 0.7em 0.9em 0.8em; }
.popup .popframe-content-view p { margin: 0 0 0.6em; }
.popup .popframe-content-view > :last-child,
.popup .popframe-content-view p:last-child { margin-bottom: 0; }
.popup .popup-loading, .popin .popup-loading { color: var(--fg-faint); font-style: italic; }
.popup.collapsed .popframe-scroll-view { display: none; }

.popup .popup-more, .popin .popup-more { font-size: 0.85em; }
.popup .popframe-content-view h2 { font-size: 1.15rem; margin: 0 0 0.6em; font-variant: small-caps; border-bottom: 1px solid var(--border); padding-bottom: 0.2em; }
.popup .popframe-content-view details.collapse { font-size: 0.9em; }
.popup .wiki-thumb, .popin .wiki-thumb {
  float: right;
  max-width: 35%;
  max-height: 12em;
  margin: 0.2em 0 0.5em 0.9em;
  border: 1px solid var(--border);
}

/* Wikipedia popups and popins: the whole article (popups.js), as on gwern.net. */
.popup .popframe-scroll-view { overscroll-behavior: contain; }
.popup.wiki-popup { width: min(46em, calc(100vw - 2rem)); max-width: min(46em, calc(100vw - 2rem)); max-height: min(78vh, 760px); }
.popup .popframe-title a::after, .popin-title::after { display: none !important; }
.popup .popframe-title a { pointer-events: auto; color: var(--fg); text-decoration: none; }
.popup .popframe-title a:hover { text-decoration: underline; }
.popin.wiki-popin .popin-content { max-height: 75vh; overflow-y: auto; overscroll-behavior: contain; }
.wiki-article { font-size: 0.95em; }
.wiki-article a::after { display: none !important; }
.wiki-article .mw-heading { margin-top: 1.1em; }
.popup .wiki-article h2, .popin .wiki-article h2 { font-size: 1.1rem; margin: 0 0 0.5em; font-variant: small-caps; border-bottom: 1px solid var(--border); padding-bottom: 0.15em; }
.wiki-article h3 { font-size: 1rem; margin: 0.9em 0 0.3em; }
.wiki-article h4 { font-size: 0.95rem; margin: 0.8em 0 0.3em; font-style: italic; font-weight: normal; }
.wiki-article ul, .wiki-article ol { padding-left: 1.4em; margin: 0 0 0.6em; }
.wiki-article dl { margin: 0 0 0.6em; }
.wiki-article blockquote { margin: 0.6em 1.2em; font-size: 0.95em; }
.wiki-toc {
  clear: both;
  font-family: var(--font-sans);
  font-size: 0.8em;
  line-height: 1.8;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 0.35em 0;
  margin: 0.7em 0 0.9em;
}
.wiki-toc-label { font-weight: 700; margin-right: 0.3em; }
.wiki-toc a { white-space: nowrap; padding: 0 0.45em; border-left: 1px solid var(--border); }
.wiki-article .infobox {
  float: right;
  clear: right;
  width: auto !important;
  max-width: 42%;
  margin: 0 0 0.7em 1em;
  font-size: 0.78em;
  line-height: 1.35;
  border: 1px solid var(--border);
  border-collapse: collapse;
}
.wiki-article .infobox th, .wiki-article .infobox td { padding: 0.2em 0.4em; vertical-align: top; text-align: left; }
.wiki-article .infobox-above, .wiki-article .infobox caption { font-weight: 700; text-align: center !important; font-size: 1.1em; }
.wiki-article .infobox-image, .wiki-article .infobox-caption { text-align: center !important; }
.wiki-article figure, .wiki-article .thumb {
  float: right;
  clear: right;
  max-width: 38%;
  margin: 0.2em 0 0.7em 1em;
  font-size: 0.8em;
  line-height: 1.35;
  color: var(--fg-muted);
}
.wiki-article img { max-width: 100%; height: auto; }
.wiki-article figcaption { margin-top: 0.2em; }
.wiki-article table:not(.infobox) { display: block; overflow-x: auto; max-width: 100%; font-size: 0.82em; border-collapse: collapse; margin: 0.6em 0; }
.wiki-article table:not(.infobox) th, .wiki-article table:not(.infobox) td { border: 1px solid var(--border); padding: 0.2em 0.4em; }
.wiki-article .gallery { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 0.6em; }
.wiki-article .gallerybox { width: 9em; font-size: 0.8em; }
@media (max-width: 600px) {
  .wiki-article .infobox { float: none; max-width: 100%; margin: 0 auto 0.8em; }
  .wiki-article figure, .wiki-article .thumb { max-width: 45%; }
}

/* ---------- link icons ----------
   After gwern.net's link icons (links.css): a small, faint glyph after a
   link saying where it goes. Drawn with mask-image so it takes the text
   colour in both themes. Wikipedia "W" from Font Awesome Free (CC BY 4.0);
   archive icon from gwern.net (CC0); source-page icon this edition's own. */
a[href*="wikipedia.org/wiki/"]::after,
a[href*="archive.org/details/"]::after,
a[href^="../ref/"]::after {
  content: "";
  display: inline-block;
  width: 0.62em;
  height: 0.62em;
  margin-left: 0.18em;
  vertical-align: 0.42em;
  background-color: currentColor;
  -webkit-mask: var(--link-icon) no-repeat center / contain;
  mask: var(--link-icon) no-repeat center / contain;
  opacity: 0.55;
}
a[href*="wikipedia.org/wiki/"] { --link-icon: url("../img/icon/wikipedia.svg"); }
a[href*="archive.org/details/"] { --link-icon: url("../img/icon/internet-archive.svg"); }
a[href*="archive.org/details/"]::after { width: 0.5em; height: 0.56em; }
/* this edition's own source pages (transcription + scan): a written page */
a[href^="../ref/"] { --link-icon: url("../img/icon/source-page.svg"); }
a[href^="../ref/"]::after { width: 0.48em; height: 0.6em; }
a[href*="wikipedia.org/wiki/"]:hover::after,
a[href*="archive.org/details/"]:hover::after,
a[href^="../ref/"]:hover::after { opacity: 0.3; }
.site-header a::after, .site-footer a::after { display: none !important; }

/* ---------- editorial insertions & translations ----------
   gwern.net sets "[editorial]" insertions in a typewriter serif
   (initial.css: .editorial), so they can never be mistaken for the
   author's text. Translations are editorial: hidden behind a toggle when
   JS runs, shown inline (in brackets) when it doesn't. */
.editorial {
  font-family: "Nimbus Mono PS", "Nimbus Mono", "Free Mono", "Courier New", monospace;
  font-size: 0.88em;
  color: var(--fg-muted);
}
.editorial .editorial { font-style: italic; }
.js .translation:not(.shown) { display: none; }
.translation.shown { margin-left: 0.25em; }

.translate-toggle {
  appearance: none;
  font-family: var(--font-sans);
  font-size: 0.62em;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  line-height: 1;
  color: var(--fg-muted);
  background: none;
  border: 1px dotted var(--footnote-border, var(--fg-faint));
  padding: 0.2em 0.35em 0.15em;
  margin: 0 0.1em 0 0.35em;
  vertical-align: 0.2em;
  cursor: pointer;
}
.translate-toggle:hover,
.translate-toggle.highlighted { color: var(--fg); border-style: solid; }
.translate-toggle[aria-expanded="true"] {
  color: var(--bg);
  background: var(--fg-muted);
  border-style: solid;
  border-color: var(--fg-muted);
}

/* ---------- source pages ---------- */
.passage-source {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  color: var(--fg-muted);
}
.cited-passage {
  background: var(--sidenote-bg);
  box-shadow: 0 0 0 1px var(--border);
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}
.parallel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17em, 1fr));
  gap: 0 2em;
  margin: 1.4rem 0;
}
.parallel > div > p { font-size: 0.95em; }
.parallel .original { font-style: italic; }
.parallel .original em { font-style: normal; }
.parallel .rendering { border-left: 1px solid var(--border); padding-left: 1.2em; }
@media (min-width: 1100px) {
  .content .parallel { margin-left: -6em; margin-right: -6em; }
}
@media (max-width: 760px) {
  .parallel .rendering { border-left: none; padding-left: 0; border-top: 1px solid var(--border); padding-top: 1em; }
}
.popup .parallel { display: block; }
.popup .parallel .rendering { border-left: none; padding-left: 0; border-top: 1px solid var(--border); padding-top: 0.6em; margin-top: 0.6em; }

.table-wrap { overflow-x: auto; margin: 1.4rem 0; }
table.collation {
  border-collapse: collapse;
  font-size: 0.86rem;
  width: 100%;
  border-top: 2px solid var(--border-strong);
  border-bottom: 2px solid var(--border-strong);
}
table.collation th, table.collation td {
  text-align: left;
  vertical-align: top;
  padding: 0.45em 0.7em;
  border-bottom: 1px solid var(--border);
}
table.collation thead th {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--fg-muted);
  border-bottom: 1px solid var(--border-strong);
}
table.collation tbody th {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.78rem;
  color: var(--fg-muted);
  white-space: nowrap;
}
table.collation td[lang="la"], table.collation td[lang="fr"] { font-style: italic; }
.parallel .source-notes {
  font-size: 0.8em;
  border-top: 1px solid var(--border);
  padding-top: 0.5em;
}
table.collation strong { font-weight: 700; }
.editorial-note {
  border-left: 3px solid var(--border-strong);
  padding-left: 1em;
  color: var(--fg-muted);
  font-size: 0.95em;
}

/* ---------- index / landing pages ---------- */

.work-list { list-style: none; padding: 0; margin: 1.5rem 0; }
.work-list li {
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}
.work-list .work-title { font-size: 1.15rem; }
.work-list .work-title a { text-decoration: none; }
.work-list .work-title a:hover { text-decoration: underline; }
.work-list .work-desc { color: var(--fg-muted); font-size: 0.92rem; margin-top: 0.3rem; }
.work-list .work-status {
  font-family: var(--font-sans);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--fg-faint);
  border: 1px solid var(--border-strong);
  padding: 0.15em 0.5em;
  border-radius: 2px;
  margin-left: 0.5em;
}

.toc { margin: 1.5rem 0 2.5rem; font-family: var(--font-sans); font-size: 0.92rem; }
.toc ol { padding-left: 1.3em; }
.toc li { margin-bottom: 0.35em; }
.toc a { text-decoration: none; }
.toc a:hover { text-decoration: underline; }

.site-footer {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 2rem 4rem;
  color: var(--fg-faint);
  font-size: 0.8rem;
  font-family: var(--font-sans);
  border-top: 1px solid var(--border);
  margin-top: 3rem;
}

.placeholder-notice {
  background: var(--sidenote-bg);
  border: 1px dashed var(--border-strong);
  color: var(--fg-muted);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  padding: 0.8rem 1.1rem;
  margin-bottom: 2rem;
}

@media (max-width: 640px) {
  body { font-size: 18px; }
  main.article { padding: 1.6rem 1.1rem 4rem; }
  .dropcap { font-size: 3.1em; }
}

/* ---------- printer's ornament (from the 1865 edition, redrawn) ---------- */
.fleuron-head, .fleuron-tail { text-align: center; color: var(--fg-muted); }
.fleuron-head { margin: 0 0 2rem; }
.fleuron-tail { margin: 3rem 0 0; clear: both; }
svg.fleuron { width: 12em; max-width: 60%; height: auto; display: inline-block; }

/* ---------- gwern.net drop caps (chapter openings) ----------
   Fonts and the size/margin values ("all of these numbers are magic") are
   gwern.net's (style.css, dropcaps). A page picks a face with front matter
   'dropcap: goudy|yinit|kanzlei|de-zs', which sets main.dropcaps-<face>. */
@font-face { font-family: 'Goudy Initialen'; src: url('../fonts/dropcap/goudy/GoudyInitialen-D.ttf') format('truetype'); font-display: swap; unicode-range: U+0044; }
@font-face { font-family: 'Goudy Initialen'; src: url('../fonts/dropcap/goudy/GoudyInitialen-T.ttf') format('truetype'); font-display: swap; unicode-range: U+0054; }
@font-face { font-family: 'Goudy Initialen'; src: url('../fonts/dropcap/goudy/GoudyInitialen-W.ttf') format('truetype'); font-display: swap; unicode-range: U+0057; }
@font-face { font-family: 'Yinit'; src: url('../fonts/dropcap/yinit/Yinit-D.ttf') format('truetype'); font-display: swap; unicode-range: U+0044; }
@font-face { font-family: 'Yinit'; src: url('../fonts/dropcap/yinit/Yinit-T.ttf') format('truetype'); font-display: swap; unicode-range: U+0054; }
@font-face { font-family: 'Yinit'; src: url('../fonts/dropcap/yinit/Yinit-W.ttf') format('truetype'); font-display: swap; unicode-range: U+0057; }
@font-face { font-family: 'Kanzlei Initialen'; src: url('../fonts/dropcap/kanzlei/Kanzlei-Initialen-D.ttf') format('truetype'); font-display: swap; unicode-range: U+0044; }
@font-face { font-family: 'Kanzlei Initialen'; src: url('../fonts/dropcap/kanzlei/Kanzlei-Initialen-T.ttf') format('truetype'); font-display: swap; unicode-range: U+0054; }
@font-face { font-family: 'Kanzlei Initialen'; src: url('../fonts/dropcap/kanzlei/Kanzlei-Initialen-W.ttf') format('truetype'); font-display: swap; unicode-range: U+0057; }
@font-face { font-family: 'Deutsche Zierschrift'; src: url('../fonts/dropcap/de-zs/DeutscheZierschrift-D.ttf') format('truetype'); font-display: swap; unicode-range: U+0044; }
@font-face { font-family: 'Deutsche Zierschrift'; src: url('../fonts/dropcap/de-zs/DeutscheZierschrift-T.ttf') format('truetype'); font-display: swap; unicode-range: U+0054; }
@font-face { font-family: 'Deutsche Zierschrift'; src: url('../fonts/dropcap/de-zs/DeutscheZierschrift-W.ttf') format('truetype'); font-display: swap; unicode-range: U+0057; }
main[class*="dropcaps-"] .dropcap {
  float: left;
  font-style: normal;
  font-weight: normal;
  padding: 0;
  color: var(--fg);
}
main.dropcaps-goudy .dropcap {
  font-family: "Goudy Initialen", var(--font-serif);
  font-size: 7em; line-height: 1;
  margin: 0.025em 0.02em -0.25em 0;
}
main.dropcaps-yinit .dropcap {
  font-family: "Yinit", var(--font-serif);
  font-size: 5.625em; line-height: 1.35;
  margin: 0.07em 0.08em -0.5em 0;
}
main.dropcaps-kanzlei .dropcap {
  font-family: "Kanzlei Initialen", var(--font-serif);
  font-size: 7em; line-height: 1;
  margin: 0.025em 0.025em -0.25em -0.02em;
}
main.dropcaps-de-zs .dropcap {
  font-family: "Deutsche Zierschrift", var(--font-serif);
  font-size: 6.625em; line-height: 1.1;
  margin: 0.01em 0.05em -0.25em 0;
}
/* gwern.net drops them below 650px; here they shrink instead. */
@media (max-width: 649px) {
  main[class*="dropcaps-"] .dropcap { font-size: 4.6em; margin-bottom: 0 !important; }
  .abstract { text-align: left; }
}

/* ---------- table of contents (gwern.net #TOC) ----------
   Built by build.py for pages with 5+ sections. Desktop: a numbered box
   floated left beside the abstract and opening text; narrower screens: a
   full-width two-column box without numbers. */
#TOC {
  position: relative;
  z-index: 2;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  line-height: 1.25;
  background: var(--sidenote-bg);
  border: 1px solid var(--border);
  padding: 0.625em 0.75em 0.75em;
}
#TOC ul { list-style: none; margin: 0; padding: 0; }
#TOC > ul > li { font-weight: 600; margin: 0 0 0.5em; padding-left: 1.6em; position: relative; }
#TOC > ul > li:last-child { margin-bottom: 0; }
#TOC ul ul { padding: 0.35em 0 0 0.2em; }
#TOC ul ul li { font-weight: 400; font-size: 0.92em; margin: 0 0 0.3em; padding-left: 1.9em; position: relative; }
#TOC a { color: var(--fg); text-decoration: none; background: none; display: block; }
#TOC a:hover { background: var(--border); }
#TOC .toc-num { position: absolute; left: 0; color: #909090; font-weight: 400; }
@media (min-width: 901px) {
  #TOC { float: left; max-width: 285px; margin: 0 2.25rem 1rem 0; }
  #TOC + .abstract { margin-top: 0; }
}
@media (max-width: 900px) {
  #TOC {
    margin: 1.6rem 0 1.4rem;
    background-image: linear-gradient(var(--border), var(--border));
    background-repeat: no-repeat;
    background-size: 1px 100%;
    background-position: 50% 0;
  }
  #TOC > ul { column-count: 2; column-gap: 1.5em; }
  #TOC li { break-inside: avoid; }
  #TOC > ul > li, #TOC ul ul li { padding-left: 0; }
  #TOC .toc-num { display: none; }
}

/* ---------- sidenotes (sidenotes.js) ----------
   gwern.net-style: notes in the left margin beside their markers, on screens
   with room for them (html.sidenotes-on); otherwise hidden. */
.sidenote-column { display: none; }
.sidenotes-on .sidenote-column {
  display: block;
  position: absolute;
  top: 0;
}
.sidenote {
  position: absolute;
  left: 0;
  right: 0;
  max-height: 24em;
  overflow-y: auto;
  scrollbar-width: thin;
  font-size: 0.74rem;
  line-height: 1.42;
  color: var(--fg-muted);
  border-top: 1px solid var(--border);
  padding: 0.35em 0.2em 0.3em 0;
  text-align: left;
  hyphens: auto;
}
.sidenote-num {
  float: left;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.95em;
  margin-right: 0.4em;
  color: var(--fg);
  text-decoration: none;
  background: none;
}
.sidenote-body p { margin: 0 0 0.45em; }
.sidenote-body p:last-child { margin-bottom: 0; }
.sidenote.highlighted { color: var(--fg); border-top-color: var(--fg); }
a.footnote-ref.highlighted { background: var(--selection); }
.sidenotes-on .content figure.wide { margin-left: 0; margin-right: 0; }
.sidenotes-on .margin-toc { display: none; }

/* ---------- footnote markers: underlined, as on gwern.net ---------- */
a.footnote-ref sup {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
  text-decoration-color: var(--fg-muted);
}

/* ---------- footnote popins (touch screens; popups.js) ---------- */
.popin-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0, 0, 0, 0.42);
}
a.footnote-ref.popin-source {
  z-index: 61;
  background: var(--bg);
  outline: 3px double var(--fg-muted);
  outline-offset: 2px;
}
.popin {
  position: absolute;
  left: 0.5rem;
  right: 0.5rem;
  max-width: 40rem;
  margin: 0 auto;
  z-index: 62;
  background: var(--bg);
  border: 3px double var(--border-strong);
  font-size: 1rem;
  line-height: 1.5;
}
.popin-titlebar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.8rem;
  border-bottom: 1px solid var(--border);
  padding: 0.35rem 0.4rem 0.35rem 0.8rem;
  font-family: var(--font-sans);
}
.popin-title { color: var(--fg); font-size: 0.95rem; margin-right: auto; }
.popin-close {
  background: none;
  border: 1px solid var(--fg-muted);
  color: var(--fg);
  font-size: 1.3rem;
  line-height: 1;
  width: 2rem;
  height: 2rem;
  cursor: pointer;
}
.popin-content { padding: 0.7rem 0.9rem 0.8rem; }
.popin-content p { margin: 0 0 0.6em; }
.popin-content p:last-child { margin-bottom: 0; }

/* ---------- automatic backlinks on source pages (build.py) ---------- */
.backlinks { margin-top: 3rem; font-size: 0.92rem; }
.backlinks-intro { color: var(--fg-muted); font-size: 0.85rem; text-indent: 0 !important; }
.backlinks ul { padding-left: 1.2em; }
.backlinks li { margin-bottom: 0.35em; }

/* Facsimile strips on source pages: a crop of the scanned page holding the passage. */
figure.facsimile { margin: 1.25em auto; max-width: 100%; text-align: center; }
figure.facsimile img { max-width: 100%; height: auto; border: 1px solid var(--border); box-shadow: 0 1px 4px rgba(0,0,0,0.15); }
figure.facsimile figcaption { font-size: 0.85em; margin-top: 0.4em; text-align: center; }

/* Title pages and frontispieces of the cited books, floated beside the first passage on source pages. */
figure.title-page { float: right; width: 260px; max-width: 45%; margin: 0.3em 0 1em 1.5em; text-align: center; }
figure.title-page img { width: 100%; height: auto; border: 1px solid var(--border); box-shadow: 0 1px 4px rgba(0,0,0,0.15); }
figure.title-page figcaption { font-size: 0.8em; line-height: 1.35; margin-top: 0.4em; text-align: left; }
figure.title-page.large { width: 340px; }
@media (max-width: 650px) { figure.title-page, figure.title-page.large { float: none; width: auto; max-width: 300px; margin: 1em auto; } }

/* Source pages: English first, the original language folded away (build.py fold_originals). */
.parallel.folded { display: block; }
.content .parallel.folded { margin-left: 0; margin-right: 0; }
.parallel.folded .rendering { border: none; padding: 0; }
details.original-toggle { margin: 0.6em 0 1.2em; border-left: 2px solid var(--border); padding-left: 1em; }
details.original-toggle > summary { cursor: pointer; font-variant: small-caps; letter-spacing: 0.03em; font-size: 0.9em; color: var(--fg-faint, #777); list-style: none; }
details.original-toggle > summary::-webkit-details-marker { display: none; }
details.original-toggle > summary::before { content: "▸ "; }
details.original-toggle[open] > summary::before { content: "▾ "; }
details.original-toggle > summary:hover { color: inherit; }
details.original-toggle .original { margin-top: 0.5em; font-style: italic; }
details.original-toggle .original em, details.original-toggle .original i { font-style: normal; }

/* No first-line indent on a paragraph that follows a facsimile strip */
.content figure.facsimile + p { text-indent: 0; }

/* ---------- rabbit holes (build.py): related sources on source pages,
   "where next" at the end of chapters, curiosities on the home page ---------- */
.rabbit-hole, .chapter-next {
  margin: 3rem 0 1.5rem; padding: 0.9rem 1.1rem 0.7rem;
  border: 1px solid var(--border); background: var(--sidenote-bg); font-size: 0.95rem;
}
.rabbit-hole h2 { margin-top: 0; font-size: 1.15rem; }
.rabbit-intro, .chapter-next-intro { color: var(--fg-muted); font-size: 0.88rem; text-indent: 0 !important; margin: 0.2em 0 0.5em; }
.rabbit-hole ul, .chapter-next ul { list-style: none; padding-left: 0; margin: 0.3em 0; }
.rabbit-hole li, .chapter-next li { margin: 0 0 0.55em; line-height: 1.35; }
.rabbit-hole li a, .chapter-next li a { font-weight: 600; }
.rh-sub { display: block; color: var(--fg-muted); font-style: italic; font-size: 0.9em; }
.rabbit-random { font-size: 0.85rem; text-align: right; margin: 0.4em 0 0; text-indent: 0 !important; }
.next-chapter { font-size: 1.05rem; margin: 0 0 0.6em; text-indent: 0 !important; }
.next-chapter a { font-weight: 600; }

.curio-box { margin: 1.5rem 0; padding: 0.9rem 1.1rem; border: 1px solid var(--border-strong); background: var(--sidenote-bg); }
.curio-box h2 { margin-top: 0; font-size: 1.15rem; }
.curio-box ul { list-style: none; padding-left: 0; margin: 0.4em 0; }
.curio-box li { margin: 0 0 0.8em; line-height: 1.4; font-size: 0.95rem; }
.curio-box .curio-more { font-size: 0.88rem; text-indent: 0 !important; margin: 0.3em 0 0; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0.5em; }
.curio-shuffle { font: inherit; font-size: 0.88rem; background: none; border: 1px solid var(--border-strong); color: var(--link); padding: 0.1em 0.6em; cursor: pointer; }
ul.curiosities { list-style: none; padding-left: 0; }
ul.curiosities li { margin: 0 0 1.1em; line-height: 1.45; }
ul.curiosities li strong { font-variant: small-caps; letter-spacing: 0.02em; }
.start-here { display: grid; grid-template-columns: repeat(auto-fit, minmax(14em, 1fr)); gap: 0.8rem; margin: 1rem 0 1.5rem; }
.start-here a.start-card { display: block; border: 1px solid var(--border); padding: 0.7rem 0.85rem; text-decoration: none; background: var(--bg); }
.start-here a.start-card:hover { border-color: var(--fg-muted); background: var(--sidenote-bg); }
.start-card strong { display: block; font-variant: small-caps; font-size: 1.05rem; margin-bottom: 0.25em; color: var(--fg); }
.start-card span { display: block; color: var(--fg-muted); font-size: 0.88rem; line-height: 1.35; }
/* rabbit-hole cards: a crop of the old printed page above each title */
.rabbit-hole ul.rh-cards, .chapter-next ul.rh-cards {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(8.5em, 1fr)); gap: 1rem 0.9rem; margin: 0.6em 0 0.4em;
}
ul.rh-cards li { margin: 0; font-size: 0.9rem; }
ul.rh-cards a.rh-pic { display: block; margin-bottom: 0.35em; border: 1px solid var(--border); line-height: 0; background: var(--bg); }
ul.rh-cards a.rh-pic img { width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; display: block; filter: grayscale(0.35) contrast(1.05); }
ul.rh-cards a.rh-pic:hover img { filter: none; }
ul.rh-cards .rh-noimg {
  display: flex; align-items: center; justify-content: center; aspect-ratio: 3 / 2; line-height: 1;
  font-family: "UnifrakturMaguntia", serif; font-size: 3.2rem; color: var(--fg-faint);
}
ul.rh-cards .rh-sub { font-size: 0.85em; line-height: 1.3; margin-top: 0.15em; }
ul.rh-cards a::after { display: none !important; }
ul.rh-cards a.rh-pic { text-decoration: none; background-image: none; }
/* sources index: filter box, browse by chapter; gallery page */
.source-tools { display: flex; flex-wrap: wrap; gap: 0.6em 1em; align-items: center; text-indent: 0 !important; font-size: 0.9rem; }
#source-filter { flex: 1 1 18em; font: inherit; font-size: 0.95rem; padding: 0.35em 0.6em; border: 1px solid var(--border-strong); background: var(--bg); color: var(--fg); }
.filter-count { font-size: 0.85rem; color: var(--fg-muted); text-indent: 0 !important; margin: 0.2em 0; min-height: 1em; }
details.by-chapter-wrap { margin: 0.6em 0 1.4em; }
details.by-chapter-wrap > summary { cursor: pointer; font-variant: small-caps; font-size: 1.05rem; }
.by-chapter details { margin: 0.5em 0 0.5em 1em; }
.by-chapter summary { cursor: pointer; }
.by-chapter ol { columns: 2 16em; font-size: 0.9rem; margin: 0.4em 0 0.8em; padding-left: 2em; }
.by-chapter li { break-inside: avoid; margin-bottom: 0.2em; }
.bc-count { color: var(--fg-faint); font-size: 0.85em; white-space: nowrap; }
ul.rh-cards.gallery { list-style: none; padding-left: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5em, 1fr)); gap: 1.2rem 1rem; }
ul.rh-cards.gallery li a.rh-title { font-weight: 600; }
.bc-read { font-size: 0.85rem; margin: 0.2em 0 0 1em; text-indent: 0 !important; }
.continue-reading { border-left: 3px solid var(--fg-faint); padding: 0.4em 0.8em; background: var(--sidenote-bg); font-size: 0.95rem; text-indent: 0 !important; margin: 0 0 1.2rem; }
.continue-reading a { font-weight: 600; }
.new-sources-box { margin: 1.5rem 0; }
.new-sources-box h2 { font-size: 1.15rem; }
ul.rh-cards.new-sources { list-style: none; padding-left: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(8.5em, 1fr)); gap: 1rem 0.9rem; }
ul.rh-cards.new-sources li a.rh-title { font-weight: 600; }
.readtime { color: var(--fg-faint); font-size: 0.82em; font-style: italic; margin-left: 0.3em; white-space: nowrap; }
