:root {
  --bg: #07080a;
  --raise: rgba(255, 255, 255, .035);
  --line: rgba(255, 255, 255, .08);
  --line-strong: rgba(255, 255, 255, .14);
  --text: #ece8e1;
  --muted: #8d8a84;
  --faint: #5f5d59;
  --amber: #ffa41c;
  --amber-soft: rgba(255, 164, 28, .12);
  --amber-line: rgba(255, 164, 28, .35);
  --sans: 'Geist', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'Geist Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(1200px 640px at 50% 34%, rgba(255, 140, 0, .055), transparent 70%), var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 1240px; margin: 0 auto; padding-inline: 24px; }

/* Top bar */

.top {
  position: sticky;
  top: 0;
  z-index: 10;
  padding-top: env(safe-area-inset-top, 0px);
  background: rgba(7, 8, 10, .72);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--line);
}
.top-inner { display: flex; align-items: center; gap: 20px; height: 64px; }

.brand {
  display: inline-flex;
  align-items: baseline;
  font: 600 19px/1 var(--sans);
  letter-spacing: -.02em;
  color: var(--text);
  text-decoration: none;
}
.brand i {
  width: 5px;
  height: 5px;
  margin: 0 2px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 6px 1px rgba(255, 150, 20, .7);
}

.search { position: relative; flex: 1; max-width: 520px; margin-left: auto; }
.search svg {
  position: absolute;
  left: 13px;
  top: 50%;
  width: 16px;
  height: 16px;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}
.search input {
  width: 100%;
  height: 40px;
  padding: 0 44px 0 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--raise);
  color: var(--text);
  font: 14px var(--sans);
  outline: none;
  transition: border-color .15s, background .15s;
}
.search input::placeholder { color: var(--faint); }
.search input::-webkit-search-cancel-button { display: none; }
.search input:focus { border-color: var(--amber-line); background: rgba(255, 255, 255, .05); }
.search kbd {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  padding: 1px 6px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  font: 11px/1.4 var(--mono);
  color: var(--muted);
}

.results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: rgba(16, 17, 20, .94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  box-shadow: 0 24px 60px -12px rgba(0, 0, 0, .7);
}
.results li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 9px 10px;
  border-radius: 8px;
  cursor: pointer;
}
.results li[aria-selected="true"] { background: var(--amber-soft); }
.results .crs { font: 12px var(--mono); letter-spacing: .06em; color: var(--muted); }
.results li[aria-selected="true"] .crs { color: var(--amber); }
.results .none { color: var(--muted); cursor: default; }

.seg {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--raise);
}
.seg a {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 14px;
  border-radius: 7px;
  color: var(--muted);
  font: 500 13px var(--sans);
  text-decoration: none;
  transition: color .15s, background .15s;
}
.seg a:hover { color: var(--text); }
.seg a[aria-current="page"] {
  background: var(--amber-soft);
  color: var(--amber);
  box-shadow: inset 0 0 0 1px var(--amber-line);
}

/* Station heading */

.station { padding-block: 40px 22px; }
.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  font: 500 11px/1 var(--mono);
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
}
.pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--amber);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 164, 28, .55); }
  70% { box-shadow: 0 0 0 8px rgba(255, 164, 28, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 164, 28, 0); }
}
.sep { width: 18px; height: 1px; background: var(--line-strong); }

.station-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 24px;
  margin-top: 14px;
}
h1 { margin: 0; font: 500 clamp(30px, 4.4vw, 48px)/1.05 var(--sans); letter-spacing: -.03em; }
.facts { display: flex; gap: 28px; margin: 0; }
.facts div { display: grid; gap: 6px; }
.facts dt {
  font: 500 10px/1 var(--mono);
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--faint);
}
.facts dd { margin: 0; font: 500 15px/1 var(--mono); font-variant-numeric: tabular-nums; }
#station-crs { color: var(--amber); }

/* The board */

