:root {
  --paper: #f7f4ec;
  --field: #fffdf8;
  --ink: #1f1d1a;
  --muted: #5d584f;
  --rule: #b8b09f;
  --rule-soft: #e4ddcd;
  --accent: #83295a;
  --accent-fill: #9c3a70;
  --on-accent: #ffffff;
  --land: #e6dfcf;
  --land-hot: #d6ccb6;

  --c-vermilion: #b5523b;
  --c-ochre: #c9a24a;
  --c-slate: #5b7a99;
  --c-sage: #7d9467;
  --c-umber: #6b4f3a;
  --c-plum: #7e5a7c;
  --c-other: #a39e93;
  --c-none: #d9d1c0;

  --gutter: clamp(1rem, 3vw, 2.5rem);
  --sans: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --paper: #1b1916;
  --field: #221f1b;
  --ink: #ece6d8;
  --muted: #a9a192;
  --rule: #5a544a;
  --rule-soft: #34302a;
  --accent: #c9669a;
  --accent-fill: #c9669a;
  --on-accent: #1b1916;
  --land: #2d2924;
  --land-hot: #3d3831;
  --c-other: #7d776c;
  --c-none: #45403a;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { background: var(--paper); }
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-underline-offset: 2px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: var(--gutter); top: .5rem; z-index: 10; padding: .4rem .75rem; background: var(--ink); color: var(--paper); transform: translateY(-200%); }
.skip-link:focus { transform: none; }

/* Masthead */
.masthead { position: sticky; top: 0; z-index: 6; padding: 1.1rem var(--gutter) 0; background: var(--paper); }
.mast-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: .5rem 1.5rem; padding-bottom: .45rem; border-bottom: 5px solid var(--accent-fill); }
.agency { color: var(--ink); font-size: 1.15rem; font-weight: 600; text-decoration: none; }
.mast-subtitle { margin: .1rem 0 0; color: var(--muted); font-size: .9rem; }
.mast-meta { color: var(--muted); font-size: .8rem; }
.nav-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: .5rem 1rem; margin: 0 var(--gutter); border-bottom: 1px solid var(--rule-soft); }
.theme-switch { display: inline-flex; margin: .4rem 0; }
/* Sections read as a menu bar: tabs hang from the masthead rule, and the current one is filled in its color. */
.site-nav { display: flex; flex-wrap: wrap; font-size: .9rem; font-weight: 600; }
.site-nav a { display: flex; align-items: center; padding: .45rem .9rem .5rem; color: var(--ink); text-decoration: none; transition: background-color .15s ease; }
.site-nav a:hover { background: var(--rule-soft); }
.site-nav a[aria-current="page"] { background: var(--accent-fill); color: var(--on-accent); }
.theme-switch button { margin-left: -1px; padding: .1rem .55rem; border: 1px solid var(--rule); background: transparent; color: var(--ink); font-size: .78rem; cursor: pointer; }
.theme-switch button[aria-pressed="true"] { position: relative; background: var(--ink); border-color: var(--ink); color: var(--paper); }
.menu-toggle { display: none; align-items: center; justify-content: center; width: 2.75rem; height: 2.75rem; margin: 0 -.6rem 0 0; padding: 0; border: 0; background: none; color: var(--ink); cursor: pointer; }
.menu-toggle svg { fill: none; stroke: currentColor; stroke-width: 1.6; }
.menu-toggle .i-close, .menu-toggle[aria-expanded="true"] .i-open { display: none; }
.menu-toggle[aria-expanded="true"] .i-close { display: inline; }

/* Page */
main { flex: 1 0 auto; padding: .6rem var(--gutter) 3rem; }
.page-title { margin: .6rem 0 .3rem; font-size: 1.3rem; font-weight: 600; }
.page-title:focus { outline: none; }
.page-end { margin: 2rem 0 0; font-size: .92rem; }
.method { max-width: 78ch; margin: 0; padding-left: 1.4rem; font-size: .92rem; line-height: 1.55; }
.method li { margin: 0 0 .6rem; padding-left: .2rem; }
.method strong { font-weight: 600; }
.view:focus { outline: none; }
.headnote { margin: 0 0 1rem; max-width: 80ch; font-size: .88rem; }
.source, .readout { margin: .45rem 0 0; color: var(--muted); font-size: .8rem; }
.colophon { padding: 1rem var(--gutter) 2rem; border-top: 1px solid var(--rule-soft); color: var(--muted); font-size: .8rem; }
.colophon p { margin: 0; }

