/* Reading Room — a book surface, not a wiki page.
   Warm ink palette, serif reading column, plates and apparatus around it. */

:root {
  --ink: #0c0b0a;
  --ink-2: #14120f;
  --ink-3: #1c1916;
  --rule: #2e2823;
  --rule-soft: #221e1a;
  --paper: #e9e1d4;
  --paper-dim: #b3a897;
  --paper-faint: #7d7365;
  --ember: #c8763f;
  --ember-soft: #8a4f2a;
  --gold: #d8b26a;
  --blood: #8f3a3a;
  --steel: #5b7a8c;

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: ui-sans-serif, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --rail-w: 264px;
  --measure: 40rem;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.66;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

/* ---- reading progress ---- */
.progress {
  position: fixed; inset: 0 0 auto 0; height: 2px; z-index: 60;
  background: var(--rule-soft);
}
.progress-fill {
  height: 100%; width: 0;
  background: linear-gradient(90deg, var(--ember-soft), var(--ember), var(--gold));
  transition: width .15s linear;
}

/* ---- left rail / table of contents ---- */
.rail {
  position: fixed; top: 0; left: 0; bottom: 0; width: var(--rail-w);
  border-right: 1px solid var(--rule-soft);
  background: linear-gradient(180deg, var(--ink-2), var(--ink));
  display: flex; flex-direction: column; z-index: 50;
}
.rail-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px 14px; border-bottom: 1px solid var(--rule-soft);
}
.rail-home {
  font-family: var(--sans); font-size: 11px; letter-spacing: .18em;
  text-transform: uppercase; color: var(--paper-faint); text-decoration: none;
}
.rail-home:hover { color: var(--ember); }
.rail-toggle {
  display: none; background: none; border: 0; color: var(--paper-dim);
  font-size: 18px; cursor: pointer;
}

.toc { flex: 1; overflow-y: auto; padding: 14px 12px 24px; }
.toc-group {
  font-family: var(--sans); font-size: 10px; letter-spacing: .16em;
  text-transform: uppercase; color: var(--paper-faint);
  padding: 16px 10px 6px;
}
.toc a {
  display: block; padding: 5px 10px 5px 14px; margin: 1px 0;
  font-family: var(--sans); font-size: 13px; line-height: 1.35;
  color: var(--paper-dim); text-decoration: none;
  border-left: 2px solid transparent; border-radius: 0 3px 3px 0;
}
.toc a:hover { color: var(--paper); background: rgba(255,255,255,.03); }
.toc a.lvl-2 { padding-left: 26px; font-size: 12.5px; color: var(--paper-faint); }
.toc a.lvl-3 { padding-left: 38px; font-size: 12px; color: var(--paper-faint); }
.toc a.active { color: var(--ember); border-left-color: var(--ember); background: rgba(200,118,63,.07); }

.rail-foot {
  padding: 14px 20px 18px; border-top: 1px solid var(--rule-soft);
  font-family: var(--sans); font-size: 10.5px; line-height: 1.6; color: var(--paper-faint);
}
.rail-foot a { color: var(--paper-dim); }
.rail-foot .badge {
  display: inline-block; margin-bottom: 8px; padding: 3px 8px;
  border: 1px solid var(--rule); border-radius: 999px;
  letter-spacing: .14em; text-transform: uppercase; font-size: 9.5px; color: var(--gold);
}

/* ---- main column ---- */
.book { margin-left: var(--rail-w); padding-bottom: 20vh; }

