@font-face { font-family:'Poppins'; font-style:normal; font-weight:400; font-display:swap; src:url(/fonts/poppins-400.woff2) format('woff2'); }
@font-face { font-family:'Poppins'; font-style:normal; font-weight:600; font-display:swap; src:url(/fonts/poppins-600.woff2) format('woff2'); }
@font-face { font-family:'Poppins'; font-style:normal; font-weight:700; font-display:swap; src:url(/fonts/poppins-700.woff2) format('woff2'); }
@font-face { font-family:'Poppins'; font-style:normal; font-weight:800; font-display:swap; src:url(/fonts/poppins-800.woff2) format('woff2'); }
@font-face { font-family:'JetBrains Mono'; font-style:normal; font-weight:400; font-display:swap; src:url(/fonts/jetbrains-mono.woff2) format('woff2'); }

:root {
  --bg: #FFF8F0;
  --panel: #FFFFFF;
  --ink: #1A0E00;
  --ink2: #5C4A32;
  --ink3: #8B7355;
  --line: rgba(26, 14, 0, 0.08);
  --orange: #E8872A;
  --font: 'Poppins', sans-serif;
  --font-data: var(--font);
  --bar-h: 48px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
}
a { color: var(--orange); text-decoration: none; }
a:hover { color: var(--ink); }
button:focus-visible, a:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
}

#scene {
  position: fixed;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

#year-tip {
  position: fixed;
  left: 16px;
  top: calc(var(--bar-h) + 16px);
  z-index: 4;
  pointer-events: none;
  background: var(--ink);
  color: var(--bg);
  padding: 6px 10px;
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  font-size: 16px;
  font-weight: 800;
}

#year-drag {
  position: fixed;
  left: 16px;
  right: 352px;
  bottom: 16px;
  z-index: 4;
  max-width: 560px;
  padding: 14px 16px 12px;
  background: var(--panel);
  border: 1px solid var(--line);
}
#year-drag[hidden] { display: none; }
#year-drag-readout { margin: 0 0 6px; }
#year-drag-year {
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 800;
  letter-spacing: -1.5px;
  line-height: 0.95;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
#year-drag-input {
  display: block;
  width: 100%;
  margin: 0;
  height: 28px;
  accent-color: var(--orange);
  cursor: grab;
}
#year-drag-input:active { cursor: grabbing; }
.year-drag-scale {
  display: flex;
  justify-content: space-between;
  margin-top: 2px;
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ink3);
}

#panel {
  position: fixed;
  top: calc(var(--bar-h) + 16px);
  right: 16px;
  z-index: 3;
  width: 320px;
  max-height: calc(100vh - var(--bar-h) - 32px);
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 20px 18px 22px;
}

.mast h1 {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1.15;
}
.count {
  margin: 0 0 12px;
  color: var(--ink3);
  font-size: 11px;
}
.count #building-count {
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  font-size: 18px;
  font-weight: 800;
  color: var(--orange);
  letter-spacing: -0.5px;
  margin-right: 4px;
}
.lang {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
}
.lang button {
  width: 40px;
  height: 28px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.5px;
  border: 1px solid rgba(26, 14, 0, 0.12);
  background: transparent;
  color: var(--ink2);
  padding: 0;
  cursor: pointer;
}
.lang button:hover { border-color: var(--orange); color: var(--orange); }
.lang button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

h2 {
  margin: 16px 0 8px;
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--ink3);
}

#story-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.story-btn {
  font: inherit;
  text-align: left;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
  cursor: pointer;
  color: var(--ink);
  font-weight: 600;
}
.story-btn:hover { color: var(--orange); }
#story-photo {
  display: block;
  width: 100%;
  height: auto;
  margin: 8px 0;
}
#story-title { margin: 0 0 6px; font-size: 16px; font-weight: 800; letter-spacing: -0.5px; }
#story-body, #story-credit { margin: 0 0 8px; color: var(--ink2); }
#story-credit { font-size: 12px; font-family: inherit; color: var(--ink3); }

