:root {
  /* dark (default) */
  --paper: #141312;
  --paper-2: #1e1c1a;
  --card: #23201d;
  --ink: #ebe4d8;
  --ink-soft: #a89e90;
  --rule: #3b3631;
  --red: #e0645a;
  --red-soft: #f08a7f;
  --gold: #d8b04e;
  --green: #6faa86;
  --bg-glow: #1d1a17;
  --tabs-bg: rgba(20, 19, 18, .92);
  --tint: rgba(224, 100, 90, .14);
  --quote: #e3d9c8;
  --img-bg: #f4efe6;
  --focus-bg: #2b2622;
  --gap-a: #1f1b19;
  --gap-b: #241f1c;
  --btn-ink: #1a1614;
  --img-dim: brightness(.88) contrast(1.02);
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 6px 18px rgba(0, 0, 0, .3);
  /* Bruce tartan */
  --t-red: #b3262b;
  --t-green: #1f5a3a;
  --t-yellow: #e2b93b;
  --t-white: #f1ece2;
  --serif: "EB Garamond", Georgia, "Times New Roman", serif;
  --display: "Cormorant Garamond", "EB Garamond", Georgia, serif;
  color-scheme: dark;
}
[data-theme="light"] {
  --paper: #f6f0e4;
  --paper-2: #efe6d3;
  --card: #fffaf0;
  --ink: #2a2118;
  --ink-soft: #5c4f40;
  --rule: #d8cbb2;
  --red: #8e1b1b;
  --red-soft: #b54a3a;
  --gold: #a8842f;
  --green: #2f4a3a;
  --bg-glow: #fbf7ee;
  --tabs-bg: rgba(246, 240, 228, .94);
  --tint: var(--tint);
  --quote: #3c2f22;
  --img-bg: #fff;
  --focus-bg: #fff;
  --gap-a: #fbf3ea;
  --gap-b: #f8ece1;
  --btn-ink: #fff;
  --img-dim: none;
  --shadow: 0 1px 2px rgba(60, 40, 20, .08), 0 6px 18px rgba(60, 40, 20, .08);
  color-scheme: light;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 19px/1.62 var(--serif);
  background-image: radial-gradient(ellipse at top, var(--bg-glow) 0%, var(--paper) 60%);
}
a { color: var(--red); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--red-soft); }
h1, h2, h3, h4 { font-family: var(--display); font-weight: 600; line-height: 1.15; margin: 0 0 .4em; }
h2 { font-size: 2.3rem; }
h3 { font-size: 1.45rem; }
h4 { font-size: 1.15rem; }
em { font-style: italic; }

/* ---------- masthead */
.masthead { text-align: center; padding: 64px 20px 36px; position: relative; overflow: hidden; border-bottom: 1px solid var(--rule); }
.kicker { letter-spacing: .28em; text-transform: uppercase; font-size: .72rem; color: var(--ink-soft); margin: 0 0 6px; }
.masthead h1 { font-size: clamp(4rem, 12vw, 8.5rem); letter-spacing: .06em; margin: 0; font-weight: 700; color: var(--ink); }
.subtitle { font-family: var(--display); font-style: italic; font-size: 1.5rem; margin: 0 0 18px; color: var(--ink-soft); }

/* ---------- tabs */
.tabs { position: sticky; top: 0; z-index: 500; display: flex; justify-content: center; flex-wrap: wrap; gap: 2px;
  background: var(--tabs-bg); backdrop-filter: blur(6px); border-bottom: 1px solid var(--rule); padding: 0 8px; }
.tabs a { font-family: var(--display); font-size: 1.12rem; font-weight: 600; padding: 12px 16px 10px; color: var(--ink-soft); text-decoration: none; border-bottom: 3px solid transparent; }
.tabs a.active { color: var(--red); border-bottom-color: var(--red); }
.tabs a:hover { color: var(--ink); }

main { min-height: 60vh; }
.view { display: none; }
.view.active { display: block; }

