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

:root {
  --ink: #0d1117;
  --ink-2: #454e5b;
  --page: #e6e9ec;
  --panel: #ffffff;
  --rule: #c9cfd6;
  --sign: #0d1117;
  --focus: #1f4fd1;

  --culture: #b0124f;
  --on-culture: #ffffff;
  --food: #ff8a1f;
  --on-food: #0d1117;
  --movement: #00695c;
  --on-movement: #ffffff;
  --people: #1f4fd1;
  --on-people: #ffffff;
  --places: #f5c400;
  --on-places: #0d1117;

  --display: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  --text: "Work Sans", "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --radius: 14px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { background: var(--page); -webkit-text-size-adjust: 100%; }
html.is-locked { overflow: hidden; }

body {
  margin: 0;
  font-family: var(--text);
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--page);
  text-rendering: optimizeLegibility;
}

h1, h2, h3 { font-family: var(--display); margin: 0; line-height: 1.05; }
p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { display: block; }

.mono { font-family: var(--mono); font-size: 0.8rem; letter-spacing: 0.02em; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

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

.skip-link {
  position: absolute; left: 16px; top: -60px; z-index: 50;
  background: var(--places); color: var(--ink);
  padding: 10px 16px; border-radius: 8px; font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: 12px; }

/* ---------- Sign bar (masthead) ---------- */
.signbar {
  background: var(--sign);
  color: #fff;
  border-bottom: 6px solid var(--places);
}
.signbar-inner {
  max-width: 1360px;
  margin: 0 auto;
  padding: 14px 40px;
  display: flex;
  align-items: center;
  gap: 28px;
}
.brand {
  display: inline-flex; align-items: center; gap: 14px;
  color: #fff; text-decoration: none;
  --focus: var(--places);
}
.brand-mark { width: 40px; height: 40px; flex: none; }
.brand-name {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.75rem;
  letter-spacing: -0.02em;
}
.signbar-tag { color: #c4cbd4; padding-left: 28px; border-left: 1px solid #39414c; }
.signbar-issue {
  margin-left: auto;
  background: #fff; color: var(--ink);
  padding: 6px 12px; border-radius: 999px;
  white-space: nowrap;
}

/* ---------- Intro ---------- */
.intro {
  max-width: 1360px;
  margin: 0 auto;
  padding: 56px 40px 40px;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  grid-template-areas: "text map" "lines lines";
  gap: 28px 56px;
  align-items: center;
}
.intro-text { grid-area: text; }
.kicker { text-transform: uppercase; color: var(--ink-2); margin-bottom: 18px; }
.intro h1 {
  font-size: clamp(2.6rem, 5.4vw, 4.9rem);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 0.98;
  max-width: 13ch;
}
.lede {
  margin-top: 24px;
  font-size: 1.2rem;
  line-height: 1.5;
  max-width: 44ch;
  color: #1f2630;
}
.network { grid-area: map; margin: 0; }
.network svg { width: 100%; height: auto; max-height: 300px; }

.lines { grid-area: lines; display: flex; align-items: center; gap: 18px; flex-wrap: wrap; border-top: 2px solid var(--ink); padding-top: 20px; }
.lines-label { text-transform: uppercase; color: var(--ink-2); }
.lines-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.line-btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 6px 14px 6px 6px;
  border-radius: 999px;
  border: 2px solid var(--ink);
  background: var(--panel);
  font-family: var(--display);
  font-weight: 600;
  font-size: 0.98rem;
  min-height: 44px;
  transition: background-color .15s, color .15s;
}
.line-btn .pict {
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--line); color: var(--on-line);
}
.line-btn .pict svg { width: 18px; height: 18px; }
.line-btn .n { font-family: var(--mono); font-weight: 400; font-size: 0.8rem; color: var(--ink-2); }
.line-btn:hover { background: #f4f6f8; }
.line-btn[aria-pressed="true"] { background: var(--ink); color: #fff; }
.line-btn[aria-pressed="true"] .n { color: #c4cbd4; }

/* ---------- Layout ---------- */
.layout {
  max-width: 1360px;
  margin: 0 auto;
  padding: 16px 40px 96px;
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  gap: 56px;
  align-items: start;
}

/* ---------- Board (controls) ---------- */
.board { position: sticky; top: 24px; }
.board-inner {
  background: var(--sign);
  color: #fff;
  border-radius: var(--radius);
  padding: 26px 24px 24px;
  --focus: var(--places);
  display: grid;
  gap: 20px;
}
.board-title { text-transform: uppercase; color: var(--places); font-weight: 400; font-size: 0.8rem; letter-spacing: 0.12em; }
.field { display: grid; gap: 8px; }
.field label { font-family: var(--display); font-weight: 600; font-size: 1rem; }
.search-wrap, .select-wrap { position: relative; }
.search-wrap svg {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 20px; height: 20px; color: var(--ink-2); pointer-events: none;
}
.board input, .board select {
  width: 100%;
  min-height: 50px;
  border-radius: 10px;
  border: 2px solid transparent;
  background: #fff;
  color: var(--ink);
  font-size: 1.02rem;
}
.board input { padding: 10px 14px 10px 44px; }
.board input::placeholder { color: #6a7380; }
.board select {
  appearance: none; -webkit-appearance: none;
  padding: 10px 44px 10px 14px;
  font-family: var(--display);
  font-weight: 500;
}
.select-wrap::after {
  content: "";
  position: absolute; right: 18px; top: 50%;
  width: 9px; height: 9px;
  border-right: 2.5px solid var(--ink); border-bottom: 2.5px solid var(--ink);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}
.board input:focus-visible, .board select:focus-visible { outline: 3px solid var(--places); outline-offset: 2px; }

.saved-toggle {
  display: flex; align-items: center; gap: 12px;
  width: 100%;
  min-height: 52px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 2px solid #4a535f;
  background: transparent;
  color: #fff;
  font-family: var(--display);
  font-weight: 600;
  text-align: left;
}
.saved-toggle svg { width: 22px; height: 22px; flex: none; }
.saved-toggle-text { flex: 1; }
.saved-count {
  min-width: 30px; height: 26px; padding: 0 8px;
  display: inline-grid; place-items: center;
  border-radius: 999px; background: #2a313b; color: #fff;
}
.saved-toggle:hover { border-color: #8c96a3; }
.saved-toggle[aria-pressed="true"] { background: var(--places); border-color: var(--places); color: var(--ink); }
.saved-toggle[aria-pressed="true"] svg path { fill: currentColor; }
.saved-toggle[aria-pressed="true"] .saved-count { background: var(--ink); color: #fff; }

.board-status { color: #c4cbd4; border-top: 1px dashed #3d4550; padding-top: 16px; }
.board-status strong { color: var(--places); font-weight: 400; }
.board-reset {
  justify-self: start;
  background: none; border: 0; padding: 4px 0;
  color: #fff; text-decoration: underline; text-underline-offset: 4px;
  font-weight: 500;
}

/* ---------- Route list ---------- */
.route-section:focus { outline: none; }
.route-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 18px; padding-bottom: 12px; border-bottom: 2px solid var(--ink); }
.route-head h2 { font-size: 1.6rem; letter-spacing: -0.02em; }
.route-sub { color: var(--ink-2); text-transform: uppercase; }

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

.stop {
  --line: var(--ink);
  --on-line: #fff;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  column-gap: 18px;
  position: relative;
}
.stop[data-category="Culture"], .detail[data-category="Culture"], .line-btn[data-category="Culture"] { --line: var(--culture); --on-line: var(--on-culture); }
.stop[data-category="Food"], .detail[data-category="Food"], .line-btn[data-category="Food"] { --line: var(--food); --on-line: var(--on-food); }
.stop[data-category="Movement"], .detail[data-category="Movement"], .line-btn[data-category="Movement"] { --line: var(--movement); --on-line: var(--on-movement); }
.stop[data-category="People"], .detail[data-category="People"], .line-btn[data-category="People"] { --line: var(--people); --on-line: var(--on-people); }
.stop[data-category="Places"], .detail[data-category="Places"], .line-btn[data-category="Places"] { --line: var(--places); --on-line: var(--on-places); }

/* the track */
.stop::before {
  content: "";
  position: absolute;
  left: 26px; top: 0; bottom: 0;
  width: 12px;
  background: var(--line);
}
.stop:first-child::before { top: 36px; border-radius: 6px 6px 0 0; }
.stop:last-child::before { bottom: calc(100% - 48px); border-radius: 0 0 6px 6px; }
.stop:only-child::before { display: none; }

.stop-marker {
  position: relative; z-index: 1;
  width: 64px; height: 64px;
  margin-top: 8px;
  border-radius: 50%;
  background: #fff;
  border: 6px solid var(--ink);
  display: grid; place-items: center;
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 400;
}

.stop-card {
  position: relative;
  margin-bottom: 20px;
  background: var(--panel);
  border-radius: var(--radius);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 132px;
  overflow: hidden;
  box-shadow: 0 1px 0 var(--rule);
  transition: transform .18s ease, box-shadow .18s ease;
}
.stop-card:hover { transform: translateX(4px); box-shadow: 0 1px 0 var(--rule), -4px 0 0 var(--line); }
.stop-body { padding: 22px 26px 24px; display: grid; gap: 10px; align-content: start; }
.stop-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; color: var(--ink-2); }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px 3px 6px;
  border-radius: 999px;
  background: var(--line); color: var(--on-line);
  font-family: var(--display); font-weight: 600; font-size: 0.82rem; letter-spacing: 0;
}
.chip svg { width: 15px; height: 15px; }
.stop-title { font-size: 1.85rem; font-weight: 600; letter-spacing: -0.025em; line-height: 1.1; }
.stop-open {
  all: unset;
  cursor: pointer;
  text-wrap: balance;
}
.stop-open::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); z-index: 1; }
.stop-open:focus-visible { outline: none; }
.stop-open:focus-visible::after { outline: 3px solid var(--focus); outline-offset: 3px; }
.stop-card:hover .stop-open { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 5px; text-decoration-color: var(--line); }
.stop-summary { color: #27303b; max-width: 60ch; }
.stop-foot { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 4px; }
.stop-by { font-weight: 500; }
.stop-read { font-family: var(--display); font-weight: 600; font-size: 0.95rem; display: inline-flex; align-items: center; gap: 6px; margin-left: auto; }
.stop-read svg { width: 18px; height: 18px; transition: transform .18s; }
.stop-card:hover .stop-read svg { transform: translateX(4px); }
.saved-tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--mono); font-size: 0.75rem; text-transform: uppercase;
  background: var(--ink); color: #fff; padding: 3px 9px; border-radius: 6px;
}
.saved-tag svg { width: 12px; height: 12px; }

.stop-platform {
  background: var(--line);
  color: var(--on-line);
  display: grid;
  align-content: space-between;
  justify-items: start;
  padding: 18px 16px;
}
.stop-platform svg { width: 44px; height: 44px; }
.stop-platform span { font-family: var(--display); font-weight: 700; font-size: 1.05rem; letter-spacing: -0.01em; }

/* ---------- Empty state ---------- */
.empty {
  background: var(--panel);
  border: 2px dashed var(--ink-2);
  border-radius: var(--radius);
  padding: 40px 32px;
  display: grid;
  justify-items: start;
  gap: 12px;
}
.empty svg { width: 64px; height: 64px; }
.empty h3 { font-size: 1.6rem; letter-spacing: -0.02em; }
.empty p { color: var(--ink-2); max-width: 48ch; }
.load-error { padding: 24px; background: #fff; border-radius: var(--radius); border-left: 8px solid var(--culture); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px;
  padding: 10px 18px;
  border-radius: 10px;
  border: 2px solid var(--ink);
  font-family: var(--display);
  font-weight: 600;
  font-size: 1rem;
  background: #fff; color: var(--ink);
}
.btn svg { width: 20px; height: 20px; flex: none; }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: #262e38; }
.btn-ghost { border-color: transparent; background: transparent; padding-left: 8px; }
.btn-ghost:hover { background: #eef1f4; }

/* ---------- Footer ---------- */
.footer { background: var(--sign); color: #c4cbd4; border-top: 6px solid var(--places); }
.footer-inner { max-width: 1360px; margin: 0 auto; padding: 32px 40px 40px; display: flex; flex-wrap: wrap; gap: 10px 32px; align-items: baseline; }
.footer-brand { font-family: var(--display); font-weight: 700; font-size: 1.3rem; color: #fff; }

/* ---------- Detail dialog ---------- */
.detail {
  --line: var(--ink);
  --on-line: #fff;
  margin: 0 0 0 auto;
  padding: 0;
  border: 0;
  width: min(780px, 100vw);
  max-width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-height: none;
  background: var(--panel);
  color: var(--ink);
  box-shadow: -24px 0 60px rgba(13, 17, 23, .28);
  overflow: hidden;
}
.detail::backdrop { background: rgba(13, 17, 23, .6); }
.detail[open] { animation: slide-in .28s cubic-bezier(.2, .7, .2, 1); }
@keyframes slide-in { from { transform: translateX(48px); opacity: 0; } to { transform: none; opacity: 1; } }

.detail-inner { height: 100%; overflow-y: auto; overscroll-behavior: contain; }
.detail-bar {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 20px;
  background: rgba(255, 255, 255, .96);
  border-bottom: 1px solid var(--rule);
}
.save-btn[aria-pressed="true"] { background: var(--ink); color: #fff; }
.save-btn[aria-pressed="true"] svg path { fill-opacity: 1; }
.save-btn:hover { background: #eef1f4; }
.save-btn[aria-pressed="true"]:hover { background: #262e38; }

.story-band {
  background: var(--line); color: var(--on-line);
  padding: 28px 48px 26px;
  display: flex; align-items: center; gap: 18px;
}
.story-band .pict {
  width: 64px; height: 64px; border-radius: 50%;
  border: 3px solid currentColor;
  display: grid; place-items: center; flex: none;
}
.story-band .pict svg { width: 34px; height: 34px; }
.story-band-text { display: grid; gap: 2px; }
.story-band-line { font-family: var(--display); font-weight: 700; font-size: 1.35rem; letter-spacing: -0.01em; }
.story-band-stop { font-family: var(--mono); font-size: 0.82rem; }

.story-head { padding: 36px 48px 8px; display: grid; gap: 18px; }
.story-head h2 { font-size: clamp(2rem, 4.2vw, 3.1rem); font-weight: 700; letter-spacing: -0.03em; line-height: 1.02; }
.story-head h2:focus { outline: none; }
.story-standfirst { font-size: 1.28rem; line-height: 1.45; color: #1f2630; font-weight: 500; }
.story-meta {
  display: flex; flex-wrap: wrap; gap: 8px 20px;
  font-family: var(--mono); font-size: 0.82rem; color: var(--ink-2);
  padding: 14px 0; border-top: 2px solid var(--ink); border-bottom: 1px solid var(--rule);
}
.story-meta b { color: var(--ink); font-weight: 400; }
.story-body { padding: 24px 48px 40px; max-width: 68ch; }
.story-body p { font-size: 1.14rem; line-height: 1.72; margin: 0 0 1.2em; }
.story-body p:first-child::first-letter {
  float: left;
  font-family: var(--display); font-weight: 700;
  font-size: 3.6em; line-height: 0.82;
  padding: 6px 12px 0 0;
  color: var(--ink);
}
.story-end { display: inline-block; width: 14px; height: 14px; border-radius: 50%; background: var(--line); border: 3px solid var(--ink); vertical-align: -1px; margin-left: 6px; }
.story-note { margin: 0 48px; padding: 14px 0 0; border-top: 1px solid var(--rule); font-family: var(--mono); font-size: 0.75rem; color: var(--ink-2); }

.story-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 28px 48px 48px; }
.story-nav-btn {
  display: grid; gap: 4px; text-align: left;
  padding: 16px 18px; min-height: 76px;
  border-radius: 12px; border: 2px solid var(--rule);
  background: #f4f6f8;
}
.story-nav-btn.next { text-align: right; }
.story-nav-btn:hover { border-color: var(--ink); }
.story-nav-btn .dir { font-family: var(--mono); font-size: 0.75rem; text-transform: uppercase; color: var(--ink-2); }
.story-nav-btn .t { font-family: var(--display); font-weight: 600; font-size: 1.02rem; line-height: 1.25; }
.story-nav-btn[hidden] { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .intro { grid-template-columns: 1fr; grid-template-areas: "text" "lines"; }
  .network { display: none; }
  .layout { grid-template-columns: 1fr; gap: 28px; }
  .board { position: static; }
  .board-inner { grid-template-columns: 1fr 1fr; align-items: end; }
  .board-title, .board-status, .board-reset { grid-column: 1 / -1; }
}

@media (max-width: 720px) {
  body { font-size: 16px; }
  .signbar-inner { padding: 12px 18px; gap: 12px; }
  .brand-mark { width: 32px; height: 32px; }
  .brand-name { font-size: 1.4rem; }
  .signbar-tag { display: none; }
  .signbar-issue { font-size: 0.72rem; padding: 5px 10px; }
  .signbar-issue span:nth-child(2), .signbar-issue span:nth-child(3) { display: none; }

  .intro { padding: 32px 18px 20px; gap: 22px; }
  .intro h1 { font-size: 2.55rem; }
  .lede { font-size: 1.06rem; margin-top: 16px; }
  .lines { gap: 12px; }
  .lines-list { flex-wrap: nowrap; overflow-x: auto; margin: 0 -18px; padding: 4px 18px 8px; width: calc(100% + 36px); scrollbar-width: none; }
  .lines-list li { flex: none; }

  .layout { padding: 8px 18px 64px; }
  .board-inner { grid-template-columns: 1fr; padding: 20px 18px; gap: 16px; }

  .route-head h2 { font-size: 1.35rem; }
  .stop { grid-template-columns: 40px minmax(0, 1fr); column-gap: 12px; }
  .stop::before { left: 15px; width: 10px; }
  .stop:first-child::before { top: 26px; }
  .stop:last-child::before { bottom: calc(100% - 34px); }
  .stop-marker { width: 40px; height: 40px; border-width: 4px; font-size: 0.8rem; margin-top: 6px; }
  .stop-card { grid-template-columns: 1fr; margin-bottom: 14px; }
  .stop-card:hover { transform: none; }
  .stop-platform { display: none; }
  .stop-body { padding: 18px 18px 20px; }
  .stop-title { font-size: 1.4rem; }
  .stop-summary { font-size: 0.98rem; }

  .detail { width: 100vw; box-shadow: none; }
  .detail-bar { padding: 10px 12px; }
  .detail-bar .btn { padding: 8px 12px; font-size: 0.95rem; }
  .story-band { padding: 20px 20px; }
  .story-band .pict { width: 50px; height: 50px; }
  .story-band .pict svg { width: 26px; height: 26px; }
  .story-head { padding: 26px 20px 4px; }
  .story-standfirst { font-size: 1.1rem; }
  .story-body { padding: 20px 20px 28px; }
  .story-body p { font-size: 1.06rem; }
  .story-note { margin: 0 20px; }
  .story-nav { grid-template-columns: 1fr; padding: 24px 20px 40px; }
  .story-nav-btn.next { text-align: left; }
  .footer-inner { padding: 28px 18px 36px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .stop-card:hover { transform: none; }
}