/* Controls */
.map-controls { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .75rem 1rem; margin: 0 0 1rem; }
.control { display: flex; flex-direction: column; gap: .2rem; min-width: 0; margin: 0; padding: 0; border: 0; font-size: .8rem; color: var(--muted); }
.control input, .control select, .year-pair input { height: 2rem; padding: 0 .5rem; border: 1px solid var(--rule); border-radius: 0; background: var(--field); color: var(--ink); font-size: .88rem; }
.year-pair input::placeholder, .filter-search input::placeholder { color: var(--muted); opacity: 1; }
.year-pair { display: flex; align-items: center; gap: .4rem; color: var(--ink); font-size: .88rem; }
.year-pair input { width: 5.5rem; }
.text-button { height: 2rem; padding: 0; border: 0; background: none; color: var(--accent); font-size: .88rem; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.icon-button { display: inline-flex; flex: none; align-items: center; justify-content: center; width: 2rem; height: 2rem; padding: 0; border: 1px solid var(--rule); background: transparent; color: var(--ink); cursor: pointer; }
.icon-button svg { fill: none; stroke: currentColor; stroke-width: 1.5; }

/* Filters: one sticky row; the panel opens over the page below it. */
.page-title + .filters-slot { margin-top: .6rem; }
/* Sticky layers each paint a strip of paper just above themselves, under the layer above, so no sub-pixel gap shows the page. */
.filters-slot { position: sticky; top: var(--mast-h, 0px); z-index: 5; margin: 0 calc(-1 * var(--gutter)); padding: 0 var(--gutter); background: var(--paper); box-shadow: 0 -2px 0 var(--paper); }
.filters { position: relative; padding: .5rem 0 .4rem; }
.filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .5rem; }
.filter-toggle { display: inline-flex; flex: none; align-items: center; gap: .45rem; height: 2rem; padding: 0 .7rem; border: 1px solid var(--ink); background: transparent; color: var(--ink); font-size: .88rem; font-weight: 600; cursor: pointer; }
.filter-toggle svg { fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linejoin: round; }
.filter-toggle .chev { transition: transform .15s ease; }
.filter-toggle[aria-expanded="true"] { background: var(--ink); color: var(--paper); }
.filter-toggle[aria-expanded="true"] .chev { transform: rotate(180deg); }
.filter-badge { width: .5rem; height: .5rem; border-radius: 50%; background: var(--accent-fill); }
.search-toggle[aria-expanded="true"] { border-color: var(--ink); background: var(--field); }
.filter-search { position: relative; display: flex; flex: 0 1 18rem; min-width: 0; }
.filter-search label { flex: 1; min-width: 0; }
.filter-search input { width: 100%; height: 2rem; padding: 0 2rem 0 .5rem; border: 1px solid var(--ink); border-radius: 0; background: var(--field); color: var(--ink); font-size: .88rem; }
.filter-search input::-webkit-search-cancel-button { display: none; }
.search-clear { position: absolute; top: 0; right: 0; border: 0; color: var(--muted); font-size: 1.15rem; }
.filter-tokens { display: flex; flex: 1 1 0; align-items: center; gap: .4rem; min-width: 0; margin: 0; padding: 0; list-style: none; overflow: hidden; }
.filter-tokens li { flex: none; }
/* While the panel is open its own controls show every filter, so the tokens step aside. */
.filters.panel-open .filter-tokens { display: none; }
.token { display: inline-flex; align-items: center; gap: .4rem; height: 1.75rem; padding: 0 .3rem 0 .55rem; border: 1px solid var(--rule); background: var(--field); color: var(--ink); font-size: .8rem; white-space: nowrap; cursor: pointer; }
.token .sw { width: .6rem; height: .6rem; background: var(--sw); }
.token .x { color: var(--muted); font-size: 1rem; line-height: 1; }
.token:hover .x, .token:focus-visible .x { color: var(--ink); }
.token-reset { height: 1.75rem; font-size: .8rem; }
.list-controls { display: flex; flex: none; gap: .5rem; margin-left: auto; }
.list-controls select { max-width: 11rem; }
#view-explore .list-controls { display: none; }
.filter-stats { margin: .35rem 0 0; color: var(--muted); font-size: .85rem; }
.filter-stats strong { color: var(--ink); font-weight: 600; }