/* ---------- story */
#view-story.active { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 40px; max-width: 1180px; margin: 0 auto; padding: 32px 24px 80px; }
.chapter-nav { position: sticky; top: 72px; align-self: start; font-size: .95rem; }
.chapter-nav ol { list-style: none; padding: 0; margin: 0; counter-reset: ch -1; border-left: 1px solid var(--rule); }
.chapter-nav li { counter-increment: ch; }
.chapter-nav a { display: block; padding: 5px 0 5px 16px; color: var(--ink-soft); text-decoration: none; border-left: 3px solid transparent; margin-left: -2px; }
.chapter-nav a::before { content: counter(ch, upper-roman) "  "; font-family: var(--display); color: var(--gold); font-size: .85em; }
.chapter-nav li:first-child a::before { content: "❦  "; }
.chapter-nav a.active { color: var(--red); border-left-color: var(--red); }
.story { max-width: 760px; }
.chapter { padding: 8px 0 56px; margin-bottom: 40px; border-bottom: 1px solid var(--rule); scroll-margin-top: 70px; }
.chapter:last-child { border-bottom: 0; }
.chapter header { margin-bottom: 18px; }
.ch-num { text-transform: uppercase; letter-spacing: .2em; font-size: .72rem; color: var(--gold); margin: 0 0 4px; font-weight: 500; }
.chapter h2 { font-size: clamp(2.1rem, 4.5vw, 3rem); }
.place { font-style: italic; color: var(--ink-soft); margin: 0; }
.lede { font-size: 1.18em; line-height: 1.55; }
.chapter > p.lede:first-of-type::first-letter { float: left; font-family: var(--display); font-size: 4.1em; line-height: .82; padding: 6px 10px 0 0; color: var(--red); font-weight: 700; }
.people-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; }
.chip { font: inherit; font-size: .8rem; border: 1px solid var(--rule); background: var(--card); color: var(--ink); border-radius: 999px; padding: 2px 11px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.chip:hover, .chip.on { border-color: var(--red); color: var(--red); }
.chip.on { background: var(--tint); }

.context { background: var(--paper-2); border-left: 4px solid var(--green); padding: 16px 22px; margin: 26px 0; font-size: .93em; border-radius: 0 6px 6px 0; }
.context h3 { color: var(--green); font-size: 1.2rem; text-transform: uppercase; letter-spacing: .12em; }
.context p:last-child { margin-bottom: 0; }

blockquote.quote { margin: 28px 0; padding: 4px 0 4px 26px; border-left: 3px solid var(--gold); font-family: var(--display); font-size: 1.35rem; line-height: 1.4; font-style: italic; color: var(--quote); }
blockquote.quote cite { display: block; font-family: var(--serif); font-style: normal; font-size: .82rem; margin-top: 8px; color: var(--ink-soft); letter-spacing: .04em; }
blockquote.quote.big { text-align: center; border: 0; padding: 18px 0; font-size: 1.7rem; font-style: normal; }
blockquote.quote.big span { color: var(--red); font-style: italic; }

figure.doc { margin: 26px 0; cursor: zoom-in; }
figure.doc .frame { background: var(--card); padding: 10px; box-shadow: var(--shadow); border: 1px solid var(--rule); border-radius: 3px; transition: transform .2s; }
figure.doc:hover .frame { transform: translateY(-2px); }
figure.doc img { display: block; width: 100%; height: auto; max-height: 520px; object-fit: contain; background: var(--img-bg); filter: var(--img-dim); }
figure.doc figcaption { font-size: .85rem; color: var(--ink-soft); margin-top: 8px; font-style: italic; }
figure.doc figcaption .docid { font-style: normal; color: var(--gold); font-size: .75rem; margin-left: 4px; }
figure.doc.mini { margin: 12px 0 0; max-width: 260px; }
figure.doc.mini img { max-height: 160px; }
.fig-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.fig-pair figure.doc img { max-height: 340px; }

table.ministry { border-collapse: collapse; margin: 22px auto; font-size: .95rem; min-width: 70%; background: var(--card); box-shadow: var(--shadow); }
table.ministry caption { font-family: var(--display); font-size: 1.3rem; font-weight: 600; padding-bottom: 6px; }
table.ministry td { padding: 6px 16px; border-bottom: 1px solid var(--paper-2); }
table.ministry td:first-child { color: var(--gold); white-space: nowrap; font-variant-numeric: oldstyle-nums; }

.generations { display: flex; flex-wrap: wrap; align-items: stretch; gap: 0; margin-top: 30px; }
.gen { flex: 1 1 0; min-width: 96px; text-align: center; padding: 12px 6px; border: 1px solid var(--rule); background: var(--card); cursor: pointer; position: relative; margin-right: 14px; border-radius: 4px; }
.gen:not(:last-child)::after { content: "›"; position: absolute; right: -13px; top: 50%; transform: translateY(-50%); color: var(--gold); font-size: 1.3rem; }
.gen:hover { border-color: var(--red); }
.gen b { display: block; font-family: var(--display); font-size: 1.05rem; line-height: 1.1; }
.gen small { display: block; color: var(--ink-soft); font-size: .72rem; line-height: 1.25; margin-top: 3px; }
.gen.living { background: var(--tint); }
.button { display: inline-block; font-family: var(--display); font-weight: 600; font-size: 1.1rem; padding: 8px 18px; background: var(--red); color: var(--btn-ink); border-radius: 4px; text-decoration: none; margin: 4px 8px 4px 0; }
.button:hover { color: var(--btn-ink); background: var(--red-soft); }
.button.ghost { background: transparent; color: var(--red); border: 1px solid var(--red); }

/* ---------- long line */
#view-line { max-width: 880px; margin: 0 auto; padding: 40px 24px 90px; }
.line-intro { text-align: center; margin-bottom: 30px; }
.line-intro h2 { font-size: 3rem; }
ol.line { list-style: none; padding: 0 0 0 40px; margin: 0; position: relative; }
ol.line::before { content: ""; position: absolute; left: 14px; top: 0; bottom: 0; width: 2px; background: linear-gradient(var(--gold), var(--red)); }
ol.line > li { position: relative; padding: 4px 0 26px 22px; }
ol.line > li::before { content: ""; position: absolute; left: -32px; top: 14px; width: 14px; height: 14px; border-radius: 50%; background: var(--paper); border: 2px solid var(--gold); }
ol.line > li.star::before { background: var(--red); border-color: var(--red); box-shadow: 0 0 0 4px var(--tint); }
ol.line > li.now::before { background: var(--gold); border-color: var(--gold); }
ol.line time { font-family: var(--display); font-weight: 700; color: var(--gold); font-size: 1.05rem; letter-spacing: .04em; }
ol.line h3 { margin: 2px 0 4px; }
ol.line p { margin: 0; color: var(--ink-soft); }
ol.line li.era { padding: 18px 0 22px 0; }
ol.line li.era::before { display: none; }
ol.line li.era span { display: inline-block; margin-left: -46px; background: var(--t-red); color: #fff; font-family: var(--display); letter-spacing: .14em; text-transform: uppercase; font-size: .85rem; padding: 4px 14px; border-radius: 2px; }
ol.line li.gap::before { display: none; }
ol.line li.gap { margin-left: -40px; padding-left: 0; }
.gap-box { border: 2px dashed var(--red); background: repeating-linear-gradient(45deg, var(--gap-a), var(--gap-a) 12px, var(--gap-b) 12px, var(--gap-b) 24px); padding: 22px 26px; border-radius: 8px; }
.gap-box h3 { color: var(--red); font-size: 1.8rem; text-align: center; }
.leads { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 14px 0; }
.leads > div { background: var(--card); padding: 12px 16px; border-radius: 6px; border: 1px solid var(--rule); font-size: .93em; }
.leads h4 { color: var(--green); }
.decider { text-align: center; margin: 8px 0 0; }

/* ---------- tree */
#view-tree { padding: 28px 16px 80px; max-width: 1280px; margin: 0 auto; }
.tree-head { text-align: center; }
.tree-head p { color: var(--ink-soft); margin: 0 0 10px; }
.tree-jump { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-bottom: 14px; }
.tree { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 0; }
.trow { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; align-items: flex-start; }
.trow-label { font-size: .7rem; letter-spacing: .2em; text-transform: uppercase; color: var(--gold); margin-top: 8px; }
.tgroup { display: flex; gap: 8px; padding: 8px 10px; border: 1px dashed var(--rule); border-radius: 8px; flex-wrap: wrap; justify-content: center; }
.tgroup-label { width: 100%; text-align: center; font-size: .72rem; color: var(--ink-soft); font-style: italic; }
.connector { width: 2px; height: 18px; background: var(--rule); }
.pcard { background: var(--card); border: 1px solid var(--rule); border-radius: 6px; padding: 8px 12px; min-width: 150px; max-width: 210px; text-align: center; cursor: pointer; box-shadow: var(--shadow); transition: transform .15s, border-color .15s; }
.pcard:hover { transform: translateY(-2px); border-color: var(--red); }
.pcard b { display: block; font-family: var(--display); font-size: 1.12rem; line-height: 1.15; }
.pcard small { display: block; color: var(--ink-soft); font-size: .76rem; line-height: 1.3; }
.pcard.focus { border: 2px solid var(--red); background: var(--focus-bg); transform: scale(1.06); min-width: 210px; }
.pcard.focus b { font-size: 1.35rem; color: var(--red); }
.pcard.sib { opacity: .85; min-width: 120px; }
.trow.sibs .pcard { min-width: 130px; padding: 6px 10px; }
.thumbs.clipped > .thumb:nth-child(n+9) { display: none; }
.more { font: inherit; font-size: .9rem; margin-top: 12px; background: transparent; color: var(--red); border: 1px solid var(--red); border-radius: 999px; padding: 4px 14px; cursor: pointer; }
#tree { scroll-margin-top: 60px; }
.pcard.living { background: var(--tint); border-style: dashed; }
.pcard.star b::after { content: " ★"; color: var(--gold); font-size: .75em; }
.person-panel { max-width: 820px; margin: 26px auto 0; background: var(--card); border: 1px solid var(--rule); border-radius: 8px; padding: 22px 28px; box-shadow: var(--shadow); }
.person-panel h3 { font-size: 2rem; margin-bottom: 0; }
.person-panel .role { color: var(--ink-soft); font-style: italic; margin: 0 0 12px; }
.facts { width: 100%; border-collapse: collapse; margin: 10px 0 14px; font-size: .95rem; }
.facts th { text-align: left; color: var(--gold); font-weight: 500; padding: 4px 14px 4px 0; vertical-align: top; white-space: nowrap; width: 1%; }
.facts td { padding: 4px 0; border-bottom: 1px solid var(--paper-2); }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; margin-top: 8px; }
.thumb { cursor: pointer; font-size: .72rem; color: var(--ink-soft); line-height: 1.25; }
.thumb img { width: 100%; height: 110px; object-fit: cover; object-position: top; border: 1px solid var(--rule); background: var(--img-bg); filter: var(--img-dim); display: block; margin-bottom: 4px; }

/* ---------- map */
#view-map { padding: 24px 16px 60px; max-width: 1280px; margin: 0 auto; }
.map-head { text-align: center; }
.map-head p { color: var(--ink-soft); margin: 0 0 10px; }
.map-buttons { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin-bottom: 12px; }
.map-buttons button, .chips button { font: inherit; font-size: .9rem; background: var(--card); border: 1px solid var(--rule); border-radius: 999px; padding: 4px 14px; cursor: pointer; color: var(--ink); }
.map-buttons button:hover, .chips button:hover, .chips button.on { border-color: var(--red); color: var(--red); }
.chips button.on { background: var(--tint); }
#leaflet { height: 72vh; min-height: 460px; border: 1px solid var(--rule); border-radius: 8px; box-shadow: var(--shadow); }
.leaflet-popup-content { font: 15px/1.45 var(--serif); }
.leaflet-popup-content h4 { margin: 0 0 4px; color: var(--red); font-size: 1.15rem; }
.leaflet-popup-content ul { margin: 4px 0 0; padding-left: 18px; }
.pin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.3), 0 2px 6px rgba(0,0,0,.3); }
.pin.family { background: var(--red); }
.pin.history { background: var(--gold); }
.pin.voyage { background: var(--green); }

