/* Suchen — Lesen — Analysieren · Stylesheet
   Source Serif 4 (body) + JetBrains Mono (labels) · single accent: deep PDF green
   Hand-tuned for long-form legal-academic reading. No framework, no preprocessor. */

:root {
  --ink: #1a1a1a;
  --ink-soft: #2a2a2a;
  --paper: #fafaf7;
  --paper-2: #f3f1ea;
  --paper-3: #ecebe5;
  --rule: #d8d6cf;
  --rule-soft: #e8e6df;
  --muted: #6b6b6b;
  --muted-2: #9a9890;
  --green: #08612d;
  --green-soft: #e8efe9;
  --green-ink: #b8d4c2;

  --measure: 60ch;
  --side-col: 280px;
  --toc-col: 240px;
  --gap: 32px;

  --font-serif: "Source Serif 4", "Source Serif Pro", Georgia, "Cambria", "Times New Roman", serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Monaco, Consolas, monospace;

  --radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-serif);
  font-feature-settings: "liga", "kern";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden; /* Prevent horizontal scroll from any over-wide child */
}
body.nav-open, body.toc-open { overflow: hidden; height: 100vh; }
main { flex: 1; }

a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--green); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
a.xref { color: var(--ink); }
a.xref::after { content: "↗"; color: var(--green); margin-left: 2px; font-size: 0.85em; }

::selection { background: var(--green); color: var(--paper); }

/* ──────────── Masthead ──────────── */
.site-masthead {
  border-bottom: 1px solid var(--rule);
  padding: 16px 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  background: var(--paper);
  position: sticky; top: 0; z-index: 70;
}
.brand {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.version-pill {
  color: var(--green);
  margin-left: 10px;
}
.primary-nav {
  display: flex; align-items: center; gap: 22px;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.primary-nav a {
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
}
.primary-nav a:hover, .primary-nav a[aria-current="page"] { color: var(--ink); }
.ai-link {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--paper-2);
  color: var(--ink) !important;
}
.ai-link .arrow { color: var(--green); }
.lang-switch {
  display: flex; gap: 8px;
  padding-left: 22px;
  border-left: 1px solid var(--rule);
}
.lang-switch .lang { color: var(--muted-2); }
.lang-switch .lang.active { color: var(--ink); font-weight: 500; }

/* ──────────── Reading layout ──────────── */
main.reading {
  display: grid;
  grid-template-columns: var(--toc-col) minmax(0, 1fr) var(--side-col);
  gap: 0;
  align-items: start;
}

.toc {
  border-right: 1px solid var(--rule-soft);
  padding: 56px 28px 56px 56px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.85;
  color: var(--muted);
  position: sticky;
  top: 60px;
  align-self: start;
  max-height: calc(100vh - 60px);
  overflow-y: auto;
}
.toc-label {
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--green);
  margin-bottom: 14px;
  font-weight: 600;
}
.toc-label.muted { color: var(--muted); }
.toc ul { list-style: none; padding: 0; margin: 0 0 18px; }
.toc li { margin: 0; padding: 0; }
.toc a {
  color: var(--muted);
  text-decoration: none;
  display: block;
  padding: 2px 0;
  position: relative;
}
.toc a:hover { color: var(--ink); }
.toc a.active { color: var(--ink); font-weight: 500; }
.toc a.active::before {
  content: "";
  position: absolute;
  left: -28px;
  top: 12px;
  width: 18px;
  height: 1px;
  background: var(--green);
}
.toc-divider {
  height: 1px;
  background: var(--rule-soft);
  margin: 12px 0 18px;
}

/* ──────────── Reading column ──────────── */
.reading-col {
  padding: 56px 48px 80px;
  border-right: 1px solid var(--rule-soft);
  display: grid;
  grid-template-columns: minmax(0, var(--measure)) var(--side-col);
  column-gap: var(--gap);
  align-items: start;
}
.reading-col > *:not(aside.sn):not(.frontispiece):not(.chapter-foot) {
  grid-column: 1;
}
.reading-col > aside.sn { grid-column: 2; }
.reading-col > .frontispiece { grid-column: 1 / -1; }
.reading-col > .chapter-foot { grid-column: 1 / -1; }

.chapter-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--green);
  margin-bottom: 14px;
}
.chapter-title {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.08;
  letter-spacing: -0.014em;
  margin: 0 0 32px;
  color: var(--ink);
  font-optical-sizing: auto;
  max-width: 16ch;
}