@keyframes pulse { 0%,100% { opacity:.3 } 50% { opacity:1 } }
@keyframes arrive { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---- the binding screen ----
   Shown only until the article's own text arrives, which on a cold build is
   about a fifth of the total. Every line on it is a real event from the build,
   with the real elapsed time — there is no synthetic progress here. */
.binder { min-height: 84vh; display: flex; align-items: center; }
.binder-inner { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 40px; }
.binder-eyebrow {
  font-family: var(--sans); font-size: 10.5px; letter-spacing: .24em;
  text-transform: uppercase; color: var(--gold); margin-bottom: 16px;
}
.binder-title {
  font-size: clamp(2rem, 4.6vw, 3.4rem); line-height: 1.05; margin: 0;
  font-weight: 600; letter-spacing: -.02em; text-wrap: balance;
}
.binder-stages { list-style: none; margin: 34px 0 0; padding: 0; border-left: 1px solid var(--rule-soft); max-width: 40rem; }
.binder-stages li {
  position: relative; padding: 9px 0 9px 26px;
  display: flex; align-items: baseline; justify-content: space-between; gap: 20px;
  font-family: var(--sans); font-size: 12.5px; color: var(--paper-faint);
}
.binder-stages li::before {
  content: ''; position: absolute; left: -4px; top: 16px;
  width: 7px; height: 7px; border-radius: 50%; background: var(--rule);
}
.binder-stages li.on { color: var(--paper); }
.binder-stages li.on::before {
  background: var(--ember); box-shadow: 0 0 0 4px rgba(200,118,63,.14);
  animation: pulse 1.5s ease-in-out infinite;
}
.binder-ms { font-family: var(--mono); font-size: 11px; color: var(--paper-faint); flex: 0 0 auto; }
.binder-foot { margin-top: 30px; font-family: var(--sans); font-size: 11.5px; color: var(--paper-faint); }
.binder.failed .binder-title { color: var(--blood); }
.binder.failed .binder-stages li.on::before { background: var(--blood); box-shadow: none; animation: none; }

/* ---- apparatus strip ----
   The book is readable while the rest of it is still being built. Say so. */
.apparatus-note {
  position: fixed; left: calc(var(--rail-w) + 26px); bottom: 22px; z-index: 55;
  display: flex; align-items: center; gap: 10px;
  padding: 9px 15px; border: 1px solid var(--rule); border-radius: 2px;
  background: rgba(20,18,15,.93); backdrop-filter: blur(6px);
  box-shadow: 0 14px 34px rgba(0,0,0,.55);
  font-family: var(--sans); font-size: 11.5px; color: var(--paper-dim);
  transition: opacity .5s ease, transform .5s ease;
}
.apparatus-note.done { opacity: 0; transform: translateY(10px); }
.apparatus-pulse {
  flex: 0 0 auto; width: 7px; height: 7px; border-radius: 50%;
  background: var(--ember); animation: pulse 1.5s ease-in-out infinite;
}

.arriving { animation: arrive .5s ease-out both; }

@media (prefers-reduced-motion: reduce) {
  .arriving { animation: none; }
  .binder-stages li.on::before, .apparatus-pulse { animation: none; }
  html { scroll-behavior: auto; }
}

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 40px; }
.measure { max-width: var(--measure); }

section.block { padding: 72px 0; border-top: 1px solid var(--rule-soft); }
section.block:first-of-type { border-top: 0; }

.block-title {
  font-family: var(--sans); font-size: 11px; letter-spacing: .22em;
  text-transform: uppercase; color: var(--ember);
  margin: 0 0 6px;
}
.block-caption {
  font-family: var(--sans); font-size: 12.5px; color: var(--paper-faint);
  max-width: 46rem; margin: 0 0 28px;
}
.block-title + .block-caption { margin-top: 10px; }
.block-title:only-child, .block-title.solo { margin-bottom: 28px; }

/* ---- cover ---- */
.cover { position: relative; min-height: 78vh; display: flex; align-items: flex-end;
  border-bottom: 1px solid var(--rule); overflow: hidden; }
.cover-art { position: absolute; inset: 0; }
.cover-art img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(.35) contrast(1.05) brightness(.62); }
.cover-art::after {
  content: ''; position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(12,11,10,.72) 0%, rgba(12,11,10,.28) 38%, rgba(12,11,10,.92) 88%, var(--ink) 100%),
    radial-gradient(120% 80% at 20% 100%, rgba(200,118,63,.16), transparent 60%);
}
.cover-inner { position: relative; padding: 0 40px 56px; width: 100%; max-width: 1080px; margin: 0 auto; }
.cover-eyebrow {
  font-family: var(--sans); font-size: 10.5px; letter-spacing: .24em;
  text-transform: uppercase; color: var(--gold); margin-bottom: 18px;
}
.cover h1 {
  font-size: clamp(2.6rem, 6.2vw, 5rem); line-height: 1.02; margin: 0 0 16px;
  font-weight: 600; letter-spacing: -.02em; text-wrap: balance;
}
.cover-sub {
  font-size: 1.12rem; color: var(--paper-dim); max-width: 34rem; margin: 0 0 30px; font-style: italic;
}
.cover-facts { display: flex; flex-wrap: wrap; gap: 0; border-top: 1px solid var(--rule); }
.cover-fact { padding: 16px 28px 4px 0; margin-right: 28px; border-right: 1px solid var(--rule-soft); }
.cover-fact:last-child { border-right: 0; }
.cover-fact dt {
  font-family: var(--sans); font-size: 9.5px; letter-spacing: .18em;
  text-transform: uppercase; color: var(--paper-faint); margin-bottom: 4px;
}
.cover-fact dd { margin: 0; font-size: .98rem; color: var(--paper); max-width: 22rem; }