/* ---------- archive */
#view-archive { padding: 28px 20px 80px; max-width: 1280px; margin: 0 auto; }
.archive-head { text-align: center; }
.archive-head p { color: var(--ink-soft); max-width: 760px; margin: 0 auto 14px; }
.filters { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 22px; }
.filters input { font: inherit; font-size: 1rem; padding: 8px 14px; width: min(520px, 100%); border: 1px solid var(--rule); border-radius: 6px; background: var(--card); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 18px; }
.card { background: var(--card); border: 1px solid var(--rule); border-radius: 6px; overflow: hidden; cursor: pointer; box-shadow: var(--shadow); display: flex; flex-direction: column; transition: transform .15s; }
.card:hover { transform: translateY(-3px); }
.card img { width: 100%; height: 170px; object-fit: cover; object-position: top; background: var(--img-bg); filter: var(--img-dim); border-bottom: 1px solid var(--rule); }
.card .meta { padding: 10px 12px 12px; }
.card .yr { font-family: var(--display); font-weight: 700; color: var(--gold); }
.card .t { font-size: .92rem; line-height: 1.3; }
.card .cat { font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-soft); margin-top: 4px; }
.decade { grid-column: 1 / -1; font-family: var(--display); font-size: 1.6rem; font-weight: 700; color: var(--red); border-bottom: 1px solid var(--rule); margin-top: 10px; }

