/* =============================================================
   NEW YORK CITY HISTORY TO 1900
   The chrome stays dark and quiet so his map carries all the colour.
   ============================================================= */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --ink:        #0B0B0C;   /* ground */
  --ink-raised: #131316;
  --ink-card:   #191A1E;
  --ink-hover:  #23242A;

  --cream:      #DDD8CE;   /* body text — warm off-white */
  --cream-soft: #948F86;
  --cream-dim:  #5C584F;
  --paper:      #FBF8F2;   /* emphasis */

  --brass:      #C5A880;   /* the single accent */
  --brass-deep: #9C8258;
  --brass-glow: rgba(197,168,128,0.16);

  --rule:       rgba(221,216,206,0.11);
  --rule-mid:   rgba(221,216,206,0.20);

  /* Four voices, each with one job.
     display  — titles and numbers you are meant to feel
     text     — anything you actually read at length
     ui       — labels, counts, buttons, navigation
     archival — reserved for genuinely technical marginalia            */
  --serif:   "Fraunces", "Iowan Old Style", Georgia, serif;
  --classic: "Spectral", "Iowan Old Style", Georgia, serif;
  --sans:    "Inter Tight", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --label:   "Inter Tight", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --mono:    "Courier Prime", ui-monospace, "Courier New", monospace;

  --film:       cubic-bezier(0.16, 1, 0.30, 1);
  --mechanical: cubic-bezier(0.83, 0, 0.17, 1);

  --bar: 62px;   /* top bar height */
}

html { height: 100%; }

body {
  min-height: 100%;
  background: var(--ink);
  color: var(--cream);
  font-family: var(--sans);
  font-weight: 380;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  opacity: 0;
  transition: opacity 700ms var(--film);
}
body.is-ready { opacity: 1; }
/* only the map locks the viewport; reading pages scroll */
body.page-map { height: 100%; overflow: hidden; }
body:not(.page-map) { overflow-x: hidden; }

img, svg, canvas { display: block; max-width: 100%; }
/* `hidden` must beat the layout display values set further down */
[hidden] { display: none !important; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input { font: inherit; }
::selection { background: var(--brass); color: var(--ink); }

/* thin dark scrollbars inside panels */
.panel-scroll, .legend-list { scrollbar-width: thin; scrollbar-color: var(--cream-dim) transparent; }
.panel-scroll::-webkit-scrollbar, .legend-list::-webkit-scrollbar { width: 8px; }
.panel-scroll::-webkit-scrollbar-thumb, .legend-list::-webkit-scrollbar-thumb {
  background: var(--cream-dim); border-radius: 4px;
}

/* =============================================================
   FILM GRAIN — transform-only so it never repaints
   ============================================================= */
.grain {
  position: fixed; top: -8%; left: -8%; width: 116%; height: 116%;
  pointer-events: none; z-index: 60; opacity: 0.035;
  mix-blend-mode: screen;
  background-image: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.5 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grainJitter 0.9s steps(1, end) infinite;
  will-change: transform;
}
@keyframes grainJitter {
  0%    { transform: translate3d(0,0,0); }
  25%   { transform: translate3d(1.4%,-1.8%,0); }
  50%   { transform: translate3d(-2.2%,1.1%,0); }
  75%   { transform: translate3d(2.0%,2.4%,0); }
  100%  { transform: translate3d(0,0,0); }
}
@media (prefers-reduced-motion: reduce) { .grain { animation: none; } }

/* =============================================================
   PRELOADER
   ============================================================= */
.preloader {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--ink);
  display: grid; place-items: center;
  transition: opacity 800ms var(--film), visibility 800ms;
}
.preloader.hidden { opacity: 0; visibility: hidden; }
.pre-inner { text-align: center; }
.pre-mark { width: 74px; height: 74px; margin: 0 auto 1.6rem; }
.pre-mark path {
  fill: none; stroke: var(--brass); stroke-width: 3;
  stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 320; stroke-dashoffset: 320;
  animation: preDraw 1.5s 0.15s var(--film) forwards;
}
.pre-mark .draw-2 { animation-delay: 0.5s; }
@keyframes preDraw { to { stroke-dashoffset: 0; } }

.pre-title {
  font-family: var(--serif); font-weight: 300;
  font-size: clamp(1.5rem, 4vw, 2.4rem); letter-spacing: 0.01em;
  color: var(--paper);
}
.pre-sub {
  font-family: var(--serif); font-style: italic; font-weight: 300;
  font-size: clamp(1rem, 2.4vw, 1.4rem); color: var(--brass); margin-top: 0.1rem;
}
.pre-bar {
  width: 190px; height: 1px; margin: 1.7rem auto 0.8rem;
  background: var(--rule); overflow: hidden;
}
.pre-bar span {
  display: block; height: 100%; width: 0%;
  background: var(--brass); transition: width 240ms linear;
}
.pre-meta {
  font-family: var(--label); font-weight: 500; font-size: 0.63rem; letter-spacing: 0.28em;
  text-transform: uppercase; color: var(--cream-dim);
}

/* =============================================================
   CURSOR
   ============================================================= */
.cursor-ring {
  position: fixed; top: 0; left: 0; z-index: 70;
  width: 26px; height: 26px; margin: -13px 0 0 -13px;
  border: 1px solid var(--brass); border-radius: 50%;
  pointer-events: none; opacity: 0;
  transition: opacity 250ms, width 220ms var(--film), height 220ms var(--film),
              margin 220ms var(--film), background 220ms;
  will-change: transform;
}
.cursor-ring.on { opacity: 0.55; }
.cursor-ring.hot {
  width: 42px; height: 42px; margin: -21px 0 0 -21px;
  background: var(--brass-glow); opacity: 0.9;
}
@media (hover: none) { .cursor-ring { display: none; } }

/* =============================================================
   TOP BAR
   ============================================================= */
.topbar {
  position: fixed; inset: 0 0 auto 0; height: var(--bar); z-index: 40;
  display: flex; align-items: center; gap: 1.2rem;
  padding: 0 clamp(14px, 2.2vw, 26px);
  background: linear-gradient(to bottom, rgba(11,11,12,0.97), rgba(11,11,12,0.86));
  border-bottom: 1px solid var(--rule);
  backdrop-filter: blur(14px);
}
.brand { display: flex; flex-direction: column; line-height: 1.15; flex-shrink: 0;
          text-decoration: none; }
.brand-title {
  font-family: var(--serif); font-size: 1.02rem; font-weight: 400;
  color: var(--paper); letter-spacing: 0.005em;
}
.brand-sub {
  font-family: var(--label); font-weight: 500; font-size: 0.58rem; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--cream-dim); margin-top: 2px;
}

.searchwrap {
  position: relative; flex: 1 1 auto; max-width: 460px; margin: 0 auto;
  display: flex; align-items: center;
}
.search-ico {
  position: absolute; left: 12px; width: 15px; height: 15px;
  color: var(--cream-dim); pointer-events: none;
}
#search {
  width: 100%; padding: 9px 34px 9px 34px;
  background: var(--ink-raised); color: var(--cream);
  border: 1px solid var(--rule); border-radius: 2px;
  font-size: 0.85rem; outline: none;
  transition: border-color 250ms, background 250ms;
}
#search::placeholder { color: var(--cream-dim); }
#search:focus { border-color: var(--brass-deep); background: var(--ink-card); }
.search-clear {
  position: absolute; right: 8px; width: 22px; height: 22px;
  color: var(--cream-dim); font-size: 1.1rem; line-height: 1;
  border-radius: 50%; display: none;
}
.search-clear.on { display: block; }
.search-clear:hover { color: var(--cream); }

.nav-links {
  display: flex; gap: 0.15rem; flex-shrink: 0; margin-left: 0.4rem;
}
.nav-links a {
  position: relative;
  font-family: var(--label); font-weight: 500; font-size: 0.62rem; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--cream-soft);
  padding: 9px 13px; border-radius: 2px;
  transition: color 220ms, background 220ms;
}
.nav-links a:hover { color: var(--cream); background: var(--ink-raised); }
.nav-links a.active { color: var(--brass); }
.nav-links a.active::after {
  content: ''; position: absolute; left: 13px; right: 13px; bottom: 3px;
  height: 1px; background: var(--brass);
}

.topbar-actions { display: flex; gap: 0.5rem; flex-shrink: 0; }
.tbtn {
  font-family: var(--label); font-weight: 500; font-size: 0.6rem; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--cream-soft);
  padding: 7px 12px; border: 1px solid var(--rule); border-radius: 2px;
  transition: color 220ms, border-color 220ms, background 220ms;
}
.tbtn:hover, .tbtn[aria-pressed="true"] {
  color: var(--brass); border-color: var(--brass-deep); background: var(--ink-raised);
}