/* Frontispiece — homepage variation */
.frontispiece {
  padding: 32px 0 56px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 56px;
}
.frontispiece .rule-accent {
  width: 80px;
  height: 4px;
  background: var(--green);
  margin-bottom: 32px;
}
.frontispiece .kicker {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--green);
  margin: 0 0 12px;
}
.frontispiece .display-title {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(32px, 5.5vw, 64px);
  line-height: 1.04;
  letter-spacing: -0.018em;
  margin: 0 0 24px;
  color: var(--ink);
  font-optical-sizing: auto;
}
.frontispiece .display-sub {
  display: block;
  font-weight: 400;
  font-style: italic;
  font-size: 0.55em;
  margin-top: 12px;
  color: var(--muted);
  letter-spacing: -0.005em;
}
.frontispiece .byline {
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink);
  margin: 0 0 6px;
}
.frontispiece .version {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0;
}

/* Section headings */
.prose h2 {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(20px, 2.4vw, 24px);
  line-height: 1.25;
  letter-spacing: -0.005em;
  margin: 56px 0 16px;
  color: var(--ink);
  position: relative;
  scroll-margin-top: 80px;
}
.prose h3 {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 19px;
  line-height: 1.3;
  margin: 32px 0 10px;
  color: var(--ink);
  scroll-margin-top: 80px;
}
.prose h2 .section-num,
.prose h3 .section-num {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--green);
  margin-right: 12px;
  vertical-align: 3px;
  letter-spacing: 0.02em;
}
.prose h2 .anchor,
.prose h3 .anchor {
  position: absolute;
  margin-left: 8px;
  color: var(--muted-2);
  opacity: 0;
  font-family: var(--font-mono);
  font-size: 14px;
  text-decoration: none;
  transition: opacity 0.15s;
}
.prose h2:hover .anchor,
.prose h3:hover .anchor { opacity: 1; }

/* Paragraphs */
.prose p {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 17.5px;
  line-height: 1.62;
  margin: 0 0 16px;
  color: var(--ink);
  font-optical-sizing: auto;
  hyphens: auto;
}
.prose em { font-style: italic; }
.prose strong { font-weight: 600; }

.prose blockquote {
  margin: 24px 0;
  padding: 4px 0 4px 24px;
  border-left: 2px solid var(--green);
  color: var(--ink);
  font-style: italic;
}

.prose ul, .prose ol {
  font-family: var(--font-serif);
  font-size: 17.5px;
  line-height: 1.62;
  padding-left: 24px;
  margin: 0 0 16px;
}
.prose ul li, .prose ol li { margin-bottom: 6px; }

/* Tables */
.prose table {
  font-family: var(--font-serif);
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  font-size: 16px;
  line-height: 1.5;
}
.prose th {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--green);
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1.5px solid var(--ink);
}
.prose td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--rule-soft);
  vertical-align: top;
}
.prose td:first-child {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--green);
  white-space: nowrap;
  width: 1%;
}

/* Single-column tables (e.g. "Prompts zur Inspiration") render as a quiet bordered list */
.prose table.single-col {
  border: 1px solid var(--rule);
  border-radius: 4px;
  margin: 28px 0;
}
.prose table.single-col th {
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--green);
  background: var(--paper-2);
  border-bottom: 1px solid var(--rule);
  padding: 12px 18px;
}
.prose table.single-col tbody tr td:first-child,
.prose table.single-col tbody td {
  font-family: var(--font-serif);
  font-size: 16px;
  font-style: italic;
  font-weight: 400;
  color: var(--ink);
  padding: 12px 18px;
  border-bottom: 1px solid var(--rule-soft);
  white-space: normal;
  width: auto;
}
.prose table.single-col tbody tr:last-child td { border-bottom: none; }

/* Inline code */
.prose code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  background: var(--paper-2);
  padding: 1px 6px;
  border-radius: 3px;
  color: var(--ink);
}
.prose pre {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.55;
  background: var(--ink);
  color: var(--paper);
  padding: 18px 22px;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 24px 0;
}
.prose pre code {
  background: transparent;
  padding: 0;
  color: inherit;
}