/* The cover clips its overflow, so the plate strip has to scroll on its own. */
.plates { display: flex; gap: 8px; margin-top: 26px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.plates img { flex: 0 0 auto; }
.plates img {
  width: 62px; height: 62px; object-fit: cover; border: 1px solid var(--rule);
  filter: grayscale(.4) brightness(.8); cursor: pointer; transition: .2s;
}
.plates img:hover, .plates img.on { filter: none; border-color: var(--ember); }

/* ---- sides ---- */
.sides { display: grid; grid-template-columns: 1fr auto 1fr; gap: 0 28px; align-items: start; }
.side-col { min-width: 0; }
.side-col.right { text-align: right; }
.side-name { font-size: 1.7rem; margin: 0 0 12px; letter-spacing: -.01em; }
.side-parties { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 20px; }
.side-col.right .side-parties { justify-content: flex-end; }
.chip {
  font-family: var(--sans); font-size: 11.5px; padding: 3px 9px;
  border: 1px solid var(--rule); border-radius: 999px; color: var(--paper-dim);
}
.versus {
  font-family: var(--sans); font-size: 11px; letter-spacing: .2em; color: var(--paper-faint);
  padding-top: 12px; position: relative;
}
.versus::before, .versus::after {
  content: ''; position: absolute; left: 50%; width: 1px; background: var(--rule-soft);
}
.versus::before { top: -60px; height: 52px; }
.versus::after { top: 40px; bottom: -80px; }

.formation { margin-bottom: 14px; }
.formation-name {
  font-family: var(--sans); font-size: 10px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--ember); margin-bottom: 5px;
}
.formation ul { list-style: none; margin: 0; padding: 0; font-size: .88rem; color: var(--paper-dim); }
.formation li { line-height: 1.5; }

/* ---- forces ---- */
.phase-tabs { display: flex; gap: 6px; margin-bottom: 26px; flex-wrap: wrap; }
.phase-tab {
  font-family: var(--sans); font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
  padding: 7px 14px; border: 1px solid var(--rule); background: none; color: var(--paper-faint);
  cursor: pointer; border-radius: 2px; transition: .15s;
}
.phase-tab:hover { color: var(--paper); }
.phase-tab.on { border-color: var(--ember); color: var(--ember); background: rgba(200,118,63,.08); }

.force-head { display: grid; grid-template-columns: 1fr 128px 1fr; align-items: center; margin-bottom: 18px; }
.force-head .fh {
  font-family: var(--sans); font-size: 11px; letter-spacing: .16em; text-transform: uppercase;
}
.force-head .fh.a { text-align: right; color: var(--blood); }
.force-head .fh.b { color: var(--steel); }

.force-row { display: grid; grid-template-columns: 1fr 128px 1fr; align-items: center; margin-bottom: 4px; }
.force-label {
  font-family: var(--sans); font-size: 10px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--paper-faint); text-align: center;
}
.bar-cell { display: flex; align-items: center; gap: 10px; height: 34px; }
.bar-cell.a { justify-content: flex-end; }
.bar {
  height: 15px; min-width: 2px;
  transition: width .5s cubic-bezier(.2,.7,.2,1);
}
.bar.a { background: linear-gradient(90deg, rgba(143,58,58,.25), var(--blood)); }
.bar.b { background: linear-gradient(90deg, var(--steel), rgba(91,122,140,.25)); }
.bar-num { font-family: var(--mono); font-size: 12.5px; color: var(--paper-dim); white-space: nowrap; }

.raw-toggle {
  margin-top: 26px; font-family: var(--sans); font-size: 11px; letter-spacing: .12em;
  text-transform: uppercase; background: none; border: 0; color: var(--paper-faint);
  cursor: pointer; padding: 0; border-bottom: 1px dotted var(--rule);
}
.raw-toggle:hover { color: var(--ember); }
.raw-src { display: none; margin-top: 18px; gap: 40px; grid-template-columns: 1fr 1fr; }
.raw-src.on { display: grid; }
.raw-src ul { list-style: none; margin: 0; padding: 0; font-family: var(--mono); font-size: 11.5px; color: var(--paper-faint); line-height: 1.7; }

