:root {
  --paper: #f1ebdd;
  --paper-2: #e8e0cd;
  --ink: #1c1a17;
  --muted: #6b6458;
  --rule: #cfc5ae;
  --red: #b3261e;
  --display: "Bodoni Moda", "Didot", "Bodoni 72", Georgia, serif;
  --text: "Spectral", Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font: 17px/1.55 var(--text);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--red); text-underline-offset: 2px; }
a:hover { color: var(--ink); }
h1, h2 { font-family: var(--display); font-weight: 400; line-height: 1.05; margin: 0; }
p { margin: 0 0 0.8em; }

.kicker {
  font: 600 11px/1 var(--text);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}

/* ---------- atlas ---------- */
.atlas {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 440px);
  height: 100vh;
  height: 100dvh;
}
.map { height: 100%; background: var(--paper-2); overflow: hidden; isolation: isolate; contain: paint; }
.reel {
  position: relative;
  z-index: 1;
  overflow-y: auto;
  border-left: 1px solid var(--ink);
  background: var(--paper);
  scroll-padding-top: 12px;
}
.masthead { padding: 28px 28px 18px; border-bottom: 1px solid var(--rule); }
.masthead h1 { font-size: 46px; letter-spacing: -0.01em; }
.masthead h1 em { font-style: italic; }
.tagline { margin: 12px 0 0; font-style: italic; color: var(--muted); }
.intro { padding: 18px 28px 6px; font-size: 15.5px; }
.intro p { margin-bottom: 0.7em; }

.controls {
  position: sticky; top: 0; z-index: 5;
  display: flex; gap: 10px; align-items: center;
  padding: 12px 28px;
  background: var(--paper);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--ink);
}
.controls button {
  font: 600 12px/1 var(--text); letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink); background: transparent; border: 0; padding: 8px 12px; cursor: pointer;
}
.play { border: 1px solid var(--red) !important; border-radius: 999px; color: var(--red) !important; }
.play[aria-pressed="true"] { background: var(--red) !important; color: var(--paper) !important; }
.controls button:focus-visible, .scene-head:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