/* =============================================================
   MAP STAGE
   ============================================================= */
.stage {
  position: fixed; inset: var(--bar) 0 0 0;
  overflow: hidden; background: #0E0E10;
  cursor: grab; touch-action: none;
}
.stage canvas { position: absolute; inset: 0; display: block; }
.stage.dragging { cursor: grabbing; }
.tiles { position: absolute; inset: 0; transform-origin: 0 0; }
.tiles img {
  position: absolute; image-rendering: auto;
  opacity: 0; transition: opacity 320ms ease-out;
  user-select: none; -webkit-user-drag: none;
}
.tiles img.loaded { opacity: 1; }
/* Tiles carry a z-index for cross-level layering, so the overlay must sit above them. */
.overlay { position: absolute; inset: 0; pointer-events: none; z-index: 20; }

.hint {
  position: absolute; left: 50%; bottom: 128px; transform: translateX(-50%);
  font-family: var(--label); font-weight: 500; font-size: 0.6rem; letter-spacing: 0.22em;
  text-transform: uppercase; color: var(--cream-dim);
  background: rgba(11,11,12,0.72); padding: 7px 14px; border-radius: 2px;
  pointer-events: none; transition: opacity 700ms var(--film);
}
.hint.gone { opacity: 0; }

.tooltip {
  position: absolute; z-index: 30; max-width: 300px;
  background: rgba(9,9,10,0.95); border: 1px solid var(--rule-mid);
  border-left: 2px solid var(--brass);
  padding: 9px 12px; border-radius: 2px;
  font-size: 0.8rem; line-height: 1.45; color: var(--cream);
  pointer-events: none; opacity: 0; transform: translateY(4px);
  transition: opacity 180ms, transform 180ms;
}
.tooltip.on { opacity: 1; transform: translateY(0); }
.tooltip .tt-years {
  display: block; font-family: var(--label); font-weight: 500; font-size: 0.62rem;
  letter-spacing: 0.14em; color: var(--brass); margin-top: 3px;
}
.tooltip .tt-more {
  display: block; font-family: var(--label); font-weight: 500; font-size: 0.56rem;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--cream-dim); margin-top: 6px;
}

.zoomctl {
  position: absolute; right: 18px; bottom: 128px; z-index: 25;
  display: flex; flex-direction: column; gap: 1px;
  border: 1px solid var(--rule); border-radius: 2px; overflow: hidden;
}
.zoomctl button {
  width: 34px; height: 34px; background: rgba(11,11,12,0.88);
  color: var(--cream-soft); font-size: 1rem; line-height: 1;
  transition: color 200ms, background 200ms;
}
.zoomctl button:hover { color: var(--brass); background: var(--ink-hover); }

/* =============================================================
   PERIOD SWITCHER — his four historical layers
   ============================================================= */
.rail::-webkit-scrollbar { width: 6px; }
.rail::-webkit-scrollbar-thumb { background: var(--cream-dim); border-radius: 3px; }

.periods {}
.pd-head {
  font-family: var(--label); font-weight: 500; font-size: 0.55rem; letter-spacing: 0.22em;
  text-transform: uppercase; color: var(--cream-dim); margin-bottom: 9px;
}
.pd-list { display: flex; flex-direction: column; gap: 2px; }
.pd-list button {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  width: 100%; padding: 7px 9px; border-radius: 2px; text-align: left;
  border: 1px solid transparent;
  transition: background 200ms, border-color 200ms, color 200ms;
}
.pd-list button:hover { background: var(--ink-hover); }
.pd-list button[aria-pressed="true"] {
  background: var(--ink-card); border-color: var(--brass-deep);
}
.pd-list button[aria-pressed="true"] .pd-name { color: var(--brass); }
.pd-name { font-family: var(--serif); font-size: 0.95rem; color: var(--cream); }
.pd-count { font-family: var(--label); font-weight: 500; font-size: 0.58rem; color: var(--cream-dim); }
.pd-note {
  margin-top: 9px; font-size: 0.66rem; line-height: 1.5; color: var(--cream-dim);
}

/* =============================================================
   DISTRICT JUMP
   ============================================================= */
.districtbar {}
.db-head {
  font-family: var(--label); font-weight: 500; font-size: 0.55rem; letter-spacing: 0.22em;
  text-transform: uppercase; color: var(--cream-dim); margin-bottom: 8px;
}
.db-list { display: flex; flex-direction: column; }
.db-list button {
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
  width: 100%; text-align: left; padding: 5px 7px; border-radius: 2px;
  font-size: 0.78rem; color: var(--cream-soft);
  transition: background 180ms, color 180ms;
}
.db-list button:hover { background: var(--ink-hover); color: var(--brass); }
.db-list button span {
  font-family: var(--label); font-weight: 500; font-size: 0.56rem; color: var(--cream-dim);
}

.zoom-pct {
  font-family: var(--mono); font-size: 0.52rem; letter-spacing: 0.08em;
  color: var(--cream-dim); text-align: center; padding: 3px 0;
  background: rgba(11,11,12,0.88);
}

/* =============================================================
   TIMELINE
   ============================================================= */
.timeline {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  z-index: 35; width: min(660px, calc(100vw - 40px));
  background: rgba(11,11,12,0.92); backdrop-filter: blur(14px);
  border: 1px solid var(--rule); border-radius: 3px;
  padding: 12px 18px 10px;
}
.tl-head {
  display: flex; align-items: baseline; gap: 10px; margin-bottom: 7px;
}
.tl-label {
  font-family: var(--label); font-weight: 500; font-size: 0.58rem; letter-spacing: 0.22em;
  text-transform: uppercase; color: var(--cream-dim);
}
.tl-value {
  font-family: var(--serif); font-size: 1.02rem; color: var(--paper);
  flex: 1;
}
.tl-reset {
  font-family: var(--label); font-weight: 500; font-size: 0.56rem; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--cream-dim);
}
.tl-reset:hover { color: var(--brass); }

#yearRange { width: 100%; -webkit-appearance: none; appearance: none; background: transparent; }
/* The visible rule is 1px but the hit target is 20px, so clicking anywhere
   along the track seeks — a 1px target meant only the handle worked. */
#yearRange { height: 20px; cursor: pointer; }
#yearRange::-webkit-slider-runnable-track {
  height: 20px; background: linear-gradient(var(--rule-mid), var(--rule-mid))
    center / 100% 1px no-repeat;
}
#yearRange::-moz-range-track {
  height: 20px; background: linear-gradient(var(--rule-mid), var(--rule-mid))
    center / 100% 1px no-repeat;
}
#yearRange::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 13px; height: 13px; margin-top: 3.5px; border-radius: 50%;
  background: var(--brass); border: 2px solid var(--ink);
  box-shadow: 0 0 0 1px var(--brass-deep);
  transition: transform 180ms var(--film);
}
#yearRange::-webkit-slider-thumb:hover { transform: scale(1.25); }
#yearRange::-moz-range-thumb {
  width: 13px; height: 13px; border-radius: 50%;
  background: var(--brass); border: 2px solid var(--ink);
}
.tl-ticks {
  display: flex; justify-content: space-between; margin-top: 5px;
  font-family: var(--label); font-weight: 500; font-size: 0.55rem; letter-spacing: 0.12em;
  color: var(--cream-dim);
}

/* =============================================================
   LEGEND
   ============================================================= */
.legend {}
@keyframes slideIn { from { opacity: 0; transform: translateX(-14px); } }
.legend-head { display: flex; align-items: center; justify-content: space-between; }
.legend h2 {
  font-family: var(--serif); font-size: 1rem; font-weight: 400; color: var(--paper);
}
.legend-note { font-size: 0.72rem; color: var(--cream-soft); margin: 6px 0 10px; }
.legend h2 { font-size: 0.88rem; }
.legend-head { margin-bottom: 8px; }
.legend-list { list-style: none; }
.legend-list li { margin-bottom: 1px; }
.legend-list button {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 6px 7px; border-radius: 2px; text-align: left;
  transition: background 200ms;
}
.legend-list button:hover { background: var(--ink-hover); }
.legend-list button[aria-pressed="true"] { background: var(--ink-card); }
.legend-list button[aria-pressed="true"] .lg-name { color: var(--brass); }
.lg-swatch {
  width: 13px; height: 13px; border-radius: 2px; flex-shrink: 0;
  border: 1px solid rgba(255,255,255,0.22);
}
.lg-name { flex: 1; font-size: 0.79rem; color: var(--cream); }
.lg-count { font-family: var(--label); font-weight: 500; font-size: 0.62rem; color: var(--cream-dim); }