/* ---------- viewer */
.viewer { position: fixed; inset: 0; z-index: 2000; background: rgba(28, 20, 12, .82); display: flex; align-items: center; justify-content: center; padding: 18px; }
.viewer[hidden] { display: none; }
.viewer-inner { position: relative; background: var(--paper); width: min(1400px, 100%); height: min(94vh, 1000px); border-radius: 8px; display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr); overflow: hidden; }
.viewer-img { background: #2b241c; display: flex; flex-direction: column; min-height: 0; }
.viewer-img img { flex: 1; min-height: 0; width: 100%; object-fit: contain; cursor: zoom-in; }
.viewer-img.zoomed { overflow: auto; display: block; }
.viewer-img.zoomed img { width: 220%; max-width: none; height: auto; cursor: zoom-out; }
.viewer-pager { display: flex; gap: 6px; padding: 8px; justify-content: center; flex-wrap: wrap; background: #1f1912; }
.viewer-pager button { font: inherit; font-size: .8rem; background: #3a3026; color: #eee; border: 0; border-radius: 4px; padding: 3px 10px; cursor: pointer; }
.viewer-pager button.on { background: var(--red); }
.viewer-text { overflow: auto; padding: 22px 24px; }
.viewer-text h3 { font-size: 1.6rem; }
.viewer-text .vmeta { font-size: .85rem; color: var(--ink-soft); margin-bottom: 10px; }
.viewer-text .credit { font-size: .75rem; color: var(--ink-soft); font-style: italic; margin-top: 18px; }
.viewer-text dl { margin: 12px 0 0; font-size: .92rem; }
.viewer-text dt { color: var(--gold); font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; margin-top: 10px; }
.viewer-text dd { margin: 2px 0 0; white-space: pre-line; }
.close { position: absolute; top: 8px; right: 10px; z-index: 3; font-size: 1.8rem; line-height: 1; background: var(--paper); border: 1px solid var(--rule); border-radius: 50%; width: 40px; height: 40px; cursor: pointer; color: var(--ink); }

/* ---------- next */
#view-next { max-width: 860px; margin: 0 auto; padding: 40px 24px 90px; }
.next h2 { font-size: 3rem; text-align: center; }
.dna { background: var(--card); border: 1px solid var(--rule); border-top: 4px solid var(--red); border-radius: 6px; padding: 20px 26px; margin: 26px 0; box-shadow: var(--shadow); }
.outcomes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 12px; }
.outcomes > div { padding: 12px 14px; border-radius: 6px; font-size: .9em; background: var(--paper-2); }
.outcomes .yes { border-top: 3px solid var(--green); }
.outcomes .match { border-top: 3px solid var(--gold); }
.outcomes .no { border-top: 3px solid var(--ink-soft); }
.todo li { margin-bottom: 8px; }
.small { font-size: .85rem; color: var(--ink-soft); }
.foot { text-align: center; padding: 28px; color: var(--ink-soft); font-size: .85rem; border-top: 1px solid var(--rule); }

  .viewer-inner { grid-template-columns: 1fr; grid-template-rows: 58% 42%; height: 96vh; }
  .leads, .outcomes, .fig-pair { grid-template-columns: 1fr; }
  .gen { min-width: 44%; margin-bottom: 10px; }
  .pcard { min-width: 120px; }
}

/* ---------- tartan, arms, theme toggle */
.tartan {
  height: 9px; border: 0; margin: 0;
  background:
    repeating-linear-gradient(90deg, transparent 0 22px, rgba(31, 90, 58, .9) 22px 34px, transparent 34px 46px, var(--t-yellow) 46px 47px, transparent 47px 58px, var(--t-white) 58px 59px, transparent 59px 72px),
    var(--t-red);
  opacity: .9;
}
.tartan.thin { height: 4px; opacity: .75; }
.arms { display: block; width: 54px; height: 64px; margin: 0 auto 14px; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .35)); }
.arms.small { display: inline-block; width: 18px; height: 22px; margin: 0 6px -5px 0; filter: none; }
.motto { font-family: var(--display); font-style: italic; letter-spacing: .2em; color: var(--gold); font-size: .95rem; margin: 10px 0 0; }
.theme-toggle { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font: inherit; font-size: .85rem; background: transparent; color: var(--ink-soft); border: 1px solid var(--rule); border-radius: 999px; padding: 3px 12px; cursor: pointer; }
.theme-toggle:hover { color: var(--red); border-color: var(--red); }
.tabs { position: sticky; }
.tabs a.active { border-bottom-color: var(--t-red); }
.context { border-left-color: var(--t-green); }
:root:not([data-theme="light"]) .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.9) contrast(.9) saturate(.7); }
:root:not([data-theme="light"]) .leaflet-container { background: #1b1d20; }
:root:not([data-theme="light"]) .leaflet-popup-content-wrapper, :root:not([data-theme="light"]) .leaflet-popup-tip { background: var(--card); color: var(--ink); }
:root:not([data-theme="light"]) .leaflet-bar a { background: var(--card); color: var(--ink); border-color: var(--rule); }
:root:not([data-theme="light"]) .leaflet-control-attribution { background: rgba(20, 19, 18, .8); color: var(--ink-soft); }
:root:not([data-theme="light"]) .leaflet-control-attribution a { color: var(--gold); }
.foot .blazon { display: block; font-size: .78rem; margin-top: 6px; font-style: italic; }
@media (max-width: 900px) { .theme-toggle { position: static; transform: none; margin: 6px auto; } }

/* ---------- phones and small tablets */
@media (max-width: 900px) {
  body { font-size: 17px; }
  h2 { font-size: 1.9rem; }
  #view-story.active { display: block; padding: 18px 18px 60px; }
  .chapter-nav { display: none; }
  .masthead { padding: 26px 16px 18px; }
  .arms { width: 38px; height: 46px; margin-bottom: 8px; }
  .kicker { font-size: .62rem; letter-spacing: .2em; }
  .masthead h1 { font-size: 3.6rem; }
  .subtitle { font-size: 1.12rem; line-height: 1.3; margin-bottom: 12px; }
  .motto { font-size: .8rem; margin-top: 6px; }
  /* one swipeable row of tabs */
  .tabs { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; scrollbar-width: none; padding: 0 4px; -webkit-overflow-scrolling: touch; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs a { flex: 0 0 auto; font-size: 1rem; padding: 10px 10px 8px; }
  .theme-toggle { position: static; transform: none; flex: 0 0 auto; align-self: center; margin: 0 4px 0 auto; font-size: .78rem; padding: 2px 10px; white-space: nowrap; }
  .chapter { padding-bottom: 36px; margin-bottom: 28px; }
  .chapter h2 { font-size: 2rem; }
  .lede { font-size: 1.08em; }
  .chapter > p.lede:first-of-type::first-letter { font-size: 3.2em; padding: 4px 8px 0 0; }
  .context { padding: 12px 16px; margin: 20px 0; }
  blockquote.quote { font-size: 1.15rem; padding-left: 16px; }
  blockquote.quote.big { font-size: 1.35rem; }
  .fig-pair { grid-template-columns: 1fr; gap: 0; }
  figure.doc .frame { padding: 6px; }
  table.ministry { min-width: 0; width: 100%; font-size: .88rem; }
  table.ministry td { padding: 5px 8px; }
  .gen { min-width: calc(50% - 14px); margin-bottom: 10px; }
  .leads, .outcomes { grid-template-columns: 1fr; }
  /* long line */
  #view-line { padding: 24px 14px 60px; }
  .line-intro h2, .next h2 { font-size: 2.2rem; }
  ol.line { padding-left: 30px; }
  ol.line::before { left: 8px; }
  ol.line > li { padding-left: 10px; }
  ol.line > li::before { left: -29px; }
  ol.line li.era span { margin-left: -30px; font-size: .72rem; }
  ol.line li.gap { margin-left: -30px; }
  .gap-box { padding: 16px; }
  /* tree: each generation is a swipeable row */
  #view-tree { padding: 18px 0 60px; }
  .tree-head { padding: 0 14px; }
  .tree-jump { flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; padding-bottom: 4px; scrollbar-width: none; }
  .tree-jump::-webkit-scrollbar, .trow::-webkit-scrollbar { display: none; }
  .tree { align-items: stretch; }
  .trow { flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; padding: 6px 14px; gap: 10px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .trow.focus-row { justify-content: center; }
  .trow-label, .connector { align-self: center; }
  .tgroup { flex: 0 0 auto; flex-wrap: nowrap; }
  .pcard { flex: 0 0 auto; min-width: 128px; max-width: 160px; padding: 7px 9px; }
  .pcard b { font-size: 1rem; }
  .pcard small { font-size: .7rem; }
  .pcard.focus { transform: none; min-width: 150px; }
  .pcard.focus b { font-size: 1.15rem; }
  .person-panel { margin: 18px 12px 0; padding: 16px 16px; }
  .person-panel h3 { font-size: 1.6rem; }
  .facts th { white-space: normal; width: 28%; }
  .thumbs { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .thumb img { height: 90px; }
  /* map */
  #view-map { padding: 16px 0 40px; }
  .map-buttons { flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; padding: 0 12px 4px; }
  .map-buttons button { flex: 0 0 auto; }
  #leaflet { height: 68vh; min-height: 380px; border-radius: 0; border-left: 0; border-right: 0; }
  /* archive */
  #view-archive { padding: 18px 12px 60px; }
  .chips { flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; width: 100%; padding-bottom: 4px; scrollbar-width: none; }
  .chips::-webkit-scrollbar { display: none; }
  .chips button { flex: 0 0 auto; white-space: nowrap; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .card img { height: 120px; }
  .card .meta { padding: 7px 9px 9px; }
  .card .t { font-size: .82rem; }
  .card .cat { font-size: .6rem; }
  .decade { font-size: 1.3rem; }
  /* viewer: full screen */
  .viewer { padding: 0; }
  .viewer-inner { width: 100%; height: 100%; border-radius: 0; grid-template-columns: 1fr; grid-template-rows: 55% 45%; }
  .viewer-text { padding: 14px 16px 30px; }
  .viewer-text h3 { font-size: 1.3rem; padding-right: 0; }
  .close { top: 8px; right: 8px; background: rgba(20, 19, 18, .85); color: #fff; border-color: transparent; }
  #view-next { padding: 24px 16px 60px; }
  .dna { padding: 16px; }
  .kicker { display: none; }
  .masthead h1 { font-size: 3.2rem; }
  .tabs { -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); }
  .tgroup { flex-wrap: wrap; justify-content: center; }
  .tgroup-label { flex: 0 0 100%; }
  .trow > :first-child { margin-left: auto; }
  .trow > :last-child { margin-right: auto; }
  .trow.focus-row { justify-content: flex-start; }
}
