/* ============================================================
   CROSSTOWN — civic wayfinding city journal
   Faces: Oswald (signage), IBM Plex Mono (timetable), Space Grotesk (reading)
   ============================================================ */

@font-face {
  font-family: "Oswald";
  src: url("assets/oswald.ttf") format("truetype");
  font-weight: 200 700;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("assets/ibm-plex-mono.ttf") format("truetype");
  font-weight: 100 700;
  font-display: swap;
}
@font-face {
  font-family: "Space Grotesk";
  src: url("assets/space-grotesk.ttf") format("truetype");
  font-weight: 300 700;
  font-display: swap;
}

/* ---- Tokens ------------------------------------------------ */
:root {
  --paper: #efe7d6;
  --paper-2: #e8dfca;
  --paper-line: #d8ccb0;
  --ink: #1a1612;
  --ink-2: #5c5247;
  --ink-3: #8a7f6f;
  --board: #15110c;
  --board-2: #1f1a13;
  --board-line: #2e2820;
  --board-ink: #f3ecda;
  --board-ink-2: #b9ad93;
  --board-ink-3: #7d7058;

  /* civic line colors */
  --c-culture: #6e4fa3;
  --c-food: #c77a1b;
  --c-movement: #1f7e8e;
  --c-people: #c0392b;
  --c-places: #3c7a4e;
  --pin: #f2c14e;

  --line-w: 9px;
  --radius: 3px;

  --font-display: "Oswald", "Arial Narrow", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --font-body: "Space Grotesk", system-ui, -apple-system, Segoe UI, sans-serif;
}

/* ---- Reset-ish -------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.55;
  font-size: 16px;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }
::selection { background: var(--ink); color: var(--paper); }

/* themed scrollbars (browser surface) */
* { scrollbar-color: var(--paper-line) transparent; }
body { scrollbar-width: thin; }
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-thumb {
  background: var(--paper-line);
  border: 3px solid var(--paper);
  border-radius: 10px;
}

/* ---- Skip link -------------------------------------------- */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 1000;
  background: var(--ink);
  color: var(--paper);
  padding: 10px 16px;
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.skip-link:focus { left: 12px; top: 12px; outline: none; box-shadow: 0 0 0 3px var(--pin); }

/* ---- Focus rings ------------------------------------------ */
:focus-visible {
  outline: 3px solid var(--pin);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ---- Shared typography ------------------------------------ */
.section-title {
  font-family: var(--font-display);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  line-height: 1;
  margin: 0;
}

/* ============================================================
   KIOSK HEADER
   ============================================================ */
.kiosk {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px clamp(20px, 4vw, 56px);
  border-bottom: 1px solid var(--ink);
  background: var(--paper);
  position: relative;
}
.kiosk::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -5px;
  height: 1px;
  background: var(--ink);
  opacity: 0.35;
}
.kiosk-mark { display: flex; align-items: center; gap: 16px; }
.mark-glyph { color: var(--ink); display: inline-flex; }
.mark-words { display: flex; flex-direction: column; line-height: 1; }
.mark-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(26px, 3.4vw, 38px);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.mark-sub {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin-top: 7px;
}
.kiosk-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  text-align: right;
  max-width: 42ch;
}
.meta-line {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--c-people);
  font-weight: 600;
}
.meta-note {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.02em;
}

/* ============================================================
   LAYOUT
   ============================================================ */
main {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 clamp(20px, 4vw, 56px);
}

/* ============================================================
   NETWORK / MAP
   ============================================================ */
.network {
  padding-top: clamp(28px, 4vw, 44px);
  padding-bottom: 6px;
}
.network-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.network-head .section-title { font-size: clamp(34px, 5vw, 64px); }
.section-lede {
  margin: 0;
  max-width: 52ch;
  font-size: clamp(15px, 1.4vw, 17px);
  color: var(--ink-2);
  line-height: 1.5;
}

.network-frame {
  position: relative;
  background: var(--paper-2);
  border: 1px solid var(--ink);
  box-shadow: 10px 10px 0 0 var(--ink);
}
.map-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 1200 / 400;
}
.map-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
/* paper texture via repeating rule lines, faint */
.network-frame::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(26,22,18,0.04) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(26,22,18,0.04) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}

