@font-face {
  font-family: "Oswald";
  src: url("assets/oswald.ttf") format("truetype");
  font-weight: 200 700;
  font-display: swap;
}
@font-face {
  font-family: "Literata";
  src: url("assets/literata.ttf") format("truetype");
  font-weight: 200 900;
  font-display: swap;
}

:root {
  --ink: #12202b;
  --ink-soft: #3d4d59;
  --paper: #eaeff1;
  --sheet: #f8f9f9;
  --rule: #c5d0d6;
  --signal: #f2c230;
  --focus: #0b57d0;

  --culture: #b3226a;
  --food: #b24e05;
  --movement: #1b5fc1;
  --people: #1c7448;
  --places: #6a43b8;

  --display: "Oswald", "Arial Narrow", "Helvetica Neue", sans-serif;
  --text: "Literata", Georgia, "Times New Roman", serif;
}

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

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--text);
  font-size: 1rem;
  line-height: 1.55;
}
body.is-locked { overflow: hidden; }

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

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: 380px minmax(0, 1fr); min-height: 100vh; }

.station {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 44px 36px 32px;
  background: var(--ink);
  color: #eef3f5;
  overflow-y: auto;
}

.masthead {
  display: block;
  color: inherit;
  text-decoration: none;
  font-family: var(--display);
  font-weight: 700;
  font-size: 108px;
  line-height: 0.86;
  letter-spacing: -0.01em;
}
.masthead-word { display: block; }
.masthead:focus-visible { outline-color: var(--signal); }

.stripe { display: flex; height: 10px; margin: 26px 0 16px; }
.stripe i { flex: 1; }
.stripe i:nth-child(1) { background: var(--culture); }
.stripe i:nth-child(2) { background: var(--food); }
.stripe i:nth-child(3) { background: var(--movement); }
.stripe i:nth-child(4) { background: var(--people); }
.stripe i:nth-child(5) { background: var(--places); }

.tagline { margin: 0 0 36px; font-size: 1.0625rem; font-style: italic; color: #cbd6dc; }

.controls { display: grid; gap: 18px; }
.field { display: grid; gap: 6px; }
.field label { font-family: var(--display); font-weight: 500; font-size: 1.0625rem; letter-spacing: 0.02em; }

.field input,
.field select {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border: 2px solid transparent;
  border-radius: 2px;
  background: #f4f7f8;
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
}
.field select {
  appearance: none;
  padding-right: 44px;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position: calc(100% - 22px) 52%, calc(100% - 16px) 52%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}
.field input::placeholder { color: #5b6b76; }
.field input:focus-visible,
.field select:focus-visible { outline-color: var(--signal); outline-offset: 2px; }

.saved-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 16px;
  border: 2px solid #5d7283;
  border-radius: 2px;
  background: transparent;
  color: inherit;
  font-family: var(--display);
  font-weight: 500;
  font-size: 1.1875rem;
  letter-spacing: 0.02em;
  cursor: pointer;
  text-align: left;
}
.saved-toggle:hover { border-color: var(--signal); }
.saved-toggle:focus-visible { outline-color: var(--signal); }
.saved-toggle .saved-count {
  margin-left: auto;
  min-width: 28px;
  padding: 1px 8px;
  border-radius: 14px;
  background: #2b3d4b;
  text-align: center;
  font-size: 1rem;
}
.saved-toggle[aria-pressed="true"] { background: var(--signal); border-color: var(--signal); color: var(--ink); }
.saved-toggle[aria-pressed="true"] .saved-count { background: var(--ink); color: var(--signal); }

.fine { margin: auto 0 0; padding-top: 32px; font-size: 0.875rem; color: #aebdc6; }

/* ---------- list ("route") ---------- */
.route { padding: 56px 72px 96px 56px; max-width: 1060px; }

.route-head { display: flex; align-items: baseline; justify-content: space-between; gap: 24px; margin-bottom: 36px; padding-bottom: 14px; border-bottom: 2px solid var(--ink); }
.route-title { margin: 0; font-family: var(--display); font-weight: 600; font-size: 1.75rem; line-height: 1.1; }
.result-count { margin: 0; font-size: 0.9375rem; color: var(--ink-soft); }

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

.stop {
  --line: var(--ink);
  position: relative;
  display: grid;
  grid-template-columns: 96px 48px minmax(0, 1fr);
  padding-bottom: 52px;
}
.stop[data-cat="Culture"] { --line: var(--culture); }
.stop[data-cat="Food"] { --line: var(--food); }
.stop[data-cat="Movement"] { --line: var(--movement); }
.stop[data-cat="People"] { --line: var(--people); }
.stop[data-cat="Places"] { --line: var(--places); }

.stop-date { padding-top: 2px; text-align: right; padding-right: 8px; font-family: var(--display); font-weight: 500; font-size: 1.75rem; line-height: 1.05; }
.stop-date small { display: block; font-family: var(--text); font-weight: 400; font-size: 0.8125rem; color: var(--ink-soft); }

.track { position: relative; }
.track::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 14px;
  bottom: 0;
  width: 8px;
  margin-left: -4px;
  background: var(--line);
  transform-origin: top;
  animation: draw 700ms cubic-bezier(.3, .7, .2, 1) both;
  animation-delay: calc(var(--i, 0) * 110ms);
}
.stop.is-last .track::before { display: none; }
.dot {
  position: absolute;
  left: 50%;
  top: 4px;
  width: 28px;
  height: 28px;
  margin-left: -14px;
  border: 6px solid var(--line);
  border-radius: 50%;
  background: var(--paper);
}
.stop.is-saved .dot { background: var(--signal); }

@keyframes draw { from { transform: scaleY(0); } to { transform: scaleY(1); } }

.stop-body { position: relative; padding-left: 12px; }
.stop-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin-bottom: 6px; font-family: var(--display); font-weight: 500; font-size: 1.125rem; letter-spacing: 0.02em; }
.stop-cat { color: var(--line); }
.stop-saved { display: none; align-items: center; gap: 5px; padding: 0 8px 0 6px; background: var(--signal); color: var(--ink); font-size: 0.9375rem; }
.stop.is-saved .stop-saved { display: inline-flex; }