/* =============================================================
   DETAIL PANEL
   ============================================================= */
.panel {
  position: fixed; top: var(--bar); right: 0; bottom: 0; z-index: 45;
  width: min(520px, 92vw);
  background: var(--ink-raised);
  border-left: 1px solid var(--rule);
  transform: translateX(102%);
  transition: transform 560ms var(--film);
  display: flex; flex-direction: column;
}
.panel.open { transform: translateX(0); box-shadow: -30px 0 70px rgba(0,0,0,0.55); }
.panel-x {
  position: absolute; top: 12px; right: 14px; z-index: 2;
  width: 30px; height: 30px; border-radius: 50%;
  color: var(--cream-soft); font-size: 1.3rem; line-height: 1;
  background: rgba(11,11,12,0.7);
}
.panel-x:hover { color: var(--brass); background: var(--ink-hover); }
.panel-scroll { overflow-y: auto; padding: 30px clamp(20px, 3vw, 34px) 60px; }

.p-eyebrow {
  font-family: var(--label); font-weight: 500; font-size: 0.58rem; letter-spacing: 0.24em;
  text-transform: uppercase; color: var(--brass); margin-bottom: 9px;
  display: flex; align-items: center; gap: 8px;
}
.p-eyebrow .dot {
  width: 9px; height: 9px; border-radius: 2px;
  border: 1px solid rgba(255,255,255,0.25);
}
.p-sub {
  font-family: var(--serif); font-weight: 400; font-size: 1.08rem;
  color: var(--paper); margin-bottom: 12px; line-height: 1.3;
}
.p-dist { color: var(--brass); border-bottom: 1px solid var(--brass-deep); }
.p-dist:hover { color: var(--paper); }
.p-title {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(1.35rem, 2.7vw, 1.85rem); line-height: 1.22;
  color: var(--paper); margin-bottom: 8px;
}
.p-years {
  font-family: var(--label); font-weight: 500; font-size: 0.72rem; letter-spacing: 0.14em;
  color: var(--brass); margin-bottom: 16px;
}
.p-rule { height: 1px; background: var(--rule); margin: 18px 0; }

/* his own label, verbatim */
.p-verbatim {
  background: var(--ink-card); border-left: 2px solid var(--brass-deep);
  padding: 13px 15px; border-radius: 2px; margin-bottom: 4px;
}
.p-verbatim .vb-head {
  font-family: var(--mono); font-size: 0.55rem; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--cream-dim); margin-bottom: 7px;
}
.p-verbatim ul { list-style: none; }
.p-verbatim li {
  font-family: var(--classic); font-size: 0.92rem; line-height: 1.5;
  color: var(--cream);
}

.p-section-label {
  font-family: var(--label); font-weight: 500; font-size: 0.56rem; letter-spacing: 0.22em;
  text-transform: uppercase; color: var(--cream-dim); margin: 22px 0 9px;
}
.p-body {
  font-family: var(--classic); font-size: 0.96rem; line-height: 1.72;
  color: var(--cream);
}
.p-body p { margin-bottom: 0.95em; }
.p-body p:last-child { margin-bottom: 0; }
.p-more {
  margin-top: 14px; font-family: var(--label); font-weight: 500; font-size: 0.6rem;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--brass);
  border-bottom: 1px solid var(--brass-deep); padding-bottom: 2px;
}
.p-more:hover { color: var(--paper); }
.p-empty { font-size: 0.85rem; color: var(--cream-soft); font-style: italic; }

.p-related { margin-top: 8px; }
.p-related button {
  display: block; width: 100%; text-align: left;
  padding: 9px 11px; margin-bottom: 5px; border-radius: 2px;
  background: var(--ink-card); border: 1px solid transparent;
  font-size: 0.82rem; color: var(--cream-soft);
  transition: border-color 200ms, color 200ms;
}
.p-related button:hover { border-color: var(--brass-deep); color: var(--cream); }

/* search results inside the panel */
.res-group { margin-bottom: 26px; }
.res-count {
  font-family: var(--label); font-weight: 500; font-size: 0.56rem; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--cream-dim); margin-bottom: 10px;
}
.res {
  display: block; width: 100%; text-align: left;
  padding: 10px 12px; margin-bottom: 4px; border-radius: 2px;
  border: 1px solid transparent; background: var(--ink-card);
  transition: border-color 200ms, background 200ms;
}
.res:hover { border-color: var(--brass-deep); background: var(--ink-hover); }
.res-t { font-size: 0.87rem; color: var(--cream); line-height: 1.4; }
.res-m {
  font-family: var(--label); font-weight: 500; font-size: 0.58rem; letter-spacing: 0.12em;
  color: var(--cream-dim); margin-top: 3px;
}
.res mark { background: transparent; color: var(--brass); font-weight: 500; }

/* =============================================================
   ABOUT MODAL
   ============================================================= */
.modal {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(6,6,7,0.82); backdrop-filter: blur(6px);
  display: grid; place-items: center; padding: 24px;
  animation: fadeIn 340ms var(--film);
}
@keyframes fadeIn { from { opacity: 0; } }
.modal-card {
  position: relative; max-width: 620px; width: 100%;
  max-height: 86vh; overflow-y: auto;
  background: var(--ink-raised); border: 1px solid var(--rule);
  border-radius: 3px; padding: clamp(26px, 4vw, 44px);
}
.modal-card .x {
  position: absolute; top: 14px; right: 16px;
  width: 30px; height: 30px; color: var(--cream-soft); font-size: 1.3rem;
}
.modal-card .x:hover { color: var(--brass); }
.eyebrow {
  font-family: var(--label); font-weight: 500; font-size: 0.58rem; letter-spacing: 0.24em;
  text-transform: uppercase; color: var(--brass); margin-bottom: 12px;
}
.modal-card h2 {
  font-family: var(--serif); font-weight: 300;
  font-size: clamp(1.5rem, 3.4vw, 2.1rem); line-height: 1.2;
  color: var(--paper); margin-bottom: 18px;
}
.modal-card p {
  font-family: var(--classic); font-size: 0.96rem; line-height: 1.72;
  color: var(--cream); margin-bottom: 1em;
}
.stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 16px; margin: 26px 0 20px;
  border-top: 1px solid var(--rule); padding-top: 22px;
}
.stats div { display: flex; flex-direction: column; }
.stats dt {
  font-family: var(--serif); font-size: 1.5rem; color: var(--brass); line-height: 1;
}
.stats dd {
  font-family: var(--label); font-weight: 500; font-size: 0.56rem; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--cream-dim); margin-top: 6px;
}
.colophon {
  font-family: var(--mono) !important; font-size: 0.6rem !important;
  letter-spacing: 0.1em; color: var(--cream-dim) !important;
  line-height: 1.8 !important; margin-bottom: 0 !important;
}

/* =============================================================
   RESPONSIVE
   ============================================================= */
@media (max-width: 900px) {
  :root { --bar: 108px; }
  .topbar { flex-wrap: wrap; align-content: center; padding-top: 8px; gap: 8px; }
  .brand { width: 100%; }
  .searchwrap { max-width: none; margin: 0; }
  .topbar-actions { flex-shrink: 0; }
  .legend { left: 12px; right: 12px; width: auto; }
  .timeline { bottom: 12px; padding: 10px 14px 8px; }
  .hint { display: none; }
  .zoomctl { bottom: 120px; right: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important; transition-duration: 0.01ms !important;
  }
}


/* =============================================================
   READING PAGES — districts / streets / themes / about
   ============================================================= */
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 clamp(18px, 4vw, 46px); }
.page { padding-top: calc(var(--bar) + clamp(40px, 7vw, 90px)); padding-bottom: 120px; }

.hero { max-width: 940px; margin-bottom: clamp(40px, 6vw, 76px); }
.hero .eyebrow { margin-bottom: 16px; }
.hero h1 {
  font-family: var(--serif); font-weight: 300;
  font-size: clamp(2.3rem, 6.2vw, 4.6rem); line-height: 1.02;
  letter-spacing: -0.015em; color: var(--paper);
}
.hero h1 em { font-style: italic; color: var(--brass); }
.hero .lede {
  font-family: var(--classic); font-size: clamp(1.02rem, 1.5vw, 1.22rem);
  line-height: 1.7; color: var(--cream); margin-top: 22px; max-width: 66ch;
}
.hero .lede + .lede { margin-top: 0.9em; }

