/* ============================================================
   The Life of Jesus — study atlas (v2)
   ============================================================ */
:root {
  --bg: #f7f3ea;
  --panel: #fffdf8;
  --ink: #2b2721;
  --ink-soft: #6b6357;
  --ink-faint: #a2988a;
  --line: #e6ddcc;
  --accent: #8a2f1d;
  --accent-soft: #f3e2dc;
  --gold: #b08a3c;
  --serif: Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  overflow: hidden;
  font-size: 15px;
  line-height: 1.55;
}
button { font-family: inherit; cursor: pointer; }

/* ---------- layout ---------- */
#app { display: flex; flex-direction: column; height: 100vh; }
header#topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 0 18px; height: 58px; flex: 0 0 58px;
  background: var(--panel); border-bottom: 1px solid var(--line);
  z-index: 30;
}
.brand { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand h1 { font-family: var(--serif); font-size: 19px; font-weight: 600; letter-spacing: 0.2px; white-space: nowrap; }
.brand small { font-size: 10.5px; color: var(--ink-soft); letter-spacing: 1.6px; text-transform: uppercase; }
#searchbox {
  flex: 0 1 320px; margin-left: auto;
  padding: 7px 12px; border: 1px solid var(--line); border-radius: 18px;
  background: var(--bg); font-size: 13.5px; color: var(--ink);
  outline: none; transition: border-color .15s;
}
#searchbox:focus { border-color: var(--gold); background: #fff; }
.navbtn {
  border: 1px solid var(--line); background: var(--panel); color: var(--ink-soft);
  padding: 6px 14px; border-radius: 16px; font-size: 13px;
}
.navbtn:hover { border-color: var(--gold); color: var(--ink); }
.navbtn.on { background: var(--ink); color: #fff; border-color: var(--ink); }

main#main { display: flex; flex: 1 1 auto; min-height: 0; }

/* ---------- map ---------- */
#mapwrap { flex: 1.05 1 0; position: relative; min-width: 0; background: #ece5d4; }
#map, #jermap { width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
#map.dragging, #jermap.dragging { cursor: grabbing; }

.mapctrl {
  position: absolute; top: 12px; left: 12px; display: flex; flex-direction: column; gap: 6px; z-index: 5;
}
.mapctrl button {
  width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line);
  background: rgba(255,253,248,.94); color: var(--ink); font-size: 17px; line-height: 1;
  box-shadow: 0 1px 4px rgba(60,45,20,.12);
}
.mapctrl button:hover { border-color: var(--gold); }
.maptools {
  position: absolute; top: 12px; right: 12px; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; z-index: 5;
}
.maptools .tool {
  border: 1px solid var(--line); background: rgba(255,253,248,.94); color: var(--ink-soft);
  padding: 6px 12px; border-radius: 9px; font-size: 12.5px;
  box-shadow: 0 1px 4px rgba(60,45,20,.12);
}
.maptools .tool.on { background: var(--ink); color: #fff; border-color: var(--ink); }

#filterPill {
  position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); z-index: 5;
  display: none; align-items: center; gap: 6px;
  border: 1.6px solid var(--ink); border-radius: 16px;
  background: rgba(255,253,248,.96); color: var(--ink);
  padding: 6px 14px; font-size: 12px;
  box-shadow: 0 2px 8px rgba(60,45,20,.15);
}
#filterPill.on { display: inline-flex; }
#filterPill:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- city insets (corner cards over the region map) ---------- */
.cityinset {
  position: absolute; left: 14px; bottom: 14px; z-index: 8;
  width: min(46%, 440px);
  display: none; flex-direction: column;
  background: #ece5d4; border: 1px solid #c9b891; border-radius: 12px; overflow: hidden;
  box-shadow: 0 14px 40px rgba(43,39,33,.28), 0 2px 8px rgba(43,39,33,.14);
  transition: width .25s ease;
}
.cityinset.open { display: flex; }
.cityinset.big { width: min(88%, 860px); }
#jerview svg { aspect-ratio: 780 / 660; height: auto; }
#capview svg { aspect-ratio: 760 / 540; height: auto; }
.insetbar {
  display: flex; align-items: center; gap: 8px; padding: 6px 10px;
  background: rgba(255,253,248,.96); border-bottom: 1px solid var(--line);
}
.insetbar b { font-family: var(--serif); font-weight: 600; font-size: 14px; }
.insetbar span { font-size: 10.5px; color: var(--ink-soft); flex: 1; }
.jbtn {
  border: 1px solid var(--line); background: var(--panel); color: var(--ink-soft);
  border-radius: 8px; padding: 3px 9px; font-size: 12px;
}
.jbtn:hover { border-color: var(--gold); color: var(--ink); }