.filter-panel { position: absolute; top: 100%; left: calc(-1 * var(--gutter)); right: calc(-1 * var(--gutter)); max-height: calc(100dvh - var(--mast-h, 0px) - var(--sticky-h, 6rem)); overflow: auto; padding: 1rem var(--gutter) .8rem; border-bottom: 1px solid var(--rule); background: var(--paper); box-shadow: 0 10px 20px -12px rgb(0 0 0 / .35); overscroll-behavior: contain; }
.panel-group { margin: 0; padding: 0; border: 0; min-width: 0; }
.panel-group > legend { padding: 0; margin-bottom: .4rem; color: var(--muted); font-size: .8rem; }
.occupations-filter > legend { float: left; margin: 0 1rem 0 0; line-height: 2rem; }
.causes-filter { margin-top: 1.1rem; }
.fields-summary { margin-left: .4rem; color: var(--ink); }
.fields-actions { display: flex; gap: 1rem; margin-bottom: .45rem; }
.fields-actions .text-button { font-size: .8rem; }
.chips { clear: both; display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { position: relative; display: inline-flex; align-items: center; gap: .45rem; padding: .28rem .6rem; border: 1px solid var(--rule); background: transparent; color: var(--muted); font-size: .82rem; cursor: pointer; user-select: none; }
.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.chip .sw { width: .7rem; height: .7rem; border: 1.5px solid var(--sw); background: transparent; }
.chip b { font-weight: 400; color: var(--muted); }
.chip:has(input:checked) { border-color: var(--ink); background: var(--field); color: var(--ink); }
.chip:has(input:checked) .sw { background: var(--sw); }
.chip:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.chip.empty-field { opacity: .55; }
.panel-row { display: flex; flex-wrap: wrap; gap: 1rem 2.5rem; margin-top: 1.1rem; }
.panel-foot { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1.1rem; padding-top: .7rem; border-top: 1px solid var(--rule-soft); }
.panel-done { height: 2.25rem; padding: 0 1.1rem; border: 1px solid var(--ink); background: var(--ink); color: var(--paper); font-size: .88rem; font-weight: 600; cursor: pointer; }

/* Registry table */
.table-section { margin-top: .4rem; }
#view-explore .filters-slot { margin-bottom: 1.2rem; }
/* Column heads stick under the filter bar, so the table's borders sit on its cells (separate borders move with sticky cells). */
.registry { width: 100%; table-layout: fixed; border-collapse: separate; border-spacing: 0; font-size: .88rem; }
.registry .h-name { width: 27%; }
.registry .h-date { width: 6.6rem; }
.registry .h-cause { width: 22%; }
.registry .h-source { width: 5.5rem; }
/* Narrow desktops drop the birth date so occupation keeps its room. */
@media (max-width: 960px) {
  .registry .h-born, .registry .c-born { display: none; }
}
.registry th, .registry td { padding: .45rem 1rem .45rem 0; text-align: left; vertical-align: top; }
.registry thead th { position: sticky; top: calc(var(--mast-h, 0px) + var(--sticky-h, 0px)); z-index: 3; border-top: 2px solid var(--ink); border-bottom: 1px solid var(--ink); background: var(--paper); box-shadow: 0 -2px 0 var(--paper); font-size: .8rem; font-weight: 600; white-space: nowrap; }
.registry tbody tr:nth-child(3n):not(:last-child) > * { border-bottom: 1px solid var(--rule-soft); }
.registry tbody tr:last-child > * { border-bottom: 2px solid var(--ink); }
.registry tbody tr { height: 3.5rem; scroll-margin-top: calc(var(--mast-h, 0px) + var(--sticky-h, 5rem) + 2.4rem); }
.registry tbody th { font-weight: 400; }
.registry .one { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.registry .desc { color: var(--ink); font-size: .8rem; }
.registry .clip { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }


.registry td:last-child, .registry th:last-child { padding-right: 0; }
.empty { margin: 1rem 0 0; }
.table-end { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1.5rem; margin-top: .7rem; }
.more { padding: .4rem 1rem; border: 1px solid var(--ink); background: transparent; color: var(--ink); font-size: .88rem; cursor: pointer; }
.more:hover { background: var(--ink); color: var(--paper); }

/* Record */
body[data-view="record"] main { display: flex; flex-direction: column; padding-bottom: 0; }
/* On phones a record fills the window below the masthead, its browse links at the bottom; the colophon steps aside. */
@media (max-width: 640px) {
  body[data-view="record"] { min-height: 100dvh; }
  body[data-view="record"] .colophon { display: none; }
  body[data-view="record"] main { padding-bottom: env(safe-area-inset-bottom); }
}
#view-record { touch-action: pan-y; }
.record-body.enter-next { animation: enter-next .22s ease-out; }
.record-body.enter-prev { animation: enter-prev .22s ease-out; }
@keyframes enter-next { from { opacity: 0; transform: translateX(48px); } }
@keyframes enter-prev { from { opacity: 0; transform: translateX(-48px); } }
.record-body { transition: transform .2s ease, opacity .2s ease; }
.browse-hint { grid-column: 1 / -1; grid-row: 1; margin-bottom: 1.45em; color: var(--muted); text-align: center; }
.swipe-hint { display: none; }
@media (hover: none) and (pointer: coarse) {
  .browse .record-hint { display: none; }
  .browse .swipe-hint { display: block; }
}
#view-record:not([hidden]) { position: relative; display: flex; flex: 1 0 auto; flex-direction: column; }
.record-body { width: 100%; max-width: 44rem; margin: 0 auto; padding-top: 1.6rem; }
.record-close { position: absolute; top: .6rem; right: 0; display: inline-flex; align-items: center; justify-content: center; width: 2.25rem; height: 2.25rem; border: 1px solid var(--rule); color: var(--ink); font-size: 1.4rem; line-height: 1; text-decoration: none; }
.record-close:hover { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.browse { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 0 1rem; align-items: center; width: 100%; max-width: 44rem; margin: auto auto 0; padding: 2.5rem 0 1rem; font-size: .88rem; }
.browse .prev, .browse .pos, .browse .next { grid-row: 2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.browse .prev { justify-self: start; max-width: 100%; }
.browse .next { justify-self: end; max-width: 100%; text-align: right; }
.browse .pos { color: var(--muted); text-align: center; }
.browse .none { color: var(--muted); }
.record-hint kbd { display: inline-block; min-width: 1.3em; padding: 0 .25em; border: 1px solid var(--rule); border-radius: 3px; font: inherit; line-height: 1.35; text-align: center; }
.record-qid { margin: 0; color: var(--muted); font-size: .8rem; }
.record-name { margin: .1rem 0 .1rem; font-size: 1.6rem; font-weight: 600; line-height: 1.2; }
.record-name:focus { outline: none; }
.record-desc { margin: 0 0 1.2rem; color: var(--muted); }
.fields { width: 100%; max-width: 44rem; border-collapse: collapse; border-top: 2px solid var(--ink); border-bottom: 2px solid var(--ink); font-size: .92rem; }
.fields th, .fields td { padding: .45rem 1rem .45rem 0; text-align: left; vertical-align: top; }
.fields th { width: 12rem; color: var(--muted); font-weight: 400; }
.fields sup, .notes sup { color: var(--muted); font-size: .68em; line-height: 0; }
.notes { margin: .5rem 0 1.2rem; color: var(--muted); font-size: .8rem; }
.notes a + sup { margin-left: .9em; }
.notes sup { margin-right: .1em; }
.notes .photo-credit { margin-left: .9em; }
.fields td p { margin: 0; }
.fields td p + p { margin-top: .5em; }
/* A round portrait to the left of the name and description, which wrap beside it, so every record's heading sits the same way. */
.record-head { display: flex; align-items: center; gap: 1.25rem; margin-bottom: 1.2rem; }
.record-heading { min-width: 0; }
.record-head .record-desc { margin-bottom: 0; }
.record-photo { position: relative; flex: 0 0 auto; display: block; width: 7rem; height: 7rem; overflow: hidden; border-radius: 50%; background: var(--rule-soft); }
.record-photo img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 25%; }
.record-photo.none::before { content: ""; position: absolute; inset: 12% 12% 0; background: var(--muted); opacity: .22; -webkit-mask: url("/institute/silhouette.svg") center bottom / contain no-repeat; mask: url("/institute/silhouette.svg") center bottom / contain no-repeat; }
.record-photo.none span { position: relative; display: flex; align-items: center; justify-content: center; height: 100%; color: var(--muted); font-size: .72rem; line-height: 1.25; text-align: center; }

/* Figures */
.figure { margin: 2.2rem 0 0; }
/* A figure's top rule sticks under the filter bar while the figure scrolls past, as the bar's lower edge. */
.figure::before { content: ""; position: sticky; top: calc(var(--mast-h, 0px) + var(--sticky-h, 0px)); z-index: 4; display: block; height: 2px; margin-bottom: 1rem; background: var(--ink); }
.figure h2 { margin: 0 0 .2rem; font-size: .98rem; font-weight: 600; }
.figure .headnote { margin-bottom: .8rem; }
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.axis text, .chart-label { fill: var(--muted); font-size: 11px; font-family: var(--sans); }
.axis line, .axis path { stroke: var(--rule); fill: none; }
.gridline { stroke: var(--rule-soft); }
.baseline { stroke: var(--ink); }
.break-mark { stroke: var(--ink); stroke-width: 1.2; fill: none; }

/* Timeline modes */
.time-controls { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem 1rem; margin: 0 0 .7rem; }
.segmented { display: inline-flex; margin: 0; padding: 0; border: 0; }
.segmented label { margin-left: -1px; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.segmented span { display: block; padding: .25rem .7rem; border: 1px solid var(--rule); font-size: .82rem; }
.segmented input:checked + span { position: relative; background: var(--ink); border-color: var(--ink); color: var(--paper); }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.time-stats { margin: 0; color: var(--muted); font-size: .8rem; }
.chart-wrap { position: relative; }
.points-svg:focus { outline: none; }
.points-svg:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.year-grid { stroke: var(--rule-soft); stroke-dasharray: 2 5; }
.year-tick { stroke: var(--ink); }
.minor-tick { stroke: var(--rule); }
.year-label { fill: var(--muted); font-size: 11px; font-family: var(--sans); }
.band-guide { stroke: var(--rule); stroke-dasharray: 2 5; }
.plabel text { font-family: var(--sans); font-size: 11px; fill: var(--ink); }
.plabel .pcount { fill: var(--muted); }
.plabels, .guides { pointer-events: none; }
.pt { stroke-width: 1.3; cursor: pointer; }
.pt.confirmed { stroke: none; }
.pt:hover, .pt.active { stroke: var(--ink) !important; stroke-width: 2; }
.tip { position: absolute; z-index: 3; width: max-content; max-width: 18rem; padding: .4rem .6rem; background: var(--ink); color: var(--paper); font-size: .78rem; line-height: 1.4; pointer-events: none; transform: translate(-50%, calc(-100% - 10px)); }
.tip strong { font-weight: 600; }
.zoom { margin-top: .6rem; }
.zoom-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .4rem 1rem; font-size: .85rem; }
.zoom-readout { font-weight: 600; }
.zoom-rail { position: relative; height: 26px; margin: .2rem 7px 0; }
.zoom-track, .zoom-selection { position: absolute; top: 12px; left: 0; right: 0; height: 2px; background: var(--rule); }
.zoom-selection { right: auto; background: var(--accent-fill); }
.zoom-rail input[type="range"] { -webkit-appearance: none; appearance: none; position: absolute; inset: 0; width: 100%; height: 26px; margin: 0; background: transparent; pointer-events: none; }
.zoom-rail input[type="range"]::-webkit-slider-runnable-track { height: 2px; background: transparent; }
.zoom-rail input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 12px; height: 20px; margin-top: -9px; border: 1px solid var(--paper); background: var(--ink); cursor: ew-resize; pointer-events: auto; }
.zoom-rail input[type="range"]::-moz-range-track { height: 2px; background: transparent; }
.zoom-rail input[type="range"]::-moz-range-thumb { width: 10px; height: 18px; border: 1px solid var(--paper); border-radius: 0; background: var(--ink); cursor: ew-resize; pointer-events: auto; }
.zoom-rail input[type="range"]:focus-visible { outline: none; }
.zoom-rail input[type="range"]:focus-visible::-webkit-slider-thumb { outline: 2px solid var(--accent); outline-offset: 2px; }
.zoom-rail input.active { z-index: 2; }
.zoom-extents { display: flex; justify-content: space-between; color: var(--muted); font-size: .75rem; }
.time-key { margin: .5rem 0 0; color: var(--muted); font-size: .8rem; }
.time-key i { display: inline-block; width: .6rem; height: .6rem; margin: 0 .3rem 0 0; vertical-align: 0; }
.time-key i + span + i { margin-left: .9rem; }
.time-key .k-dot { border-radius: 50%; background: var(--ink); }
.time-key .k-ring { border-radius: 50%; border: 1.3px solid var(--ink); }

/* Manner chart */
.manner-chart { --label: 11.5rem; --count: 3.5rem; --bar: 16px; --row: 24px; --phase: .32s; }
.mrow { position: relative; display: grid; grid-template-columns: var(--label) minmax(0, 1fr) var(--count); column-gap: .75rem; align-items: start; padding: 4px 0; border-top: 1px solid var(--rule-soft); }
.mrow:first-child { border-top: 0; }
.mhead { justify-self: start; padding: 0; border: 0; background: none; color: var(--ink); font-size: .85rem; line-height: var(--bar); text-align: left; cursor: pointer; }
.mhead::before { content: "+"; display: inline-block; width: 1em; color: var(--muted); }
.mhead[aria-expanded="true"]::before { content: "−"; }
.mhead:hover { text-decoration: underline; }
.mcount { justify-self: end; font-size: .85rem; line-height: var(--bar); text-align: right; transition: transform .45s ease; }
/* Closing, the stage shrinks with the last segment's rise so the rows below never ride up over the closing parts. */
.stage { position: relative; height: var(--bar); cursor: pointer; transition: height var(--phase) ease calc(var(--phase) + (var(--n) - 1) * 35ms); }
.mrow.open .stage { height: calc(var(--bar) + var(--n) * var(--row) + 6px); transition-delay: 0s; }
.stage .total { position: absolute; left: 0; top: 0; height: var(--bar); width: var(--w); border: 1px dashed var(--rule); opacity: 0; transition: opacity .3s ease; }
.mrow.open .stage .total { opacity: 1; }
/* Segments move in two phases so none crosses another: opening, each drops straight to its own row, then slides left;
   closing, each slides back right within its row, then rises. Everything to a segment's left sits in the rows above it. */
.seg { position: absolute; top: 0; left: var(--x); width: var(--w); height: var(--bar); background: var(--color); box-shadow: inset 1px 0 0 var(--paper);
  transition: left var(--phase) ease, top var(--phase) ease; transition-delay: calc(var(--i) * 35ms), calc(var(--phase) + var(--i) * 35ms); }
.mrow.open .seg { left: 0; top: calc(var(--bar) + 6px + var(--i) * var(--row)); box-shadow: none; transition-delay: calc(var(--phase) + var(--i) * 35ms), calc(var(--i) * 35ms); }
.seg-name, .seg-count { position: absolute; top: 0; font-size: .8rem; line-height: var(--bar); white-space: nowrap; opacity: 0; pointer-events: none; }
.seg-count { left: calc(100% + .4rem); color: var(--muted); transition: opacity .25s ease; }
/* Names unfold straight down from the group name: only top and opacity change. */
.seg-name { left: calc(-1 * var(--label) - .75rem); width: var(--label); padding-left: 1em; overflow: hidden; text-overflow: ellipsis; color: var(--ink); transition: top var(--phase) ease, opacity .15s ease; transition-delay: calc(var(--phase) + var(--i) * 35ms), 0s; }
.mrow.open .seg-name { top: calc(var(--bar) + 6px + var(--i) * var(--row)); opacity: 1; transition: top var(--phase) ease, opacity .3s ease; transition-delay: calc(var(--i) * 35ms), calc(var(--i) * 35ms + .08s); }
.mrow.open .seg-count { opacity: 1; transition-delay: calc(2 * var(--phase) + var(--i) * 35ms); }

/* Map */
.map-controls { align-items: center; gap: .5rem 1.4rem; margin-bottom: .6rem; font-size: .85rem; }
.check { display: inline-flex; align-items: center; gap: .4rem; cursor: pointer; }
.check input { width: 1rem; height: 1rem; margin: 0; accent-color: var(--accent-fill); }
.map-key { margin: 0; color: var(--muted); font-size: .8rem; }
.key-dot { display: inline-block; width: .6rem; height: .6rem; margin: 0 .3rem 0 .6rem; border-radius: 50%; vertical-align: 0; }
.key-dot.key-birth { margin-left: 0; background: var(--c-slate); }
.key-dot.key-death { background: var(--c-vermilion); }
.map-controls .text-button { height: auto; }
.map svg { overflow: hidden; }
.map path { vector-effect: non-scaling-stroke; }
.map .continent { fill: var(--land); fill-rule: evenodd; stroke: none; transition: fill .15s ease, opacity .35s ease; }
.map .continent.hot { fill: var(--land-hot); cursor: pointer; }
.map .continent.faded { opacity: .45; }
.map .sphere { fill: none; stroke: var(--rule); }
.map .graticule { fill: none; stroke: var(--rule-soft); stroke-width: .5; }
.map .arcs { fill: none; stroke: var(--ink); stroke-opacity: .24; stroke-width: .7; }
.map .dots path { fill: none; stroke-linecap: round; stroke-width: 3.6; }
.map .dots .birth { stroke: var(--c-slate); stroke-opacity: .65; }
.map .dots .death { stroke: var(--c-vermilion); stroke-opacity: .65; }
.map.has-active .arcs { visibility: hidden; }
.map.has-active .dots { opacity: .3; }
.map.hover-dot svg { cursor: pointer; }
.map .arc { fill: none; stroke: var(--ink); stroke-width: 1.6; }
.map .sel-ring { fill: none; stroke: var(--ink); stroke-linecap: round; stroke-width: 10; }
.map .sel-birth, .map .sel-death { fill: none; stroke-linecap: round; stroke-width: 7; }
.map .sel-birth { stroke: var(--c-slate); }
.map .sel-death { stroke: var(--c-vermilion); }

@media (max-width: 640px) {
  html { font-size: 17px; }
  body { font-size: 1rem; }
  .agency { font-size: .95rem; }
  .mast-subtitle { font-size: .8rem; }
  #mast-meta { display: none; }
  .intro { font-size: 1.05rem; }
  .headnote, .method { font-size: .9rem; }
  .source, .readout, .time-stats, .time-key, .map-key, .zoom-extents, .filter-stats { font-size: .82rem; }
  .axis text, .year-label, .plabel text { font-size: 12px; }

  /* Touch-sized controls; 16px+ text also stops iOS from zooming into fields. */
  .control { font-size: .85rem; }
  .control input, .control select, .year-pair input { height: 2.75rem; font-size: 1rem; }
  .year-pair input { width: 6rem; }
  .text-button { height: 2.75rem; font-size: .95rem; }
  .theme-switch button { min-height: 2.25rem; padding: 0 .75rem; font-size: .85rem; }
  .chip { min-height: 2.5rem; padding: .3rem .7rem; font-size: .88rem; }
  .fields-actions .text-button { font-size: .88rem; }

  /* Masthead: the nav and theme switch fold into the menu button. */
  /* The menu button is pinned to the top-right corner, level with the title's first line; only the title makes room for it. */
  .agency { display: block; margin-right: 1.8rem; }
  .menu-toggle { display: inline-flex; position: absolute; top: .42rem; right: calc(var(--gutter) - .8rem); margin: 0; }
  .nav-row { display: none; position: fixed; top: var(--mast-h, 4.5rem); left: 0; right: 0; z-index: 7; margin: 0; padding: .3rem var(--gutter) .9rem; border-bottom: 1px solid var(--rule); background: var(--paper); box-shadow: 0 10px 20px -12px rgb(0 0 0 / .35); }
  .masthead.menu-open + .nav-row { display: flex; flex-direction: column; align-items: stretch; gap: .6rem; }
  .masthead.menu-open + .nav-row .site-nav { flex-direction: column; gap: 0; }
  .masthead.menu-open + .nav-row .site-nav a { min-height: 2.75rem; padding: 0 .75rem; border-bottom: 1px solid var(--rule-soft); font-size: 1.05rem; }
  .masthead.menu-open + .nav-row .theme-switch { align-self: flex-start; margin: .2rem 0 0; }
  .masthead.menu-open + .nav-row:not(:has(.theme-switch)) .site-nav a:last-child { border-bottom: 0; }

  /* Filter bar: toggle, search, sort and jump share one row; search and tokens drop to lines of their own. */
  .filters { padding: .45rem 0 .35rem; }
  .filter-bar { gap: .4rem; }
  .filter-toggle, .icon-button, .list-controls select { height: 2.6rem; }
  .icon-button { width: 2.6rem; }
  .filter-toggle { gap: .35rem; padding: 0 .6rem; font-size: .95rem; }
  .filter-toggle .chev { display: none; }
  .filter-toggle .filter-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .list-controls { flex: 1 1 0; min-width: 0; gap: .4rem; }
  .list-controls .control { flex: 1 1 0; min-width: 0; }
  .list-controls .control:last-child { flex: 0 0 4.9rem; }
  .list-controls select { -webkit-appearance: none; appearance: none; width: 100%; max-width: none; padding: 0 1rem 0 .4rem; background: var(--field) no-repeat right .4rem center / .55rem; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(-45deg, transparent 50%, var(--muted) 50%); background-size: .3rem .3rem, .3rem .3rem; background-position: right .6rem center, right .3rem center; font-size: .95rem; text-overflow: ellipsis; }
  .filter-search { order: 1; flex: 1 0 100%; }
  .filter-search input { height: 2.75rem; font-size: 1rem; }
  .search-clear { width: 2.75rem; height: 2.75rem; }
  .filter-tokens { order: 2; flex: 1 0 100%; }
  .token, .token-reset { height: 2.25rem; font-size: .88rem; }
  .panel-row { flex-direction: column; gap: 1rem; }
  .panel-done { height: 2.75rem; font-size: 1rem; }
  .panel-foot { position: sticky; bottom: -.8rem; margin-bottom: -.8rem; padding-bottom: .8rem; background: var(--paper); }
  .segmented span { padding: .55rem .7rem; font-size: .88rem; }
  .check { min-height: 2.5rem; }
  .check input { width: 1.25rem; height: 1.25rem; }
  .zoom-rail { height: 36px; margin: .2rem 12px 0; }
  .zoom-track, .zoom-selection { top: 17px; }
  .zoom-rail input[type="range"] { height: 36px; }
  .zoom-rail input[type="range"]::-webkit-slider-thumb { width: 22px; height: 30px; margin-top: -14px; }
  .zoom-rail input[type="range"]::-moz-range-thumb { width: 20px; height: 28px; }
  .manner-chart { --label: 8.5rem; --count: 2.5rem; --bar: 22px; --row: 30px; }
  .mhead, .mcount { font-size: .9rem; }
  .seg-name, .seg-count { font-size: .82rem; }

  /* Table 1 becomes a compact two-line list; the whole row opens the record. */
  .filters { border-bottom: 2px solid var(--ink); }
  #view-explore .filters { border-bottom: 0; }
    .registry { font-size: .95rem; }
  .registry thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .registry tbody { display: block; }
  .registry tbody tr { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: .8rem; align-items: baseline; height: auto; min-height: 3.6rem; padding: .55rem 0; }
  .registry tbody tr { scroll-margin-top: calc(var(--mast-h, 0px) + var(--sticky-h, 5rem) + .5rem); }
  .registry tbody tr > * { border-bottom: 0 !important; }
  .registry tbody tr:nth-child(3n):not(:last-child) { border-bottom: 1px solid var(--rule-soft); }
  .registry tbody tr:last-child { border-bottom: 2px solid var(--ink); }
  .registry tbody th, .registry td { display: block; width: auto; max-width: none; padding: 0; }
  /* The name cell's parts join the row grid, so the description runs the full width under the name and date. */
  .registry tbody th { display: contents; }
  .registry th a.one { grid-column: 1; grid-row: 1; min-width: 0; }
  .registry th .desc { grid-column: 1 / -1; grid-row: 2; min-width: 0; }
  .registry .one { max-width: none; }
  .registry th a.one { font-weight: 600; }
  .registry th a.one::after { content: ""; position: absolute; inset: 0; }
  .registry th a.one:focus-visible { outline: none; }
  .registry tr:has(a.one:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
  .registry .desc { font-size: .85rem; }
  .registry .c-born, .registry .c-occ, .registry .c-source { display: none; }
  .registry .c-cause { grid-column: 1 / -1; grid-row: 3; margin-top: .15rem; color: var(--muted); font-size: .82rem; }
  .registry .c-cause .clip { -webkit-line-clamp: 1; line-clamp: 1; }
  .registry .c-died { grid-column: 2; grid-row: 1; color: var(--muted); font-size: .85rem; text-align: right; }

  .table-end { display: block; }
  .more { width: 100%; height: 3rem; margin-top: .7rem; font-size: 1rem; }
  .to-top { display: block; width: 100%; height: 3rem; margin-top: .4rem; }
  .site-nav { font-size: .95rem; }

  .browse { padding: 1.25rem 0 .25rem; }
  .record-body { padding-top: .9rem; }
  .record-qid, .record-name { padding-right: 2.75rem; }
  .record-desc { margin-bottom: .9rem; }
  .record-head { gap: 1rem; margin-bottom: .9rem; }
  .record-photo { width: 5.25rem; height: 5.25rem; }
  .record-photo.none span { font-size: .66rem; }
  .browse a { display: block; line-height: 2.75rem; }
  .fields th { width: 7.25rem; }
  .fields th, .fields td { padding: .35rem .75rem .35rem 0; }
  .notes { margin-bottom: .6rem; }
}

@media (prefers-reduced-motion: reduce) {
  .stage, .seg, .seg-name, .seg-count, .filter-toggle .chev, .record-body, .stage .total, .mcount, .map .continent { transition: none !important; }
  .record-body { animation: none !important; }
}