.rule-row {
  display: flex; align-items: center; gap: 18px;
  margin: clamp(30px, 5vw, 54px) 0 clamp(20px, 3vw, 34px);
}
.rule-row h2 {
  font-family: var(--label); font-weight: 500; font-size: 0.6rem; letter-spacing: 0.26em;
  text-transform: uppercase; color: var(--cream-dim); white-space: nowrap;
}
.rule-row::after { content: ''; flex: 1; height: 1px; background: var(--rule); }

/* --- district cards --------------------------------------------------- */
.dgrid { display: flex; flex-direction: column; gap: clamp(16px, 2.4vw, 26px); }
.dcard {
  position: relative; display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: clamp(20px, 3vw, 46px);
  background: var(--ink-raised); border: 1px solid var(--rule);
  border-radius: 3px; padding: clamp(22px, 3vw, 38px);
  transition: border-color 320ms var(--film), transform 320ms var(--film);
  scroll-margin-top: calc(var(--bar) + 24px);
}
.dcard:hover { border-color: var(--rule-mid); }
.dcard-n {
  font-family: var(--label); font-weight: 500; font-size: 0.58rem; letter-spacing: 0.24em;
  color: var(--brass); margin-bottom: 10px;
}
.dcard h3 {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(1.5rem, 2.6vw, 2.1rem); line-height: 1.14;
  color: var(--paper); margin-bottom: 12px;
}
.dcard .blurb {
  font-family: var(--classic); font-size: 0.98rem; line-height: 1.68;
  color: var(--cream); max-width: 54ch;
}
.dmeta { display: flex; flex-wrap: wrap; gap: 26px; margin-top: 22px; }
.dmeta div { display: flex; flex-direction: column; }
.dmeta dt { font-family: var(--serif); font-size: 1.55rem; color: var(--brass); line-height: 1; }
.dmeta dd {
  font-family: var(--label); font-weight: 500; font-size: 0.54rem; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--cream-dim); margin-top: 6px;
}
.dstreets { margin-top: 20px; font-size: 0.8rem; color: var(--cream-soft); }
.dstreets b {
  font-family: var(--label); font-weight: 500; font-size: 0.54rem; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--cream-dim);
  display: block; margin-bottom: 7px; font-weight: 400;
}
.dbar { display: flex; height: 5px; border-radius: 3px; overflow: hidden; margin-top: 22px; }
.dbar span { display: block; }
.dnotable { display: flex; flex-direction: column; gap: 4px; }
.dnotable > b {
  font-family: var(--label); font-weight: 500; font-size: 0.54rem; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--cream-dim); font-weight: 400;
  margin-bottom: 6px;
}
.dn {
  display: flex; gap: 10px; align-items: baseline; width: 100%; text-align: left;
  padding: 8px 10px; border-radius: 2px; border: 1px solid transparent;
  background: var(--ink-card); transition: border-color 200ms, background 200ms;
}
.dn:hover { border-color: var(--brass-deep); background: var(--ink-hover); }
.dn .sw { width: 9px; height: 9px; border-radius: 2px; flex-shrink: 0;
          border: 1px solid rgba(255,255,255,0.2); margin-top: 5px; }
.dn .tx { flex: 1; font-size: 0.82rem; color: var(--cream); line-height: 1.4; }
.dn .yr { font-family: var(--label); font-weight: 500; font-size: 0.58rem; color: var(--brass); }
.dgo {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 20px;
  font-family: var(--label); font-weight: 500; font-size: 0.6rem; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--brass);
  border-bottom: 1px solid var(--brass-deep); padding-bottom: 3px;
}
.dgo:hover { color: var(--paper); border-color: var(--paper); }

/* --- street gazetteer -------------------------------------------------- */
.filterbar { display: flex; gap: 12px; align-items: center; margin-bottom: 26px; flex-wrap: wrap; }
.filterbar input {
  flex: 1 1 260px; max-width: 380px; padding: 10px 14px;
  background: var(--ink-raised); color: var(--cream);
  border: 1px solid var(--rule); border-radius: 2px; outline: none; font-size: 0.88rem;
}
.filterbar input:focus { border-color: var(--brass-deep); }
.filterbar .cnt { font-family: var(--label); font-weight: 500; font-size: 0.6rem; color: var(--cream-dim); letter-spacing: 0.16em; }

.stgrid { columns: 2; column-gap: clamp(20px, 3vw, 44px); }
@media (max-width: 820px) { .stgrid { columns: 1; } }
.st { break-inside: avoid; margin-bottom: 22px; }
.st h3 {
  font-family: var(--serif); font-size: 1.24rem; font-weight: 400;
  color: var(--paper); display: flex; align-items: baseline; gap: 10px;
  padding-bottom: 8px; border-bottom: 1px solid var(--rule); margin-bottom: 10px;
}
.st h3 span { font-family: var(--label); font-weight: 500; font-size: 0.56rem; color: var(--cream-dim); }
.st ul { list-style: none; }
.st li { display: flex; gap: 12px; padding: 5px 0; align-items: baseline; }
.st .num {
  font-family: var(--label); font-weight: 500; font-size: 0.68rem; color: var(--brass);
  min-width: 62px; flex-shrink: 0;
}
.st .desc { font-family: var(--classic); font-size: 0.92rem; color: var(--cream); line-height: 1.5; }
.st button.desc { text-align: left; }
.st button.desc:hover { color: var(--brass); }

/* --- themes ------------------------------------------------------------ */
.tgrid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(288px, 1fr));
  gap: clamp(14px, 2vw, 22px);
}
.tcard {
  display: flex; flex-direction: column; text-align: left; height: 100%;
  background: var(--ink-raised); border: 1px solid var(--rule);
  border-radius: 3px; padding: 20px 21px;
  transition: border-color 260ms, transform 260ms var(--film), background 260ms;
}
.tcard:hover { border-color: var(--brass-deep); background: var(--ink-card); transform: translateY(-2px); }
.tcard h3 {
  font-family: var(--serif); font-size: 1.1rem; font-weight: 400;
  color: var(--paper); line-height: 1.25; margin-bottom: 9px;
}
.tcard p {
  font-family: var(--classic); font-size: 0.86rem; line-height: 1.6;
  color: var(--cream-soft); flex: 1;
}
.tcard .foot {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-top: 14px; font-family: var(--label); font-weight: 500; font-size: 0.56rem;
  letter-spacing: 0.14em; color: var(--cream-dim);
}
.tcard .foot em { color: var(--brass); font-style: normal; }

/* --- reader overlay ---------------------------------------------------- */
.reader {
  position: fixed; inset: 0; z-index: 90; display: none;
  background: rgba(6,6,7,0.9); backdrop-filter: blur(8px);
}
.reader.open { display: block; animation: fadeIn 300ms var(--film); }
.reader-card {
  position: absolute; inset: 4vh auto 4vh 50%; transform: translateX(-50%);
  width: min(820px, 92vw); overflow-y: auto;
  background: var(--ink-raised); border: 1px solid var(--rule);
  border-radius: 3px; padding: clamp(28px, 4vw, 52px);
}
.reader-card h2 {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(1.5rem, 3vw, 2.15rem); line-height: 1.16;
  color: var(--paper); margin-bottom: 10px;
}
.reader-card .p-body { font-size: 1rem; }
.reader-x {
  position: absolute; top: 14px; right: 18px; width: 32px; height: 32px;
  border-radius: 50%; color: var(--cream-soft); font-size: 1.4rem; line-height: 1;
  background: rgba(11,11,12,0.75);
}
.reader-x:hover { color: var(--brass); }

/* --- about ------------------------------------------------------------- */
.about-body { max-width: 68ch; }
.about-body p {
  font-family: var(--classic); font-size: 1.02rem; line-height: 1.78;
  color: var(--cream); margin-bottom: 1.05em;
}
.about-body p em { color: var(--brass); font-style: italic; }
.bigstats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 22px; margin: 40px 0;
  border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
  padding: 30px 0;
}
.bigstats div { display: flex; flex-direction: column; }
.bigstats dt { font-family: var(--serif); font-size: 2rem; color: var(--brass); line-height: 1; }
.bigstats dd {
  font-family: var(--label); font-weight: 500; font-size: 0.55rem; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--cream-dim); margin-top: 8px;
}
.layertable { width: 100%; border-collapse: collapse; margin: 12px 0 30px; }
.layertable th, .layertable td {
  text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--rule);
  font-size: 0.88rem;
}
.layertable th {
  font-family: var(--mono); font-size: 0.55rem; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--cream-dim); font-weight: 400;
}
.layertable td:first-child { font-family: var(--serif); color: var(--paper); font-size: 1rem; }
.layertable .on { color: var(--brass); }

