/* =====================================================================
   KHARITATI · main stylesheet
   - All colors are tokens on :root. Text colors meet WCAG 2.1 contrast
     (4.5:1 for normal text) on the backgrounds they are used on.
   - Logical properties (margin-inline, inset-inline, border-inline) are
     used throughout so the Arabic interface mirrors with dir="rtl".
   - Breakpoints: 900px (panels stack) and 600px (phone layout).
   ===================================================================== */

:root {
  /* surfaces */
  --parchment: #f5efdc;
  --panel: #fdf8e8;
  --cream: #ebe3cc;
  --map-land: #e9e0c5;
  --dark: #1c1a12;
  --dark-2: #24221a;
  --dark-line: #3a3626;
  /* text */
  --ink: #3f3a22;          /* 9.9:1 on parchment */
  --ink-2: #5f5838;        /* 6.2:1 on parchment */
  --ochre-text: #76612f;   /* 5.2:1 on parchment: links, Arabic secondary names */
  --on-dark: #f5efdc;
  --on-dark-2: #c9bf9f;    /* 10:1 on --dark */
  --on-dark-3: #a39a7c;    /* 6.5:1 on --dark */
  /* lines */
  --stone: #d6c89a;
  --stone-light: #e0d8b8;
  --ochre: #a6936c;        /* decorative only, never text */
  /* status and evidence */
  --evidence: #b3261e;      /* 5.7:1 on parchment; white text on it 6.2:1 */
  --evidence-text-dark: #a82218;
  --evidence-on-dark: #ff8a7a; /* 8:1 on --dark */
  --destroyed: #a63d26;
  --damaged: #8a5a1c;
  --street: #2f7fa6;
  /* category accents on dark backgrounds */
  --cat-now: #8fc0d4;
  --cat-voices: #b5cc8a;
  --cat-before: #e0b56e;
  /* flag stripe */
  --moss: #4a6238;
  --olive: #6e7c4d;
  /* type */
  --serif: "Cormorant Garamond", Georgia, serif;
  --serif-ar: "Amiri", "Cormorant Garamond", serif;
  --sans: "IBM Plex Sans", system-ui, sans-serif;
  --sans-ar: "IBM Plex Sans Arabic", "IBM Plex Sans", system-ui, sans-serif;
  --radius: 8px;
  --header-h: 64px;
}

*, *::before, *::after { box-sizing: border-box; }
/* The hidden attribute always wins over component display rules (place.js relies on it). */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--parchment); color: var(--ink); font-family: var(--sans); font-size: 14px; line-height: 1.5; }
html[lang="ar"] body { font-family: var(--sans-ar); }
a { color: var(--ochre-text); }
a:hover { color: var(--ink); }
button { font: inherit; color: inherit; }
img, video { max-width: 100%; display: block; }
:focus-visible { outline: 2px solid var(--street); outline-offset: 2px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.serif { font-family: var(--serif); }
html[lang="ar"] .serif { font-family: var(--serif-ar); }
.ar { font-family: var(--serif-ar); }

/* ---------- top stripe, header ---------- */
.flag-stripe { display: flex; height: 4px; }
.flag-stripe span { flex: 1; }
.flag-stripe span:nth-child(1) { background: var(--moss); }
.flag-stripe span:nth-child(2) { background: var(--ochre); }
.flag-stripe span:nth-child(3) { background: var(--olive); }

.dev-banner { background: var(--cream); color: var(--ink-2); font-size: 12.5px; padding: 6px 28px; border-bottom: 1px solid var(--stone); }

.site-header { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 28px; padding: 12px 28px; background: var(--panel); border-bottom: 1px solid var(--stone); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand img { width: 34px; height: 34px; }
.brand-en { font-family: var(--serif); font-size: 26px; font-weight: 600; }
.brand-ar { font-family: var(--serif-ar); font-size: 22px; color: var(--ochre-text); }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); margin: 0; padding: 0; list-style: none; }
.crumbs li + li::before { content: "›"; margin-inline-end: 6px; }
html[dir="rtl"] .crumbs li + li::before { content: "‹"; }
.crumbs [aria-current="page"] { color: var(--ink); font-weight: 500; }
.main-nav { margin-inline-start: auto; display: flex; align-items: center; gap: 4px; }
.main-nav a { display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 16px; border-radius: 999px; text-decoration: none; color: var(--ink); font-size: 14px; }
.main-nav a[aria-current="page"] { background: var(--ink); color: var(--panel); }
.main-nav .record-dot { width: 9px; height: 9px; border-radius: 2px; background: var(--evidence); }
.lang-link { margin-inline-start: 12px; font-size: 16px; text-decoration: none; padding: 6px 4px; }
html[lang="en"] .lang-link { font-family: var(--serif-ar); font-size: 18px; }