/* SVG line + dot styling */
.map-svg .line {
  fill: none;
  stroke-width: var(--line-w);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1400;
  stroke-dashoffset: 0;
  opacity: 0.92;
  transition: opacity 0.4s ease, stroke-width 0.25s ease;
}
.map-svg .line-bridge {
  fill: none;
  stroke: var(--paper-2);
  stroke-width: calc(var(--line-w) + 3px);
  stroke-linecap: round;
  pointer-events: none;
}
.map-svg .stop-dot {
  fill: var(--paper-2);
  stroke-width: 5px;
  transition: r 0.2s ease, stroke-width 0.2s ease, fill 0.2s ease;
}
.map-svg .stop-halo {
  fill: none;
  stroke-width: 2.5px;
  opacity: 0;
  transition: opacity 0.2s ease, r 0.25s ease;
}
.map-svg .line-label {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.map-svg .stop-code {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
}

/* map dimmed state during filtering */
.map-stage.is-filtered .map-svg .line { opacity: 0.18; }
.map-stage.is-filtered .map-svg .stop-dot { opacity: 0.18; }
.map-stage.is-filtered .map-svg .stop-code { opacity: 0.18; }
.map-stage.is-filtered .map-svg .line-label { opacity: 0.18; }
.map-stage.is-filtered .map-svg .line.match { opacity: 0.95; }
.map-stage.is-filtered .map-svg .stop-dot.match { opacity: 1; }
.map-stage.is-filtered .map-svg .stop-code.match { opacity: 1; }
.map-stage.is-filtered .map-svg .line-label.match { opacity: 1; }

/* HTML overlay stop buttons */
.map-stops {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.map-stop {
  position: absolute;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
  width: 30px;
  height: 30px;
  margin-left: 0;
  display: grid;
  place-items: center;
}
.map-stop .stop-ring {
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  border: 2px solid transparent;
  transition: transform 0.18s ease, border-color 0.18s ease;
}
.map-stop:hover .stop-ring,
.map-stop:focus-visible .stop-ring {
  border-color: var(--ink);
  transform: scale(1.18);
}
.map-stage.is-filtered .map-stop { opacity: 0.25; }
.map-stage.is-filtered .map-stop.match { opacity: 1; }
.map-stage.is-filtered .map-stop.is-saved { opacity: 1; }

.map-stop .stop-pin {
  position: absolute;
  top: -10px;
  right: -8px;
  width: 14px;
  height: 14px;
  color: var(--pin);
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.map-stop.is-saved .stop-pin { opacity: 1; transform: scale(1); }

/* legend */
.map-legend {
  position: absolute;
  left: 16px;
  top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
  background: rgba(239,231,214,0.82);
  padding: 7px 11px;
  border: 1px solid var(--paper-line);
  backdrop-filter: blur(2px);
}
.legend-item { display: inline-flex; align-items: center; gap: 7px; }
.legend-swatch { width: 22px; height: 5px; border-radius: 2px; background: currentColor; }

.map-tip {
  position: absolute;
  pointer-events: none;
  transform: translate(-50%, calc(-100% - 14px));
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 13px;
  padding: 6px 10px;
  white-space: nowrap;
  max-width: 80vw;
  z-index: 5;
  box-shadow: 0 6px 18px rgba(0,0,0,0.28);
}
.map-tip::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -5px;
  transform: translateX(-50%) rotate(45deg);
  width: 9px; height: 9px;
  background: var(--ink);
}

/* ============================================================
   CONTROLS
   ============================================================ */
.controls {
  display: grid;
  grid-template-columns: 1.4fr 1fr auto;
  gap: 18px;
  align-items: end;
  padding: clamp(20px, 2.4vw, 28px) 0 18px;
  border-bottom: 1px solid var(--ink);
}
.control { display: flex; flex-direction: column; gap: 8px; }
.control-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-2);
  font-weight: 600;
}