/* ---- toll ---- */
.toll { display: grid; grid-template-columns: 1fr 1fr; gap: 44px; }
.toll-total {
  font-family: var(--sans); text-align: center; margin-bottom: 34px;
  font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--gold);
}
.toll-num { font-family: var(--serif); font-size: clamp(2rem,4.4vw,3.2rem); line-height: 1; margin: 6px 0; letter-spacing: -.02em; }
.toll-side .toll-num { color: var(--paper); }
.toll-caption { font-family: var(--mono); font-size: 11.5px; color: var(--paper-faint); margin-bottom: 16px; }
.dots { display: grid; grid-template-columns: repeat(40, 1fr); gap: 2px; margin: 16px 0; }
.dot { width: 100%; aspect-ratio: 1; border-radius: 50%; }
.dot.a { background: rgba(143,58,58,.85); }
.dot.b { background: rgba(91,122,140,.85); }
.dot.ghost { background: var(--rule-soft); }
.toll-break { list-style: none; margin: 14px 0 0; padding: 0; font-size: .84rem; color: var(--paper-faint); line-height: 1.6; }

/* ---- cast ---- */
.cast-group { margin-bottom: 40px; }
.cast-group h3 { font-family: var(--sans); font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--paper-dim); margin: 0 0 16px; }
.cast-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 18px; }
.person { text-align: left; cursor: pointer; }
.person-face {
  width: 100%; aspect-ratio: 3/4; background: var(--ink-3); border: 1px solid var(--rule);
  overflow: hidden; margin-bottom: 8px;
}
.person-face img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(.55) contrast(1.06); transition: .3s; }
.person:hover .person-face img { filter: grayscale(0); }
.person-face.empty { display: flex; align-items: center; justify-content: center; color: var(--rule); font-size: 26px; }
.person-name { font-size: .92rem; line-height: 1.3; }
.person-desc { font-family: var(--sans); font-size: 10.5px; color: var(--paper-faint); line-height: 1.4; margin-top: 3px; }

/* ---- map ---- */
.map-shell { height: 60vh; min-height: 420px; border: 1px solid var(--rule); background: var(--ink-3); position: relative; }
.map-mount { width: 100%; height: 100%; background: #10100f; }
.leaflet-container { background: #10100f; font-family: var(--sans); }
.leaflet-tile { filter: grayscale(.6) brightness(.62) contrast(1.12) sepia(.22); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--ink-2); color: var(--paper); border: 1px solid var(--rule); border-radius: 2px; }
.leaflet-popup-content { margin: 12px 14px; font-family: var(--sans); font-size: 12.5px; }
.leaflet-control-attribution { background: rgba(12,11,10,.8) !important; color: var(--paper-faint) !important; font-size: 9px !important; }
.leaflet-control-attribution a { color: var(--paper-dim) !important; }
.pin { width: 10px; height: 10px; border-radius: 50%; background: var(--ember); box-shadow: 0 0 0 3px rgba(200,118,63,.22); }
.pin.primary { width: 15px; height: 15px; background: var(--gold); box-shadow: 0 0 0 5px rgba(216,178,106,.22); }
.map-fallback { padding: 28px; display: grid; grid-template-columns: repeat(auto-fill,minmax(190px,1fr)); gap: 12px; font-family: var(--sans); font-size: 12.5px; color: var(--paper-dim); }

/* ---- country: identity ---- */
.identity { display: grid; grid-template-columns: auto 1fr; gap: 44px; align-items: start; }
.emblems { display: flex; gap: 22px; align-items: flex-start; }
.emblem { margin: 0; }
.emblem img { display: block; border: 1px solid var(--rule); background: var(--ink-3); }
.emblem.flag img { width: 200px; height: auto; }
.emblem.arms img { width: 96px; height: auto; border: 0; background: none; }
.emblem figcaption {
  font-family: var(--sans); font-size: 9.5px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--paper-faint); margin-top: 8px;
}
.identity-rows { margin: 0; display: grid; grid-template-columns: minmax(110px, auto) 1fr; gap: 0 20px; align-self: center; }
.identity-rows dt {
  font-family: var(--sans); font-size: 9.5px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--paper-faint); padding: 10px 0; border-top: 1px solid var(--rule-soft);
}
.identity-rows dd { margin: 0; padding: 10px 0; border-top: 1px solid var(--rule-soft); font-size: .95rem; }

.identity-notes { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 34px; margin-top: 40px; }
.dated-list { list-style: none; margin: 0; padding: 0; }
.dated-list li { display: flex; gap: 14px; padding: 6px 0; border-top: 1px solid var(--rule-soft); }
.dated-when {
  font-family: var(--mono); font-size: 11.5px; color: var(--gold);
  flex: 0 0 96px; white-space: nowrap; padding-top: 2px;
}
.dated-what { font-size: .9rem; color: var(--paper-dim); text-decoration: none; }
a.dated-what:hover { color: var(--ember); }

