:root {
  --paper: #f5f1e8;
  --paper-raised: #fbf9f4;
  --paper-sunk: #ece6d8;
  --ink: #1b1710;
  --ink-soft: #46402f;
  --ink-faint: #4f493c;
  --line: #d9d0bc;
  --line-strong: #b5a98c;
  --accent: #7a2e1f;
  --accent-text: #6f2718;
  --accent-tint: #f1e1dc;
  --focus: #1f4a63;
  --uncoded: #cfc6b2;
  --uncoded-text: #4f493c;
  --c1: #e9d9c3;
  --c2: #c9a27a;
  --c3: #9c6b3f;
  --c4: #5e3a1e;
  --c5: #2e1c0e;
  --disagree: #2b6a8a;
  --absent: #b9c9c2;
  --absent-line: #6d8a80;
  --map-land: #e3dbc8;
  --map-line: #bdb197;
  --shadow: 0 18px 40px -22px rgba(27, 23, 16, 0.35);
  --measure: 40rem;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #15120e;
    --paper-raised: #1d1913;
    --paper-sunk: #0f0d09;
    --ink: #f1ebdf;
    --ink-soft: #cfc5b0;
    --ink-faint: #b3a992;
    --line: #37301f;
    --line-strong: #56492f;
    --accent: #e0946c;
    --accent-text: #e9a882;
    --accent-tint: #3a2419;
    --focus: #8fc2dc;
    --uncoded: #3f3829;
    --uncoded-text: #b3a992;
    --c1: #4a3a27;
    --c2: #7d5a37;
    --c3: #b3844f;
    --c4: #dcb27f;
    --c5: #f5dcb5;
    --disagree: #7fbfe0;
    --absent: #2f4a44;
    --absent-line: #8fb3a8;
    --map-land: #262117;
    --map-line: #4a4130;
    --shadow: 0 18px 40px -22px rgba(0, 0, 0, 0.7);
  }
}
:root[data-theme="dark"] {
  --paper: #15120e;
  --paper-raised: #1d1913;
  --paper-sunk: #0f0d09;
  --ink: #f1ebdf;
  --ink-soft: #cfc5b0;
  --ink-faint: #b3a992;
  --line: #37301f;
  --line-strong: #56492f;
  --accent: #e0946c;
  --accent-text: #e9a882;
  --accent-tint: #3a2419;
  --focus: #8fc2dc;
  --uncoded: #3f3829;
  --uncoded-text: #b3a992;
  --c1: #4a3a27;
  --c2: #7d5a37;
  --c3: #b3844f;
  --c4: #dcb27f;
  --c5: #f5dcb5;
  --disagree: #7fbfe0;
  --absent: #2f4a44;
  --absent-line: #8fb3a8;
  --map-land: #262117;
  --map-line: #4a4130;
  --shadow: 0 18px 40px -22px rgba(0, 0, 0, 0.7);
}

