/* LAST STOP · Route No. 8 — night-bus journal */
@font-face { font-family: "Oswald"; src: url("assets/oswald.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "Space Grotesk"; src: url("assets/space-grotesk.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "DM Sans"; src: url("assets/dm-sans.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("assets/ibm-plex-mono.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "Literata"; src: url("assets/literata.ttf") format("truetype"); font-display: swap; }

:root {
  --depot: #101736;
  --depot-2: #0a0f26;
  --asphalt: #18204a;
  --paper: #fdf6e7;
  --paper-2: #f7ecd2;
  --ink: #141a33;
  --signal: #ffc700;
  --coral: #ff5a3c;
  --mint: #7de3a8;
  --sky: #8fd0ff;
  --lilac: #c9b3ff;
  --line: #2b3568;
  --muted: #c7cdea;
  --focus: #ffffff;
  --radius: 14px;
  --cat-Culture: #c9b3ff;
  --cat-Food: #ffb35c;
  --cat-Movement: #8fd0ff;
  --cat-People: #ff9ecf;
  --cat-Places: #7de3a8;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; color-scheme: dark; }
body {
  margin: 0;
  overflow-x: hidden;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(255,199,0,.35);
  background:
    radial-gradient(1200px 500px at 80% -100px, #232c63 0%, transparent 60%),
    repeating-linear-gradient(0deg, transparent 0 34px, rgba(255,255,255,.025) 34px 35px),
    linear-gradient(var(--depot-2), var(--depot));
  color: var(--paper);
  font-family: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.55;
  min-height: 100vh;
}

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

.skip {
  position: absolute; left: 12px; top: -60px; z-index: 200;
  background: var(--signal); color: #111; font-weight: 700;
  padding: .6rem 1rem; border-radius: 0 0 10px 10px; text-decoration: none;
  transition: top .15s ease;
}
.skip:focus { top: 0; }

/* ---------- destination blind ---------- */
.blind { border-bottom: 6px solid #05081a; }
.blind-top {
  background: #05081a;
  padding: clamp(1.2rem, 3vw, 2.2rem) clamp(1rem, 4vw, 3rem) 1.2rem;
}
.blind-eyebrow {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  color: var(--signal); font-size: .8rem; letter-spacing: .14em;
  text-transform: uppercase; margin: 0 0 .8rem;
  display: flex; align-items: center; gap: .6rem;
}
.dot-live {
  width: .65em; height: .65em; border-radius: 50%;
  background: var(--coral); display: inline-block;
  box-shadow: 0 0 10px var(--coral);
  animation: blink 1.6s infinite;
}
@keyframes blink { 50% { opacity: .35; } }
.blind-main {
  display: grid; grid-template-columns: 1.2fr .8fr; gap: 1.5rem; align-items: end;
}
.kicker {
  font-family: "IBM Plex Mono", monospace; color: var(--muted);
  text-transform: uppercase; letter-spacing: .22em; font-size: .75rem; margin: 0 0 .3rem;
}
.masthead {
  font-family: "Oswald", "Arial Narrow", sans-serif;
  font-size: clamp(3.2rem, 10vw, 7rem);
  line-height: .95; margin: 0; letter-spacing: .01em;
  color: var(--signal);
  text-shadow: 0 0 22px rgba(255,199,0,.35), 4px 4px 0 var(--coral);
}
.tagline { color: var(--muted); max-width: 34ch; margin: .7rem 0 0; }
.tagline em { color: var(--paper); }
.blind-sign {
  background: #0b1030; border: 3px solid #2b3568; border-radius: 12px;
  overflow: hidden; font-family: "IBM Plex Mono", monospace;
  box-shadow: inset 0 0 30px rgba(0,0,0,.7);
}
.sign-row {
  display: flex; gap: 1rem; align-items: center;
  background: var(--signal); color: #111; font-weight: 700;
  font-size: clamp(1.4rem, 3vw, 2.2rem); padding: .4rem 1rem;
}
.sign-row span:first-child {
  background: #111; color: var(--signal); border-radius: 8px;
  padding: 0 .55rem;
}
.sign-sub { color: var(--signal); padding: .55rem 1rem; font-size: .8rem; letter-spacing: .08em; }

/* bus window */
.window { background: #05081a; padding: 0 clamp(1rem, 4vw, 3rem) 1rem; }
.window-glass {
  position: relative; border: 6px solid #2b3568; border-bottom-width: 10px;
  border-radius: 18px; overflow: hidden;
  background: linear-gradient(#2a3a7d 0%, #4a4a9e 55%, #b3543f 78%, #ff9a5c 100%);
  min-height: 150px;
}
.skyline { position: absolute; inset: auto 0 18px 0; width: 100%; height: 120px; }
.win-lights rect { animation: flick 3s infinite; }
.win-lights rect:nth-child(3n) { animation-delay: 1s; }
@keyframes flick { 50% { opacity: .4; } }
.lamps {
  position: absolute; top: 12px; left: 0; right: 0;
  display: flex; justify-content: space-around;
}
.lamps i {
  width: 34px; height: 10px; border-radius: 999px;
  background: radial-gradient(ellipse at center, #fff8d6, #ffc700);
  box-shadow: 0 6px 24px 6px rgba(255,199,0,.45);
}
.bus-rail {
  position: absolute; left: 0; right: 0; bottom: 8px; height: 3px;
  display: flex; gap: 0; justify-content: space-evenly;
}
.bus-rail span { width: 60px; height: 3px; background: rgba(255,255,255,.35); border-radius: 2px; }
.window-caption {
  position: absolute; right: 10px; bottom: 22px;
  font-family: "IBM Plex Mono", monospace; font-size: .68rem;
  background: rgba(5,8,26,.8); color: var(--muted);
  padding: .25rem .6rem; border-radius: 999px; margin: 0;
}

/* ticker */
.ticker {
  background: var(--coral); color: #180a06; overflow: hidden;
  border-top: 4px solid #05081a; border-bottom: 4px solid #05081a;
  font-family: "IBM Plex Mono", monospace; font-size: .82rem; font-weight: 700;
  white-space: nowrap; padding: .45rem 0;
}
.ticker-track { display: inline-flex; gap: 2.5rem; padding-left: 1rem; animation: roll 40s linear infinite; }
@keyframes roll { to { transform: translateX(-50%); } }

/* ---------- farebox ---------- */
.farebox-wrap { padding: clamp(1rem, 3vw, 2rem) clamp(1rem, 4vw, 3rem) 0; max-width: 1100px; margin: 0 auto; }
.farebox {
  background: linear-gradient(180deg, var(--paper), var(--paper-2));
  color: var(--ink); border-radius: var(--radius);
  border: 3px dashed var(--ink);
  box-shadow: 8px 8px 0 rgba(0,0,0,.45);
  padding: clamp(1rem, 2.5vw, 1.6rem);
}
.farebox-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; }
.farebox-head h2 { font-family: "Space Grotesk", sans-serif; margin: 0; font-size: 1.25rem; }
.farebox-head p { font-family: "IBM Plex Mono", monospace; font-size: .8rem; margin: 0; background: var(--ink); color: var(--signal); padding: .25rem .7rem; border-radius: 999px; }
.farebox-grid { display: grid; grid-template-columns: 1.2fr .8fr 1fr; gap: 1rem; margin-top: 1rem; }
.field label, .field-label {
  display: block; font-family: "IBM Plex Mono", monospace; font-size: .72rem;
  text-transform: uppercase; letter-spacing: .12em; font-weight: 700; margin-bottom: .4rem;
}
.field select { background-color: #fff; color: var(--ink); }
.field input, .field select {
  width: 100%; font: inherit; font-size: 1rem; color: var(--ink);
  background: #fff; border: 2px solid var(--ink); border-radius: 10px;
  padding: .65rem .8rem;
}
.field input::placeholder { color: #8a8fa8; }
#savedFilter {
  display: flex; align-items: center; gap: .6rem; width: 100%;
  font: inherit; font-weight: 700; cursor: pointer;
  background: #fff; color: var(--ink); border: 2px solid var(--ink); border-radius: 10px;
  padding: .6rem .8rem;
}
#savedFilter .stub { font-size: 1.3rem; }
#savedFilter .count-bubble {
  margin-left: auto; background: var(--ink); color: var(--signal);
  font-family: "IBM Plex Mono", monospace; font-size: .8rem;
  min-width: 1.8em; height: 1.8em; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px;
}
#savedFilter[aria-pressed="true"] { background: var(--ink); color: var(--signal); }
#savedFilter[aria-pressed="true"] .count-bubble { background: var(--signal); color: #111; }
.hint { font-size: .8rem; color: #4a5170; margin: .4rem 0 0; }
.farebox-foot { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-top: 1rem; flex-wrap: wrap; }
.announce { font-family: "IBM Plex Mono", monospace; font-size: .8rem; margin: 0; min-height: 1.2em; }
.random {
  font: inherit; font-weight: 700; cursor: pointer;
  background: var(--coral); color: #fff; border: 2px solid var(--ink); border-radius: 999px;
  padding: .55rem 1.1rem; box-shadow: 3px 3px 0 var(--ink);
}
.random:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }

/* ---------- route ---------- */
#route { max-width: 1100px; margin: 0 auto; padding: 2rem clamp(1rem, 4vw, 3rem) 3rem; }
.route-intro h2 {
  font-family: "Oswald", sans-serif; font-size: 2rem; margin: 0;
  display: flex; align-items: center; gap: .8rem;
}
.route-line { flex: 1; height: 6px; background: repeating-linear-gradient(90deg, var(--signal) 0 26px, transparent 26px 40px); border-radius: 3px; min-width: 60px; }
.route-intro p { color: var(--muted); max-width: 62ch; }
.route-intro kbd { font-family: "IBM Plex Mono", monospace; background: var(--ink); border: 1px solid var(--line); border-bottom-width: 3px; border-radius: 6px; padding: 0 .45rem; }

.stops { list-style: none; margin: 2rem 0 0; padding: 0 0 0 8px; position: relative; }
.stops::before {
  content: ""; position: absolute; left: 27px; top: 10px; bottom: 10px; width: 6px;
  background: repeating-linear-gradient(180deg, var(--signal) 0 22px, #3a467f 22px 34px);
  border-radius: 3px;
}
.stop {
  position: relative; display: grid; grid-template-columns: 1fr 220px; gap: 1.2rem;
  background: linear-gradient(180deg, var(--paper), var(--paper-2));
  color: var(--ink); border-radius: var(--radius);
  border: 2px solid var(--ink);
  margin: 0 0 1.4rem 52px; padding: 1.1rem 1.2rem 1.2rem;
  box-shadow: 6px 6px 0 rgba(0,0,0,.45);
  scroll-margin-top: 1rem;
}
.stop::before {
  content: attr(data-stop);
  position: absolute; left: -52px; top: 14px; width: 40px; height: 40px;
  background: var(--ink); color: var(--signal);
  border: 3px solid var(--signal); border-radius: 50%;
  font-family: "IBM Plex Mono", monospace; font-weight: 700; font-size: .8rem;
  display: flex; align-items: center; justify-content: center;
}
.stop[data-cat="Culture"] { border-top: 10px solid var(--cat-Culture); }
.stop[data-cat="Food"] { border-top: 10px solid var(--cat-Food); }
.stop[data-cat="Movement"] { border-top: 10px solid var(--cat-Movement); }
.stop[data-cat="People"] { border-top: 10px solid var(--cat-People); }
.stop[data-cat="Places"] { border-top: 10px solid var(--cat-Places); }
.stop-top { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-bottom: .5rem; }
.badge {
  font-family: "IBM Plex Mono", monospace; font-size: .7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .1em;
  background: var(--ink); color: #fff; border-radius: 999px; padding: .2rem .7rem;
}
.stop[data-cat="Culture"] .badge { background: #4b3480; color: #efe6ff; }
.stop[data-cat="Food"] .badge { background: #8a4a00; color: #ffedd2; }
.stop[data-cat="Movement"] .badge { background: #0d4a70; color: #dff1ff; }
.stop[data-cat="People"] .badge { background: #8a2358; color: #ffe3f1; }
.stop[data-cat="Places"] .badge { background: #14532d; color: #dcfce7; }
.meta { font-family: "IBM Plex Mono", monospace; font-size: .72rem; color: #5a6185; }
.stop h3 { font-family: "Space Grotesk", sans-serif; font-size: 1.35rem; line-height: 1.2; margin: 0 0 .4rem; text-wrap: balance; overflow-wrap: break-word; }
.stop .summary { overflow-wrap: break-word; }
.stop .summary { margin: 0 0 .8rem; color: #2c3352; }
.stop-thumb { border-radius: 10px; overflow: hidden; border: 2px solid var(--ink); align-self: start; }
.stop-thumb img { display: block; width: 100%; height: 150px; object-fit: cover; aspect-ratio: 3 / 2; }
.stop-actions { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.open-btn {
  font: inherit; font-weight: 700; cursor: pointer;
  background: var(--ink); color: var(--signal); border: 2px solid var(--ink);
  border-radius: 999px; padding: .55rem 1.2rem;
}
.open-btn:hover { background: #232c63; }
.open-btn:active { background: #2e3875; }
#savedFilter:hover { border-color: #000; }
.detail-nav button:hover:not(:disabled) { background: var(--ink); color: var(--signal); }
#closeDetail:hover { background: #232c63; }
#backToTop:hover { background: rgba(255,199,0,.15); }
.saved-flag {
  font-family: "IBM Plex Mono", monospace; font-size: .72rem; font-weight: 700;
  background: var(--signal); border: 2px dashed var(--ink); border-radius: 999px; padding: .25rem .7rem;
}
.saved-flag[hidden] { display: none; }

/* empty */
.empty {
  background: var(--paper); color: var(--ink); border-radius: var(--radius);
  border: 3px dashed var(--ink); text-align: center; padding: 3rem 1.5rem; margin-top: 2rem;
}
.empty[hidden] { display: none; }
.empty-big { font-size: 3rem; margin: 0; }
.empty h2 { font-family: "Space Grotesk", sans-serif; margin: .5rem 0; }
.empty button {
  font: inherit; font-weight: 700; cursor: pointer; margin-top: .8rem;
  background: var(--signal); border: 2px solid var(--ink); border-radius: 999px;
  padding: .6rem 1.4rem; box-shadow: 3px 3px 0 var(--ink);
}

/* pocket strip */
.pocket-strip { margin-top: 2.5rem; background: rgba(255,199,0,.08); border: 2px dashed var(--signal); border-radius: var(--radius); padding: 1rem 1.2rem; }
.pocket-strip[hidden] { display: none; }
.pocket-strip h2 { font-family: "Space Grotesk", sans-serif; font-size: 1.1rem; margin: 0 0 .6rem; }
.pocket-strip ul { list-style: none; margin: 0; padding: 0; display: flex; gap: .6rem; flex-wrap: wrap; }
.pocket-strip button {
  font: inherit; font-size: .85rem; font-weight: 700; cursor: pointer;
  background: var(--paper); color: var(--ink); border: 2px solid var(--signal); border-radius: 999px;
  padding: .4rem .9rem;
}

/* terminus */
.terminus { background: #05081a; border-top: 6px solid var(--signal); padding: 2.5rem clamp(1rem, 4vw, 3rem); }
.terminus-inner { max-width: 1100px; margin: 0 auto; }
.terminus h2 { font-family: "Oswald", sans-serif; color: var(--signal); margin: 0 0 .5rem; font-size: 1.8rem; }
.terminus p { color: var(--muted); max-width: 70ch; }
.terminus .fine { font-size: .8rem; }
#backToTop { font: inherit; font-weight: 700; cursor: pointer; background: transparent; color: var(--signal); border: 2px solid var(--signal); border-radius: 999px; padding: .5rem 1.1rem; margin-top: .6rem; }

/* ---------- detail: the transfer ---------- */
.detail-scrim {
  overscroll-behavior: contain;
  position: fixed; inset: 0; z-index: 100;
  background: rgba(5,8,26,.78);
  backdrop-filter: blur(3px);
  overflow-y: auto; padding: clamp(.8rem, 3vw, 2.5rem) clamp(.8rem, 4vw, 2rem);
  display: flex; justify-content: center; align-items: flex-start;
}
.detail-scrim[hidden] { display: none; }
.detail {
  background: linear-gradient(180deg, #fffdf4, var(--paper-2));
  color: var(--ink); border-radius: 18px;
  max-width: 680px; width: 100%;
  border: 3px solid var(--ink);
  box-shadow: 10px 10px 0 rgba(0,0,0,.5);
  padding: clamp(1.2rem, 3vw, 2.2rem);
  position: relative;
  animation: punch .28s ease-out;
}
@keyframes punch { from { transform: translateY(26px) rotate(-.6deg); opacity: 0; } }
.detail-perforation {
  height: 14px; margin: -6px -6px 1rem;
  background-image: radial-gradient(circle, var(--depot-2) 4px, transparent 4.5px);
  background-size: 22px 14px; background-repeat: repeat-x; background-position: center;
}
.detail-eyebrow { font-family: "IBM Plex Mono", monospace; font-size: .75rem; text-transform: uppercase; letter-spacing: .14em; color: #5a6185; margin: 0 0 .6rem; }
.detail-title { font-family: "Space Grotesk", sans-serif; font-size: clamp(1.6rem, 4vw, 2.4rem); line-height: 1.1; margin: 0 0 .5rem; text-wrap: balance; overflow-wrap: break-word; }
.detail-byline { font-family: "IBM Plex Mono", monospace; font-size: .8rem; color: #4a5170; margin: 0 0 1rem; }
.detail-fig { margin: 0 0 1rem; }
.detail-fig img { width: 100%; max-height: 320px; object-fit: cover; border-radius: 12px; border: 2px solid var(--ink); display: block; }
.detail-fig figcaption { font-size: .75rem; color: #5a6185; margin-top: .4rem; font-family: "IBM Plex Mono", monospace; }
.detail-actions { display: flex; gap: .7rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
#saveItem {
  font: inherit; font-weight: 700; cursor: pointer;
  background: #fff; color: var(--ink); border: 2px solid var(--ink); border-radius: 999px;
  padding: .6rem 1.2rem; box-shadow: 3px 3px 0 var(--ink);
}
#saveItem[aria-pressed="true"] { background: var(--signal); }
#closeDetail {
  font: inherit; font-weight: 700; cursor: pointer;
  background: var(--ink); color: #fff; border: 2px solid var(--ink); border-radius: 999px;
  padding: .6rem 1.2rem;
}
.detail-body {
  font-family: "Literata", Georgia, serif; font-size: 1.08rem; line-height: 1.75; color: #20263f;
  border-top: 2px dashed var(--ink); padding-top: 1.2rem;
}
.detail-body p { margin: 0 0 1.1em; }
.detail-body p:first-child::first-letter {
  font-family: "Oswald", sans-serif; font-size: 2.6em; float: left;
  line-height: .9; padding-right: .12em; color: var(--coral);
}
.detail-nav { display: flex; justify-content: space-between; align-items: center; gap: .8rem; margin-top: 1.4rem; border-top: 2px dashed var(--ink); padding-top: 1rem; }
.detail-nav button { font: inherit; font-weight: 700; cursor: pointer; background: transparent; color: var(--ink); border: 2px solid var(--ink); border-radius: 999px; padding: .45rem 1rem; }
.detail-nav button:disabled { opacity: .35; cursor: default; }
#detailPos { font-family: "IBM Plex Mono", monospace; font-size: .75rem; color: #5a6185; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--ink); color: var(--signal); z-index: 300;
  font-family: "IBM Plex Mono", monospace; font-size: .85rem; font-weight: 700;
  border: 2px solid var(--signal); border-radius: 999px; padding: .6rem 1.3rem;
  box-shadow: 0 8px 30px rgba(0,0,0,.5); max-width: min(92vw, 480px); text-align: center;
}
.toast[hidden] { display: none; }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .blind-main { grid-template-columns: 1fr; }
  .farebox-grid { grid-template-columns: 1fr; }
  .stop { grid-template-columns: 1fr; margin-left: 46px; }
  .stop-thumb img { height: 170px; }
  .stops::before { left: 21px; }
  .stop::before { left: -46px; }
  .detail-nav { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .ticker-track { animation: none; flex-wrap: wrap; white-space: normal; }
}