/* Footnote refs in body */
.prose sup.footnote-ref a {
  font-family: var(--font-mono);
  font-size: 0.62em;
  vertical-align: super;
  color: var(--green);
  font-weight: 500;
  text-decoration: none;
  padding: 0 1px;
}
.prose sup.footnote-ref a:hover { background: var(--green-soft); border-radius: 2px; }

/* The chapter-end footnotes section (canonical) — visible only when sidenotes are not */
.prose section.footnotes {
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--muted);
}
.prose section.footnotes::before {
  content: "Anmerkungen";
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--green);
  font-weight: 600;
  margin-bottom: 14px;
}
.prose section.footnotes ol { padding-left: 24px; margin: 0; }
.prose section.footnotes li { margin-bottom: 8px; }
.prose section.footnotes .footnote-backref { color: var(--green); margin-left: 6px; text-decoration: none; }

/* Tufte-style sidenotes (post-processed clones) */
aside.sn {
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.65;
  color: var(--muted);
  border-top: 1px solid var(--rule-soft);
  padding-top: 8px;
  margin-top: 4px;
  align-self: start;
  max-width: 32ch;
}
aside.sn .sn-num {
  color: var(--green);
  margin-right: 6px;
  font-weight: 500;
}
aside.sn p {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  margin: 0 0 6px;
  color: inherit;
}
aside.sn em { font-style: italic; }

/* On wide layouts, hide the chapter-end fallback (sidenotes carry the load) */
@media (min-width: 1280px) {
  .prose section.footnotes { display: none; }
}

/* Glossary terms */
.glossary {
  border-bottom: 1px dotted var(--green);
  cursor: help;
  background: linear-gradient(to top, rgba(8,97,45,0.06), rgba(8,97,45,0.06)) no-repeat;
  background-size: 100% 5px;
  background-position: 0 100%;
  position: relative;
}
.glossary:hover { background-size: 100% 8px; }

.glossary-card {
  position: absolute;
  background: var(--ink);
  color: var(--paper);
  padding: 14px 16px;
  border-radius: var(--radius);
  width: 280px;
  box-shadow: 0 14px 40px -12px rgba(0,0,0,0.4);
  font-family: var(--font-serif);
  font-size: 14px;
  line-height: 1.5;
  z-index: 100;
  pointer-events: auto;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 0.15s, transform 0.15s, visibility 0.15s;
}
.glossary[data-open="true"] .glossary-card,
.glossary:focus-within .glossary-card {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.glossary-card .term {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--green-ink);
  margin-bottom: 6px;
}
.glossary-card .full {
  display: block;
  font-weight: 500;
  margin-bottom: 6px;
}
.glossary-card .src {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--green-ink);
  margin-top: 8px;
}
.glossary-card .src a { color: var(--green-ink); }
.glossary-card::before {
  content: "";
  position: absolute;
  top: -6px;
  left: 24px;
  width: 12px;
  height: 12px;
  background: var(--ink);
  transform: rotate(45deg);
}

/* Chapter foot */
.chapter-foot {
  margin-top: 80px;
  padding: 24px 0;
  border-top: 1px solid var(--rule);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.chapter-foot a { color: var(--ink); text-decoration: none; }
.chapter-foot a:hover { color: var(--green); }
.chapter-foot .next-arrow { color: var(--green); }
.chapter-foot .edit { color: var(--muted); }

/* ──────────── Footer ──────────── */
.site-footer {
  border-top: 1px solid var(--rule);
  padding: 56px 56px 64px;
  background: var(--paper);
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.8;
  color: var(--muted);
}
.footer-grid h4 {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink);
  font-weight: 600;
  margin: 0 0 12px;
}
.footer-grid a { color: var(--muted); text-decoration: none; display: block; }
.footer-grid a:hover { color: var(--ink); }
.footer-grid code { font-size: 12px; }
.colophon {
  font-family: var(--font-serif);
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--muted);
  max-width: 38ch;
}
.colophon strong { color: var(--ink); font-weight: 500; }
.colophon p { margin: 0 0 6px; }
.colophon a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--green); display: inline; }
.ai-col h4 { color: var(--green); }

/* ──────────── Mobile UI controls (visible only on small screens) ──────────── */