* { box-sizing: border-box; }
html { background: var(--paper); color: var(--ink); scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif;
  font-size: 1.0625rem;
  line-height: 1.6;
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
a { color: var(--accent-text); text-decoration-thickness: 1px; text-underline-offset: 0.15em; }
a:hover { color: var(--ink); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
h1, h2, h3, h4 { font-weight: 600; line-height: 1.15; letter-spacing: -0.01em; margin: 0; }
h1 { font-size: clamp(2.6rem, 7vw, 4.6rem); letter-spacing: -0.025em; }
h2 { font-size: clamp(1.7rem, 3.4vw, 2.3rem); margin-top: 3.5rem; margin-bottom: 0.6rem; }
h3 { font-size: 1.35rem; margin-top: 2.4rem; margin-bottom: 0.4rem; }
h4 { font-size: 1.05rem; margin-top: 1.4rem; margin-bottom: 0.2rem; }
p { margin: 0 0 1rem; }
small, .small { font-size: 0.875rem; }
.muted { color: var(--ink-faint); }
code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.9em; }
figure { margin: 1.4rem 0; }
figcaption { font-size: 0.875rem; color: var(--ink-faint); line-height: 1.45; margin-top: 0.45rem; }
table { border-collapse: collapse; width: 100%; font-size: 0.9375rem; font-variant-numeric: tabular-nums; }
th, td { text-align: left; vertical-align: top; padding: 0.35rem 0.6rem 0.35rem 0; border-bottom: 1px solid var(--line); }
th { font-weight: 600; color: var(--ink-soft); }
td.num, th.num { text-align: right; padding-right: 0; white-space: nowrap; }
details { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 0.4rem 0; margin: 0.8rem 0; }
details + details { border-top: 0; margin-top: -0.8rem; }
summary { cursor: pointer; color: var(--ink-soft); font-size: 0.95rem; padding: 0.3rem 0; }
summary:hover { color: var(--ink); }
hr { border: 0; border-top: 1px solid var(--line); margin: 3rem 0; }

.page { display: grid; grid-template-columns: [full-start] minmax(1.1rem, 1fr) [wide-start] minmax(0, 8rem) [text-start] min(var(--measure), 100% - 2.2rem) [text-end] minmax(0, 8rem) [wide-end] minmax(1.1rem, 1fr) [full-end]; }
.page > * { grid-column: text; min-width: 0; }
.page > .wide { grid-column: wide; }
.page > .full { grid-column: full; }

/* header */
.masthead { grid-column: full; padding: 1rem 1.2rem 0; display: flex; justify-content: space-between; align-items: center; gap: 1rem; font-size: 0.875rem; color: var(--ink-faint); }
.masthead a { color: inherit; text-decoration: none; }
.masthead a:hover { color: var(--ink); text-decoration: underline; }
.theme-toggle { font: inherit; color: var(--ink-soft); background: var(--paper-raised); border: 1px solid var(--line-strong); border-radius: 999px; padding: 0.35rem 0.8rem; cursor: pointer; }
.theme-toggle:hover { color: var(--ink); border-color: var(--ink-soft); }

.hero { padding: 3.2rem 0 1.2rem; }
.kicker { font-size: 0.875rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent-text); margin-bottom: 1rem; }
.deck { font-size: clamp(1.2rem, 2.2vw, 1.45rem); line-height: 1.45; color: var(--ink-soft); margin: 1.2rem 0 0; max-width: 34em; }
.lede p { font-size: 1.125rem; }
.byline { font-size: 0.875rem; color: var(--ink-faint); margin-top: 1.4rem; }

/* contents */
.toc { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 1rem 0; margin: 2rem 0 0.5rem; font-size: 0.95rem; }
.toc ol { margin: 0.3rem 0 0; padding-left: 1.4rem; columns: 2; column-gap: 2rem; }
.toc li { break-inside: avoid; padding: 0.12rem 0; }
@media (max-width: 40rem) { .toc ol { columns: 1; } }

/* rules */
.rules { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); margin: 1.4rem 0; }
.rule { background: var(--paper-raised); border: 1px solid var(--line); border-radius: 6px; padding: 1rem 1.1rem; }
.rule h4 { margin-top: 0; }
.rule p { margin: 0.35rem 0 0; font-size: 0.95rem; }

/* question blocks */
.group-head { margin-top: 4rem; padding-top: 1rem; border-top: 2px solid var(--ink); }
.group-head .kicker { margin-bottom: 0.4rem; }
.group-head h2 { margin-top: 0; }
.q { margin-top: 2.6rem; scroll-margin-top: 1rem; }
.q h3 { font-size: 1.45rem; }
.q .var { font-size: 0.875rem; color: var(--ink-faint); margin: 0.25rem 0 0.9rem; }
.q .var a { color: inherit; }
.q .reading { font-size: 1.0625rem; }
.limit { font-size: 0.95rem; color: var(--ink-soft); border-left: 3px solid var(--line-strong); padding-left: 0.9rem; margin: 0.9rem 0 1rem; }
.case-ref { font-size: 0.95rem; background: var(--paper-raised); border: 1px solid var(--line); border-radius: 6px; padding: 0.8rem 1rem; margin: 0.9rem 0; }
.case-ref .who { font-weight: 600; }