.search-field, .select-field {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--paper);
  border: 1px solid var(--ink);
  box-shadow: 5px 5px 0 0 var(--ink);
}
.search-field { padding: 0 14px; }
.search-icon { color: var(--ink-2); flex: none; }
#search {
  flex: 1;
  border: 0;
  background: transparent;
  padding: 13px 10px;
  font-family: var(--font-mono);
  font-size: 14px;
  letter-spacing: 0.02em;
  color: var(--ink);
  min-width: 0;
}
#search::placeholder { color: var(--ink-3); }
#search:focus-visible { outline: none; }
.search-field:has(#search:focus-visible) { box-shadow: 5px 5px 0 0 var(--pin); }

.select-field { padding: 0 12px; }
#filter {
  flex: 1;
  appearance: none;
  border: 0;
  background: transparent;
  padding: 13px 8px 13px 4px;
  font-family: var(--font-mono);
  font-size: 14px;
  letter-spacing: 0.02em;
  color: var(--ink);
  text-transform: uppercase;
  cursor: pointer;
  min-width: 0;
}
.select-chev { color: var(--ink); flex: none; pointer-events: none; }
.select-field:has(#filter:focus-visible) { box-shadow: 5px 5px 0 0 var(--pin); }

/* saved toggle */
.control-saved { align-items: flex-start; }
.saved-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--paper);
  border: 1px solid var(--ink);
  box-shadow: 5px 5px 0 0 var(--ink);
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
  cursor: pointer;
  transition: box-shadow 0.18s ease, background 0.18s ease, color 0.18s ease;
  white-space: nowrap;
}
.saved-dot {
  width: 13px; height: 13px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: transparent;
  transition: background 0.18s ease, border-color 0.18s ease;
}
.saved-toggle[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
  box-shadow: 5px 5px 0 0 var(--pin);
}
.saved-toggle[aria-pressed="true"] .saved-dot {
  background: var(--pin);
  border-color: var(--pin);
}
.saved-count {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  padding: 1px 7px;
  border: 1px solid currentColor;
  border-radius: 2px;
  font-size: 11px;
}

/* ============================================================
   BOARD (dark departures)
   ============================================================ */
.board {
  margin-top: clamp(20px, 2.6vw, 30px);
  margin-bottom: clamp(40px, 5vw, 64px);
  background: var(--board);
  color: var(--board-ink);
  border: 1px solid var(--ink);
  box-shadow: 10px 10px 0 0 var(--ink);
}
.board-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 22px clamp(18px, 2.4vw, 30px) 14px;
  border-bottom: 1px solid var(--board-line);
}
.board-head .section-title { font-size: clamp(26px, 3vw, 40px); color: var(--board-ink); }
.board-sub {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--board-ink-2);
  font-variant-numeric: tabular-nums;
}

.board-grid {
  display: grid;
  grid-template-columns: 84px 1fr 78px 110px;
  gap: 16px;
  padding: 10px clamp(18px, 2.4vw, 30px);
  border-bottom: 1px solid var(--board-line);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--board-ink-3);
}
.board-grid .col-time, .board-grid .col-status { text-align: right; }

.departures {
  list-style: none;
  margin: 0;
  padding: 0;
}

.trip {
  position: relative;
  border-bottom: 1px solid var(--board-line);
}
.trip:last-child { border-bottom: 0; }
.trip-open {
  display: grid;
  grid-template-columns: 84px 1fr 78px 110px;
  gap: 16px;
  align-items: center;
  width: 100%;
  padding: 16px clamp(18px, 2.4vw, 30px);
  background: transparent;
  border: 0;
  text-align: left;
  color: var(--board-ink);
  cursor: pointer;
  transition: background 0.16s ease;
}
.trip-open:hover { background: var(--board-2); }
.trip-open:focus-visible { outline: none; background: var(--board-2); box-shadow: inset 0 0 0 3px var(--pin); }

.trip-line {
  display: flex;
  align-items: center;
  gap: 10px;
}
.trip-bar {
  width: 6px;
  height: 38px;
  border-radius: 2px;
  flex: none;
}
.trip-code {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.04em;
  color: var(--board-ink);
  font-variant-numeric: tabular-nums;
}
.trip-dest { min-width: 0; }
.trip-title {
  font-family: var(--font-display);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  font-size: clamp(18px, 1.7vw, 23px);
  line-height: 1.08;
  color: var(--board-ink);
  margin: 0 0 5px;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.trip-via {
  margin: 0;
  font-size: 13px;
  color: var(--board-ink-2);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.trip-time {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  text-align: right;
  color: var(--board-ink);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.trip-time small {
  display: block;
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--board-ink-3);
}
.trip-status {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--board-ink-2);
}
.trip-status .pinmark {
  width: 12px; height: 12px;
  color: var(--pin);
  flex: none;
}
.trip-status .status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.trip.is-saved .trip-title::after {
  content: "";
  display: inline-block;
  width: 8px; height: 8px;
  margin-left: 8px;
  vertical-align: middle;
  background: var(--pin);
  border-radius: 50%;
}

/* line color helpers */
.lc-culture { color: var(--c-culture); }
.lc-food { color: var(--c-food); }
.lc-movement { color: var(--c-movement); }
.lc-people { color: var(--c-people); }
.lc-places { color: var(--c-places); }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  padding: 44px clamp(20px, 4vw, 40px);
  text-align: center;
  color: var(--board-ink-2);
}
.empty-mark { color: var(--board-ink-3); margin: 0 auto 14px; }
.empty-title {
  font-family: var(--font-display);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 22px;
  color: var(--board-ink);
  margin: 0 0 6px;
}
.empty-body {
  margin: 0 0 18px;
  font-size: 14px;
  color: var(--board-ink-2);
}
.reset-btn {
  background: transparent;
  color: var(--board-ink);
  border: 1px solid var(--board-ink);
  padding: 11px 18px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease;
}
.reset-btn:hover, .reset-btn:focus-visible { background: var(--pin); color: var(--ink); border-color: var(--pin); }