.foot {
  border-top: 1px solid var(--rule); margin-top: 80px; padding: 30px 0 10px;
  font-family: var(--label); font-weight: 500; font-size: 0.58rem; letter-spacing: 0.14em;
  color: var(--cream-dim); display: flex; justify-content: space-between; gap: 20px;
  flex-wrap: wrap;
}
.foot a { color: var(--cream-soft); }
.foot a:hover { color: var(--brass); }

@media (max-width: 900px) {
  .dcard { grid-template-columns: 1fr; }
  .periods, .districtbar { display: none; }
}

/* =============================================================
   THE COLLECTION — plates, lightbox, museum furniture
   ============================================================= */
.hero-plates { max-width: 900px; }

.segmented {
  display: inline-flex; border: 1px solid var(--rule); border-radius: 2px;
  overflow: hidden; flex-shrink: 0;
}
.segmented button {
  font-family: var(--label); font-weight: 500; font-size: 0.56rem; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--cream-soft);
  padding: 10px 15px; border-right: 1px solid var(--rule);
  transition: color 220ms, background 220ms;
}
.segmented button:last-child { border-right: 0; }
.segmented button:hover { color: var(--cream); background: var(--ink-raised); }
.segmented button[aria-pressed="true"] { color: var(--brass); background: var(--ink-card); }

/* Masonry-ish columns keep every plate at its true proportions. */
.plates {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  grid-auto-rows: 6px;                 /* row spans are computed per plate */
  column-gap: clamp(14px, 1.8vw, 26px);
}

.plate {
  cursor: zoom-in; position: relative;
  align-self: start;
  background: var(--ink-raised); border: 1px solid var(--rule);
  border-radius: 2px; padding: 10px 10px 0;
  transition: border-color 300ms var(--film), transform 300ms var(--film);
}
.plate:hover { border-color: var(--brass-deep); background: var(--ink-card); }
.plate:hover img { filter: brightness(1.06); }
.plate img {
  width: 100%; height: auto; display: block;
  background: #16161a;
  box-shadow: 0 2px 14px rgba(0,0,0,0.45);
}
.plate figcaption {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 10px; padding: 11px 2px 12px;
}
.plate .pt {
  font-family: var(--classic); font-size: 0.82rem; line-height: 1.35;
  color: var(--cream); flex: 1;
}
.plate .py {
  font-family: var(--label); font-weight: 500; font-size: 0.6rem; color: var(--brass);
  flex-shrink: 0;
}

/* --- lightbox ---------------------------------------------------------- */
.lightbox {
  position: fixed; inset: 0; z-index: 95;
  background: rgba(8,8,9,0.96);
  display: grid; place-items: center; padding: clamp(20px, 5vh, 70px);
  animation: fadeIn 260ms var(--film);
}
.lb-fig { display: flex; flex-direction: column; align-items: center; gap: 18px; max-height: 100%; }
.lb-fig img {
  max-width: min(1500px, 92vw); max-height: 78vh; width: auto; height: auto;
  box-shadow: 0 30px 90px rgba(0,0,0,0.7);
  background: #16161a;
}
.lb-fig figcaption {
  font-family: var(--classic); font-size: 0.98rem; color: var(--cream);
  text-align: center; max-width: 70ch;
}
.lb-fig figcaption span {
  font-family: var(--label); font-weight: 500; font-size: 0.68rem; color: var(--brass); margin-left: 10px;
}
.lb-x, .lb-nav {
  position: absolute; color: var(--cream-soft); background: rgba(11,11,12,0.7);
  border: 1px solid var(--rule); border-radius: 50%;
  width: 46px; height: 46px; font-size: 1.5rem; line-height: 1;
  transition: color 200ms, border-color 200ms;
}
.lb-x:hover, .lb-nav:hover { color: var(--brass); border-color: var(--brass-deep); }
.lb-x { top: 22px; right: 26px; }
.lb-nav { top: 50%; transform: translateY(-50%); }
.lb-prev { left: 26px; }
.lb-next { right: 26px; }
@media (max-width: 700px) { .lb-nav { display: none; } }

/* --- district plates --------------------------------------------------- */
.dplate {
  margin: -4px 0 20px; border-radius: 2px; overflow: hidden;
  border: 1px solid var(--rule); background: #16161a;
}
.dplate img { width: 100%; height: 210px; object-fit: cover; display: block; opacity: 0.9; }
.dplate figcaption {
  font-family: var(--label); font-weight: 500; font-size: 0.54rem; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--cream-dim); padding: 9px 11px;
}