/* ---------- layout shells ---------- */
.split { display: flex; flex-wrap: wrap; min-height: calc(100vh - var(--header-h)); }
.split > .side { flex: 1 1 300px; max-width: 360px; min-width: 270px; background: var(--panel); }
.split > .side--wide { max-width: 440px; }
.split > .side--start { border-inline-end: 1px solid var(--stone); }
.split > .side--end { border-inline-start: 1px solid var(--stone); }
.split > .stage { flex: 999 1 520px; min-width: 0; position: relative; }

/* ---------- map ---------- */
.map-wrap { position: relative; height: calc(100vh - var(--header-h) - 40px); min-height: 520px; background: var(--map-land); }
/* .map-wrap > .map outranks MapLibre's own .maplibregl-map { position: relative } */
.map-wrap > .map { position: absolute; inset: 0; width: 100%; height: 100%; }
.map-note { margin: 0; padding: 10px 24px; font-size: 12.5px; color: var(--ink-2); background: var(--panel); border-top: 1px solid var(--stone); }
.map-attrib { position: absolute; inset-inline-end: 8px; bottom: 6px; z-index: 3; background: rgba(253,248,232,0.92); color: var(--ink); font-size: 11px; padding: 2px 8px; border-radius: 4px; }
.maplibregl-ctrl-attrib { display: none; } /* attribution is shown in .map-attrib, updated per view */