.nav-toggle, .toc-toggle {
  display: none;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink);
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  user-select: none;
}
.nav-toggle:hover, .toc-toggle:hover { background: var(--paper); border-color: var(--ink); }
.nav-toggle .icon, .toc-toggle .icon { color: var(--green); font-size: 14px; line-height: 1; }
.nav-toggle[aria-expanded="true"], .toc-toggle[aria-expanded="true"] {
  background: var(--ink); color: var(--paper); border-color: var(--ink);
}
.nav-toggle[aria-expanded="true"] .icon,
.toc-toggle[aria-expanded="true"] .icon { color: var(--paper); }

.toc-toggle {
  margin: 24px 24px 0;
  justify-self: start;
  align-self: start;
  width: fit-content;
}

.drawer-scrim {
  display: none;
  position: fixed; inset: 0;
  background: rgba(26, 26, 26, 0.45);
  z-index: 80;
  opacity: 0;
  transition: opacity 0.2s ease;
}
body.nav-open .drawer-scrim,
body.toc-open .drawer-scrim {
  display: block;
  opacity: 1;
}

/* ──────────── Wide-content widening (≥1600 px gives content more breathing room) ──────────── */

@media (min-width: 1600px) {
  :root {
    --toc-col: 260px;
    --side-col: 320px;
    --measure: 64ch;
  }
  .site-masthead, .site-footer { padding-left: 72px; padding-right: 72px; }
  .reading-col { padding: 64px 64px 96px; }
  .toc { padding: 64px 32px 64px 72px; }
  .sidenotes { padding-right: 72px; }
}

/* ──────────── Tablet+desktop hybrid (1024–1279) ──────────── */
/* Drop sidenotes margin column; reflow footnotes inline in body. */

@media (max-width: 1279px) {
  main.reading {
    grid-template-columns: var(--toc-col) minmax(0, 1fr);
  }
  .reading-col {
    grid-template-columns: minmax(0, 1fr);
    padding: 56px 56px 80px;
  }
  .reading-col > aside.sn { display: none; }
  .prose section.footnotes { display: block; }
  .footer-grid { grid-template-columns: 1.5fr 1fr 1fr 1fr; }
}

/* ──────────── Tablet portrait / small laptops (≤ 1023) ──────────── */

@media (max-width: 1099px) {
  :root {
    --toc-col: 220px;
    --side-col: 240px;
  }
  .site-masthead { padding: 14px 28px; gap: 16px; }
  .primary-nav { gap: 14px; font-size: 10.5px; }
  .ai-link { padding: 5px 10px; }
  .lang-switch { padding-left: 12px; gap: 6px; }
  .reading-col { padding: 48px 36px 72px; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 36px; }
  .site-footer { padding: 48px 32px 56px; }
  .colophon { max-width: none; }
}

/* ──────────── Phone landscape / tablet portrait edge (≤ 900) ──────────── */
/* Single column. TOC behind a toggle. Mobile nav drawer. */

@media (max-width: 900px) {
  /* Masthead: hamburger replaces inline nav */
  .site-masthead {
    padding: 12px 20px;
    gap: 12px;
  }
  .brand { font-size: 10px; }
  .version-pill { display: block; margin-left: 0; margin-top: 2px; font-size: 9.5px; }
  .nav-toggle { display: inline-flex; }
  .primary-nav {
    position: fixed;
    top: 0; right: 0; bottom: 0;
    width: min(320px, 86vw);
    background: var(--paper);
    border-left: 1px solid var(--rule);
    box-shadow: -24px 0 60px -20px rgba(0,0,0,0.18);
    z-index: 90;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 84px 28px 32px;
    transform: translateX(100%);
    transition: transform 0.22s ease;
    overflow-y: auto;
  }
  body.nav-open .primary-nav { transform: translateX(0); }
  .primary-nav a {
    display: block;
    padding: 14px 0;
    border-bottom: 1px solid var(--rule-soft);
    font-size: 12px;
    color: var(--ink);
  }
  .primary-nav a.ai-link {
    margin-top: 18px;
    border-bottom: none;
    background: var(--paper-2);
    padding: 12px 14px;
    border-radius: 999px;
    text-align: center;
  }
  .lang-switch {
    padding: 18px 0 0;
    border: none;
    margin-top: 18px;
    border-top: 1px solid var(--rule-soft);
    justify-content: flex-start;
    gap: 18px;
  }

  /* Reading: single column, TOC behind a toggle */
  main.reading { grid-template-columns: 1fr; }
  .toc-toggle { display: inline-flex; }
  .toc {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: min(320px, 86vw);
    background: var(--paper);
    border-right: 1px solid var(--rule);
    box-shadow: 24px 0 60px -20px rgba(0,0,0,0.18);
    z-index: 90;
    padding: 84px 28px 32px;
    max-height: 100vh;
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
  }
  body.toc-open .toc { transform: translateX(0); }
  .reading-col {
    padding: 32px 24px 64px;
    border-right: 0;
  }
  .frontispiece { padding-top: 12px; padding-bottom: 36px; margin-bottom: 36px; }
  .frontispiece .display-title { font-size: clamp(28px, 7vw, 40px); }
  .frontispiece .display-sub { font-size: 0.7em; }
  .chapter-title { font-size: clamp(26px, 6.5vw, 34px); max-width: none; margin-bottom: 24px; }
  .prose h2 { margin-top: 40px; }
  .prose section.footnotes { display: block; }
}