/* --- a plate inside the map panel -------------------------------------- */
.p-plate { margin: 16px 0 6px; border: 1px solid var(--rule); border-radius: 2px; overflow: hidden; }
.p-plate img { width: 100%; height: auto; display: block; background: #16161a; }
.p-plate figcaption {
  font-family: var(--label); font-weight: 500; font-size: 0.55rem; letter-spacing: 0.14em;
  color: var(--cream-dim); padding: 8px 10px;
}

/* --- palette switch on the map ----------------------------------------- */
.palettebox {}
.palettebox .pd-head { margin-bottom: 8px; }
.pal-list { display: flex; flex-direction: column; gap: 2px; }
.pal-list button {
  text-align: left; padding: 7px 9px; border-radius: 2px;
  border: 1px solid transparent; font-size: 0.8rem; color: var(--cream-soft);
  transition: background 200ms, border-color 200ms, color 200ms;
}
.pal-list button:hover { background: var(--ink-hover); }
.pal-list button[aria-pressed="true"] {
  background: var(--ink-card); border-color: var(--brass-deep); color: var(--brass);
}
.pal-list small {
  display: block; font-family: var(--label); font-weight: 500; font-size: 0.53rem;
  letter-spacing: 0.12em; color: var(--cream-dim); margin-top: 3px;
}
@media (max-width: 900px) { .palettebox { display: none; } }

/* =============================================================
   THE ENTRANCE
   ============================================================= */
body.page-index .page { padding-top: clamp(46px, 6vw, 84px); }

.entrance {
  position: relative; min-height: 100svh;
  display: grid; align-items: center;
  overflow: hidden; isolation: isolate;
}
.entrance-plate { position: absolute; inset: 0; z-index: -2; pointer-events: none; }
.entrance-plate img {
  width: 100%; height: 100%; object-fit: cover; object-position: center 42%;
  filter: saturate(0.86) contrast(1.02);
  animation: driftIn 2600ms var(--film) both;
}
@keyframes driftIn { from { transform: scale(1.07); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.entrance-scrim {
  position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    linear-gradient(to right, rgba(9,9,10,0.94) 0%, rgba(9,9,10,0.78) 42%, rgba(9,9,10,0.30) 78%, rgba(9,9,10,0.55) 100%),
    linear-gradient(to bottom, rgba(9,9,10,0.86) 0%, rgba(9,9,10,0.10) 30%, rgba(9,9,10,0.20) 60%, rgba(9,9,10,0.92) 100%);
}
.entrance-inner {
  max-width: 1240px; width: 100%;
  margin: 0 auto; padding: 0 clamp(18px, 4vw, 46px);
}
.entrance-inner .eyebrow { animation: rise 900ms 200ms var(--film) both; }
.entrance-inner h1 {
  font-family: var(--serif); font-weight: 300;
  font-size: clamp(2.8rem, 8.2vw, 6.6rem); line-height: 0.98;
  letter-spacing: -0.022em; color: var(--paper);
  animation: rise 1000ms 320ms var(--film) both;
}
.entrance-inner h1 em { font-style: italic; color: var(--brass); }
.entrance-lede {
  font-family: var(--classic); font-size: clamp(1.02rem, 1.5vw, 1.24rem);
  line-height: 1.65; color: var(--cream); max-width: 46ch; margin-top: 26px;
  animation: rise 1000ms 460ms var(--film) both;
}
@keyframes rise { from { opacity: 0; transform: translateY(18px); } }

.entrance-actions {
  display: flex; gap: 12px; flex-wrap: wrap; margin-top: 34px;
  animation: rise 1000ms 600ms var(--film) both;
}
.btn {
  font-family: var(--label); font-weight: 500; font-size: 0.62rem; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--cream);
  padding: 15px 26px; border: 1px solid var(--rule-mid); border-radius: 2px;
  transition: color 260ms, border-color 260ms, background 260ms, transform 260ms var(--film);
}
.btn:hover { border-color: var(--brass); color: var(--brass); transform: translateY(-2px); }
.btn-primary { background: var(--brass); color: #14120E; border-color: var(--brass); }
.btn-primary:hover { background: var(--paper); border-color: var(--paper); color: #14120E; }

.entrance-credit {
  font-family: var(--label); font-weight: 500; font-size: 0.55rem; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--cream-dim); margin-top: 42px;
  animation: rise 1000ms 760ms var(--film) both;
}
.entrance-cue {
  position: absolute; left: 50%; bottom: 26px; transform: translateX(-50%);
  pointer-events: none;
  width: 1px; height: 54px; background: var(--rule-mid); overflow: hidden;
}
.entrance-cue span {
  display: block; width: 100%; height: 40%; background: var(--brass);
  animation: cue 2400ms ease-in-out infinite;
}
@keyframes cue { 0% { transform: translateY(-100%); } 100% { transform: translateY(280%); } }

/* --- premise ---------------------------------------------------------- */
.premise { max-width: 66ch; margin-bottom: 10px; }
.premise-lead {
  font-family: var(--serif); font-weight: 300; font-style: italic;
  font-size: clamp(1.5rem, 3vw, 2.15rem); line-height: 1.28;
  color: var(--paper); margin-bottom: 26px;
}
.premise p {
  font-family: var(--classic); font-size: 1.02rem; line-height: 1.78;
  color: var(--cream); margin-bottom: 1.05em;
}

/* --- featured strip --------------------------------------------------- */
.strip {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr);
  gap: 16px; overflow-x: auto; padding-bottom: 12px;
  scroll-snap-type: x mandatory;
}
.strip::-webkit-scrollbar { height: 6px; }
.strip::-webkit-scrollbar-thumb { background: var(--cream-dim); border-radius: 3px; }
.sp {
  scroll-snap-align: start; display: flex; flex-direction: column;
  background: var(--ink-raised); border: 1px solid var(--rule); border-radius: 2px;
  padding: 9px 9px 0; transition: border-color 300ms, transform 300ms var(--film);
}
.sp:hover { border-color: var(--brass-deep); transform: translateY(-3px); }
.sp img { width: 100%; height: 168px; object-fit: cover; background: #16161a; }
.sp-c { display: flex; justify-content: space-between; gap: 8px; padding: 10px 2px 11px; align-items: baseline; }
.sp-c b { font-family: var(--classic); font-weight: 400; font-size: 0.78rem; color: var(--cream); line-height: 1.35; }
.sp-c i { font-family: var(--label); font-style: normal; font-size: 0.58rem; color: var(--brass); }
.strip-more { margin-top: 14px; }
.strip-more a {
  font-family: var(--label); font-weight: 500; font-size: 0.6rem; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--brass);
  border-bottom: 1px solid var(--brass-deep); padding-bottom: 2px;
}
.strip-more a:hover { color: var(--paper); }

/* --- district preview -------------------------------------------------- */
.dpreview {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}
.dp {
  display: flex; flex-direction: column;
  background: var(--ink-raised); border: 1px solid var(--rule);
  border-radius: 2px; overflow: hidden;
  transition: border-color 300ms, transform 300ms var(--film);
}
.dp:hover { border-color: var(--brass-deep); transform: translateY(-3px); }
.dp img, .dp-blank { width: 100%; height: 132px; object-fit: cover; background: #191A1E; display: block; }
.dp-t {
  font-family: var(--serif); font-size: 1.02rem; color: var(--paper);
  padding: 13px 14px 3px; line-height: 1.24;
}
.dp-n {
  font-family: var(--label); font-weight: 500; font-size: 0.55rem; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--cream-dim); padding: 0 14px 14px;
}

/* On a phone the hero text sits directly over the busiest part of an 1850
   lithograph. At 45% the scrim was nowhere near enough and the lede
   disappeared into the engraving. */
@media (max-width: 820px) {
  .entrance-plate img {
    object-position: center 38%;
    filter: saturate(0.62) brightness(0.5) contrast(1.04);
  }
  .entrance-scrim {
    background:
      linear-gradient(to bottom,
        rgba(9,9,10,0.94) 0%,
        rgba(9,9,10,0.80) 34%,
        rgba(9,9,10,0.86) 64%,
        rgba(9,9,10,0.97) 100%);
  }
  .entrance { min-height: auto; padding: clamp(56px,14vh,110px) 0 clamp(48px,10vh,90px); }
  .entrance-inner h1 { font-size: clamp(2.5rem, 13vw, 3.6rem); }
  .entrance-sub { font-size: 1.06rem; }
  .entrance-lede { font-size: 1rem; max-width: none; }
  .entrance-actions { gap: 10px; }
  .entrance-actions .btn { flex: 1 1 100%; text-align: center; padding: 15px 18px; }
  .entrance-credit { margin-top: 30px; }
  .entrance-cue { display: none; }
}

/* =============================================================
   ACCESSIBILITY + REMAINING FURNITURE
   ============================================================= */
.skip {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--brass); color: #14120E; padding: 12px 20px;
  font-family: var(--label); font-weight: 500; font-size: 0.62rem; letter-spacing: 0.18em;
  text-transform: uppercase;
}
.skip:focus { left: 8px; top: 8px; }

:focus-visible {
  outline: 2px solid var(--brass); outline-offset: 3px; border-radius: 2px;
}
.stage:focus-visible { outline-offset: -3px; }

/* --- the four periods, on the entrance --------------------------------- */
.periods-home {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px;
}
.ph {
  display: flex; flex-direction: column; gap: 7px;
  padding: 22px 20px 20px;
  background: var(--ink-raised); border: 1px solid var(--rule); border-radius: 2px;
  transition: border-color 300ms, transform 300ms var(--film), background 300ms;
}
.ph:hover { border-color: var(--brass-deep); background: var(--ink-card); transform: translateY(-3px); }
.ph-y { font-family: var(--serif); font-size: 1.85rem; font-weight: 300; color: var(--paper); line-height: 1; }
.ph-s {
  font-family: var(--label); font-weight: 500; font-size: 0.55rem; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--cream-dim);
}

/* =============================================================
   THE MAP ON A SMALL SCREEN
   The side panels are desktop furniture; on a phone they become a
   single sheet that slides up, so every control is still reachable.
   ============================================================= */
.mobile-bar { display: none; }

@media (max-width: 900px) {
  :root { --bar: 104px; }
  .topbar { flex-wrap: wrap; align-content: center; padding-top: 9px; gap: 7px; }
  .brand { width: 100%; }
  .nav-links { order: 3; width: 100%; overflow-x: auto; padding-bottom: 2px; }
  .nav-links::-webkit-scrollbar { display: none; }
  .searchwrap { max-width: none; margin: 0; order: 2; }

  .periods, .districtbar, .palettebox, .legend { display: none; }

  .mobile-bar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 44;
    background: rgba(11,11,12,0.96); backdrop-filter: blur(14px);
    border-top: 1px solid var(--rule);
  }
  .mobile-bar button {
    flex: 1; padding: 13px 6px 15px;
    font-family: var(--label); font-weight: 500; font-size: 0.54rem; letter-spacing: 0.14em;
    text-transform: uppercase; color: var(--cream-soft);
    border-right: 1px solid var(--rule);
  }
  .mobile-bar button:last-child { border-right: 0; }
  .mobile-bar button[aria-pressed="true"] { color: var(--brass); background: var(--ink-card); }

  .sheet {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 43;
    max-height: 62vh; overflow-y: auto;
    background: rgba(11,11,12,0.98); backdrop-filter: blur(16px);
    border-top: 1px solid var(--rule-mid);
    transform: translateY(101%); transition: transform 420ms var(--film);
    padding: 18px 18px calc(64px + 18px);
  }
  .sheet.open { transform: translateY(0); }
  .sheet h3 {
    font-family: var(--label); font-weight: 500; font-size: 0.56rem; letter-spacing: 0.22em;
    text-transform: uppercase; color: var(--cream-dim); margin-bottom: 12px;
  }
  .sheet .pd-list, .sheet .pal-list, .sheet .db-list { display: flex; flex-direction: column; gap: 3px; }
  .sheet .legend-list { list-style: none; }

  .timeline { bottom: 62px; width: calc(100vw - 20px); padding: 9px 13px 7px; }
  .zoomctl { bottom: 128px; right: 12px; }
  .hint { display: none; }
  .panel { top: var(--bar); width: 100%; }
  .stage { inset: var(--bar) 0 0 0; }
}