/* ---- country: lineage ---- */
.lineage {
  display: flex; align-items: stretch; gap: 0;
  overflow-x: auto; padding-bottom: 14px; scrollbar-width: thin;
}
.lin-col { flex: 0 0 auto; width: 176px; display: flex; flex-direction: column; gap: 10px; }
.lin-era {
  font-family: var(--sans); font-size: 9.5px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--paper-faint); padding-bottom: 8px; border-bottom: 1px solid var(--rule-soft); margin-bottom: 4px;
}
.lin-col.subject .lin-era { color: var(--gold); border-bottom-color: var(--ember-soft); }
/* Beside the first card, not centred in the column: a dissolution column can be
   six cards tall, and a centred arrow floats in empty space. */
.lin-arrow {
  flex: 0 0 auto; width: 34px; display: flex; align-items: flex-start; justify-content: center;
  padding-top: 76px; color: var(--rule); font-size: 15px;
}
.lin-node {
  display: block; text-decoration: none; padding: 12px; background: var(--ink-2);
  border: 1px solid var(--rule-soft); transition: .2s;
}
a.lin-node:hover { border-color: var(--ember-soft); transform: translateY(-2px); }
.lin-node.on { border-color: var(--gold); background: rgba(216,178,106,.06); }
.lin-flag { height: 34px; margin-bottom: 10px; display: flex; align-items: center; }
.lin-flag img { max-height: 34px; max-width: 100%; border: 1px solid var(--rule); }
.lin-flag.empty::before { content: ''; width: 44px; height: 26px; border: 1px dashed var(--rule); }
.lin-name { font-size: .92rem; line-height: 1.28; margin-bottom: 5px; }
.lin-span { font-family: var(--mono); font-size: 10.5px; color: var(--paper-faint); }
.lin-via {
  font-family: var(--sans); font-size: 9px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ember-soft); margin-top: 7px;
}
.lin-more { font-family: var(--sans); font-size: 10.5px; color: var(--paper-faint); padding-top: 4px; }

/* ---- country: dated series ---- */
.series-svg { width: 100%; height: auto; display: block; overflow: visible; }
.series-line { fill: none; stroke: var(--ember); stroke-width: 1.8; stroke-linejoin: round; }
.series-dot { fill: var(--ember); opacity: .55; }
.series-dot.mark { fill: var(--gold); opacity: 1; }
.series-grid { stroke: var(--rule-soft); stroke-width: 1; }
.series-gridlabel, .series-mark, .series-xlabel { font-family: var(--mono); fill: var(--paper-faint); }
.series-gridlabel { font-size: 10px; }
.series-xlabel { font-size: 10.5px; }
.series-mark { font-size: 12px; fill: var(--gold); }

/* ---- country: rulers ---- */
.ruler-axis { position: relative; height: 18px; margin: 4px 0 10px; }
.ruler-year {
  position: absolute; transform: translateX(-50%);
  font-family: var(--mono); font-size: 10px; color: var(--paper-faint);
}
.ruler-track { margin-bottom: 30px; }
.ruler-track h3 {
  font-family: var(--sans); font-size: 10px; letter-spacing: .18em; text-transform: uppercase;
  color: var(--ember); margin: 0 0 12px;
}
.ruler-row {
  display: grid; grid-template-columns: 34px 190px 1fr 96px; gap: 12px;
  align-items: center; text-decoration: none; color: inherit; padding: 3px 0;
}
a.ruler-row:hover .ruler-name span:first-child { color: var(--gold); }
.ruler-face {
  width: 34px; height: 34px; border-radius: 50%; overflow: hidden;
  background: var(--ink-3); border: 1px solid var(--rule);
}
.ruler-face img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(.5) contrast(1.05); }
.ruler-face.empty { display: flex; align-items: center; justify-content: center; color: var(--rule); font-size: 14px; }
.ruler-name { min-width: 0; font-size: .9rem; line-height: 1.25; }
.ruler-name span { display: block; }
.ruler-note {
  font-family: var(--sans); font-size: 9.5px; color: var(--paper-faint);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ruler-rail { position: relative; height: 20px; background: linear-gradient(var(--rule-soft), var(--rule-soft)) center/100% 1px no-repeat; }
.ruler-rail .bar { position: absolute; top: 4px; height: 12px; min-width: 3px; }
.ruler-span { font-family: var(--mono); font-size: 10.5px; color: var(--paper-faint); text-align: right; white-space: nowrap; }

/* ---- map layers ---- */
.map-layers { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.layer-tab {
  font-family: var(--sans); font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
  padding: 6px 12px; border: 1px solid var(--rule); background: none; color: var(--paper-faint);
  cursor: pointer; border-radius: 2px; transition: .15s;
}
.layer-tab span { font-family: var(--mono); letter-spacing: 0; opacity: .6; margin-left: 6px; }
.layer-tab:hover { color: var(--paper); }
.layer-tab.on { border-color: var(--ember); color: var(--ember); background: rgba(200,118,63,.08); }
.pin.faint { width: 7px; height: 7px; background: var(--steel); box-shadow: 0 0 0 2px rgba(91,122,140,.2); }

/* ---- chronology ---- */
.chrono-rail {
  position: relative; height: 92px; border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule); margin: 8px 0 26px; cursor: crosshair;
}
.chrono-axis { position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--rule); }
/* Era bands: equal spans of time drawn at unequal width, so the compression of
   a two-millennium axis is visible rather than silent. */