.scenes { list-style: none; margin: 0; padding: 0; }
.scene { border-bottom: 1px solid var(--rule); }
.scene-head {
  display: grid; grid-template-columns: 34px 1fr; column-gap: 12px; row-gap: 2px;
  width: 100%; text-align: left; padding: 14px 28px; border: 0; background: none;
  color: inherit; font: inherit; cursor: pointer;
}
.scene-head:hover { background: var(--paper-2); }
.num {
  grid-row: span 2; align-self: start;
  display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: var(--ink); color: var(--paper); font: 700 13px/1 var(--display);
}
.scene-title { font: 400 21px/1.15 var(--display); }
.scene-place { font-size: 13.5px; color: var(--muted); }
.scene.is-open { background: #f7f2e7; }
.scene.is-open .num { background: var(--red); }
.detail { padding: 0 28px 20px 74px; font-size: 15.5px; }

.detail-summary, .scene-page .detail-summary { margin-bottom: 14px; }
.where { margin: 0; }
.where-row { padding: 10px 0; border-top: 1px dotted var(--rule); }
.where dt {
  font: 600 11px/1 var(--text); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted);
  display: flex; align-items: center; gap: 8px; margin-bottom: 6px;
}
.where dd { margin: 0; }
.where .place { font-weight: 600; margin-bottom: 4px; }
.where .notes { font-size: 14.5px; color: #3a362f; }
.where .notes p { margin-bottom: 0.5em; }
.key { display: inline-block; width: 12px; height: 12px; border-radius: 50%; }
.key-road { width: 18px; height: 0; border-radius: 0; border-top: 4px solid var(--red); }

.certainty {
  display: inline-block; vertical-align: 2px; margin-left: 6px;
  font: 600 10px/1 var(--text); letter-spacing: 0.12em; text-transform: uppercase;
  padding: 4px 6px; border-radius: 3px; white-space: nowrap;
}
.certainty-documented { background: var(--ink); color: var(--paper); }
.certainty-attributed { border: 1px solid var(--ink); color: var(--ink); }
.certainty-estimated { border: 1px dashed var(--muted); color: var(--muted); }

.sources { font-size: 13px; color: var(--muted); margin-top: 8px; }
.permalink { font-size: 14px; margin: 10px 0 0; }

.colophon { padding: 26px 28px 40px; font-size: 14.5px; background: var(--paper-2); }
.colophon h2 { font-size: 22px; margin: 0 0 10px; }
.colophon h2 + * { margin-top: 0; }
.colophon p + h2, .colophon div + h2 { margin-top: 22px; }
.biblio { padding-left: 18px; margin: 0 0 16px; }
.biblio li { margin-bottom: 6px; }
.credit { color: var(--muted); font-size: 12.5px; }

/* ---------- map marks ---------- */
.leaflet-container { font-family: var(--text); background: var(--paper-2); }
.sheet { filter: sepia(0.2) saturate(0.9) contrast(1.18) brightness(0.97); }
.road-casing { stroke: var(--paper); stroke-width: 10; stroke-linecap: round; stroke-linejoin: round; opacity: .85; fill: none; }
.road-line { stroke: var(--red); stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; fill: none; }
.road-pending { opacity: .3; }
.road-trail { stroke: var(--ink); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 6 6; fill: none; }
.pin-wrap { background: none; border: 0; }
.pin {
  display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  font: 700 13px/1 var(--display); box-shadow: 0 1px 3px rgba(0,0,0,.35);
  translate: var(--dx, 0) var(--dy, 0);
  transition: transform .2s ease, translate .25s ease;
}
.pin { background: var(--ink); color: var(--paper); box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--red), 0 1px 4px rgba(0,0,0,.4); }
.is-active .pin { transform: scale(1.35); background: var(--red); }
.moto-wrap { background: none; border: 0; }
.moto { display: block; width: 14px; height: 14px; border-radius: 50%; background: var(--red); border: 2px solid var(--paper); box-shadow: 0 0 0 1px var(--red), 0 1px 4px rgba(0,0,0,.5); }
.minimap { width: 132px; padding: 6px; background: rgba(241,235,221,.94); border: 1px solid var(--ink); box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.minimap svg { display: block; width: 100%; height: auto; cursor: pointer; }
.mm-land path { fill: var(--paper-2); stroke: var(--ink); stroke-width: .6; stroke-linejoin: round; }
.mm-pins circle { fill: var(--ink); }
.mm-view { fill: rgba(179,38,30,.18); stroke: var(--red); stroke-width: 1.4; }
.leaflet-control-attribution { background: rgba(241,235,221,.85) !important; font-size: 11px; }
.leaflet-bar a { background: var(--paper); color: var(--ink); border-color: var(--rule); }

/* ---------- scene page ---------- */
.scene-page { max-width: 720px; margin: 0 auto; padding: 32px 24px 64px; }
.scene-page h1 { font-size: 48px; margin-bottom: 18px; }
.crumbs { font-size: 14px; margin-bottom: 28px; }
.scene-map { overflow: hidden; isolation: isolate; contain: paint; height: 340px; border: 1px solid var(--ink); margin: 6px 0 22px; }
.pager { display: flex; justify-content: space-between; gap: 16px; margin-top: 30px; padding-top: 16px; border-top: 1px solid var(--ink); font-size: 15px; }
.pager .next { margin-left: auto; text-align: right; }
.notfound { padding-top: 18vh; }

/* ---------- small screens ---------- */
@media (max-width: 820px) {
  .atlas { display: block; height: auto; }
  .map { position: sticky; top: 0; z-index: 10; height: 46vh; height: 46dvh; border-bottom: 1px solid var(--ink); }
  .reel { border-left: 0; overflow: visible; }
  .controls { top: 46vh; top: 46dvh; padding: 10px 18px; }
  .masthead, .intro, .scene-head, .colophon { padding-left: 18px; padding-right: 18px; }
  .masthead h1 { font-size: 38px; }
  .detail { padding: 0 18px 18px 18px; }
  .scene-page h1 { font-size: 38px; }
}
