/* ==========================================================================
   BiUH Campus Map — shared styles
   One stylesheet for four pages. No frameworks, no build step.
   ========================================================================== */

:root {
  --ink: #14201c;
  --paper: #fbfaf7;
  --paper-2: #f3f0e8;
  --dim: #5f6b63;
  --line: #dcd8d0;
  --teal: #0f766e;
  --teal-dark: #0b4f49;
  --orange: #c2410c;
  /* the open category row: a pale cream, warmer than plain paper */
  --band: #e9e6de;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 32, 28, 0.05), 0 10px 30px rgba(20, 32, 28, 0.06);

  /* surfaces and text that change with the theme */
  --surface: #fff;
  --pill: #fff;
  --body-ink: #2c332f;
  --header-bg: rgba(251, 250, 247, 0.93);
  --hover-shadow: rgba(20, 32, 28, 0.35);
  --marker: rgba(244, 178, 84, 0.55);
  /* teal behind white text: the same in both themes, so the contrast holds */
  --accent: #0f766e;
  --accent-top: #13887f;
  --accent-strong: #0b4f49;
  --footer-bg: #14201c;
  color-scheme: light;
}

/* Dark theme. map.js-free pages set data-theme from the stored choice or the
   system setting before the stylesheet paints (see the script in <head>). */
[data-theme="dark"] {
  --ink: #e4ebe7;
  --paper: #0e1513;
  --paper-2: #18221f;
  --dim: #9eaca5;
  --line: #2b3934;
  --teal: #4fd1c1;
  --teal-dark: #8fe3d8;
  --orange: #f08a4b;
  --band: #201d18;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 30px rgba(0, 0, 0, 0.28);

  --surface: #141e1b;
  --pill: #24312d;
  --body-ink: #cdd7d2;
  --header-bg: rgba(14, 21, 19, 0.88);
  --hover-shadow: rgba(0, 0, 0, 0.65);
  --marker: rgba(214, 140, 40, 0.42);
  --footer-bg: #080d0c;
  color-scheme: dark;
}