/* Capernaum schematic */
.cap-pier { fill: #b7a67f; stroke: #8d7b57; stroke-width: 1; opacity: .85; }
.cap-insula { fill: rgba(255,253,248,.5); stroke: #8d7b57; stroke-width: 1.2; }
.cap-basalt { fill: #6b6357; opacity: .55; }
.cap-octagon { fill: none; stroke: #8d7b57; stroke-width: 1.4; stroke-dasharray: 4 3; }

/* lightbox */
#lightbox {
  position: fixed; inset: 0; z-index: 90; display: none;
  background: rgba(30,26,20,.88); cursor: zoom-out;
  align-items: center; justify-content: center; padding: 4vh 4vw;
}
#lightbox.open { display: flex; }
#lightbox figure { max-width: min(1100px, 92vw); max-height: 92vh; display: flex; flex-direction: column; }
#lightbox img {
  max-width: 100%; max-height: 72vh; object-fit: contain;
  border-radius: 8px 8px 0 0; background: #111;
}
#lightbox figcaption {
  background: var(--panel); border-radius: 0 0 8px 8px; padding: 10px 14px;
  font-size: 12px; max-height: 18vh; overflow-y: auto;
}
#lightbox figcaption b { font: 600 14px var(--serif); }
#lightbox figcaption em.media-cap { display: block; margin-top: 3px; font: italic 12.5px/1.5 var(--serif); color: #574e40; }
#lbClose {
  position: absolute; top: 14px; right: 18px; width: 40px; height: 40px;
  border-radius: 50%; border: none; background: rgba(255,253,248,.92);
  font-size: 22px; color: var(--ink);
}
.media-card img { cursor: zoom-in; }