.chrono-rail.banded { height: 104px; }
.chrono-band { position: absolute; top: 0; bottom: 0; border-left: 1px solid var(--rule-soft); }
.chrono-band.alt { background: rgba(255,255,255,.022); }
.chrono-bandlabel {
  position: absolute; top: 6px; left: 5px;
  font-family: var(--mono); font-size: 10px; color: var(--paper-faint); white-space: nowrap;
}
.chrono-band.tight .chrono-bandlabel { display: none; }
.chrono-tick { position: absolute; top: 50%; transform: translate(-50%,-50%); }
.chrono-tick i {
  display: block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--paper-faint); transition: .2s; cursor: pointer;
}
.chrono-tick:hover i, .chrono-tick.on i { background: var(--ember); transform: scale(1.85); }
.chrono-tick.imprecise i { width: 5px; height: 5px; opacity: .5; }
.chrono-year {
  position: absolute; bottom: 6px; transform: translateX(-50%);
  font-family: var(--mono); font-size: 10px; color: var(--paper-faint);
}
.chrono-year span { position: absolute; top: -74px; left: 50%; width: 1px; height: 70px; background: var(--rule-soft); }
.chrono-detail {
  min-height: 118px; border-left: 2px solid var(--ember); padding: 4px 0 4px 20px;
}
.chrono-date { font-family: var(--sans); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--ember); margin-bottom: 8px; }
.chrono-sentence { font-size: 1.06rem; line-height: 1.6; margin: 0 0 10px; max-width: 46rem; }
.chrono-src { font-family: var(--sans); font-size: 11px; color: var(--paper-faint); }
.chrono-src a { color: var(--paper-dim); }
.chrono-nav { display: flex; gap: 8px; margin-top: 16px; }
.chrono-nav button {
  font-family: var(--sans); font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
  background: none; border: 1px solid var(--rule); color: var(--paper-faint);
  padding: 6px 12px; cursor: pointer; border-radius: 2px;
}
.chrono-nav button:hover { color: var(--ember); border-color: var(--ember-soft); }

/* ---- chapters / the reading spine ---- */
.chapter { padding: 54px 0 8px; scroll-margin-top: 24px; }
.chapter-num {
  font-family: var(--sans); font-size: 10px; letter-spacing: .22em;
  text-transform: uppercase; color: var(--paper-faint); margin-bottom: 10px;
}
.chapter h2 { font-size: 2.1rem; line-height: 1.14; margin: 0 0 24px; font-weight: 500; letter-spacing: -.015em; }
.chapter h3 { font-size: 1.42rem; margin: 34px 0 14px; font-weight: 500; }
.chapter.lvl-2 h2 { font-size: 1.5rem; }
.chapter.lvl-3 h2 { font-size: 1.2rem; }
.chapter.part { padding-bottom: 0; }
.chapter.part h2 {
  font-size: 1rem; letter-spacing: .3em; text-transform: uppercase; color: var(--gold);
  border-bottom: 1px solid var(--rule); padding-bottom: 18px; font-weight: 400;
}