.strip { margin: 1rem 0 0.4rem; }
.strip-host { position: relative; }
.strip-host svg { display: block; width: 100%; height: auto; overflow: visible; }
.strip-host .axis text, .strip-host .rowlabel { font-family: ui-sans-serif, system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif; font-size: 11px; fill: var(--ink-faint); }
.strip-host .rowlabel { font-size: 12px; fill: var(--ink-soft); }
.strip-host .rowlabel.uncoded { fill: var(--uncoded-text); }
.strip-host .rowcount { font-family: ui-sans-serif, system-ui, sans-serif; font-size: 12px; fill: var(--ink-soft); font-variant-numeric: tabular-nums; }
.strip-host .axis line, .strip-host .rowline { stroke: var(--line); }
.strip-host .axis .major { stroke: var(--line-strong); }
.strip-host .mark { stroke: var(--paper); stroke-width: 0.6; cursor: pointer; }
.strip-host .mark.u { fill: var(--uncoded); }
.strip-host .mark.b0 { fill: var(--absent); stroke: var(--absent-line); }
.strip-host .mark.b1 { fill: var(--c2); }
.strip-host .mark.b2 { fill: var(--c3); }
.strip-host .mark.b3 { fill: var(--c4); }
.strip-host .mark.b4 { fill: var(--c5); }
.strip-host .mark.d { fill: var(--disagree); }
.strip-host .mark.hl { stroke: var(--focus); stroke-width: 2.5; }
.strip-host .mark:focus { outline: none; stroke: var(--focus); stroke-width: 2.5; }
.strip-host .early { font-family: ui-sans-serif, system-ui, sans-serif; font-size: 11px; fill: var(--ink-faint); }
.strip-legend { font-size: 0.875rem; color: var(--ink-faint); display: flex; flex-wrap: wrap; gap: 0.3rem 1.1rem; margin: 0.5rem 0 0; }
.strip-legend span::before { content: ""; display: inline-block; width: 0.7em; height: 0.7em; border-radius: 50%; margin-right: 0.35em; vertical-align: -0.02em; background: var(--uncoded); }
.strip-legend .u::before { background: var(--uncoded); }
.strip-legend .b0::before { background: var(--absent); box-shadow: inset 0 0 0 1px var(--absent-line); }
.strip-legend .b1::before { background: var(--c2); }
.strip-legend .b2::before { background: var(--c3); }
.strip-legend .b3::before { background: var(--c4); }
.strip-legend .b4::before { background: var(--c5); }
.strip-legend .d::before { background: var(--disagree); }
.tip { position: absolute; z-index: 5; pointer-events: none; background: var(--ink); color: var(--paper); font-family: ui-sans-serif, system-ui, sans-serif; font-size: 0.8125rem; line-height: 1.35; padding: 0.45rem 0.6rem; border-radius: 4px; max-width: 18rem; box-shadow: var(--shadow); }
.tip b { font-weight: 600; }
.strip-status { font-size: 0.875rem; color: var(--ink-faint); margin: 0.4rem 0 0; }

.counts summary { font-size: 0.9rem; }
.extras { margin-top: 0.6rem; }
.extras > summary { font-size: 0.95rem; }
.counts table { margin-top: 0.4rem; }

/* static charts */
.chart svg { display: block; width: 100%; height: auto; }
.chart .bar { fill: var(--c3); }
.chart .bar.dim { fill: var(--uncoded); }
.chart .bar.hi { fill: var(--accent); }
.chart text { font-family: ui-sans-serif, system-ui, sans-serif; font-size: 11px; fill: var(--ink-soft); }
.chart .label { font-size: 12px; fill: var(--ink); }
.chart .axis { stroke: var(--line-strong); }
.chart .grid { stroke: var(--line); }
.chart .dot { fill: var(--c3); stroke: var(--paper); stroke-width: 0.6; }
.chart .dot.w { fill: var(--accent); }
.chart .dot.m { fill: var(--c4); }
.chart .dot.o { fill: var(--disagree); }
.chart .median { stroke: var(--ink); stroke-dasharray: 3 3; }