.map-controls { position: absolute; top: 10px; inset-inline-end: 10px; z-index: 4; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.view-switch { display: flex; background: var(--panel); border: 1px solid var(--ochre); border-radius: var(--radius); overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.18); }
.view-switch button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; width: 78px; white-space: nowrap; height: 54px; border: 0; background: transparent; cursor: pointer; font-size: 11.5px; color: var(--ink); }
.view-switch button[aria-pressed="true"] { background: var(--ink); color: var(--panel); }
.view-switch svg { width: 18px; height: 18px; }
.names-switch { display: flex; align-items: center; background: var(--panel); border: 1px solid var(--ochre); border-radius: 999px; overflow: hidden; font-size: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.18); }
.names-switch > span { padding: 0 6px 0 12px; color: var(--ink-2); }
.names-switch button { height: 36px; padding: 0 12px; border: 0; border-radius: 999px; background: transparent; cursor: pointer; font-size: 12px; }
.names-switch button[aria-pressed="true"] { background: var(--ink); color: var(--panel); }
.map-toast { position: absolute; left: 50%; bottom: 40px; transform: translateX(-50%); z-index: 4; background: var(--street); color: #fff; font-size: 12.5px; padding: 6px 12px; border-radius: 6px; }

/* street-level viewer (placeholder for the Panoramax viewer) */
.street-viewer { position: absolute; inset-inline-end: 12px; bottom: 34px; z-index: 5; width: min(52%, 560px); min-width: 300px; background: var(--dark); color: var(--on-dark); border-radius: var(--radius); overflow: hidden; box-shadow: 0 6px 24px rgba(0,0,0,0.4); }
.street-viewer[hidden] { display: none; }
.street-pano { position: relative; aspect-ratio: 16 / 9; background-size: auto 100%; background-repeat: repeat-x; cursor: grab; touch-action: pan-y; }
.street-pano .badge { position: absolute; top: 8px; inset-inline-start: 8px; }
.street-viewer .close { position: absolute; top: 4px; inset-inline-end: 4px; }
.street-meta { padding: 10px 12px; font-size: 12px; color: var(--on-dark-2); display: flex; flex-wrap: wrap; gap: 4px 12px; }

/* ---------- side panels ---------- */
.panel-section { padding: 22px 24px; border-bottom: 1px solid var(--stone-light); }
.h-display { font-family: var(--serif); font-weight: 600; line-height: 1.12; margin: 0; }
html[lang="ar"] .h-display { font-family: var(--serif-ar); font-weight: 700; }
.h-kicker { font-size: 11px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-2); margin: 0 0 10px; }
html[lang="ar"] .h-kicker { letter-spacing: 0; font-size: 12.5px; }
.lead { font-family: var(--serif); font-size: 18px; line-height: 1.6; }
html[lang="ar"] .lead { font-family: var(--serif-ar); font-size: 19px; }
.legend { display: flex; flex-direction: column; gap: 10px; font-size: 12.5px; color: var(--ink-2); }
.legend span { display: flex; align-items: center; gap: 10px; }
.legend .ring { width: 14px; height: 14px; border-radius: 50%; background: var(--ink); box-shadow: 0 0 0 3px var(--panel), 0 0 0 6px var(--evidence); margin: 4px; }
.legend .dash { width: 22px; border-top: 2px dashed #8a8056; }

.row-list { list-style: none; margin: 0; padding: 0; }
.row-list a, .row-list .row { display: flex; align-items: center; gap: 14px; min-height: 60px; padding: 12px 24px; border-bottom: 1px solid var(--stone-light); text-decoration: none; color: var(--ink); }
.row-list a:hover { background: var(--cream); }
.row-list .row { opacity: 0.75; }
.row-title { font-family: var(--serif); font-size: 19px; font-weight: 600; line-height: 1.2; }
html[lang="ar"] .row-title { font-family: var(--serif-ar); font-weight: 700; }
.row-sub { font-size: 12.5px; color: var(--ink-2); }
.row-meta { margin-inline-start: auto; font-size: 12px; text-align: end; }
.row-meta--evidence { color: var(--evidence-text-dark); font-weight: 600; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: #a39a7c; flex-shrink: 0; }
.dot--live { width: 14px; height: 14px; background: var(--ink); box-shadow: 0 0 0 3px var(--panel), 0 0 0 6px var(--evidence); margin: 3px; }
.dot--building { background: var(--ochre-text); }
/* Place Condition, matching the pin colours in map/style.json. Unknown stays neutral. */
.dot--unknown { background: #a39a7c; }
.dot--intact { background: var(--moss); }
.dot--damaged { background: var(--damaged); }
.dot--partly_destroyed { background: #c06a4a; }
.dot--destroyed { background: var(--destroyed); }

.evidence-card { margin: 18px; background: var(--evidence); color: #fff; border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.evidence-card .h-kicker { color: #fff; }
.evidence-card .big { font-family: var(--serif); font-size: 26px; font-weight: 600; line-height: 1.15; }
.evidence-card p { margin: 0; font-size: 12.5px; color: #fbe3dc; }
.evidence-card button { align-self: flex-start; height: 40px; padding: 0 14px; border-radius: 6px; border: 1px solid #fff; background: transparent; color: #fff; cursor: pointer; font-size: 13px; }
.evidence-card button[aria-pressed="true"] { background: #fff; color: var(--evidence); font-weight: 600; }
.evidence-card a { color: #fff; font-size: 13px; }

.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; border-radius: 999px; padding: 4px 10px; background: var(--panel); }
html[lang="ar"] .pill { letter-spacing: 0; font-size: 12.5px; }
.pill--destroyed, .pill--partly_destroyed { color: var(--destroyed); }
.pill--damaged { color: var(--damaged); }
.pill--evidence { color: #fff; background: var(--evidence); }
.pill--unverified { color: var(--ink-2); border: 1px dashed var(--ink-2); }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- place page: media first ---------- */
.place { background: var(--dark); color: var(--on-dark); }
.place .side { color: var(--ink); }
.place-back { display: flex; align-items: center; gap: 8px; padding: 0 22px; min-height: 48px; font-size: 13px; color: var(--ink-2); border-bottom: 1px solid var(--stone-light); text-decoration: none; }
.place-head-sm { display: none; flex-direction: column; align-items: flex-start; gap: 4px; }
.place-head-sm a { color: var(--on-dark-2); font-size: 13px; min-height: 40px; display: flex; align-items: center; }
.media-stage { padding: 22px 26px 96px; display: flex; flex-direction: column; gap: 14px; }
.place-intro { border: 0; }
.place-intro .pills { margin-bottom: 10px; }
.place-intro h1 { font-size: 30px; }
.place-intro .place-other-name { margin-top: 4px; font-size: 20px; }
.place-intro .place-facts { margin-top: 18px; }
.place-media-count { margin: 18px 0 0; padding-top: 12px; border-top: 1px solid var(--stone-light); font-size: 13px; font-weight: 700; }
.place-head-sm .h-display { font-size: 26px; }
.media-all { margin-top: 6px; max-width: 880px; }
.media-title > div { flex: 1 1 360px; min-width: 0; }

.hero { position: relative; width: 100%; max-width: 880px; aspect-ratio: 16 / 9; border-radius: 6px; overflow: hidden; background: #0f0e09; touch-action: pan-y; scroll-margin-top: 12px; }
.hero.is-photo { aspect-ratio: 16 / 9; }
.media-panel { position: absolute; inset: 0; }
.media-panel[hidden] { display: none; }
.media-frame { position: absolute; inset: 0; background: #0f0e09; }
.media-frame > img, .media-frame > video { width: 100%; height: 100%; object-fit: contain; }
.media-frame.is-docked { position: fixed; inset: auto; inset-inline-end: 12px; bottom: 64px; width: 220px; height: auto; aspect-ratio: 16 / 9; z-index: 50; border-radius: var(--radius); overflow: hidden; box-shadow: 0 8px 24px rgba(0,0,0,0.45); }
.dock-bar { display: none; }
.media-frame.is-docked .dock-bar { display: flex; position: absolute; top: 4px; inset-inline-end: 4px; gap: 4px; z-index: 2; }
.dock-bar button { width: 32px; height: 32px; border-radius: 50%; border: 0; background: rgba(0,0,0,0.6); color: #fff; cursor: pointer; }

/* gated graphic media: blurred, never hidden */
.media-panel.is-gated .media-frame > img, .media-panel.is-gated .media-frame > video, .media-panel.is-gated .compare { filter: blur(18px); transform: scale(1.08); pointer-events: none; }
.gate { display: none; position: absolute; inset: 0; z-index: 2; flex-direction: column; align-items: center; justify-content: center; gap: 12px; text-align: center; padding: 24px; background: rgba(28,26,18,0.35); }
.media-panel.is-gated .gate { display: flex; }
.gate .label { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 16px; background: var(--evidence); color: #fff; padding: 6px 14px; border-radius: 999px; }
.gate p { max-width: 440px; margin: 0; font-size: 14px; text-shadow: 0 1px 3px rgba(0,0,0,0.8); }
.gate button { height: 44px; padding: 0 20px; border-radius: 6px; border: 2px solid #fff; background: rgba(28,26,18,0.6); color: #fff; cursor: pointer; font-size: 14px; font-weight: 500; }

.badge { position: absolute; z-index: 1; font-size: 12px; background: rgba(0,0,0,0.6); color: #fff; padding: 4px 10px; border-radius: 4px; }
.badge--identity { top: 12px; inset-inline-start: 12px; }

/* satellite before/after */
.compare { position: absolute; inset: 0; --split: 50%; }
.compare img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.compare .after { clip-path: inset(0 0 0 var(--split)); }
.compare .divider { position: absolute; top: 0; bottom: 0; left: var(--split); width: 2px; background: #fff; transform: translateX(-1px); }
.compare .tag { position: absolute; top: 12px; background: rgba(0,0,0,0.6); color: #fff; font-size: 12px; padding: 3px 8px; border-radius: 4px; }
.compare .tag--before { left: 12px; } .compare .tag--after { right: 12px; }
.compare-range { width: 100%; max-width: 880px; height: 28px; accent-color: var(--on-dark); }

/* provenance strip: on the media's bottom edge on large screens */
.source-strip { position: absolute; left: 0; right: 0; bottom: 0; z-index: 1; background: rgba(15,14,9,0.86); padding: 10px 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; font-size: 12.5px; }
.source-below { display: none; background: var(--dark-2); border-radius: 6px; padding: 10px 12px; font-size: 12.5px; line-height: 1.6; max-width: 880px; }
.cat { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.cat::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.cat--evidence, .cat--loss { color: var(--evidence-on-dark); }
.cat--now { color: var(--cat-now); }
.cat--voices { color: var(--cat-voices); }
.cat--before { color: var(--cat-before); }
.muted { color: var(--on-dark-2); }
.record-no { margin-inline-start: auto; color: var(--on-dark-2); font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; white-space: nowrap; }

.media-title { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px 24px; max-width: 880px; }
.media-title h2 { font-family: var(--serif); font-size: 28px; font-weight: 600; line-height: 1.2; margin: 0; }
html[lang="ar"] .media-title h2 { font-family: var(--serif-ar); font-weight: 700; }
.media-title p { margin: 4px 0 0; font-size: 13.5px; color: var(--on-dark-2); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.btn { display: inline-flex; align-items: center; height: 44px; padding: 0 16px; border-radius: 6px; border: 1px solid #5a5440; background: transparent; color: var(--on-dark); cursor: pointer; font-size: 13.5px; text-decoration: none; }
.btn--evidence { background: var(--evidence); border-color: var(--evidence); color: #fff; font-weight: 500; }
.btn--light { background: var(--on-dark); border-color: var(--on-dark); color: var(--dark); font-weight: 600; }

/* thumbnail strip right under the media (tablets and phones) */
.strip-wrap { display: none; flex-direction: column; gap: 8px; max-width: 880px; }
.strip-row { display: flex; align-items: center; gap: 8px; }
.round { flex-shrink: 0; width: 40px; height: 40px; border-radius: 50%; border: 1px solid #5a5440; background: transparent; color: var(--on-dark); cursor: pointer; font-size: 16px; }
.strip { flex: 1; min-width: 0; display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; }
.strip a { flex-shrink: 0; width: 76px; scroll-snap-align: start; }
.strip-hint { font-size: 12px; color: var(--on-dark-3); }

.thumb { position: relative; display: block; width: 100%; aspect-ratio: 4 / 3; border-radius: 4px; overflow: hidden; background: #0f0e09; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb.is-graphic img { filter: blur(6px); transform: scale(1.1); }
.thumb.is-evidence { outline: 2px solid var(--evidence); }
[aria-current="true"] > .thumb, .thumb[aria-current="true"] { outline: 3px solid var(--on-dark); outline-offset: 2px; }
.thumb .play { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 30px; height: 30px; border-radius: 50%; background: rgba(15,14,9,0.7); display: flex; align-items: center; justify-content: center; }
.thumb .g { position: absolute; top: 5px; inset-inline-start: 5px; background: var(--evidence); color: #fff; font-size: 10.5px; font-weight: 600; padding: 1px 6px; border-radius: 3px; }

.media-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.media-grid a { display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: var(--on-dark); }
.media-grid .t { font-size: 12.5px; line-height: 1.35; color: #e8dfc8; }
.media-grid .cat { font-size: 11.5px; }
.grid-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.grid-head h3 { margin: 0; font-size: 11px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--on-dark-2); }
.grid-head span { font-size: 12px; color: var(--on-dark-3); }

/* ---------- place sheet (a Place with no Media items) and prose pages ---------- */
.place-sheet, .prose { max-width: 720px; margin: 0 auto; padding: 32px 24px 72px; }
.place-sheet .place-back { padding: 0; margin-bottom: 18px; border: 0; }
.place-sheet .pills { margin-bottom: 12px; }
.place-sheet h1 { font-size: 40px; }
.place-other-name, .prose-other-name { margin: 6px 0 0; font-size: 22px; color: var(--ochre-text); }
.place-facts { display: grid; grid-template-columns: max-content 1fr; gap: 10px 24px; margin: 28px 0 0; padding-top: 18px; border-top: 1px solid var(--stone); }
.place-facts dt, .prose h2 { font-size: 11px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-2); }
html[lang="ar"] .place-facts dt, html[lang="ar"] .prose h2 { letter-spacing: 0; font-size: 12.5px; }
.place-facts dt { padding-top: 3px; }
.place-facts dd { margin: 0; font-size: 16px; }
.prose h1 { font-size: 44px; }
.prose .lead { margin: 24px 0 8px; }
.prose h2 { margin: 36px 0 10px; padding-top: 18px; border-top: 1px solid var(--stone); }
.prose p { font-size: 16px; line-height: 1.7; margin: 0 0 14px; }
.prose code { background: var(--cream); padding: 2px 6px; border-radius: 3px; font-size: 14px; }
.prose-sign { margin-top: 32px !important; font-style: italic; color: var(--ink-2); }
.prose-sign .ar { color: var(--ochre-text); font-style: normal; }
@media (max-width: 600px) {
  .place-sheet h1 { font-size: 32px; }
  .prose h1 { font-size: 34px; }
}

/* ---------- the record ---------- */
.record-hero { background: var(--dark); color: var(--on-dark); padding: 48px 28px 52px; }
.wrap { max-width: 1180px; margin: 0 auto; }
.record-hero .cols { display: flex; flex-wrap: wrap; gap: 48px; align-items: flex-start; }
.record-hero .cols > div { flex: 1 1 440px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.record-title { font-family: var(--serif); font-size: 54px; font-weight: 600; line-height: 1.05; margin: 0; }
.record-kicker { font-size: 11px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--evidence-on-dark); }
.tiles { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 6px; list-style: none; margin: 0; padding: 0; }
.tiles li { aspect-ratio: 1 / 1; }
.tiles a, .tiles span { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; border-radius: 3px; }
.tile--destroyed, .tile--partly_destroyed { background: #d2412f; }
.tile--damaged { background: #c8821a; }
.tile--awaiting { border: 1px dashed #5a5440; }
.totals { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 2px solid var(--ink); }
.totals > div { padding: 18px; border-inline-end: 1px solid var(--stone); }
.totals > div:last-child { border: 0; }
.totals b { display: block; font-family: var(--serif); font-size: 40px; font-weight: 600; line-height: 1; }
.chart { display: flex; align-items: flex-end; gap: 6px; height: 160px; border-bottom: 1px solid var(--ink); }
.chart span { flex: 1; background: var(--evidence-text-dark); opacity: 0.85; border-radius: 2px 2px 0 0; }

/* ---------- city page above 900px: fixed viewport, only the place list scrolls ---------- */
/* Replaces the .split and .map-wrap viewport heights above, which assume a 64px header. */
@media (min-width: 901px) {
  .city { display: flex; flex-direction: column; height: 100vh; height: 100dvh; min-height: 560px; }
  .city > * { flex: none; }
  .city > main { flex: 1 1 0; min-height: 0; display: flex; }
  .city .split { flex: 1; min-height: 0; flex-wrap: nowrap; }
  /* The panel itself scrolls only when a short window leaves the list at its floor. */
  .city .split > .side { display: flex; flex-direction: column; overflow-y: auto; }
  .city .split > .side > * { flex: none; }
  .city .split > .side > .row-list { flex: 1 1 0; min-height: 160px; overflow-y: auto; }
  .city .split > .stage { display: flex; flex-direction: column; }
  .city .map-wrap { flex: 1; height: auto; min-height: 320px; }
}

/* ---------- 900px and below: panels stack, media first ---------- */
@media (max-width: 900px) {
  .split > .side { max-width: none; flex-basis: 100%; border-inline: 0; }
  .split > .stage { order: 1; }
  .split > .side { order: 2; }
  .map-wrap { height: 70vh; min-height: 420px; }
  .place-head-sm { display: flex; }
  .place .place-back, .place .side .place-name { display: none; }
  .strip-wrap { display: flex; }
}

/* ---------- 600px and below: phones ---------- */
@media (max-width: 600px) {
  .site-header { padding: 10px 14px; gap: 8px 16px; }
  .dev-banner { padding: 6px 14px; }
  .view-switch button { width: 62px; height: 50px; font-size: 10.5px; }
  .names-switch button { height: 40px; }
  .map-controls { inset-inline-end: 8px; top: 8px; }
  .street-viewer { position: fixed; inset-inline: 8px; bottom: 8px; width: auto; min-width: 0; z-index: 70; }
  .media-stage { padding: 14px 14px 96px; }
  .hero.is-photo { aspect-ratio: 4 / 3; }
  .source-strip { display: none; }
  .source-below { display: block; }
  .gate p { display: none; }
  .gate { gap: 10px; padding: 12px; }
  .badge--identity { font-size: 11px; top: 8px; inset-inline-start: 8px; inset-inline-end: 8px; }
  .media-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .record-hero { padding: 28px 16px 32px; }
  .record-title { font-size: 36px; }
  .totals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .totals > div { padding: 14px 10px; border: 0; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