.housing {
  position: relative;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: 18px;
  background: linear-gradient(180deg, #1a1c20, #0d0e11 60%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 40px 100px -40px rgba(0, 0, 0, .9);
}
/* light from the LEDs spilling onto the wall */
.housing::before {
  content: '';
  position: absolute;
  inset: 15% 8% -10%;
  z-index: -1;
  background: radial-gradient(closest-side, rgba(255, 136, 0, .16), transparent);
  filter: blur(30px);
}
.screen {
  position: relative;
  padding: 14px;
  border-radius: 8px;
  background: #040302;
  box-shadow: inset 0 0 0 1px #000, inset 0 2px 18px rgba(0, 0, 0, .9);
  overflow: hidden;
}
/* glass */
.screen::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(168deg, rgba(255, 255, 255, .05), rgba(255, 255, 255, 0) 32%);
}
.board { display: flex; justify-content: center; }
.led { position: relative; }
.led canvas { display: block; }
.led-fg {
  position: absolute;
  inset: 0;
  filter: drop-shadow(0 0 calc(var(--pitch, 4px) * .9) rgba(255, 140, 10, .55));
}

/* the board as text, for screen readers and search engines */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.lost { margin: 18px 0 0; color: var(--muted); }

/* the train picked for the journey panel */
.pick {
  position: absolute;
  left: -6px;
  right: -6px;
  border: 1px solid rgba(255, 164, 28, .5);
  border-radius: 6px;
  box-shadow: inset 0 0 18px rgba(255, 140, 0, .14), 0 0 14px rgba(255, 140, 0, .12);
  pointer-events: none;
  transition: top .25s ease, height .25s ease;
}

/* Journey */