/* ---------- geo styles ---------- */
.geo-sea { stroke: none; }
.geo-underlay { opacity: .5; }
#map .geo-hills ellipse { opacity: .18; } /* real relief carries the terrain now */
.geo-coast { fill: none; stroke: #7fa3ad; stroke-width: 1.6; }
.geo-river { fill: none; stroke: #86aebc; stroke-width: 1.7; stroke-linecap: round; }
.geo-lake { stroke: #7fa3ad; stroke-width: 1; }
.geo-hills ellipse { fill: #d9c9a4; opacity: .35; }
.geo-mount { fill: #c8b488; stroke: #a08c5c; stroke-width: .8; }
.geo-mountlabel, .geo-ctlabel { font-size: 10px; fill: #877b66; text-anchor: middle; font-family: var(--sans); }
.geo-ctdot { fill: #a2988a; }
/* context-town labels appear only when zoomed in — dots always visible */
#map .geo-context .geo-ctlabel { opacity: 0; transition: opacity .2s; }
#map.zoomed .geo-context .geo-ctlabel { opacity: 1; }
.geo-region { font-family: var(--serif); font-size: 17px; letter-spacing: 3px; fill: #9d8e72; text-anchor: middle; font-style: italic; opacity: .85; }
.geo-region-sm { font-size: 11px; letter-spacing: 1.5px; }
.geo-sealabel { font-family: var(--serif); font-size: 15px; letter-spacing: 3px; fill: #6f97a3; text-anchor: middle; font-style: italic; }
.geo-sealabel-sm { font-size: 11px; }
.geo-sealabel-xs { font-size: 9.5px; letter-spacing: 1px; }
.geo-frame { fill: none; stroke: #c9b891; stroke-width: 2; }
.geo-scale line { stroke: #877b66; stroke-width: 1.2; }
.geo-scale text { font-size: 9.5px; fill: #877b66; text-anchor: middle; }
.geo-flight { stroke: #8a2f1d; stroke-width: 1.4; stroke-dasharray: 2 5; opacity: .5; }
.geo-wayofsea { font-style: italic; text-anchor: start; }
.geo-fadelayer rect, .geo-fadelayer { pointer-events: none; }

/* routes — trails visible by default; selection focuses one period */
#routeLayer path { fill: none; stroke-width: 1.8; stroke-dasharray: 3 4; opacity: .38; stroke-linecap: round; }
#map[data-period]:not([data-period=""]) #routeLayer path { opacity: .08; }
#map #routeLayer path.pfocus,
#map[data-period]:not([data-period=""]) #routeLayer path.pfocus { opacity: .95; stroke-width: 2.4; }
#map #routeLayer path.leg,
#map[data-period]:not([data-period=""]) #routeLayer path.leg {
  stroke: var(--accent); stroke-width: 2.8; stroke-dasharray: none; opacity: .95;
}

/* markers */
.marker { cursor: pointer; outline: none; }
.marker circle.hit { fill: transparent; stroke: none; pointer-events: all; }
.marker circle.dot {
  fill: #fffdf8; stroke: var(--ink); stroke-width: 1.6;
  transition: fill .12s, stroke .12s;
}
.marker text.count {
  text-anchor: middle; font-size: 11px; font-weight: 600; fill: var(--ink);
  font-family: var(--sans); pointer-events: none;
}
.marker text.mlabel {
  text-anchor: middle; font-size: 11px; fill: var(--ink); font-family: var(--sans);
  paint-order: stroke; stroke: rgba(247,243,234,.85); stroke-width: 3px;
  pointer-events: none; opacity: 0; transition: opacity .15s;
}
.marker.labeled text.mlabel, .marker:hover text.mlabel, .marker:focus text.mlabel,
.marker.active text.mlabel, .marker.lit text.mlabel { opacity: 1; }
svg.zoomed .marker text.mlabel { opacity: 1; }
.marker:hover circle.dot, .marker:focus circle.dot { stroke: var(--accent); }
.marker.lit circle.dot { stroke: var(--gold); stroke-width: 2.4; }
.marker.active circle.dot { fill: var(--accent); stroke: var(--accent); }
.marker.active text.count { fill: #fff; }
.marker.dim { opacity: .18; }
/* story focus: when something is selected, everything else recedes —
   but markers NOT dimmed by a period filter keep near-full presence */
#map.has-sel .marker:not(.active):not(.lit):not(:hover):not(:focus) { opacity: .5; }
#map.has-sel .marker.dim { opacity: .14; }
#map[data-period]:not([data-period=""]):not(.has-sel) .marker:not(.dim) { opacity: 1; }
.marker circle.pulse {
  fill: none; stroke: var(--accent); stroke-width: 2; opacity: 0; pointer-events: none;
}
.marker.active circle.pulse { animation: pulse 1.8s ease-out infinite; }
@keyframes pulse {
  0% { opacity: .7; r: 10; }
  100% { opacity: 0; r: 30; }
}

/* interactive region labels */
.marker.rlabel circle.rdot { fill: #9d8e72; opacity: .8; }
.marker.rlabel.active circle.rdot, .marker.rlabel.lit circle.rdot { fill: var(--accent); r: 4.5; }
#map[data-period]:not([data-period=""]) .marker.rlabel:not(.dim) circle.rdot { fill: var(--accent); }
.marker.rlabel text.rtext {
  font-family: var(--serif); font-size: 17px; letter-spacing: 3px; font-style: italic;
  fill: #9d8e72; text-anchor: middle; transition: fill .15s;
}
.marker.rlabel.rlabel-sm text.rtext { font-size: 11px; letter-spacing: 1.5px; }
.marker.rlabel tspan.rcount { font-size: 10px; letter-spacing: 0; fill: var(--ink-faint); font-style: normal; }
.marker.rlabel:hover text.rtext, .marker.rlabel:focus text.rtext { fill: var(--accent); }
.marker.rlabel.active text.rtext { fill: var(--accent); font-weight: 600; }
.marker.rlabel.lit text.rtext { fill: var(--gold); }

/* Jerusalem schematic */
.jer-valley { fill: none; stroke: #cbb98f; stroke-width: 26; opacity: .45; stroke-linecap: round; }
.jer-valley-light { stroke-width: 14; opacity: .3; }
.jer-vlabel { font-size: 11px; fill: #877b66; font-style: italic; font-family: var(--serif); }
.jer-olivet { fill: #d9c9a4; opacity: .5; }
.jer-wall { fill: rgba(255,253,248,.45); stroke: #8d7b57; stroke-width: 3; stroke-linejoin: round; }
.jer-temple-platform { fill: #efe6cf; stroke: #8d7b57; stroke-width: 1.6; }
.jer-temple { fill: #fffdf8; stroke: #8d7b57; stroke-width: 1.6; }
.jer-antonia { fill: #e4d7b8; stroke: #8d7b57; stroke-width: 1.2; }
.jer-palace { fill: #e4d7b8; stroke: #8d7b57; stroke-width: 1.2; }
.jer-slabel { font-size: 10.5px; fill: #6b6357; text-anchor: middle; font-family: var(--sans); }
.jer-slabel-strong { font-size: 12px; font-family: var(--serif); font-style: italic; }
.jer-quarter { font-size: 10px; letter-spacing: 1.6px; fill: #a2988a; text-anchor: middle; }
.jer-garden { fill: #c9d3a8; opacity: .5; }
.jer-road { fill: none; stroke: #b7a67f; stroke-width: 2; stroke-dasharray: 5 4; opacity: .6; }
.jer-note { font-size: 10.5px; fill: #877b66; font-style: italic; }

/* ---------- panel ---------- */
#panel {
  flex: 0 0 470px; max-width: 470px; background: var(--panel);
  border-left: 1px solid var(--line); overflow-y: auto; z-index: 10;
  scroll-behavior: smooth;
}
#panelContent { padding: 22px 26px 60px; }

.backbar { margin-bottom: 10px; }
.backbar a { font-size: 12px; color: var(--ink-soft); text-decoration: none; }
.backbar a:hover { color: var(--accent); }
.p-kicker { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10.5px; letter-spacing: .8px; text-transform: uppercase;
  border-radius: 10px; padding: 3px 9px; background: var(--bg); color: var(--ink-soft);
  border: 1px solid var(--line);
}
.chip i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.chip.prec-firm { color: #2c6640; border-color: #cfe0d3; background: #eef5f0; }
.chip.prec-approx { color: #8a6a1e; border-color: #e8dcbb; background: #f8f2df; }
.chip.prec-disputed { color: #8a2f1d; border-color: #ecd2ca; background: #f8ebe6; }

.p-num { font-family: var(--serif); font-size: 13px; color: var(--ink-faint); }
h2.p-title { font-family: var(--serif); font-size: 24px; font-weight: 600; line-height: 1.22; margin: 2px 0 6px; }
.p-meta { font-size: 12.5px; color: var(--ink-soft); margin-bottom: 4px; }
.p-meta a, .evrow a, .loclink { color: var(--accent); text-decoration: none; border-bottom: 1px dotted #d9b8ad; }
.p-meta a:hover, .loclink:hover { border-bottom-style: solid; }
.p-datenote { font-size: 12px; color: var(--ink-soft); background: var(--bg); border-left: 3px solid var(--gold); padding: 7px 10px; border-radius: 0 6px 6px 0; margin: 8px 0; }

.chronology-card { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0 10px; }
.chronology-card > div {
  padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--bg);
}
.chronology-card span { display: block; font-size: 9.5px; letter-spacing: 1px; text-transform: uppercase; color: var(--ink-faint); }
.chronology-card b { display: block; margin-top: 2px; font-size: 12.5px; line-height: 1.35; color: var(--ink); font-weight: 600; }

.p-nav { display: flex; gap: 8px; margin: 12px 0 4px; }
.p-nav button {
  flex: 1; border: 1px solid var(--line); background: var(--panel);
  padding: 7px 10px; border-radius: 9px; font-size: 12.5px; color: var(--ink-soft);
  text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  min-width: 0;
}
.p-nav button:hover:not(:disabled) { border-color: var(--gold); color: var(--ink); }
.p-nav button:disabled { opacity: .4; cursor: default; }

/* event study tabs */
.event-tabs {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px;
  margin: 14px 0 12px; position: sticky; top: 0; background: var(--panel); z-index: 3;
  padding: 6px 0;
}
.event-tabs button {
  min-height: 34px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel);
  padding: 5px 2px; color: var(--ink-soft); font-size: 11px; line-height: 1.2;
}
.event-tabs button:hover { border-color: var(--gold); color: var(--ink); }
.event-tabs button.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.event-tabpanel { min-height: 160px; }

/* gospels grid */
.gospels { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 14px 0; }
.gcell {
  border: 1px solid var(--line); border-radius: 9px; padding: 7px 6px 6px; text-align: center;
  background: var(--bg);
}
.gcell b { display: block; font-size: 10px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--ink-soft); margin-bottom: 2px; }
.gcell span { font-size: 12px; font-weight: 600; color: var(--ink); }
.gcell.omit { background: none; border-style: dashed; }
.gcell.omit span { color: var(--ink-faint); font-weight: 400; font-style: italic; font-size: 11px; }
.p-xref { font-size: 12px; color: var(--ink-soft); margin: -6px 0 10px; }

/* scripture */
blockquote.kjv {
  font-family: var(--serif); font-size: 15.5px; line-height: 1.6; color: #3d3428;
  border-left: 3px solid var(--accent); background: #fbf7ef;
  padding: 12px 16px; margin: 12px 0; border-radius: 0 8px 8px 0;
}
blockquote.kjv cite { display: block; font-size: 11.5px; color: var(--ink-soft); font-style: normal; margin-top: 6px; letter-spacing: .5px; }
.esvnote { font-size: 12.5px; color: var(--ink-soft); background: var(--bg); padding: 8px 12px; border-radius: 8px; margin: 10px 0; }
.esvnote b { color: var(--ink); }
.full-passage { margin: 10px 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fbf7ef; }
.full-passage h4 { padding: 8px 12px; border-bottom: 1px solid var(--line); font: 600 13.5px var(--serif); }
.passage-verses { font: 14px/1.7 var(--serif); color: #3d3428; padding: 10px 13px 4px; }
.passage-verses sup { color: var(--accent); font: 600 9px var(--sans); margin: 0 3px 0 6px; }
.passage-verses sup:first-child { margin-left: 0; }
.ch-break { display: block; text-align: center; color: var(--ink-faint); font: italic 11px var(--serif); margin: 6px 0; }
.passage-source { display: block; padding: 0 13px 10px; color: var(--ink-faint); font-size: 10px; }

/* sections */
.sec { margin: 18px 0 0; }
.sec h3 {
  font-size: 11px; letter-spacing: 1.8px; text-transform: uppercase; font-weight: 600;
  color: var(--gold); margin-bottom: 6px; display: flex; align-items: center; gap: 8px;
}
.sec h3::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.sec p { font-size: 14px; color: #433b30; margin-bottom: 8px; }

/* word studies */
table.words { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 4px; }
table.words td { padding: 6px 8px; border-top: 1px solid var(--line); vertical-align: top; }
table.words td.strong { font-size: 11px; color: var(--accent); white-space: nowrap; font-weight: 600; }
table.words td.gk { font-style: italic; font-family: var(--serif); white-space: nowrap; }

ul.sources { list-style: none; margin-top: 4px; }
ul.sources li { font-size: 12.5px; color: var(--ink-soft); padding: 3px 0 3px 16px; position: relative; }
ul.sources li::before { content: "—"; position: absolute; left: 0; color: var(--ink-faint); }

/* media */
.media-grid { display: grid; grid-template-columns: 1fr; gap: 10px; margin-top: 4px; }
.media-card { overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.media-card img { display: block; width: 100%; max-height: 300px; object-fit: cover; background: #e9e1d1; }
.media-card figcaption { padding: 8px 11px 9px; }
.media-card figcaption b { display: block; font: 600 13px var(--serif); }
.media-card figcaption em.media-cap { display: block; margin-top: 3px; font: italic 12px/1.5 var(--serif); color: #574e40; }
.media-card figcaption i.media-note {
  display: inline-block; margin-top: 5px; font-style: normal; font-size: 10px;
  color: var(--ink-soft); background: #efe8d8; border-radius: 8px; padding: 2px 8px;
}
.media-card figcaption span { display: block; margin-top: 5px; color: var(--ink-faint); font-size: 10px; line-height: 1.4; }
.media-card figcaption a { color: var(--accent); }

/* studies */
.study-sub { color: var(--ink-soft); font-size: 11.5px; }
.study-body h4 { font-family: var(--serif); font-size: 15px; font-weight: 600; margin: 16px 0 6px; }
.study-body p, .study-body li { font-size: 13.5px; color: #433b30; margin-bottom: 8px; }
.study-body ul { padding-left: 20px; }
.study-body li { margin-bottom: 5px; }
table.study-table { width: 100%; border-collapse: collapse; font-size: 12.5px; margin: 8px 0; }
table.study-table th {
  text-align: left; font-size: 10px; letter-spacing: 1px; text-transform: uppercase;
  color: var(--ink-soft); padding: 5px 8px; border-bottom: 2px solid var(--line);
}
table.study-table td { padding: 5px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
a.studylink {
  display: inline-block; margin: 2px 8px 2px 0; padding: 4px 11px;
  border: 1px solid var(--line); border-radius: 12px; font-size: 12px;
  color: var(--accent); text-decoration: none; background: var(--bg);
}
a.studylink:hover { border-color: var(--accent); }

/* location panel */
.loc-region { font-size: 12px; letter-spacing: 1.4px; text-transform: uppercase; color: var(--ink-faint); }
.meaning { font-family: var(--serif); font-style: italic; color: #5d5344; font-size: 14px; margin: 6px 0 4px; }
.evlist { margin-top: 8px; }
.evrow {
  display: flex; gap: 10px; align-items: baseline; padding: 7px 8px; border-radius: 8px;
  cursor: pointer; border: 1px solid transparent;
}
.evrow:hover { background: var(--bg); border-color: var(--line); }
.evrow .n { flex: 0 0 30px; text-align: right; font-family: var(--serif); font-size: 13px; color: var(--ink-faint); }
.evrow .t { font-size: 13.5px; }
.evrow .r { margin-left: auto; font-size: 11px; color: var(--ink-faint); white-space: nowrap; }
.evrow .d { font-size: 11px; color: var(--ink-faint); }
a.extlink { display: inline-block; font-size: 12px; color: var(--accent); margin: 2px 10px 2px 0; }

/* index */
.idx-period { margin: 16px 0 4px; }
.idx-period h4 {
  font-family: var(--serif); font-size: 15px; font-weight: 600; padding: 6px 0 3px;
  border-bottom: 2px solid; margin-bottom: 4px; display: flex; align-items: baseline; gap: 10px;
}
.idx-period h4 small { font-family: var(--sans); font-size: 11px; color: var(--ink-soft); font-weight: 400; margin-left: auto; }
.count-note { font-size: 12px; color: var(--ink-soft); margin: 8px 0; }

/* about / welcome */
.about h2 { font-family: var(--serif); font-size: 22px; margin-bottom: 10px; }
.about h3.plain { font-family: var(--serif); font-size: 16px; font-weight: 600; margin: 18px 0 6px; color: var(--ink); }
.about p, .about li { font-size: 13.5px; color: #433b30; margin-bottom: 8px; }
.about ul, .about ol { padding-left: 20px; margin-bottom: 8px; }
.about li { margin-bottom: 4px; }
.stat-row { display: flex; gap: 10px; margin: 14px 0; }
.stat {
  flex: 1; text-align: center; background: var(--bg); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 6px;
}
.stat b { display: block; font-family: var(--serif); font-size: 22px; color: var(--accent); }
.stat span { font-size: 10.5px; letter-spacing: 1px; text-transform: uppercase; color: var(--ink-soft); }
.bigbtn {
  display: block; width: 100%; margin: 14px 0; padding: 12px; border-radius: 10px;
  background: var(--ink); color: #fff; border: none; font-size: 14px; letter-spacing: .3px;
}
.bigbtn:hover { background: var(--accent); }
.hint { font-size: 12px; color: var(--ink-faint); font-style: italic; }

/* ---------- timeline ---------- */
footer#timeline {
  flex: 0 0 122px; background: var(--panel); border-top: 1px solid var(--line);
  overflow-x: auto; overflow-y: hidden; z-index: 20;
}
#tlScroll { display: flex; height: 100%; padding: 10px 18px 8px; gap: 0; min-width: max-content; }
.tl-period { display: flex; flex-direction: column; padding-right: 22px; }
.tl-phead {
  font-size: 10.5px; letter-spacing: .6px; text-transform: uppercase; white-space: nowrap;
  padding: 2px 0 1px; border-top: 3px solid; margin-bottom: 2px; cursor: pointer;
  color: var(--ink-soft); font-weight: 600; outline-offset: 2px;
}
.tl-phead small { display: block; font-size: 9.5px; color: var(--ink-faint); font-weight: 400; letter-spacing: .3px; text-transform: none; }
.tl-phead:hover { color: var(--ink); }
.tl-period.filtered .tl-phead { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.tl-dots { display: flex; gap: 3px; align-items: flex-start; padding-top: 4px; }
.tl-dot {
  width: 21px; height: 21px; border-radius: 50%; border: 1.6px solid;
  background: var(--panel); font-size: 9.5px; font-weight: 600; color: var(--ink-soft);
  display: flex; align-items: center; justify-content: center; padding: 0;
  transition: transform .1s;
}
.tl-dot:hover { transform: scale(1.25); color: var(--ink); z-index: 2; }
.tl-dot.lit { background: #f4e8c8; border-width: 2.4px; box-shadow: 0 0 0 2px rgba(176,138,60,.25); }
.tl-dot.active { background: var(--ink); color: #fff !important; border-color: var(--ink) !important; transform: scale(1.3); }
.tl-dot.dim { opacity: .25; }

/* scrollbars */
#panel::-webkit-scrollbar, footer#timeline::-webkit-scrollbar { width: 9px; height: 9px; }
#panel::-webkit-scrollbar-thumb, footer#timeline::-webkit-scrollbar-thumb {
  background: #d8ccb4; border-radius: 5px; border: 2px solid var(--panel);
}

/* ---------- mobile ---------- */
@media (max-width: 920px) {
  body { overflow: hidden; }
  #app { height: 100dvh; }
  header#topbar { flex-wrap: nowrap; gap: 8px; padding: 0 10px; height: 50px; flex-basis: 50px; }
  .brand h1 { font-size: 15px; }
  .brand small { display: none; }
  #searchbox { flex: 1 1 100px; min-width: 70px; }
  .navbtn { padding: 6px 10px; font-size: 12px; }
  main#main { flex-direction: column; min-height: 0; }
  /* reading-first: the map is a compact banner, the panel gets the space */
  #mapwrap { flex: 0 0 32vh; min-height: 180px; }
  #panel {
    flex: 1 1 auto; min-height: 0; max-width: none;
    border-left: none; border-top: 1px solid var(--line);
    overflow-y: auto;
  }
  #panelContent { padding: 14px 14px 40px; }
  footer#timeline { flex: 0 0 88px; }
  .tl-phead small { display: none; }
  .tl-dot { width: 24px; height: 24px; font-size: 10px; } /* bigger touch targets */
  .mapctrl { top: 8px; left: 8px; gap: 4px; }
  .mapctrl button { width: 30px; height: 30px; font-size: 15px; }
  .maptools { top: 8px; right: 8px; gap: 4px; }
  .maptools .tool { font-size: 10.5px; padding: 4px 8px; }
  .cityinset { left: 6px; right: 6px; bottom: 6px; width: auto; }
  .cityinset.big { width: auto; }
  .cityinset svg { max-height: 24vh; }
  #filterPill { bottom: 6px; font-size: 11px; padding: 4px 10px; max-width: 80%; }
  .gospels { grid-template-columns: repeat(2, 1fr); }
  .chronology-card { grid-template-columns: 1fr; }
  .event-tabs { grid-template-columns: repeat(5, minmax(0, 1fr)); position: static; }
  .event-tabs button { font-size: 10px; min-height: 34px; }
  .p-nav button { font-size: 11.5px; }
  h2.p-title { font-size: 20px; }
  #lightbox figcaption { max-height: 26vh; }
}
@media (max-width: 560px) {
  .brand { display: none; }
  #mapwrap { flex-basis: 30vh; }
}