/* ──────────── Phone (≤ 600) ──────────── */

@media (max-width: 600px) {
  .site-masthead { padding: 10px 16px; }
  .reading-col { padding: 24px 18px 48px; }
  .toc-toggle { font-size: 10.5px; padding: 7px 12px; }
  .nav-toggle { font-size: 10.5px; padding: 7px 12px; }

  /* Body type tightens slightly to fit phone width */
  .prose p, .prose ul, .prose ol { font-size: 16.5px; line-height: 1.6; }
  .prose ul, .prose ol { padding-left: 20px; }
  .prose h2 { font-size: 19px; margin-top: 32px; }
  .prose h3 { font-size: 17px; }
  .chapter-eyebrow { font-size: 10px; }

  /* German compound words can be 30+ chars — break in body text only */
  .prose p, .prose li, .prose blockquote {
    overflow-wrap: anywhere;
    word-break: normal;
    hyphens: auto;
  }

  /* Multi-column tables: enable horizontal scroll, keep cell text normal */
  .prose table:not(.single-col) {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .prose table:not(.single-col) thead,
  .prose table:not(.single-col) tbody {
    display: table;
    width: max-content;
    min-width: 100%;
  }
  .prose table:not(.single-col) th,
  .prose table:not(.single-col) td {
    overflow-wrap: normal;
    word-break: normal;
    hyphens: none;
    min-width: 90px;
  }
  .prose table:not(.single-col) td:first-child { min-width: 110px; }

  /* Single-column tables (Prompts boxes): wrap freely, full width */
  .prose table.single-col {
    width: 100%;
  }
  .prose table.single-col td {
    overflow-wrap: anywhere;
    word-break: normal;
    hyphens: auto;
  }
  .prose table.single-col tbody tr td:first-child {
    width: auto;
    white-space: normal;
    font-family: var(--font-serif);
    color: var(--ink);
    font-style: italic;
  }

  /* Glossary card: fit phone width, narrow padding */
  .glossary-card { width: min(280px, calc(100vw - 32px)); padding: 12px 14px; }

  .footer-grid { grid-template-columns: 1fr; gap: 28px; }
  .site-footer { padding: 36px 18px 48px; }

  .chapter-foot {
    flex-wrap: wrap;
    gap: 12px;
    font-size: 10.5px;
    padding: 18px 0;
  }
  .chapter-foot a { white-space: normal; }
}

/* ──────────── Tiny phones (≤ 380) ──────────── */

@media (max-width: 380px) {
  .reading-col { padding: 20px 14px 48px; }
  .frontispiece .display-title { font-size: 26px; }
  .chapter-title { font-size: 24px; }
  .prose p, .prose ul, .prose ol { font-size: 16px; }
  .glossary-card { font-size: 13px; }
}

/* ──────────── Print ──────────── */
@media print {
  .site-masthead, .toc, .chapter-foot, .ai-link, .lang-switch,
  .nav-toggle, .toc-toggle, .drawer-scrim, .primary-nav { display: none; }
  body { background: white; }
  .reading-col { grid-template-columns: 1fr; padding: 0; }
  aside.sn { display: none; }
  .prose section.footnotes { display: block; }
}

/* ──────────── Reduced motion ──────────── */
@media (prefers-reduced-motion: reduce) {
  .toc, .primary-nav, .drawer-scrim { transition: none !important; }
  html { scroll-behavior: auto; }
}