/* map */
.map-wrap { position: relative; background: var(--paper-raised); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.map-wrap canvas { display: block; width: 100%; height: auto; }
.map-legend { font-size: 0.875rem; color: var(--ink-faint); display: flex; flex-wrap: wrap; gap: 0.3rem 1.1rem; margin: 0.5rem 0 0; }
.map-legend span::before { content: ""; display: inline-block; width: 0.7em; height: 0.7em; border-radius: 50%; margin-right: 0.35em; }
.map-legend .s::before { background: var(--accent); }
.map-legend .p::before { background: var(--disagree); }

/* societies */
.soc-tools { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; margin: 1rem 0; }
.soc-tools label { font-size: 0.9rem; color: var(--ink-soft); }
.soc-tools input, .soc-tools select { font: inherit; font-size: 0.95rem; color: var(--ink); background: var(--paper-raised); border: 1px solid var(--line-strong); border-radius: 4px; padding: 0.4rem 0.6rem; min-width: 12rem; }
.soc-count { font-size: 0.9rem; color: var(--ink-faint); }
.soc { border-top: 1px solid var(--line); padding: 0.2rem 0; margin: 0; scroll-margin-top: 1rem; }
.soc + .soc { border-top: 1px solid var(--line); }
.soc:last-of-type { border-bottom: 1px solid var(--line); }
.soc summary { display: grid; grid-template-columns: 1fr auto; gap: 0.2rem 1rem; align-items: baseline; padding: 0.45rem 0; color: var(--ink); }
.soc summary .name { font-weight: 600; }
.soc summary .meta { font-size: 0.875rem; color: var(--ink-faint); grid-column: 1 / -1; }
.soc summary .n { font-size: 0.875rem; color: var(--ink-faint); white-space: nowrap; }
.soc .body { padding: 0.4rem 0 1rem; font-size: 0.95rem; }
.soc .body p { margin: 0.3rem 0; }
.soc table { font-size: 0.9rem; }
.soc td:first-child { color: var(--ink-soft); width: 55%; }
.soc .absent-list { color: var(--ink-faint); font-size: 0.875rem; }

/* cases */
.case { margin-top: 2.2rem; }
.case h3 { font-size: 1.25rem; }
.case .when { font-size: 0.875rem; color: var(--ink-faint); margin: 0.2rem 0 0.7rem; }
.case .src { font-size: 0.875rem; color: var(--ink-soft); margin-top: 0.4rem; }
.case .limit { margin-top: 0.6rem; }

/* images */
figure.photo { margin: 2.2rem 0; }
figure.photo.wide { grid-column: wide; }
figure.photo img { display: block; width: 100%; height: auto; border-radius: 4px; border: 1px solid var(--line); background: var(--paper-sunk); }
figure.photo figcaption { max-width: var(--measure); }
.photo-pair { grid-column: wide; display: grid; gap: 1.2rem; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); margin: 2.2rem 0; }
.photo-pair figure { margin: 0; }
.photo-pair img { display: block; width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; border-radius: 4px; border: 1px solid var(--line); background: var(--paper-sunk); }

/* arguments */
.args { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); grid-column: wide; margin: 1.4rem 0; }
.arg { background: var(--paper-raised); border: 1px solid var(--line); border-radius: 6px; padding: 1rem 1.1rem; font-size: 0.95rem; }
.arg h4 { margin-top: 0; }
.arg .who { color: var(--ink-faint); font-size: 0.875rem; margin: 0 0 0.5rem; }
.arg p { margin: 0.4rem 0 0; }
.arg .breaks { color: var(--ink-soft); }
.arg .breaks strong { color: var(--ink); font-weight: 600; }


/* gaps */
.gaps li { margin-bottom: 0.5rem; }

/* method */
.method { font-size: 0.95rem; }
.cite { background: var(--paper-raised); border: 1px solid var(--line); border-radius: 6px; padding: 0.9rem 1.1rem; font-size: 0.9375rem; }
.cite code { display: block; white-space: pre-wrap; word-break: break-word; margin-top: 0.4rem; }
.index table td:first-child { white-space: nowrap; }
.index tr.empty td { color: var(--ink-faint); }

footer.site { grid-column: full; margin-top: 4rem; padding: 2rem 1.2rem 3rem; border-top: 1px solid var(--line); font-size: 0.875rem; color: var(--ink-faint); }
footer.site nav a { margin-right: 1.2rem; }

.to-top { position: fixed; right: 1rem; bottom: 1rem; font: inherit; font-size: 0.875rem; background: var(--paper-raised); color: var(--ink-soft); border: 1px solid var(--line-strong); border-radius: 999px; padding: 0.45rem 0.9rem; cursor: pointer; box-shadow: var(--shadow); }
.to-top:hover { color: var(--ink); }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 40rem) {
  body { font-size: 1rem; }
  .hero { padding-top: 2rem; }
  th, td { padding: 0.3rem 0.45rem 0.3rem 0; }
  .soc-tools input, .soc-tools select { min-width: 0; flex: 1 1 10rem; }
  .strip-host .rowlabel, .strip-host .rowcount { font-size: 11px; }
}

/* language switch and paged society list (v2) */
.mast-right { display: flex; align-items: center; gap: 0.8rem; }
.lang-switch { font-size: 0.875rem; color: var(--ink-soft); text-decoration: none; border-bottom: 1px solid var(--line-strong); padding-bottom: 1px; }
.masthead a.lang-switch:hover { color: var(--ink); text-decoration: none; border-bottom-color: var(--ink-soft); }
.soc-more { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; margin: 1rem 0 0; }
.soc-more button { font: inherit; font-size: 0.9rem; color: var(--ink); background: var(--paper-raised); border: 1px solid var(--line-strong); border-radius: 999px; padding: 0.45rem 1rem; cursor: pointer; }
.soc-more button:hover { border-color: var(--ink-soft); }
.soc-more button.quiet { background: transparent; color: var(--ink-soft); border-color: transparent; }
.soc-more button.quiet:hover { color: var(--ink); text-decoration: underline; }
.soc-more[hidden] { display: none; }