#legend {
  list-style: none;
  margin: 0;
  padding: 0;
}
#legend li {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0;
  font-size: 13px;
}
#legend li::before {
  content: '';
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}
.age-unknown::before { background: #9AA3AD; }
.age-pre1850::before { background: #6B2D1A; }
.age-1850::before { background: #C45C26; }
.age-1919::before { background: #D4A017; }
.age-1946::before { background: #2F6F6A; }
.age-1971::before { background: #4F7C4A; }
.age-1991::before { background: #3D6B99; }
.age-2011::before { background: #E8D5A3; }
.mass-low::before { background: #F3E2C8; }
.mass-midlow::before { background: #E8C48A; }
.mass-mid::before { background: #E8872A; }
.mass-high::before { background: #C45C26; }
.mass-tall::before { background: #6B2D1A; }

.about p { margin: 0 0 8px; color: var(--ink2); font-size: 13px; }
.site-footer {
  display: flex;
  gap: 14px;
  margin-top: 18px;
  font-size: 11px;
}
.site-footer a { color: var(--ink3); font-weight: 600; }
.site-footer a:hover { color: var(--orange); }

body.hub {
  max-width: none;
  height: auto;
  min-height: 100%;
  margin: 0;
  padding: 0;
  background: var(--bg);
}
nav.top {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px max(32px, calc((100% - 760px) / 2 + 32px));
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
  font-size: 13px;
  font-weight: 600;
}
nav.top a {
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}
nav.top a:hover { color: var(--orange); }
nav.top a.active { color: var(--orange); }
nav.top .brand {
  font-weight: 800;
  letter-spacing: 5px;
  text-transform: uppercase;
  font-size: 11px;
  color: var(--ink3);
}
nav.top .brand:hover { color: var(--orange); }
nav.top .has-sub {
  position: relative;
  padding-bottom: 12px;
  margin-bottom: -12px;
}
nav.top .sub {
  position: absolute;
  left: 0;
  top: 100%;
  min-width: 180px;
  padding: 6px 0;
  background: var(--bg);
  border: 1px solid var(--line);
  opacity: 0;
  pointer-events: none;
  z-index: 8;
}
nav.top .has-sub:hover .sub,
nav.top .has-sub:focus-within .sub { opacity: 1; pointer-events: auto; }
nav.top .sub a { display: block; padding: 8px 14px; }
nav.top .lang {
  margin-left: auto;
  margin-bottom: 0;
}
/* The 3D pages carry the same bar, fixed above the canvas and the panel. */
body.viewer nav.top {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  height: var(--bar-h);
  padding: 0 16px;
  background: var(--bg);
  flex-wrap: nowrap;
}
body.hub main {
  max-width: 760px;
  margin: 0 auto;
  padding: 60px 32px;
}
body.hub main h1 {
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1.1;
  margin: 0 0 8px;
}
body.hub .subtitle {
  color: var(--ink3);
  font-size: 0.82rem;
  margin: 0 0 32px;
  letter-spacing: 0.3px;
}
body.hub > footer {
  border-top: 1px solid var(--line);
  padding: 24px max(32px, calc((100% - 760px) / 2 + 32px));
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  font-size: 12px;
  color: var(--ink2);
  align-items: center;
  margin-top: 80px;
}
body.hub > footer a {
  color: var(--ink2);
  text-decoration: none;
  white-space: nowrap;
  font-weight: 400;
}
body.hub > footer a:hover { color: var(--orange); }
body.hub > footer .brand {
  font-weight: 800;
  letter-spacing: 5px;
  text-transform: uppercase;
  font-size: 10px;
  color: var(--ink2);
}
body.hub > footer .links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  align-items: center;
}
body.hub > footer .copy { margin-left: auto; }
.city-card {
  display: block;
  margin-top: 0;
  padding: 28px 0;
  border: 0;
  border-top: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
}
.city-card:last-child { border-bottom: 1px solid var(--line); }
.city-card h2 {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.2px;
  text-transform: none;
  color: var(--ink);
}
.city-card p { margin: 0; color: var(--ink2); font-size: 15px; }
.city-card:hover h2 { color: var(--orange); }
/* The hub's groups: 3D cities, then more experiments (a demo and the road-quality page). */
.lab-list + .lab-list { margin-top: 48px; }
.lab-group {
  margin: 0 0 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--ink3);
}
.lab-tag {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border: 1px solid var(--line);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--ink3);
  vertical-align: 2px;
}

@media (max-width: 700px) {
  /* One line on every lab page down to 320px: LOCALINAR + Karten + Lab + DE/EN. */
  nav.top {
    gap: 12px;
    padding-left: 16px;
    padding-right: 16px;
  }
  nav.top .brand { letter-spacing: 3px; }
  body.viewer nav.top {
    gap: 12px;
    padding: 0 12px;
  }
  body.viewer nav.top .brand { letter-spacing: 3px; }
  #panel {
    top: var(--bar-h);
    right: 0;
    left: 0;
    width: auto;
    max-height: calc(45vh - var(--bar-h));
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
  }
  #year-drag {
    left: 12px;
    right: 12px;
    bottom: calc(45vh + 10px);
    max-width: none;
    padding: 10px 12px 8px;
  }
  #year-drag-year { font-size: 28px; }
}