/* ============================================================
   COLOPHON
   ============================================================ */
.colophon {
  max-width: 1320px;
  margin: 0 auto;
  padding: clamp(28px, 4vw, 44px) clamp(20px, 4vw, 56px);
  border-top: 1px solid var(--ink);
  background: var(--paper-2);
}
.colophon-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  margin-bottom: 28px;
}
.colophon-block { max-width: 56ch; }
.colophon-kicker {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--c-people);
  font-weight: 600;
  margin-bottom: 8px;
}
.colophon-block p {
  margin: 0;
  font-size: 14px;
  color: var(--ink-2);
  line-height: 1.55;
}
.colophon-foot {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* ============================================================
   DETAIL
   ============================================================ */
.detail-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(15, 12, 8, 0.55);
  backdrop-filter: blur(3px);
  display: grid;
  justify-items: stretch;
  align-items: stretch;
  overflow-y: auto;
  padding: clamp(8px, 2vw, 32px);
}
.detail-overlay[hidden] { display: none; }

.detail-panel {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--ink);
  box-shadow: 14px 14px 0 0 var(--ink);
  width: 100%;
  max-width: 760px;
  margin: auto;
  padding: clamp(22px, 4vw, 48px) clamp(22px, 5vw, 64px) clamp(28px, 5vw, 56px);
}

.detail-close {
  position: absolute;
  top: 14px;
  right: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--ink);
  color: var(--paper);
  border: 1px solid var(--ink);
  padding: 8px 12px 8px 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
  z-index: 2;
  transition: background 0.16s ease, color 0.16s ease;
}
.detail-close:hover, .detail-close:focus-visible {
  background: var(--pin);
  color: var(--ink);
}
.detail-close svg { flex: none; }

.detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 2px solid currentColor;
}
.detail-route { display: flex; align-items: center; gap: 12px; }
.detail-code {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.06em;
  padding: 5px 9px;
  border: 2px solid currentColor;
  background: var(--paper);
  font-variant-numeric: tabular-nums;
}
.detail-line-name {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 600;
}
.detail-meta {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--ink-2);
  text-align: right;
  line-height: 1.5;
}
.detail-meta b { color: var(--ink); font-weight: 600; }

.detail-title {
  font-family: var(--font-display);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.005em;
  line-height: 1.02;
  font-size: clamp(30px, 5.4vw, 54px);
  margin: 0 0 14px;
  color: var(--ink);
  max-width: 18ch;
}
.detail-summary {
  font-family: var(--font-body);
  font-size: clamp(16px, 1.6vw, 19px);
  line-height: 1.45;
  color: var(--ink-2);
  margin: 0 0 22px;
  font-weight: 500;
  max-width: 52ch;
}
.detail-rule {
  height: 3px;
  width: 64px;
  background: currentColor;
  margin: 0 0 26px;
}
.detail-body {
  font-family: var(--font-body);
  font-size: clamp(16px, 1.4vw, 18px);
  line-height: 1.7;
  color: var(--ink);
  max-width: 66ch;
}
.detail-body p { margin: 0 0 1.1em; }
.detail-body p:first-child::first-letter {
  font-family: var(--font-display);
  font-weight: 700;
  float: left;
  font-size: 3.4em;
  line-height: 0.82;
  padding: 6px 10px 0 0;
  color: var(--ink);
}

.detail-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 34px;
  padding-top: 22px;
  border-top: 1px solid var(--paper-line);
}
.save-item {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  padding: 13px 20px;
  background: var(--paper);
  border: 1px solid var(--ink);
  box-shadow: 6px 6px 0 0 var(--ink);
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink);
  cursor: pointer;
  transition: box-shadow 0.16s ease, background 0.16s ease, color 0.16s ease;
}
.save-item:hover { box-shadow: 6px 6px 0 0 var(--pin); }
.save-item .save-icon svg { transition: fill 0.16s ease; fill: transparent; }
.save-item[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
  box-shadow: 6px 6px 0 0 var(--pin);
}
.save-item[aria-pressed="true"] .save-icon svg { fill: var(--pin); }