.journey {
  margin-top: 20px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .03), rgba(255, 255, 255, .012));
}
.j-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.j-head h2 { margin: 10px 0 0; font: 500 clamp(22px, 2.6vw, 30px)/1.15 var(--sans); letter-spacing: -.02em; }
.j-meta { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.j-side { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.j-status {
  padding: 5px 10px;
  border-radius: 999px;
  font: 500 12px/1 var(--mono);
  letter-spacing: .04em;
  color: var(--amber);
  background: var(--amber-soft);
  box-shadow: inset 0 0 0 1px var(--amber-line);
}
.j-status[data-state="ok"] { color: #3ddc84; background: rgba(61, 220, 132, .1); box-shadow: inset 0 0 0 1px rgba(61, 220, 132, .3); }
.j-status[data-state="off"] { color: #ff6b5e; background: rgba(255, 107, 94, .1); box-shadow: inset 0 0 0 1px rgba(255, 107, 94, .3); }
.j-nav { display: flex; gap: 6px; }
.j-nav button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--raise);
  color: var(--text);
  font: 18px/1 var(--sans);
  cursor: pointer;
}
.j-nav button:hover { border-color: var(--amber-line); color: var(--amber); }
.j-now { margin: 14px 0 18px; font: 13px/1.5 var(--mono); color: var(--text); }

.j-body { display: grid; grid-template-columns: minmax(250px, 320px) 1fr; gap: 20px; }

.j-stops { margin: 0; padding: 0; list-style: none; max-height: 480px; overflow-y: auto; }
.j-stops li {
  position: relative;
  display: grid;
  grid-template-columns: 22px 1fr auto auto;
  align-items: baseline;
  gap: 10px;
  padding: 7px 4px 7px 0;
  font-size: 14px;
}
/* the line on to the next stop, green for the part already run */
.j-stops li:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 10px;
  top: 50%;
  width: 2px;
  height: 100%;
  background: linear-gradient(#3ddc84 calc(var(--f, 0) * 100%), rgba(255, 164, 28, .35) 0);
}
.j-stops li.off::before { background: var(--line-strong); }
.j-dot {
  position: relative;
  z-index: 1;
  align-self: center;
  width: 10px;
  height: 10px;
  margin-left: 6px;
  border-radius: 50%;
  border: 2px solid var(--amber);
  background: var(--bg);
}
.j-stops li.passed .j-dot { border-color: #3ddc84; background: #3ddc84; }
.j-stops li.next .j-dot { box-shadow: 0 0 0 4px rgba(255, 164, 28, .18); }
.j-stops li.off .j-dot { border-color: #6d655c; }
.j-stop { min-width: 0; }
.j-stop em {
  display: block;
  margin-top: 4px;
  font: 500 10px/1 var(--mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  font-style: normal;
  color: var(--amber);
}
.j-stops li.here { font-weight: 600; }
.j-stops li.passed .j-stop { color: var(--muted); }
.j-time, .j-exp { font: 12px var(--mono); font-variant-numeric: tabular-nums; color: var(--muted); }
.j-exp { min-width: 72px; text-align: right; }

.j-mapwrap { position: relative; }
.j-map { height: 480px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: #050607; }
.j-key {
  position: absolute;
  left: 12px;
  top: 12px;
  display: flex;
  gap: 14px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(7, 8, 10, .8);
  font: 11px/1 var(--mono);
  color: var(--muted);
  pointer-events: none;
}
.j-key span::before {
  content: '';
  display: inline-block;
  width: 16px;
  height: 3px;
  margin-right: 7px;
  vertical-align: middle;
  border-radius: 2px;
}
.j-key .done::before { background: #3ddc84; box-shadow: 0 0 6px #3ddc84; }
.j-key .ahead::before { background: var(--amber); box-shadow: 0 0 6px var(--amber); }

.j-label {
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(7, 8, 10, .7);
  font: 11px/1.3 var(--sans);
  color: var(--muted);
  white-space: nowrap;
  pointer-events: none;
  display: none;
}
.j-label.major { display: block; color: var(--text); font-weight: 500; }
.journey.all-names .j-label { display: block; }

.train-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff6dc;
  box-shadow: 0 0 0 3px rgba(255, 164, 28, .55), 0 0 18px 4px rgba(255, 150, 20, .7);
}
.train-dot::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 2px solid rgba(255, 164, 28, .6);
  animation: ping 1.8s ease-out infinite;
}
@keyframes ping {
  from { transform: scale(1); opacity: 1; }
  to { transform: scale(2.6); opacity: 0; }
}

.maplibregl-ctrl-group { background: rgba(16, 17, 20, .9); border: 1px solid var(--line-strong); box-shadow: none !important; }
.maplibregl-ctrl-group button + button { border-top-color: var(--line); }
.maplibregl-ctrl-group button .maplibregl-ctrl-icon { filter: invert(1) opacity(.7); }
.maplibregl-ctrl-attrib.maplibregl-compact { background: rgba(16, 17, 20, .85); color: var(--muted); }
.maplibregl-ctrl-attrib a { color: var(--muted); }
.maplibregl-ctrl-attrib-button { filter: invert(1); }

.foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 16px;
  padding-block: 18px 40px;
  font: 12px/1.5 var(--mono);
  color: var(--faint);
}

@media (max-width: 720px) {
  .wrap { padding-inline: 16px; }
  .top-inner { flex-wrap: wrap; height: auto; padding-block: 12px; gap: 12px; }
  .search { order: 3; flex-basis: 100%; max-width: none; margin-left: 0; }
  .search kbd { display: none; }
  .seg { margin-left: auto; }
  .station { padding-block: 26px 16px; }
  .facts { gap: 20px; }
  .housing { padding: 8px; border-radius: 14px; }
  .screen { padding: 10px 6px; }
  .journey { padding: 16px; border-radius: 14px; }
  .j-head { flex-wrap: wrap; }
  .j-body { grid-template-columns: 1fr; }
  .j-mapwrap { order: -1; }
  .j-map { height: 340px; }
  .j-stops { max-height: none; }
}