.stop-title { margin: 0 0 10px; font-family: var(--display); font-weight: 500; font-size: clamp(2rem, 3.2vw, 2.75rem); line-height: 1.08; letter-spacing: -0.005em; text-wrap: balance; }
.open {
  all: unset;
  cursor: pointer;
}
.open::after { content: ""; position: absolute; inset: -6px -12px 0 -60px; }
.open:focus-visible { outline: none; }
.open:focus-visible::after { outline: 3px solid var(--focus); outline-offset: 0; }
.stop:hover .open { text-decoration: underline; text-decoration-thickness: 3px; text-decoration-color: var(--line); text-underline-offset: 6px; }

.stop-summary { margin: 0 0 10px; max-width: 58ch; font-size: 1.125rem; line-height: 1.6; }
.stop-meta { margin: 0; font-size: 0.9375rem; color: var(--ink-soft); display: flex; flex-wrap: wrap; gap: 2px 16px; }
.stop-meta .when { display: none; }

/* ---------- empty / error ---------- */
.empty { margin-top: 8px; padding: 32px; max-width: 560px; border: 2px dashed var(--ink-soft); }
.empty h3 { margin: 0 0 8px; font-family: var(--display); font-weight: 600; font-size: 1.75rem; line-height: 1.1; }
.empty p { margin: 0 0 20px; }
.btn {
  min-height: 48px;
  padding: 0 22px;
  border: 2px solid var(--ink);
  border-radius: 2px;
  background: var(--ink);
  color: #fff;
  font-family: var(--display);
  font-weight: 500;
  font-size: 1.125rem;
  letter-spacing: 0.02em;
  cursor: pointer;
}
.btn:hover { background: #24394a; }
.load-error { padding: 20px; border: 2px solid var(--culture); }

/* ---------- detail sheet ---------- */
.sheet {
  --line: var(--ink);
  margin: 0 0 0 auto;
  padding: 0;
  width: min(920px, 100vw);
  max-width: none;
  height: 100dvh;
  max-height: none;
  border: 0;
  background: var(--sheet);
  color: var(--ink);
  overflow-y: auto;
  overscroll-behavior: contain;
  box-shadow: -18px 0 40px rgba(10, 20, 30, 0.28);
}
.sheet[data-cat="Culture"] { --line: var(--culture); }
.sheet[data-cat="Food"] { --line: var(--food); }
.sheet[data-cat="Movement"] { --line: var(--movement); }
.sheet[data-cat="People"] { --line: var(--people); }
.sheet[data-cat="Places"] { --line: var(--places); }
.sheet::backdrop { background: rgba(10, 20, 30, 0.6); }
.sheet[open] { animation: slide-in 260ms cubic-bezier(.2, .8, .2, 1); }
.sheet[open]::backdrop { animation: fade-in 260ms ease; }
@keyframes slide-in { from { transform: translateX(48px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.sheet-bar {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--sheet);
  border-bottom: 1px solid var(--rule);
}
.sheet-bar-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 40px; }
.progress { height: 6px; background: var(--rule); }
.progress i { display: block; height: 100%; width: 0; background: var(--line); }

.bar-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 18px;
  border: 2px solid var(--ink);
  border-radius: 2px;
  background: transparent;
  color: var(--ink);
  font-family: var(--display);
  font-weight: 500;
  font-size: 1.125rem;
  letter-spacing: 0.02em;
  cursor: pointer;
}
.bar-btn:hover { background: #e3e9ec; }
.bar-btn[aria-pressed="true"] { background: var(--signal); border-color: var(--ink); }
.bar-btn svg { flex: none; }

.article { padding: 48px 40px 96px; }
.article-inner { max-width: 680px; }
.article-cat { display: inline-flex; align-items: center; gap: 10px; margin: 0 0 14px; font-family: var(--display); font-weight: 500; font-size: 1.25rem; letter-spacing: 0.02em; color: var(--line); }
.article-cat::before { content: ""; width: 20px; height: 20px; border: 5px solid var(--line); border-radius: 50%; }
.article-title { margin: 0 0 20px; font-family: var(--display); font-weight: 600; font-size: clamp(2.5rem, 5vw, 4rem); line-height: 1.04; letter-spacing: -0.01em; text-wrap: balance; }
.article-dek { margin: 0 0 24px; font-size: 1.375rem; line-height: 1.5; font-style: italic; color: var(--ink-soft); }
.article-meta { display: flex; flex-wrap: wrap; gap: 4px 20px; margin: 0 0 36px; padding: 14px 0; border-block: 2px solid var(--line); font-size: 0.9375rem; }
.article-meta strong { font-weight: 700; }
.article-body p { margin: 0 0 1.35em; font-size: 1.25rem; line-height: 1.75; font-optical-sizing: auto; }
.article-body p:first-child::first-line { font-weight: 600; }

/* ---------- mobile ---------- */
@media (max-width: 980px) {
  .shell { display: block; }
  .station { position: static; height: auto; padding: 24px 20px 24px; overflow: visible; }
  .masthead { display: flex; gap: 0.25em; font-size: 56px; line-height: 1; }
  .stripe { margin: 14px 0 12px; height: 8px; }
  .tagline { margin-bottom: 20px; font-size: 1rem; }
  .controls { grid-template-columns: 1fr 1fr; gap: 14px 12px; }
  .controls .field:first-child { grid-column: 1 / -1; }
  .saved-toggle { align-self: end; min-height: 48px; padding: 0 12px; font-size: 1.0625rem; }
  .fine { display: none; }

  .route { padding: 28px 20px 72px; }
  .route-head { margin-bottom: 28px; }

  .stop { grid-template-columns: 36px minmax(0, 1fr); padding-bottom: 40px; }
  .stop-date { display: none; }
  .stop .track { grid-column: 1; }
  .stop-body { grid-column: 2; padding-left: 8px; }
  .dot { width: 24px; height: 24px; margin-left: -12px; border-width: 5px; top: 3px; }
  .track::before { width: 6px; margin-left: -3px; top: 12px; }
  .open::after { inset: -6px -4px 0 -44px; }
  .stop-title { font-size: 1.875rem; }
  .stop-summary { font-size: 1.0625rem; }
  .stop-meta .when { display: inline; }

  .sheet-bar-row { padding: 10px 16px; }
  .bar-btn { padding: 0 14px; font-size: 1.0625rem; }
  .article { padding: 32px 20px 72px; }
  .article-title { font-size: 2.5rem; }
  .article-dek { font-size: 1.1875rem; }
  .article-body p { font-size: 1.125rem; line-height: 1.7; }
}

@media (max-width: 480px) {
  .bar-btn .long { display: none; }
}
@media (max-width: 400px) {
  .masthead { font-size: 48px; }
}

@media (prefers-reduced-motion: reduce) {
  .track::before, .sheet[open], .sheet[open]::backdrop { animation: none; }
}