.prose { max-width: var(--measure); }
.prose p { margin: 0 0 1.15em; }
.prose p:first-of-type { margin-top: 0; }
.prose ul, .prose ol { margin: 0 0 1.15em; padding-left: 1.4em; }
.prose li { margin-bottom: .3em; }
.prose blockquote {
  margin: 1.6em 0; padding-left: 22px; border-left: 2px solid var(--ember-soft);
  font-style: italic; color: var(--paper-dim);
}
.prose .wb-scroll { overflow-x: auto; margin: 1.6em 0; }
.prose table { border-collapse: collapse; font-family: var(--sans); font-size: 12.5px; width: 100%; }
.prose th, .prose td { border: 1px solid var(--rule-soft); padding: 7px 10px; text-align: left; vertical-align: top; }
.prose th { color: var(--paper-dim); font-weight: 500; background: rgba(255,255,255,.02); }
.prose img { max-width: 100%; height: auto; }

/* Wikipedia's own float and multi-image boxes carry inline pixel widths — a
   400px `floatright`, a `trow` of three side-by-side plates — which are wider
   than a phone and scroll the whole page sideways. These need !important:
   the offending declaration is an inline `max-width`, which a stylesheet
   cannot outrank any other way. */
.prose .thumb, .prose .thumbinner, .prose .tmulti, .prose .tsingle, .prose .trow,
.prose .floatright, .prose .floatleft, .prose .center,
.prose .gallery, .prose .gallerybox, .prose .gallerytext, .prose .thumb-inner,
.prose .floatright > *, .prose .floatleft > *, .prose .thumbinner > *,
.prose .tsingle > *, .prose .gallerybox > * {
  max-width: 100% !important;
}
.prose .gallery { padding-left: 0; }
.prose .trow { display: flex; flex-wrap: wrap; }
.prose .tsingle { min-width: 0; }
/* Annotated images position their labels absolutely at fixed offsets, so no
   width cap reaches them. Let the figure scroll rather than the page. */
.prose .noresize { overflow-x: auto; }

.wb-link {
  color: var(--paper); text-decoration: none;
  border-bottom: 1px solid rgba(200,118,63,.4); cursor: pointer;
}
.wb-link:hover { border-bottom-color: var(--ember); color: var(--gold); }
.wb-ext { color: var(--paper-dim); }
.wb-note {
  font-family: var(--sans); font-size: .62em; vertical-align: super; line-height: 0;
  color: var(--ember); text-decoration: none; padding: 0 1px; cursor: pointer;
}
.wb-note:hover { color: var(--gold); }

/* plates inside chapters */
.plate { margin: 34px 0; }
.plate img { width: 100%; max-width: 720px; display: block; border: 1px solid var(--rule); filter: grayscale(.25) contrast(1.03); }
.plate figcaption {
  font-family: var(--sans); font-size: 11.5px; color: var(--paper-faint);
  margin-top: 9px; max-width: 46rem; line-height: 1.5;
}
.plate.wide img { max-width: 100%; }

/* ---- shelf ---- */
.shelf-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px,1fr)); gap: 20px; }
.volume {
  display: block; text-decoration: none; border: 1px solid var(--rule-soft);
  background: var(--ink-2); transition: .2s; overflow: hidden;
}
.volume:hover { border-color: var(--ember-soft); transform: translateY(-3px); }
.volume-art { height: 116px; background: var(--ink-3); overflow: hidden; }
.volume-art img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(.5) brightness(.75); }
.volume-body { padding: 12px 14px 16px; }
.volume-title { font-size: .98rem; line-height: 1.25; margin-bottom: 5px; }
.volume-desc { font-family: var(--sans); font-size: 10.5px; color: var(--paper-faint); line-height: 1.45; }

/* ---- notes ---- */
.notes-list { columns: 2; column-gap: 44px; font-size: .8rem; color: var(--paper-faint); }
.notes-list li { break-inside: avoid; margin-bottom: 10px; line-height: 1.55; }
.notes-list a { color: var(--paper-dim); }
/* Citation markup arrives with layout baggage from the source wiki. */
.notes-list li > *, .notes-list cite { margin: 0; padding: 0; text-indent: 0; float: none; }
.notes-list cite { font-style: normal; }
.notes-more {
  margin-top: 22px; font-family: var(--sans); font-size: 11px; letter-spacing: .12em;
  text-transform: uppercase; background: none; border: 1px solid var(--rule);
  color: var(--paper-faint); padding: 8px 16px; cursor: pointer;
}
.notes-more:hover { color: var(--ember); border-color: var(--ember-soft); }