.detail-close-text {
  background: transparent;
  border: 0;
  padding: 13px 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-2);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 5px;
  text-decoration-thickness: 1px;
}
.detail-close-text:hover { color: var(--ink); }

/* detail category color theming */
.detail-overlay[data-cat="Culture"] .detail-header { color: var(--c-culture); }
.detail-overlay[data-cat="Food"] .detail-header { color: var(--c-food); }
.detail-overlay[data-cat="Movement"] .detail-header { color: var(--c-movement); }
.detail-overlay[data-cat="People"] .detail-header { color: var(--c-people); }
.detail-overlay[data-cat="Places"] .detail-header { color: var(--c-places); }
.detail-overlay[data-cat="Culture"] .detail-rule,
.detail-overlay[data-cat="Culture"] .detail-body p:first-child::first-letter { color: var(--c-culture); }
.detail-overlay[data-cat="Food"] .detail-rule,
.detail-overlay[data-cat="Food"] .detail-body p:first-child::first-letter { color: var(--c-food); }
.detail-overlay[data-cat="Movement"] .detail-rule,
.detail-overlay[data-cat="Movement"] .detail-body p:first-child::first-letter { color: var(--c-movement); }
.detail-overlay[data-cat="People"] .detail-rule,
.detail-overlay[data-cat="People"] .detail-body p:first-child::first-letter { color: var(--c-people); }
.detail-overlay[data-cat="Places"] .detail-rule,
.detail-overlay[data-cat="Places"] .detail-body p:first-child::first-letter { color: var(--c-places); }

/* ============================================================
   MOTION
   ============================================================ */
@keyframes dash-draw {
  from { stroke-dashoffset: 1400; }
  to { stroke-dashoffset: 0; }
}
@keyframes pop-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes panel-in {
  from { opacity: 0; transform: translateY(20px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes overlay-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes halo-pulse {
  0% { r: 18; opacity: 0; }
  40% { opacity: 0.5; }
  100% { r: 30; opacity: 0; }
}

.map-svg .line { animation: dash-draw 1.1s cubic-bezier(0.22,0.61,0.36,1) both; }
.trip { animation: pop-in 0.5s ease-out both; }
.trip:nth-child(1) { animation-delay: 0.04s; }
.trip:nth-child(2) { animation-delay: 0.08s; }
.trip:nth-child(3) { animation-delay: 0.12s; }
.trip:nth-child(4) { animation-delay: 0.16s; }
.trip:nth-child(5) { animation-delay: 0.20s; }
.trip:nth-child(6) { animation-delay: 0.24s; }
.trip:nth-child(7) { animation-delay: 0.28s; }
.trip:nth-child(8) { animation-delay: 0.32s; }
.detail-overlay { animation: overlay-in 0.22s ease-out both; }
.detail-panel { animation: panel-in 0.34s cubic-bezier(0.22,0.61,0.36,1) both; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .map-svg .line { stroke-dashoffset: 0 !important; }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 880px) {
  .kiosk { flex-direction: column; align-items: flex-start; gap: 12px; padding: 18px 20px; }
  .kiosk-meta { align-items: flex-start; text-align: left; max-width: none; }
  .network-head { align-items: flex-start; flex-direction: column; gap: 8px; }
  .controls { grid-template-columns: 1fr; gap: 14px; }
  .control-saved { align-items: stretch; }
  .saved-toggle { justify-content: center; width: 100%; }

  .board-grid { display: none; }
  .trip-open {
    grid-template-columns: 64px 1fr auto;
    grid-template-areas:
      "line dest time"
      "line status status";
    row-gap: 10px;
    column-gap: 12px;
    padding: 16px 18px;
  }
  .trip-line { grid-area: line; }
  .trip-dest { grid-area: dest; }
  .trip-time { grid-area: time; }
  .trip-status { grid-area: status; justify-content: flex-start; }
  .trip-bar { width: 5px; height: 100%; min-height: 44px; }

  .colophon-cols { grid-template-columns: 1fr; gap: 22px; }

  .map-svg .stop-code { display: none; }
  .map-legend { font-size: 10px; gap: 4px 10px; }
}

@media (max-width: 560px) {
  .map-legend { position: static; margin: 10px; display: inline-flex; }
  .detail-panel { padding: 26px 20px 32px; }
  .detail-title { font-size: clamp(28px, 9vw, 38px); }
  .detail-close { top: 10px; right: 10px; padding: 7px 10px; }
  .detail-actions { flex-direction: column; align-items: stretch; }
  .save-item { justify-content: center; }
  .detail-close-text { text-align: center; }
}
