@font-face { font-family: "Fraunces"; src: url("fonts/fraunces-latin-wght-normal.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Fraunces"; src: url("fonts/fraunces-latin-wght-italic.woff2") format("woff2"); font-weight: 100 900; font-style: italic; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("fonts/jetbrains-mono-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }

:root {
  --ink: #05060B;
  --paper: #EAE7DE;
  --paper-dim: rgba(234, 231, 222, 0.6);
  --hair: rgba(234, 231, 222, 0.16);
  --accent: #8BE8D2;
  --panel: rgba(10, 12, 19, 0.86);
  --horizon: #14152B;
  --serif: "Fraunces", Georgia, serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}
* { box-sizing: border-box; border-radius: 0; }
html, body { margin: 0; height: 100%; overflow: hidden; color: var(--paper); font-family: var(--serif); }
/* The sky: ink above, deep indigo at the horizon; the canvas is transparent. */
body { background: linear-gradient(to bottom, var(--ink) 0%, #090A14 45%, var(--horizon) 100%); }
#scene { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; touch-action: none; }

.masthead { position: fixed; top: 16px; left: 16px; pointer-events: none; }
/* A soft ink veil behind the title, so it reads over a busy city (a gradient, no shadow). */
.masthead::before { content: ""; position: fixed; z-index: -1; top: 0; left: 0; right: 0; height: 190px; pointer-events: none;
  background: linear-gradient(to bottom, rgba(5, 6, 11, 0.88), rgba(5, 6, 11, 0.5) 50%, rgba(5, 6, 11, 0)); }
.masthead h1 { margin: 0; font-weight: 300; font-size: clamp(28px, 4vw, 44px); letter-spacing: -0.01em; }
.dek { margin: 4px 0 0; font-style: italic; font-weight: 300; color: var(--paper-dim); }
.eyebrow { margin: 0 0 10px; font: 400 10px/1 var(--mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--paper-dim); }

.places { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.place { position: absolute; left: 0; top: 0; white-space: nowrap; color: var(--paper-dim); }
.place[hidden] { display: none; }
.place-district { font: 400 12px var(--mono); letter-spacing: 0.24em; text-transform: uppercase; color: var(--paper); opacity: 0.8; }
.place-locality { font: 400 10px var(--mono); letter-spacing: 0.16em; text-transform: uppercase; }
.place-street { font: italic 300 12px var(--serif); opacity: 0.85; }

.legend { position: fixed; top: 16px; right: 16px; width: 280px; padding: 14px; background: var(--panel); border: 1px solid var(--hair); }
.legend ul { list-style: none; margin: 0; padding: 0; }
.legend button { display: grid; grid-template-columns: 12px 1fr auto; gap: 10px; align-items: center; width: 100%; padding: 5px 0; background: none; border: 0; color: var(--paper); font: 400 11px var(--mono); text-align: left; cursor: pointer; }
.legend button.off { opacity: 0.35; }
.legend .sw { width: 12px; height: 12px; }
.legend .pc { color: var(--paper-dim); }
.legend .note { margin: 10px 0 0; font: 400 10px var(--mono); color: var(--paper-dim); }

.label { position: fixed; z-index: 5; display: grid; gap: 2px; max-width: 260px; padding: 8px 10px; pointer-events: none; background: var(--panel); border: 1px solid var(--hair); }
.label .lp { font: 400 10px var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--paper-dim); }
.label .ly { font-size: 20px; font-style: italic; color: var(--accent); }
.label .ls { font: 400 10px var(--mono); color: var(--paper-dim); }

.tools { position: fixed; right: 16px; bottom: 112px; display: flex; gap: 8px; }
.tool, .play { padding: 8px 12px; background: var(--panel); border: 1px solid var(--hair); color: var(--paper); font: 400 10px var(--mono); letter-spacing: 0.12em; text-transform: uppercase; cursor: pointer; }
.tool[aria-pressed="true"] { border-color: var(--paper); }
.tool-periods { display: none; }
.credit { position: fixed; left: 16px; bottom: 112px; margin: 0; font: 400 9px var(--mono); color: var(--paper-dim); pointer-events: none; }

.timeline { position: fixed; left: 16px; right: 16px; bottom: 16px; display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: end; padding: 10px 12px; background: var(--panel); border: 1px solid var(--hair); }
.play { background: none; }
.track canvas { display: block; width: 100%; height: 56px; touch-action: none; cursor: ew-resize; }
.tally { display: grid; text-align: right; }
.tally-year { font-size: 26px; font-weight: 300; font-style: italic; color: var(--accent); }
.tally-count { font: 400 10px var(--mono); color: var(--paper-dim); }

.loading { position: fixed; left: 16px; bottom: 130px; margin: 0; color: var(--paper-dim); font: 400 10px var(--mono); letter-spacing: 0.14em; text-transform: uppercase; pointer-events: none; }
.loading[hidden], .label[hidden] { display: none; }
button:focus-visible { outline: 1px solid var(--paper); outline-offset: 2px; }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Search: one box under the title, results below it. */
.search { position: relative; margin-top: 14px; width: 300px; pointer-events: auto; }
.search input { width: 100%; padding: 9px 10px; background: var(--panel); border: 1px solid var(--hair); color: var(--paper); font: 400 12px var(--mono); }
.search input::placeholder { color: var(--paper-dim); }
.search input:focus { outline: 1px solid var(--paper); outline-offset: 0; }
.results { position: absolute; left: 0; right: 0; top: 100%; margin: 0; padding: 0; list-style: none; background: var(--panel); border: 1px solid var(--hair); border-top: 0; max-height: 50vh; overflow: auto; }
.results li { display: grid; gap: 2px; padding: 8px 10px; cursor: pointer; border-left: 2px solid transparent; }
.results li[aria-selected="true"] { border-left-color: var(--accent); background: rgba(234, 231, 222, 0.05); }
.sr-label { font-size: 15px; }
.sr-kind, .sr-note, .sr-none { font: 400 10px var(--mono); color: var(--paper-dim); }
.sr-note { color: var(--accent); }

/* The hover label's leader line. */
.leader { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 4; }
.leader line { stroke: var(--paper-dim); stroke-width: 1; }
.leader circle { fill: var(--paper); }

/* Colour modes, at the top of the legend. */
.legend .modes { display: flex; margin: 0 0 12px; }
.legend .modes button { display: block; flex: 1; padding: 6px 0; border: 1px solid var(--hair); text-align: center; font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--paper-dim); }
.legend .modes button + button { border-left: 0; }
.legend .modes button[aria-pressed="true"] { border-color: var(--paper); color: var(--paper); }

/* The side panel: a building's record. */
.panel { position: fixed; z-index: 6; top: 16px; right: 16px; bottom: 156px; width: 360px; overflow: auto; padding: 18px; background: #0A0C13; border: 1px solid var(--hair); }
body.panel-open .legend { display: none; }
.panel[hidden] { display: none; }
.panel-close { float: right; padding: 4px 8px; background: none; border: 1px solid var(--hair); color: var(--paper-dim); font: 400 10px var(--mono); letter-spacing: 0.12em; text-transform: uppercase; cursor: pointer; }
.panel-title { margin: 0 70px 4px 0; font-weight: 300; font-size: 26px; line-height: 1.15; }
.panel-sub { margin: 0 0 14px; font: 400 11px var(--mono); color: var(--paper-dim); }
.panel-date { margin: 16px 0; padding: 14px 0; border-top: 1px solid var(--hair); border-bottom: 1px solid var(--hair); }
.panel-year { margin: 0 0 6px; font-size: 28px; font-style: italic; font-weight: 300; color: var(--accent); }
.panel-how { margin: 0; font-size: 14px; line-height: 1.45; color: var(--paper-dim); }
.panel-facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0 0 16px; }
.panel-facts dt { font: 400 10px/1.8 var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--paper-dim); }
.panel-facts dd { margin: 0; font-size: 15px; }
.panel-wiki figure { margin: 0 0 12px; }
.panel-wiki img { display: block; width: 100%; height: auto; }
.panel-wiki figcaption, .panel-credit { margin: 4px 0 0; font: 400 9px var(--mono); color: var(--paper-dim); }
.panel-wiki figcaption a { color: inherit; }
.panel-intro { margin: 0; font-size: 15px; line-height: 1.5; }
.panel-links { display: flex; gap: 14px; margin: 14px 0 0; }
.panel-links a { font: 400 10px var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); }

/* Phones: the periods are a bottom sheet behind a button. */
@media (max-width: 700px) {
  .search { width: calc(100vw - 32px); margin-top: 10px; }
  .panel { top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 60vh; border-left: 0; border-right: 0; border-bottom: 0; }
  .dek { display: none; }
  .legend { display: none; top: auto; bottom: 156px; left: 16px; right: 16px; width: auto; max-height: 50vh; overflow: auto; }
  .legend.open { display: block; }
  .tool-periods { display: block; }
  .tools { left: 16px; right: 16px; bottom: 112px; }
  .tools .tool-periods { margin-right: auto; }
  .credit { bottom: 146px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
.legend li.sheds { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--hair); }

/* 1989: the sectors and the Wall on the ground, named under the legend's classes. */
.legend .ground { list-style: none; margin: 8px 0 0; padding: 8px 0 0; border-top: 1px solid var(--hair); }
.legend .ground li { display: grid; grid-template-columns: 12px 1fr auto; gap: 10px; align-items: center; padding: 4px 0; font: 400 11px var(--mono); color: var(--paper-dim); }
.legend .sw.tint { opacity: 0.45; }
.legend .sw.line { height: 1px; background: var(--paper); }
.legend .sw.line.dim { opacity: 0.4; }
.legend .sw.band { height: 6px; background: rgba(234, 231, 222, 0.25); }

/* The story: its button under the search; while it plays, its caption takes the place of the tools. */
.story { display: block; margin-top: 10px; pointer-events: auto; }
.tour { position: fixed; z-index: 7; left: 16px; bottom: 112px; width: 440px; padding: 16px 18px; background: var(--panel); border: 1px solid var(--hair); }
.tour[hidden] { display: none; }
.tour-title { margin: 0 70px 8px 0; font-weight: 300; font-size: 24px; line-height: 1.15; }
.tour-caption { margin: 0; font-size: 16px; line-height: 1.5; }
.tour-note { margin: 8px 0 0; font: 400 10px/1.5 var(--mono); color: var(--accent); }
.tour-note:empty { display: none; }
.tour-sources { margin: 10px 0 0; font: 400 9px/1.5 var(--mono); color: var(--paper-dim); }
.tour-sources a { color: inherit; }
.tour .tour-skip { position: absolute; top: 12px; right: 12px; }
.fade { position: fixed; inset: 0; z-index: 0; background: var(--ink); opacity: 0; pointer-events: none; }
body.touring .search, body.touring .story, body.touring .legend, body.touring .tools, body.touring .panel,
body.touring .label, body.touring .leader, body.touring .credit { display: none; }
body.touring .play { visibility: hidden; }
@media (max-width: 700px) {
  .story { position: fixed; top: 16px; right: 16px; margin: 0; }
  .tour { left: 0; right: 0; bottom: 104px; width: auto; border-left: 0; border-right: 0; padding: 14px 16px; }
  .tour-title { font-size: 20px; }
  .tour-caption { font-size: 15px; }
}

/* The About page: a plain reading page in the map's look. */
body.page { height: auto; overflow: auto; background: var(--ink); }
.about { max-width: 720px; margin: 0 auto; padding: 48px 16px 80px; line-height: 1.6; }
.about h1 { margin: 0 0 18px; font-weight: 300; font-size: clamp(32px, 6vw, 48px); }
.about h2 { margin: 40px 0 10px; padding-top: 16px; border-top: 1px solid var(--hair); font-weight: 300; font-size: 24px; }
.about .lead { font-size: 19px; }
.about p, .about li { font-size: 16px; }
.about a { color: var(--accent); }
.about .eyebrow a { color: var(--paper-dim); }
.about [data-n] { font-variant-numeric: tabular-nums; }
.about .figures { width: 100%; margin: 12px 0 16px; border-collapse: collapse; font: 400 12px var(--mono); }
.about .figures th, .about .figures td { padding: 6px 8px 6px 0; text-align: left; border-bottom: 1px solid var(--hair); }
.about .figures th { font-weight: 400; color: var(--paper-dim); text-transform: uppercase; letter-spacing: 0.1em; font-size: 10px; }
.about .figures td + td, .about .figures th + th { text-align: right; }
.about .sources li { margin-bottom: 8px; }
.about b { font-weight: 500; }

/* Failures: an area that did not load; a browser without WebGL. */
.notice { position: fixed; left: 16px; bottom: 112px; z-index: 5; display: flex; gap: 10px; align-items: center; margin: 0; padding: 8px 10px; background: var(--panel); border: 1px solid var(--hair); font: 400 11px var(--mono); }
.notice[hidden], .nowebgl[hidden] { display: none; }
.nowebgl { position: fixed; inset: 0; z-index: 8; overflow: auto; padding: 96px 16px 32px; background: var(--ink); }
.nowebgl img { display: block; width: 100%; max-width: 720px; height: auto; margin: 0 auto 20px; border: 1px solid var(--hair); }
.nowebgl div { max-width: 640px; margin: 0 auto; }
.nowebgl h2 { margin: 0 0 8px; font-weight: 300; font-size: 26px; }
.nowebgl p { line-height: 1.55; }
.nowebgl a { color: var(--accent); }
body.no-webgl .search, body.no-webgl .story, body.no-webgl .tools, body.no-webgl .timeline, body.no-webgl .legend { display: none; }
body.no-webgl .masthead { z-index: 9; }
a.tool { text-decoration: none; }
#scene:focus-visible, #hist:focus-visible, .panel:focus-visible { outline: 1px solid var(--paper); outline-offset: -2px; }
.panel:focus { outline: none; }
.panel-more { position: sticky; bottom: -18px; margin: 0 -18px -18px; padding: 24px 18px 8px; background: linear-gradient(to bottom, rgba(10, 12, 19, 0), #0A0C13 60%); font: 400 10px var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--paper-dim); text-align: center; pointer-events: none; }
.panel-more[hidden] { display: none; }