/* ---- colophon ---- */
.colophon {
  border-top: 1px solid var(--rule); margin-top: 40px; padding: 40px 0 0;
  font-family: var(--sans); font-size: 11.5px; color: var(--paper-faint); line-height: 1.75;
}
.colophon a { color: var(--paper-dim); }
.colophon h4 { font-size: 10px; letter-spacing: .2em; text-transform: uppercase; color: var(--ember); margin: 0 0 12px; }
.colophon-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(210px,1fr)); gap: 32px; }
.colophon dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 2px 14px; }
.colophon dt { color: var(--paper-faint); }
.colophon dd { margin: 0; color: var(--paper-dim); font-family: var(--mono); font-size: 11px; }

/* ---- floating cards ---- */
.hovercard, .notecard {
  position: absolute; z-index: 80; max-width: 340px;
  background: var(--ink-2); border: 1px solid var(--rule);
  box-shadow: 0 18px 50px rgba(0,0,0,.6);
  font-family: var(--sans); font-size: 12.5px; line-height: 1.55; color: var(--paper-dim);
}
.hovercard { display: flex; flex-direction: column; }
.hovercard img { width: 100%; height: 118px; object-fit: cover; filter: grayscale(.4) brightness(.8); }
.hc-body { padding: 12px 14px 14px; }
.hc-title { font-family: var(--serif); font-size: 1.02rem; color: var(--paper); margin-bottom: 4px; }
.hc-desc { font-size: 10.5px; letter-spacing: .04em; text-transform: uppercase; color: var(--paper-faint); margin-bottom: 8px; }
.hc-actions { margin-top: 12px; display: flex; gap: 12px; }
.hc-actions a { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--ember); text-decoration: none; }
.notecard { padding: 14px 16px; max-width: 400px; font-size: 12px; }
.notecard a { color: var(--ember); }

/* ---- responsive ---- */
@media (max-width: 1080px) {
  .toll { grid-template-columns: 1fr; gap: 32px; }
  .raw-src.on { grid-template-columns: 1fr; gap: 20px; }
  .notes-list { columns: 1; }
  .identity { grid-template-columns: 1fr; gap: 30px; }
}
@media (max-width: 860px) {
  body { font-size: 17px; }
  .rail {
    width: 100%; height: auto; bottom: auto;
    border-right: 0; border-bottom: 1px solid var(--rule-soft);
  }
  .rail .toc, .rail .rail-foot { display: none; }
  .rail.open .toc { display: block; max-height: 60vh; }
  .rail.open .rail-foot { display: block; }
  .rail-toggle { display: block; }
  .book { margin-left: 0; padding-top: 54px; }
  .wrap, .cover-inner { padding: 0 22px; }
  .cover-inner { padding-bottom: 40px; }
  .sides { grid-template-columns: 1fr; gap: 32px; }
  .side-col.right { text-align: left; }
  .side-col.right .side-parties { justify-content: flex-start; }
  .versus { display: none; }
  .force-head, .force-row { grid-template-columns: 1fr 84px 1fr; }
  .dots { grid-template-columns: repeat(24, 1fr); }
  /* Facts stack, so the column rules become stray vertical lines. */
  .cover-facts { display: block; }
  .cover-fact { border-right: 0; margin-right: 0; padding-right: 0; }

  /* The emblem strip and the lineage strip both scroll rather than squeeze. */
  .emblems { gap: 16px; }
  .emblem.flag img { width: 150px; }
  .emblem.arms img { width: 72px; }
  .identity-rows { grid-template-columns: minmax(96px, auto) 1fr; gap: 0 14px; }
  .lin-col { width: 150px; }
  .lin-arrow { width: 22px; }
  /* Portrait, name and dates share the first row; the bar gets its own beneath,
     full width, because a tenure bar in 120px says nothing. */
  .ruler-row { grid-template-columns: 28px 1fr auto; gap: 10px; row-gap: 0; }
  .ruler-face { grid-area: 1 / 1; width: 28px; height: 28px; }
  .ruler-name { grid-area: 1 / 2; }
  .ruler-span { grid-area: 1 / 3; }
  .ruler-rail { grid-area: 2 / 1 / 3 / 4; height: 14px; margin-bottom: 10px; }
  .ruler-rail .bar { top: 2px; height: 10px; }
  .dated-list li { gap: 10px; }
  .dated-when { flex-basis: 84px; }
  .binder-inner { padding: 0 22px; }
  .apparatus-note { left: 16px; right: 16px; bottom: 16px; }

  /* A floated plate in a 331px column leaves no column. Let them stack. */
  .prose .thumb, .prose .floatright, .prose .floatleft {
    float: none; margin-left: 0; margin-right: 0;
  }
}