@media (prefers-reduced-motion: reduce) {
  .entrance-plate img, .entrance-inner .eyebrow, .entrance-inner h1,
  .entrance-lede, .entrance-actions, .entrance-credit { animation: none !important; }
  .entrance-cue { display: none; }
}

/* --- topic chips on Themes --------------------------------------------- */
.topicbar { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 22px; }
.topicbar button {
  display: inline-flex; align-items: baseline; gap: 8px;
  padding: 9px 14px; border: 1px solid var(--rule); border-radius: 2px;
  font-size: 0.79rem; color: var(--cream-soft);
  transition: color 220ms, border-color 220ms, background 220ms;
}
.topicbar button span {
  font-family: var(--label); font-weight: 500; font-size: 0.55rem; color: var(--cream-dim);
}
.topicbar button:hover { color: var(--cream); border-color: var(--rule-mid); }
.topicbar button[aria-pressed="true"] {
  color: var(--brass); border-color: var(--brass-deep); background: var(--ink-card);
}
.topicbar button[aria-pressed="true"] span { color: var(--brass-deep); }

/* =============================================================
   MAP INTERACTION FURNITURE
   ============================================================= */
.tl-play {
  font-family: var(--label); font-weight: 600; font-size: 0.56rem;
  letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink);
  background: var(--brass); padding: 6px 14px; border-radius: 2px;
  transition: background 220ms, color 220ms;
}
.tl-play:hover { background: var(--paper); }
.tl-play[aria-pressed="true"] { background: var(--cream-dim); color: var(--paper); }
.tl-n {
  font-family: var(--label); font-weight: 500; font-size: 0.6rem;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--cream-dim); margin-left: 12px;
}

.street-chip {
  position: absolute; left: 50%; top: 18px; transform: translateX(-50%);
  z-index: 28; display: flex; align-items: center; gap: 11px;
  background: rgba(11,11,12,0.95); backdrop-filter: blur(12px);
  border: 1px solid var(--brass-deep); border-radius: 2px;
  padding: 9px 10px 9px 16px;
  animation: rise 320ms var(--film) both;
}
.street-chip span { font-family: var(--serif); font-size: 1.02rem; color: var(--paper); }
.street-chip b {
  font-family: var(--label); font-weight: 500; font-size: 0.58rem;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--brass);
}
.street-chip button {
  width: 24px; height: 24px; border-radius: 50%; color: var(--cream-soft);
  font-size: 1.1rem; line-height: 1;
}
.street-chip button:hover { color: var(--brass); background: var(--ink-hover); }

/* richer hover card */
.tooltip { padding: 0; overflow: hidden; max-width: 268px; }
.tooltip .tt-img {
  width: 100%; height: 116px; object-fit: cover; display: block;
  background: #16161a; border-bottom: 1px solid var(--rule);
}
.tooltip .tt-t { display: block; padding: 9px 12px 0; }
.tooltip .tt-years, .tooltip .tt-addr, .tooltip .tt-more { padding: 0 12px; }
.tooltip .tt-addr {
  display: block; font-family: var(--label); font-weight: 500; font-size: 0.6rem;
  letter-spacing: 0.12em; color: var(--cream-soft); margin-top: 3px;
}
.tooltip .tt-more { padding-bottom: 10px; }
.tooltip .tt-years { margin-top: 3px; }
.nb-y { font-family: var(--label); font-size: 0.58rem; color: var(--brass); float: right; }

.pal-note {
  margin-top: 10px; font-family: var(--classic); font-size: 0.74rem;
  line-height: 1.5; color: var(--cream-soft);
  border-left: 2px solid var(--brass-deep); padding-left: 10px;
}

/* --- Streets: A–Z index + progressive disclosure ------------------------ */
.alpha { display: flex; flex-wrap: wrap; gap: 3px; margin-bottom: 20px; }
.alpha a {
  min-width: 30px; text-align: center; padding: 7px 6px; border-radius: 2px;
  font-family: var(--label); font-weight: 500; font-size: 0.68rem;
  letter-spacing: 0.1em; color: var(--cream-soft);
  border: 1px solid var(--rule); transition: color 200ms, border-color 200ms, background 200ms;
}
.alpha a:hover { color: var(--brass); border-color: var(--brass-deep); background: var(--ink-raised); }
.st-more {
  margin-top: 8px; font-family: var(--label); font-weight: 500; font-size: 0.58rem;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--brass);
  border-bottom: 1px solid var(--brass-deep); padding-bottom: 2px;
}
.st-more:hover { color: var(--paper); border-color: var(--paper); }
.p-loading {
  font-family: var(--classic); font-size: 0.86rem; color: var(--cream-soft);
  font-style: italic; display: flex; align-items: center; gap: 10px;
}
.p-loading::before {
  content: ''; width: 11px; height: 11px; flex-shrink: 0; border-radius: 50%;
  border: 1.5px solid var(--brass-deep); border-top-color: transparent;
  animation: spin 800ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .p-loading::before { animation: none; } }
.ghost-toggle {
  display: flex; align-items: flex-start; gap: 10px; width: 100%;
  margin-top: 10px; padding: 8px 9px; border-radius: 2px;
  border: 1px solid transparent; text-align: left;
  font-size: 0.8rem; color: var(--cream-soft);
  transition: background 200ms, border-color 200ms, color 200ms;
}
.ghost-toggle:hover { background: var(--ink-hover); }
.ghost-toggle[aria-pressed="true"] {
  background: var(--ink-card); border-color: var(--brass-deep); color: var(--brass);
}
.gt-box {
  width: 13px; height: 13px; margin-top: 3px; flex-shrink: 0;
  border: 1px solid var(--rule-mid); border-radius: 2px;
}
.ghost-toggle[aria-pressed="true"] .gt-box { background: var(--brass); border-color: var(--brass); }
.ghost-toggle small {
  display: block; font-family: var(--label); font-weight: 500; font-size: 0.53rem;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--cream-dim); margin-top: 3px;
}
.preloader.failed .pre-bar { display: none; }
.preloader.failed .pre-meta { letter-spacing: 0.08em; text-transform: none; line-height: 1.7; }
.preloader.failed .pre-meta a { color: var(--brass); border-bottom: 1px solid var(--brass-deep); }

/* --- sound toggle ------------------------------------------------------- */
.sound-btn {
  flex-shrink: 0; width: 38px; height: 38px; border-radius: 2px;
  display: grid; place-items: center; color: var(--cream-dim);
  border: 1px solid var(--rule);
  transition: color 220ms, border-color 220ms, background 220ms;
}
.sound-btn:hover { color: var(--cream); background: var(--ink-raised); }
.sound-btn svg { width: 18px; height: 18px; }
.sound-btn .wv1, .sound-btn .wv2 { opacity: 0; transition: opacity 260ms; }
.sound-btn[aria-pressed="true"] { color: var(--brass); border-color: var(--brass-deep); }
.sound-btn[aria-pressed="true"] .wv1 { opacity: 1; }
.sound-btn[aria-pressed="true"] .wv2 { opacity: 0.65; }
@media (max-width: 900px) { .sound-btn { width: 34px; height: 34px; } }


/* =============================================================
   MAP SIDEBAR
   Every control used to live inside <main class="stage">, which meant the
   map's own pointer and wheel handlers fought them: capture killed clicks,
   and wheeling to reach the legend zoomed the map instead of scrolling.
   They now sit beside the map, not on top of it.
   ============================================================= */
:root { --sbw: 274px; }

.sidebar {
  position: fixed; left: 0; top: var(--bar); bottom: 0; width: var(--sbw);
  z-index: 38; background: rgba(13,13,15,0.97);
  border-right: 1px solid var(--rule);
  backdrop-filter: blur(14px);
  transition: transform 420ms var(--film);
}
.sidebar-scroll {
  height: 100%; overflow-y: auto; overscroll-behavior: contain;
  padding: 4px 0 26px;
  scrollbar-width: thin; scrollbar-color: var(--cream-dim) transparent;
}
.sidebar-scroll::-webkit-scrollbar { width: 7px; }
.sidebar-scroll::-webkit-scrollbar-thumb { background: var(--cream-dim); border-radius: 4px; }