/* Category colours — inherited by map shapes, chips, dots and card borders. */
[data-category="academic"]     { --cat: #cfe3f2; --cat-line: #4a7c9b; --cat-ink: #2f5d78; }
[data-category="student-life"] { --cat: #f7e0c4; --cat-line: #b45309; --cat-ink: #8a3e07; }
[data-category="residence"]    { --cat: #ece0b8; --cat-line: #8a6d1f; --cat-ink: #6b5416; }
[data-category="sports"]       { --cat: #d8e9c8; --cat-line: #4d7c2f; --cat-ink: #3a5f22; }
[data-category="landmark"]     { --cat: #a9d6e5; --cat-line: #2b7a99; --cat-ink: #1d5b73; }

*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  /* Latin first, then a Chinese face for each platform. Only 400/600/700 are
     used: Segoe UI has no 650/750, and Windows rounds 750 up to Black. */
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui,
        "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei",
        "Noto Sans SC", "Noto Sans CJK SC", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
}

/* Chinese reads better with a little more leading and no tight tracking.
   Letter-spacing made for Latin capitals only spreads Chinese apart. */
[data-lang="zh"] body { line-height: 1.75; }
[data-lang="zh"] :is(h1, h2, h3, .brand) { letter-spacing: 0; }
[data-lang="zh"] h1 { line-height: 1.18; }
[data-lang="zh"] :is(.kicker, .search label, .inside-label, .chip, .panel-meta strong) {
  letter-spacing: 0.04em;
}
[data-lang="zh"] .kicker { font-size: 0.86rem; }
[data-lang="zh"] .inside-label { font-size: 0.84rem; }

/* no lonely last word (or "续吧。") on a line of its own; ignored by older browsers */
p, li, figcaption { text-wrap: pretty; }
h1, h2, h3 { text-wrap: balance; }

img, svg { max-width: 100%; }

a { color: var(--teal); text-underline-offset: 0.18em; }
a:hover { color: var(--teal-dark); }

code {
  padding: 0.08em 0.32em;
  border-radius: 4px;
  background: var(--paper-2);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
}

:focus-visible {
  outline: 3px solid var(--orange);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -70px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  transition: top 0.15s ease;
}
.skip-link:focus { top: 12px; color: #fff; }

.wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}
.wrap-wide { max-width: 1440px; }

/* ---------------------------------------------------------------- header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--header-bg);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}

.header-inner {
  /* Keep navigation aligned across pages, independent of content width. */
  max-width: 1440px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-top: 13px;
  padding-bottom: 13px;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  font-weight: 700;
  letter-spacing: -0.015em;
  text-decoration: none;
}
.brand:hover { color: var(--ink); }
.brand svg { width: 26px; height: 26px; color: var(--teal); flex: none; }

.site-nav { display: flex; gap: 3px; flex-wrap: wrap; margin-left: auto; }
.site-nav a {
  padding: 8px 13px;
  border-radius: 999px;
  color: var(--dim);
  font-size: 0.94rem;
  font-weight: 600;
  text-decoration: none;
}
.site-nav a:hover { background: var(--paper-2); color: var(--ink); }
.site-nav a[aria-current="page"] { background: var(--accent); color: #fff; }

/* ------------------------------------------------------- language switch */

.lang-switch {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper-2);
}
.lang-switch button {
  padding: 4px 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--dim);
  font: inherit;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
}
.lang-switch button:hover { color: var(--ink); }
.lang-switch button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(20, 32, 28, 0.12);
}

/* Phones: the brand and the language switch share the first line, the
   navigation gets the whole second line (was three stacked rows). */
@media (max-width: 520px) {
  .header-tools { order: 2; margin-left: auto; }
  .site-nav { order: 3; width: 100%; margin-left: 0; justify-content: space-between; }
}

/* ------------------------------------------------------------ typography */

h1, h2, h3 { color: var(--ink); }
h1 {
  margin: 0 0 18px;
  font-size: clamp(2.2rem, 5vw, 3.6rem);
  line-height: 1.04;
  letter-spacing: -0.03em;
}
h2 {
  margin: 0 0 10px;
  font-size: clamp(1.5rem, 2.6vw, 2.1rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
}
h3 { letter-spacing: -0.01em; }

.kicker {
  margin: 0 0 13px;
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.lead {
  max-width: 36em;
  margin: 0 0 26px;
  color: var(--dim);
  font-size: clamp(1.05rem, 1.7vw, 1.22rem);
  line-height: 1.55;
  /* balance keeps a two-character tail like "续吧。" off a line of its own;
     Chinese has no word breaks, so pretty alone does not help */
  text-wrap: balance;
}

/* ---------------------------------------------------------------- hero */

.hero {
  padding-top: clamp(38px, 6vw, 80px);
  padding-bottom: 20px;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: clamp(28px, 5vw, 64px);
  align-items: center;
}
/* Stacked: the preview leads, so a phone shows the map before the words. */
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-map { order: -1; }
}

.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 21px;
  border: 1.5px solid transparent;
  border-radius: 999px;
  font: inherit;
  font-size: 0.98rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-strong); color: #fff; }
.btn-ghost { border-color: var(--line); background: var(--surface); color: var(--ink); }
.btn-ghost:hover { border-color: var(--teal); color: var(--teal-dark); }

.hero-map {
  position: relative;
  display: block;
  border-radius: 18px;
  color: inherit;
  text-decoration: none;
}
.hero-map:focus-visible { outline-offset: 5px; border-radius: 18px; }

/* The preview is a way into the map: a label sits on it the whole time, so
   touch screens see it too, and turns teal when the pointer is over it. */
.hero-map-cta {
  position: absolute;
  right: 16px;
  bottom: 16px;
  padding: 8px 15px;
  border: 1px solid rgba(20, 32, 28, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: #0b4f49;
  font-size: 0.88rem;
  font-weight: 700;
  box-shadow: 0 8px 20px -10px rgba(20, 32, 28, 0.45);
  transition: background-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}
.hero-map:hover .hero-map-cta,
.hero-map:focus-visible .hero-map-cta {
  border-color: transparent;
  background: var(--accent);
  color: #fff;
  transform: translateY(-2px);
}
.hero-map svg {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.hero-pin { filter: drop-shadow(0 6px 8px rgba(15, 118, 110, 0.35)); }
.stats {
  display: flex;
  gap: clamp(20px, 4vw, 44px);
  flex-wrap: wrap;
  margin-top: clamp(28px, 4vw, 44px);
  padding: 18px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.stat strong {
  display: block;
  font-size: 1.6rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.stat span { color: var(--dim); font-size: 0.86rem; }

/* -------------------------------------------------------------- sections */

.section {
  padding-top: clamp(34px, 5vw, 64px);
  padding-bottom: clamp(34px, 5vw, 64px);
}

.section-head { max-width: 46em; margin-bottom: 26px; }
.section-head p { margin: 0; color: var(--dim); }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.card {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(20, 32, 28, 0.04);
}
.card h3 { margin: 0 0 8px; font-size: 1.06rem; }
.card p { margin: 0; color: var(--dim); font-size: 0.94rem; }

.card-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin-bottom: 14px;
  border-radius: 10px;
  background: var(--paper-2);
  color: var(--teal);
  font-weight: 700;
}
.card-icon svg { width: 21px; height: 21px; }
.card p { line-height: 1.6; }

/* Phones: icon beside the text, so four cards do not fill three screens. */
@media (max-width: 560px) {
  .card {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    column-gap: 14px;
    padding: 16px 18px;
  }
  .card-icon { grid-row: span 2; margin: 0; }
  .card h3 { margin: 6px 0 4px; }
}

/* ------------------------------------------------------------ page head */

.page-head { padding: clamp(30px, 5vw, 54px) 0 18px; }
.page-head h1 { font-size: clamp(2rem, 4.2vw, 3rem); }
.page-head .lead { margin-bottom: 0; }

/* ---------------------------------------------------------- map toolbar */

.map-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin: 6px 0 8px;
}

.search { flex: 1 1 260px; max-width: 380px; }
.search label {
  display: block;
  margin-bottom: 6px;
  color: var(--dim);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.search input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}
.search input:focus {
  border-color: var(--teal);
  outline: none;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.15);
}

.legend { display: flex; gap: 6px; flex-wrap: wrap; }
.legend-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 11px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--dim);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}
.legend-btn:hover { border-color: var(--dim); color: var(--ink); }
.legend-btn[aria-pressed="true"] {
  border-color: var(--ink);
  background: var(--paper-2);
  color: var(--ink);
}
.swatch {
  width: 11px;
  height: 11px;
  border: 1.5px solid var(--cat-line);
  border-radius: 3px;
  background: var(--cat);
}
.swatch-all {
  border-color: var(--dim);
  background: linear-gradient(135deg, #cfe3f2 0 50%, #f7e0c4 50% 100%);
}

.map-status {
  min-height: 1.4em;
  margin: 0 0 10px;
  color: var(--dim);
  font-size: 0.88rem;
}

/* --------------------------------------------------------------- map card */

.map-card {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.map-scroller {
  overflow-x: auto;
  border-radius: 10px;
  background: #e9f0dd;
  overscroll-behavior-x: contain;
}
.map-scroller svg { display: block; width: 100%; height: auto; }

.map-hint {
  margin: 10px 6px 2px;
  color: var(--dim);
  font-size: 0.82rem;
}

/* ------------------------------------------------------------- map artwork */

/* The drawing is a printed map: its colours do not follow the theme, so the
   hover outline (var(--ink)) stays dark even on a dark page. */
.map-scroller,
.hero-map { --ink: #14201c; }
[data-theme="dark"] .map-scroller,
[data-theme="dark"] .hero-map svg { filter: brightness(0.9) saturate(0.95); }

.map-scroller text {
  font-family: inherit;
  user-select: none;
}

.building { cursor: pointer; }

.b-shape {
  fill: var(--cat);
  stroke: var(--cat-line);
  stroke-width: 2;
  transition: stroke-width 0.15s ease, filter 0.15s ease, opacity 0.15s ease;
}
.b-shape--track { fill: #e7a9ab; stroke: #c98b8b; }
.building:hover .b-shape,
.building:focus-visible .b-shape {
  stroke: var(--ink);
  stroke-width: 3.5;
}
.building.is-selected .b-shape {
  stroke: var(--accent-strong);
  stroke-width: 5;
  filter: drop-shadow(0 0 10px rgba(15, 118, 110, 0.55));
}
.building.is-dimmed { opacity: 0.16; pointer-events: none; }

.b-label { paint-order: stroke; stroke: rgba(251, 250, 247, 0.9); stroke-width: 4px; }
.b-label .en { fill: #14201c; font-weight: 700; font-size: 22px; }
/* The second line (the other language) used to render at ~6px on a laptop;
   these sizes keep it legible without running into the first line. */
.b-label .zh { fill: #3f4a43; font-size: 17px; font-weight: 600; }
.b-label--small .en { font-size: 18px; }
.b-label--small .zh { font-size: 14px; }
.b-label--minor .en { font-size: 21px; }
.b-label--minor .zh { font-size: 14.5px; }
.b-label--water .en { fill: var(--cat-ink); font-style: italic; font-size: 21px; }
.b-label--water .zh { fill: var(--cat-ink); font-size: 15px; }
.b-label--outside { stroke-width: 5px; }

.b-leader {
  fill: none;
  stroke: #8d9184;
  stroke-width: 1.3;
  stroke-dasharray: 5 4;
}

/* markers for the places inside buildings (generated by map.js) */

.map-spot { cursor: pointer; }

.spot-hit { fill: transparent; }

.spot-dot {
  fill: #fff;
  stroke: var(--cat-line);
  stroke-width: 2.5;
  transition: fill 0.15s ease, stroke-width 0.15s ease;
}
.map-spot:hover .spot-dot,
.map-spot:focus-visible .spot-dot { stroke: var(--ink); stroke-width: 3.5; }
.map-spot.is-active .spot-dot {
  fill: var(--accent);
  stroke: var(--accent-strong);
  stroke-width: 3;
}

/* Markers carry a small line drawing — a fork, a dumbbell, a book. Words do
   not fit inside a dot, and a single letter says nothing in either language. */
.spot-icon {
  fill: none;
  stroke: var(--cat-ink);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}
.map-spot.is-active .spot-icon { stroke: #fff; }

.map-spot.is-dimmed { opacity: 0.18; pointer-events: none; }

.tree { fill: #7fb35a; stroke: #a8cf83; stroke-width: 2; }
.road { fill: none; stroke: #f6f1e6; stroke-linecap: round; }
.park { fill: #dfeccb; }
.plinth { fill: #efe9dc; opacity: 0.9; }

/* --------------------------------------------------------------- map panel */

.map-panel {
  margin-top: 16px;
  padding: clamp(18px, 3vw, 26px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  scroll-margin-top: 92px;
}

.panel-empty h2 { font-size: clamp(1.25rem, 2vw, 1.55rem); }
.panel-empty p { max-width: 62em; margin: 0; color: var(--dim); }

.panel-tips {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}
.panel-tips li {
  display: flex;
  gap: 10px;
  color: var(--dim);
  font-size: 0.9rem;
}
.panel-tips b {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--paper-2);
  color: var(--teal-dark);
  font-size: 0.74rem;
}

.panel-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 0.8fr);
  gap: 26px;
  align-items: start;
}
@media (max-width: 760px) { .panel-grid { grid-template-columns: 1fr; } }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 10px;
  padding: 4px 10px;
  border: 1px solid var(--cat-line);
  border-radius: 999px;
  background: var(--cat);
  color: var(--cat-ink);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
.chip::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cat-line);
}

.panel-name { margin: 0 0 2px; font-size: clamp(1.4rem, 2.4vw, 1.9rem); }
.panel-zh { margin: 0 0 14px; color: var(--dim); font-size: 1rem; }
.panel-desc { margin: 0; color: var(--ink); }

.panel-side { padding-left: 22px; border-left: 2px solid var(--line); }
@media (max-width: 760px) {
  .panel-side {
    padding-top: 16px;
    padding-left: 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }
}
.panel-meta {
  margin: 0 0 14px;
  color: var(--dim);
  font-size: 0.9rem;
}
.panel-meta strong {
  display: block;
  margin-bottom: 3px;
  color: var(--ink);
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.panel-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ------------------------------------------------------- map and photo */

.map-layout {
  display: grid;
  /* minmax(0, …) so the map scroller can stay narrower than the SVG */
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  position: relative;
}

/* The photograph floats beside the shape that was just clicked — on a wide
   screen as well as a phone. It lands where the eye already is, and the map
   keeps the full width instead of sharing it with a column. map.js places it
   and keeps it there while the map is swiped. */
.map-photo {
  position: absolute;
  z-index: 6;
  top: 0;
  left: 0;
  width: clamp(200px, 22vw, 320px);
  max-width: 58%;
  padding: 6px 6px 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 18px 36px -14px rgba(20, 32, 28, 0.55), 0 2px 6px rgba(20, 32, 28, 0.14);
  animation: pop 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.map-photo.is-away {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.96);
}

.map-photo-link {
  display: block;
  cursor: zoom-in;
}
.map-photo img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 8px;
}

.map-photo-name {
  margin: 7px 3px 0;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.25;
}
.map-photo-zh {
  margin: 0 3px;
  color: var(--dim);
  font-size: 0.8rem;
}

/* nothing picked yet, so there is nothing to float */
.map-photo.is-empty { display: none; }

.panel-breadcrumb {
  margin: 0 0 14px;
  color: var(--dim);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.panel-breadcrumb strong { color: var(--ink); }
[data-lang="zh"] .panel-breadcrumb { text-transform: none; letter-spacing: 0; }

.spot-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 18px;
}

.spot-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 13px 5px 5px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}
.spot-chip:hover { border-color: var(--teal); color: var(--teal-dark); }
.spot-chip.is-active {
  border-color: var(--accent-strong);
  background: var(--accent);
  color: #fff;
}

.spot-chip-glyph {
  flex: none;
  width: 24px;
  height: 24px;
  padding: 4px;
  border-radius: 999px;
  background: var(--paper-2);
  fill: none;
  stroke: var(--teal-dark);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.spot-chip.is-active .spot-chip-glyph {
  background: rgba(255, 255, 255, 0.22);
  stroke: #fff;
}

/* --------------------------------------------------------------- lightbox */

.lightbox {
  width: min(92vw, 1240px);
  max-width: none;
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: #0d1512;
  color: #fff;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}
.lightbox::backdrop { background: rgba(10, 16, 14, 0.82); }

/* Touch browsers scroll the page behind a modal dialog; stop them. Kept to
   touch devices so desktop does not lose its scrollbar and jump. */
@media (hover: none) {
  body.has-dialog { overflow: hidden; }
}

.lightbox img {
  display: block;
  width: 100%;
  max-height: 82vh;
  object-fit: contain;
  background: #0d1512;
}

.lightbox-caption {
  margin: 0;
  padding: 10px 18px 14px;
  color: #cfd8d3;
  font-size: 0.85rem;
}

.lightbox-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: rgba(13, 21, 18, 0.7);
  color: #fff;
  font: inherit;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}
.lightbox-close:hover { background: var(--accent); }

/* ------------------------------------------------------------- buildings */

.building-groups { margin-top: 18px; }

/* Categories fold away, so the page opens as five short rows instead of one
   very long scroll. The count says what is inside before it is opened. */
.building-group {
  margin: 0;
  border-bottom: 1px solid var(--line);
}
.building-group:first-of-type { border-top: 1px solid var(--line); }

.building-group > summary {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 15px 6px;
  border-radius: 8px;
  cursor: pointer;
  list-style: none;
  transition: background-color 0.15s ease;
}
.building-group > summary::-webkit-details-marker { display: none; }
/* the same drawer treatment as the rooms inside, in the warm accent colour:
   a plain row while folded, a full-width tint once it is open */
.building-group[open] > summary { background: var(--band); }
.building-group > summary::after {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--teal);
  border-bottom: 2px solid var(--teal);
  transform: rotate(45deg);
  transition: transform 0.2s ease, border-color 0.15s ease;
}
.building-group[open] > summary::after { transform: rotate(225deg); }

.group-name {
  font-size: 1.26rem;
  font-weight: 700;
  letter-spacing: -0.005em;
}
.group-count {
  margin-left: auto;
  color: var(--dim);
  font-size: 0.85rem;
}
.group-dot {
  width: 13px;
  height: 13px;
  border: 2px solid var(--cat-line);
  border-radius: 4px;
  background: var(--cat);
}

.building-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  margin: 0 0 30px;
}

/* One place per row: the words run across the page, the photograph is a
   small square on the right, the rooms inside sit on a second row below. */
.building-card {
  display: grid;
  /* A wide, short photograph beside the words: it grows with the window and
     stops short of a square, so a row stays low. */
  grid-template-columns: minmax(0, 1fr) clamp(220px, 30vw, 440px);
  align-content: start;
  padding: 0;
  border: 1px solid var(--line);
  border-top: 4px solid var(--cat-line);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
  scroll-margin-top: 92px;
}

.building-photo {
  grid-column: 2;
  grid-row: 1;
  /* above the inside row's rule, so the photograph covers the last few pixels
     of it instead of letting the dashes run under the picture */
  position: relative;
  z-index: 1;
  /* fills the row beside the words, so no strip of empty card is left under
     the picture when the text is taller than the photograph */
  align-self: stretch;
  display: block;
  background: var(--paper-2);
  cursor: zoom-in;
}
.building-photo img {
  display: block;
  width: 100%;
  height: 100%;
  /* Wider than the 4:3 original, so the row is shorter; the crop keeps the
     middle of the building, which is what the photograph is of. */
  aspect-ratio: 2.1 / 1;
  object-fit: cover;
}
/* two shots need the crop nudged: the sports field is mostly sky at the top,
   and the welcome center's entrance sits low in the frame */
#sports-field .building-photo img { object-position: 50% 100%; }
#welcome-center .building-photo img { object-position: 50% 60%; }

.building-body {
  grid-column: 1;
  grid-row: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-content: center;
  align-items: baseline;
  gap: 2px 18px;
  padding: 16px 22px;
}

/* "Where" and the map link share the last line, so a row stays short. */
.building-body > h3,
.building-body > .zh,
.building-body > .desc,
.building-body > .building-inside { grid-column: 1 / -1; }
.building-body > .where { grid-column: 1; }
.building-body > .card-link { grid-column: 2; justify-self: end; }

.building-card h3 { margin: 0; font-size: 1.18rem; line-height: 1.3; }
.building-card .zh { margin: 0 0 6px; color: var(--dim); font-size: 0.92rem; line-height: 1.4; }
.building-card .desc {
  max-width: 78ch;
  margin: 0 0 4px;
  color: var(--body-ink);
  font-size: 0.95rem;
  line-height: 1.55;
}
.building-card .where { margin: 0; color: var(--dim); font-size: 0.85rem; line-height: 1.45; }
.building-card .where strong { color: var(--ink); font-weight: 600; }
.building-card .card-link {
  color: var(--teal);
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.building-card .card-link:hover { color: var(--teal-dark); text-decoration: underline; }

/* The rooms inside get their own full-width row, so six thumbnails can share
   the card width rather than the narrower text column. */
/* The rooms inside are a drawer of their own: one row that opens to the
   thumbnails, so a card stays as short as its photograph. */
.building-inside {
  grid-column: 1 / -1;
  grid-row: 2;
  position: relative;
  padding: 0;
}
/* a dashed rule with a wider gap than the browser's default border */
.building-inside::before {
  content: "";
  position: absolute;
  inset: -1px 0 auto 0;
  height: 1px;
  background: repeating-linear-gradient(90deg,
    color-mix(in srgb, var(--teal) 45%, transparent) 0 7px,
    transparent 7px 17px);
}
.building-inside > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  cursor: pointer;
  list-style: none;
  background: transparent;
  transition: background-color 0.15s ease;
}
/* the tint only appears once the drawer is open, so a folded card stays calm */
.building-inside[open] > summary { background: color-mix(in srgb, var(--teal) 14%, transparent); }
.building-inside[open] > summary:hover { background: color-mix(in srgb, var(--teal) 20%, transparent); }
.building-inside > summary::-webkit-details-marker { display: none; }
.building-inside > summary:hover .inside-label { color: var(--teal-dark); }
.building-inside > summary::after {
  content: "";
  flex: none;
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--teal);
  border-bottom: 2px solid var(--teal);
  transform: rotate(45deg);
  transition: transform 0.2s ease;
}
.building-inside[open] > summary::after { transform: rotate(225deg); }

.inside-label {
  margin: 0;
  color: var(--teal);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  transition: color 0.15s ease;
}
.inside-count {
  margin-right: auto;
  color: var(--dim);
  font-size: 0.9rem;
}

.inside-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0 22px 16px;
  padding: 0;
  list-style: none;
}

.inside-photo {
  display: block;
  cursor: zoom-in;
}
.inside-photo img {
  display: block;
  width: 100%;
  height: auto;
  /* a wide crop of the 4:3 original: six rooms read as two rows of three
     without the drawer growing taller than the card above it needs */
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
  border-radius: 6px;
  object-fit: cover;
}
.inside-photo:hover img { border-color: var(--teal); }

.inside-link {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  text-decoration: none;
}
.inside-link:hover .inside-name { color: var(--teal-dark); text-decoration: underline; }

/* narrow screens: stack the photo on top instead of squeezing the text column */
@media (max-width: 560px) {
  .building-card { grid-template-columns: 1fr; }
  .building-photo { grid-column: 1; grid-row: 1; }
  .building-photo img { height: auto; aspect-ratio: 4 / 3; }
  .building-body { grid-column: 1; grid-row: 2; padding: 16px 18px; }
  .building-inside { padding: 0; }
  .building-inside > summary { padding: 10px 18px; }
  .inside-list { grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0 18px 14px; }
  .building-inside { grid-row: 3; }
  /* a narrow column: let the map link sit under "Where" instead of beside it */
  .building-body > .where,
  .building-body > .card-link { grid-column: 1; justify-self: start; }
}

.inside-name { display: block; font-size: 0.94rem; font-weight: 600; line-height: 1.3; }
.inside-zh { display: block; color: var(--dim); font-size: 0.84rem; line-height: 1.3; }

/* ----------------------------------------------------------------- about */

.prose { max-width: 68ch; margin-top: 20px; font-size: 1.04rem; line-height: 1.7; }
/* Section headings inside an article: smaller than the page h1's h2s,
   with the space above them rather than below. */
.prose h2 {
  margin: 2.2em 0 0.55em;
  padding-top: 1.1em;
  border-top: 1px solid var(--line);
  font-size: clamp(1.3rem, 2vw, 1.55rem);
}
.prose h2:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.prose p { margin: 0 0 1em; }
.prose p, .prose li { color: var(--body-ink); }
.prose ul { margin: 0 0 1em; padding-left: 1.2em; }
.prose li { margin: 0.45em 0; }
.prose li::marker { color: var(--teal); }
.prose strong { color: var(--ink); }
[data-lang="zh"] .prose { line-height: 1.85; }

.callout {
  margin: 22px 0;
  padding: 16px 20px;
  border-left: 4px solid var(--teal);
  border-radius: 0 10px 10px 0;
  background: var(--paper-2);
  color: var(--dim);
}
.callout p { margin: 0; }

.credits {
  margin-top: 28px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--dim);
  font-size: 0.9rem;
}
.credits p { margin: 0.4em 0; line-height: 1.6; }
.credits p:first-child { margin-top: 0; color: var(--ink); }

/* ---------------------------------------------------------------- footer */

.site-footer {
  margin-top: 64px;
  padding: 26px 0 40px;
  border-top: 1px solid var(--line);
  color: var(--dim);
  font-size: 0.9rem;
}
.footer-inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.site-footer p { margin: 0; }
.site-footer strong { color: var(--ink); }
.site-footer nav { display: flex; gap: 14px; flex-wrap: wrap; }
.site-footer a { color: var(--dim); text-decoration: none; }
.site-footer a:hover { color: var(--ink); text-decoration: underline; }

/* ================================================================ polish
   Character and motion, layered over the base styles above. Everything that
   moves is switched off again in the prefers-reduced-motion block at the end.
   ======================================================================== */

::selection { background: rgba(15, 118, 110, 0.18); }

/* A faint map grid behind the top of every page, fading out before the
   content gets long — a nod to graph paper without hurting the text. */
/* The footer sits at the bottom of the window even on a short page. */
body {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
body > main { flex: 1 0 auto; width: 100%; }
body::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  z-index: -1;
  height: 760px;
  background:
    radial-gradient(ellipse 55% 65% at 88% 0%, rgba(15, 118, 110, 0.11), transparent 70%),
    radial-gradient(ellipse 40% 55% at 0% 8%, rgba(217, 150, 60, 0.10), transparent 70%),
    radial-gradient(rgba(15, 118, 110, 0.16) 1px, transparent 1.5px) 0 0 / 24px 24px;
  -webkit-mask-image: linear-gradient(#000 35%, transparent);
  mask-image: linear-gradient(#000 35%, transparent);
  pointer-events: none;
}

/* ------------------------------------------------------- page transitions */

/* Moving between pages cross-fades instead of flashing white; the header
   has its own name so it stays put while the page underneath changes. */
@view-transition { navigation: auto; }
.site-header { view-transition-name: site-header; }
::view-transition-old(root) { animation: vt-out 0.16s ease both; }
::view-transition-new(root) { animation: vt-in 0.26s ease both; }
@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; } }

/* Each page settles in: heading first, then what follows it. */
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
}
@keyframes fade-in { from { opacity: 0; } }

.page-head > *,
.hero-grid > div:first-child > *,
.hero-map,
.map-toolbar,
.map-layout,
.map-panel,
.section-head,
.cards > .card,
.building-group,
.prose > * {
  animation: rise 0.55s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.page-head > :nth-child(2),
.hero-grid > div:first-child > :nth-child(2) { animation-delay: 0.05s; }
.page-head > :nth-child(3),
.hero-grid > div:first-child > :nth-child(3) { animation-delay: 0.1s; }
.hero-grid > div:first-child > :nth-child(4),
.map-toolbar { animation-delay: 0.15s; }
.hero-grid > div:first-child > :nth-child(5),
.hero-map,
.map-layout { animation-delay: 0.2s; }
.map-panel { animation-delay: 0.26s; }
.cards > .card:nth-child(2) { animation-delay: 0.06s; }
.cards > .card:nth-child(3) { animation-delay: 0.12s; }
.cards > .card:nth-child(4) { animation-delay: 0.18s; }
.building-group:nth-of-type(2) { animation-delay: 0.06s; }
.building-group:nth-of-type(n+3) { animation-delay: 0.12s; }
.prose > * { animation-duration: 0.45s; animation-delay: 0.12s; }

/* -------------------------------------------------------------- headings */

/* One word in each page title gets a marker stroke, drawn in after load. */
.hl {
  padding: 0 0.06em;
  background: linear-gradient(transparent 58%, var(--marker) 58% 90%, transparent 90%)
              no-repeat 0 0 / 100% 100%;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  animation: mark 0.7s 0.35s cubic-bezier(0.6, 0, 0.2, 1) both;
}
@keyframes mark { from { background-size: 0% 100%; } }
/* a Chinese phrase this short reads as one word: never break it */
[data-lang="zh"] .hl { white-space: nowrap; }

.kicker {
  display: flex;
  align-items: center;
  gap: 10px;
}
.kicker::before {
  content: "";
  width: 24px;
  height: 2px;
  border-radius: 2px;
  background: var(--orange);
}

/* ---------------------------------------------------------------- header */

.site-nav a {
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.12s ease;
}
.site-nav a:active { transform: scale(0.95); }
.site-nav a[aria-current="page"] {
  box-shadow: 0 6px 14px -8px rgba(15, 118, 110, 0.9);
}
.brand svg { transition: transform 0.25s cubic-bezier(0.3, 1.6, 0.5, 1); }
.brand:hover svg { transform: translateY(-2px) rotate(-8deg); }

/* The language switch is one sliding pill rather than two separate ones. */
.lang-switch {
  position: relative;
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
}
.lang-switch::before {
  content: "";
  position: absolute;
  top: 2px;
  bottom: 2px;
  left: 2px;
  width: calc((100% - 6px) / 2);
  border-radius: 999px;
  background: var(--pill);
  box-shadow: 0 1px 3px rgba(20, 32, 28, 0.16);
  transition: transform 0.25s cubic-bezier(0.3, 1.3, 0.5, 1);
}
[data-lang="zh"] .lang-switch::before { transform: translateX(calc(100% + 2px)); }
.lang-switch button {
  position: relative;
  min-width: 3.2em;
  transition: color 0.2s ease;
}
.lang-switch button[aria-pressed="true"] { background: transparent; box-shadow: none; }

/* --------------------------------------------------------------- buttons */

.btn {
  transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease,
              border-color 0.15s ease, color 0.15s ease;
}
.btn:active { transform: translateY(1px) scale(0.97); }

.btn-primary {
  background: linear-gradient(180deg, var(--accent-top), var(--accent));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 10px 20px -10px rgba(15, 118, 110, 0.85);
}
.btn-primary::after {
  content: "→";
  transition: transform 0.18s ease;
}
.btn-primary:hover {
  background: linear-gradient(180deg, var(--accent), var(--accent-strong));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 14px 24px -12px rgba(15, 118, 110, 0.95);
  transform: translateY(-1px);
}
.btn-primary:hover::after { transform: translateX(3px); }

.btn-ghost:hover {
  box-shadow: 0 8px 18px -12px rgba(20, 32, 28, 0.5);
  transform: translateY(-1px);
}

.legend-btn,
.spot-chip {
  transition: transform 0.12s ease, border-color 0.15s ease, background-color 0.15s ease,
              color 0.15s ease;
}
.legend-btn:active,
.spot-chip:active { transform: scale(0.95); }

.search input { transition: border-color 0.15s ease, box-shadow 0.15s ease; }

/* ----------------------------------------------------------------- cards */

.card {
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.card:hover {
  border-color: rgba(15, 118, 110, 0.35);
  box-shadow: 0 16px 30px -18px var(--hover-shadow);
  transform: translateY(-3px);
}
.card-icon { background: rgba(15, 118, 110, 0.09); }

.stat strong { color: var(--teal-dark); }

/* ---------------------------------------------------------- home preview */

.hero-map svg { transition: transform 0.35s ease, box-shadow 0.35s ease; }
.hero-map:hover svg {
  transform: translateY(-3px);
  box-shadow: 0 1px 2px rgba(20, 32, 28, 0.05), 0 22px 40px -16px rgba(20, 32, 28, 0.28);
}

.hero-pin-drop { animation: pin-drop 0.6s 0.45s cubic-bezier(0.3, 1.5, 0.5, 1) both; }
@keyframes pin-drop {
  from { opacity: 0; transform: translateY(-46px); }
  60% { opacity: 1; }
}
.hero-pulse {
  transform-box: fill-box;
  transform-origin: center;
  opacity: 0;
  animation: pulse 2.4s 1.05s ease-out infinite;
}
@keyframes pulse {
  0% { opacity: 0.55; transform: scale(0.4); }
  100% { opacity: 0; transform: scale(2.2); }
}

/* -------------------------------------------------------------- map page */

/* The panel and the photo are re-rendered on every click; let them ease in. */
.panel-grid,
.panel-empty { animation: rise 0.32s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.map-photo-link,
.map-photo-name,
.map-photo-zh { animation: fade-in 0.35s ease both; }
.map-photo-link {
  overflow: hidden;
  border-radius: 8px;
  background: var(--paper-2);
}
.map-photo img { transition: transform 0.4s ease; }
.map-photo-link:hover img { transform: scale(1.03); }

.map-spot.is-active .spot-dot { animation: spot-pop 0.35s cubic-bezier(0.3, 1.6, 0.5, 1); }
.map-spot .spot-dot { transform-box: fill-box; transform-origin: center; }
@keyframes spot-pop { from { transform: scale(0.6); } }

/* ---------------------------------------------------------- buildings page */

.building-card { transition: box-shadow 0.2s ease, border-color 0.2s ease; }
.building-card:hover { box-shadow: 0 14px 30px -20px var(--hover-shadow); }
.building-photo { overflow: hidden; }
.building-photo img,
.inside-photo img { transition: transform 0.4s ease; }
.building-photo:hover img { transform: scale(1.05); }
.inside-photo { overflow: hidden; border-radius: 6px; }
.inside-photo:hover img { transform: scale(1.06); }

/* Arriving from "Open in guide" on the map: flash the card that was asked for. */
.building-card:target { animation: target-ring 1.8s ease 0.2s both; }
@keyframes target-ring {
  0%, 40% { box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.35), 0 14px 30px -18px rgba(20, 32, 28, 0.4); }
  100% { box-shadow: 0 0 0 0 rgba(15, 118, 110, 0); }
}

/* -------------------------------------------------------------- lightbox */

.lightbox[open] { animation: pop 0.24s cubic-bezier(0.2, 0.8, 0.2, 1); }
.lightbox[open]::backdrop { animation: fade-in 0.24s ease; }
@keyframes pop { from { opacity: 0; transform: scale(0.96); } }
.lightbox-close { transition: background-color 0.15s ease, transform 0.15s ease; }
.lightbox-close:hover { transform: rotate(90deg); }

/* ---------------------------------------------------------------- footer */

/* A dark band closes every page, with the same dashed rule the building
   cards use along its top edge. */
.site-footer {
  margin-top: 80px;
  padding: 40px 0 46px;
  border-top: 0;
  background:
    repeating-linear-gradient(90deg,
      rgba(79, 209, 193, 0.55) 0 7px,
      transparent 7px 17px) 0 0 / 100% 1px no-repeat,
    var(--footer-bg);
  color: #aebbb4;
}
.site-footer strong { color: #fff; }
.site-footer a { color: #cfd9d4; transition: color 0.15s ease; }
.site-footer a:hover { color: #fff; }
.site-footer a[href^="mailto"] { color: #8fd3c9; }


/* ------------------------------------------------- theme switch, header */

.header-tools { display: flex; align-items: center; gap: 8px; }

.theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--paper-2);
  color: var(--dim);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.theme-toggle:hover { border-color: var(--dim); color: var(--ink); }
.theme-toggle:active { transform: scale(0.9); }
/* the two icons share one cell and swap with a quarter turn */
.theme-toggle svg {
  grid-area: 1 / 1;
  width: 18px;
  height: 18px;
  transition: transform 0.35s cubic-bezier(0.3, 1.4, 0.5, 1), opacity 0.2s ease;
}
.icon-sun { opacity: 0; transform: rotate(-90deg) scale(0.5); }
[data-theme="dark"] .icon-sun { opacity: 1; transform: none; }
[data-theme="dark"] .icon-moon { opacity: 0; transform: rotate(90deg) scale(0.5); }

/* once the page scrolls, a soft shadow replaces the hairline under the header */
.site-header { transition: box-shadow 0.2s ease, border-color 0.2s ease; }
.site-header.is-scrolled {
  border-bottom-color: transparent;
  box-shadow: 0 10px 28px -18px rgba(20, 32, 28, 0.55);
}
[data-theme="dark"] .site-header.is-scrolled { box-shadow: 0 10px 28px -14px rgba(0, 0, 0, 0.9); }


/* ------------------------------------------------------------------- 404 */

.notfound h1 { font-size: clamp(2.1rem, 4.6vw, 3.4rem); }
.notfound {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: clamp(28px, 5vw, 64px);
  align-items: center;
  min-height: min(62vh, 560px);
  padding: clamp(36px, 6vw, 72px) 0 20px;
}
@media (max-width: 860px) { .notfound { grid-template-columns: 1fr; min-height: 0; } }

.notfound-copy > * { animation: rise 0.55s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.notfound-copy > :nth-child(2) { animation-delay: 0.05s; }
.notfound-copy > :nth-child(3) { animation-delay: 0.1s; }
.notfound-copy > :nth-child(4) { animation-delay: 0.15s; }

/* the drawing is a printed map, like the real one: same colours in both themes */
.lost-map {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 18px;
  box-shadow: var(--shadow);
  animation: rise 0.6s 0.2s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
[data-theme="dark"] .lost-map { filter: brightness(0.9) saturate(0.95); }
.lost-paper { fill: #f6f4ee; stroke: #dcd8d0; stroke-width: 2; }
.lost-road { fill: none; stroke: #ece6d8; stroke-width: 16; }
.lost-block { stroke-width: 2; }
.lost-block--academic { fill: #cfe3f2; stroke: #4a7c9b; }
.lost-block--life { fill: #f7e0c4; stroke: #b45309; }
.lost-block--residence { fill: #ece0b8; stroke: #8a6d1f; }
.lost-tree { fill: #7fb35a; stroke: #a8cf83; stroke-width: 2; }
.lost-route {
  fill: none;
  stroke: #0f766e;
  stroke-width: 3.5;
  stroke-linecap: round;
  stroke-dasharray: 2 9;
  animation: march 1.2s linear infinite;
}
@keyframes march { to { stroke-dashoffset: -22; } }
.lost-pin-body {
  filter: drop-shadow(0 6px 6px rgba(194, 65, 12, 0.35));
  transform-box: fill-box;
  transform-origin: 50% 100%;
  animation: pin-drop 0.6s 0.5s cubic-bezier(0.3, 1.5, 0.5, 1) both,
             wobble 2.8s 1.2s ease-in-out infinite;
}
.lost-pin-body path { fill: #c2410c; }
.lost-pin-body text { fill: #fff; font-size: 26px; font-weight: 700; }
@keyframes wobble {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-7deg); }
  75% { transform: rotate(7deg); }
}

/* --------------------------------------------------------- small screens */

@media (max-width: 900px) {
  .map-scroller svg { min-width: 1200px; }
}

@media (max-width: 760px) {
  /* Wide enough that the 60-unit marker hit circle stays above 44 CSS px. */
  .map-scroller svg { min-width: 1440px; }
  .header-inner { padding-top: 10px; padding-bottom: 10px; }
  .site-nav a { padding: 7px 10px; font-size: 0.9rem; }
  .map-toolbar { align-items: stretch; }
  .search { max-width: none; }
  .legend { width: 100%; }
}

@media (max-width: 520px) {
  .header-inner { row-gap: 8px; }
  .site-nav a { padding: 7px 12px; }
  .map-panel, .building-card { scroll-margin-top: 110px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
  }
  @view-transition { navigation: none; }
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) { animation: none !important; }
}