/* sections flow as one column instead of four floating cards */
.sidebar .periods, .sidebar .palettebox,
.sidebar .legend, .sidebar .districtbar {
  position: static; width: auto; background: none; border: 0;
  backdrop-filter: none; border-radius: 0;
  padding: 15px clamp(13px, 1.3vw, 18px);
  border-bottom: 1px solid var(--rule);
}
.sidebar .districtbar { border-bottom: 0; }
.sidebar .pd-head, .sidebar .db-head, .sidebar .legend-head h2 {
  font-family: var(--label); font-weight: 600; font-size: 0.56rem;
  letter-spacing: 0.24em; text-transform: uppercase;
  color: var(--cream-dim); margin-bottom: 11px;
}
.sidebar .legend h2 { font-family: var(--label); font-size: 0.56rem; }
.sidebar .legend-list { max-height: none; }

.body-has-sidebar .stage { left: var(--sbw); }
.stage { transition: left 420ms var(--film); }

.sidebar-toggle {
  position: fixed; top: calc(var(--bar) + 14px); left: calc(var(--sbw) - 13px);
  z-index: 39; width: 26px; height: 46px; border-radius: 0 3px 3px 0;
  background: rgba(13,13,15,0.97); border: 1px solid var(--rule); border-left: 0;
  display: grid; place-items: center;
  transition: left 420ms var(--film), color 220ms, border-color 220ms;
  color: var(--cream-dim);
}
.sidebar-toggle:hover { color: var(--brass); border-color: var(--brass-deep); }
.sidebar-toggle span {
  width: 7px; height: 7px; border-left: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor; transform: rotate(45deg);
  transition: transform 420ms var(--film);
}
body.sidebar-closed { --sbw: 0px; }
body.sidebar-closed .sidebar { transform: translateX(-100%); }
body.sidebar-closed .sidebar-toggle { left: 0; }
body.sidebar-closed .sidebar-toggle span { transform: rotate(-135deg); }

/* the timeline belongs over the map, not over the sidebar */
.timeline { left: calc(var(--sbw) + (100vw - var(--sbw)) / 2); }

@media (max-width: 900px) {
  .sidebar, .sidebar-toggle { display: none; }
  .body-has-sidebar .stage { left: 0; }
  .timeline { left: 50%; }
}


/* Denser sidebar: at 768px the four sections overflowed by ~690px, so the
   legend sat below the fold. Tightening the rows roughly halves that. */
.sidebar .pd-list button { padding: 5px 8px; }
.sidebar .pd-name { font-size: 0.88rem; }
.sidebar .pd-note { font-size: 0.62rem; line-height: 1.45; margin-top: 7px; }
.sidebar .pal-list button { padding: 5px 8px; font-size: 0.76rem; }
.sidebar .pal-list small { font-size: 0.5rem; margin-top: 2px; }
.sidebar .ghost-toggle { margin-top: 7px; padding: 6px 8px; font-size: 0.76rem; }
.sidebar .legend-list button { padding: 4px 6px; }
.sidebar .lg-name { font-size: 0.75rem; }
.sidebar .db-list button { padding: 4px 6px; font-size: 0.74rem; }
.sidebar .legend-note { display: none; }

/* =============================================================
   DEDICATION
   Quiet by design: one photograph, one column, no furniture.
   ============================================================= */
.ded {
  max-width: 760px; margin: 0 auto;
  padding-top: clamp(10px, 3vw, 40px); text-align: center;
}
.ded-name {
  font-family: var(--serif); font-weight: 300;
  font-size: clamp(2.2rem, 5.6vw, 3.9rem); line-height: 1.04;
  letter-spacing: -0.015em; color: var(--paper); margin-top: 14px;
}
.ded-dates {
  font-family: var(--label); font-weight: 500; font-size: 0.66rem;
  letter-spacing: 0.28em; text-transform: uppercase;
  color: var(--brass); margin-top: 18px;
}
.ded-plate {
  margin: clamp(36px, 6vw, 62px) 0 clamp(30px, 4vw, 48px);
  border: 1px solid var(--rule); border-radius: 2px;
  background: #14141a; padding: 12px 12px 0;
}
.ded-plate img {
  width: 100%; height: auto; display: block;
  box-shadow: 0 18px 48px rgba(0,0,0,0.55);
}
.ded-plate figcaption {
  font-family: var(--label); font-weight: 500; font-size: 0.55rem;
  letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--cream-dim); padding: 13px 2px 14px;
}
.ded-body { text-align: left; max-width: 62ch; margin: 0 auto; }
.ded-body p {
  font-family: var(--classic); font-size: 1.03rem; line-height: 1.82;
  color: var(--cream); margin-bottom: 1.1em;
}
.ded-lead {
  font-family: var(--serif) !important; font-weight: 300; font-style: italic;
  font-size: clamp(1.28rem, 2.4vw, 1.66rem) !important;
  line-height: 1.42 !important; color: var(--paper) !important;
  margin-bottom: 1.3em !important;
}
.ded-verse {
  font-family: var(--serif) !important; font-style: italic;
  font-size: 1.16rem !important; color: var(--brass) !important;
  text-align: center; margin: 2.2em 0 0 !important;
  padding-top: 1.6em; border-top: 1px solid var(--rule);
}
.ded-links {
  display: flex; gap: 12px; justify-content: center; flex-wrap: wrap;
  margin-top: clamp(36px, 5vw, 58px);
}
.premise-credit { margin-top: -0.4em; }
.premise-credit a {
  font-family: var(--label); font-weight: 500; font-size: 0.6rem;
  letter-spacing: 0.2em; text-transform: uppercase; color: var(--brass);
  border-bottom: 1px solid var(--brass-deep); padding-bottom: 2px;
}
.premise-credit a:hover { color: var(--paper); border-color: var(--paper); }
.entrance-sub {
  font-family: var(--serif); font-style: italic; font-weight: 300;
  font-size: clamp(1.05rem, 2.1vw, 1.5rem); color: var(--cream);
  margin-top: 16px; opacity: 0.92;
  animation: rise 1000ms 400ms var(--film) both;
}
.entrance-lede a { color: var(--brass); border-bottom: 1px solid var(--brass-deep); }
.entrance-lede a:hover { color: var(--paper); border-color: var(--paper); }


/* =============================================================
   SMALL SCREENS — legibility pass
   ============================================================= */
@media (max-width: 820px) {
  .wrap { padding: 0 18px; }
  .page { padding-bottom: 80px; }

  /* reading text must not go below 16px or iOS zooms on focus */
  .about-body p, .ded-body p, .premise p, .hero .lede { font-size: 1.02rem; }
  .p-body, .reader-card .p-body { font-size: 1rem; line-height: 1.75; }

  .hero h1, .ded-name { font-size: clamp(2.1rem, 10.5vw, 3rem); }
  .ded-body { max-width: none; }
  .ded-lead { font-size: 1.3rem !important; }
  .ded-links .btn { flex: 1 1 100%; text-align: center; }

  /* the nav scrolls horizontally; say so with a fade at the edge */
  .topbar { position: relative; }
  .nav-links {
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    mask-image: linear-gradient(to right, #000 84%, transparent 100%);
  }
  .nav-links::after { content: ''; flex: 0 0 12px; }

  .dcard { padding: 20px 18px; }
  .dmeta { gap: 18px; }
  .dmeta dt { font-size: 1.3rem; }
  .plates { grid-template-columns: 1fr; }
  .strip { grid-auto-columns: minmax(200px, 78%); }
  .bigstats { gap: 16px; padding: 24px 0; }
  .bigstats dt { font-size: 1.6rem; }
  .reader-card { inset: 2vh auto 2vh 50%; padding: 24px 20px; }
  .lb-fig img { max-height: 68vh; }
}

/* =============================================================
   TRAVELLING — the map while the years are running
   ============================================================= */
body.travelling .stage::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 5;
  box-shadow: inset 0 0 clamp(60px, 12vw, 190px) rgba(0,0,0,0.55);
  animation: breathe 3.4s ease-in-out infinite;
}
@keyframes breathe { 0%,100% { opacity: 0.75; } 50% { opacity: 1; } }
body.travelling .tl-value { color: var(--brass); }
body.travelling .timeline { border-color: var(--brass-deep); }
@media (prefers-reduced-motion: reduce) {
  body.travelling .stage::after { animation: none; }
}

/* the sound control was an unlabelled icon, so nobody found it */
.sound-btn {
  width: auto; padding: 0 12px; gap: 8px;
  grid-auto-flow: column; align-items: center;
}
.sb-label {
  font-family: var(--label); font-weight: 600; font-size: 0.55rem;
  letter-spacing: 0.2em; text-transform: uppercase;
}
.sound-btn[aria-pressed="true"] .sb-label { color: var(--brass); }
@media (max-width: 700px) { .sb-label { display: none; } .sound-btn { width: 34px; padding: 0; } }
