/* WEEKEND LINE — transit terminal departure board */
@font-face {
  font-family: 'PlexMono';
  src: url('assets/ibm-plex-mono.ttf') format('truetype');
  font-weight: 100 900; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'SpaceGrotesk';
  src: url('assets/space-grotesk.ttf') format('truetype');
  font-weight: 100 900; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'DMSerif';
  src: url('assets/dm-serif.ttf') format('truetype');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'WorkSans';
  src: url('assets/work-sans.ttf') format('truetype');
  font-weight: 100 900; font-style: normal; font-display: swap;
}

:root {
  --bg: #0a0d13;
  --bg-2: #0e131c;
  --panel: #11161f;
  --panel-2: #161c27;
  --ink: #e7eef4;
  --ink-dim: #9aa9b8;
  --ink-mute: #5e6b7a;
  --line: #1e2733;
  --amber: #ffb300;
  --amber-soft: #f0a800;
  --border: #232c3a;

  --art: #e8c547;
  --film: #c084fc;
  --food: #fb923c;
  --literature: #60a5fa;
  --music: #34d399;
  --outdoors: #a3e635;
  --walks: #f472b6;

  --mono: 'PlexMono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --sans: 'SpaceGrotesk', 'WorkSans', system-ui, -apple-system, sans-serif;
  --serif: 'DMSerif', Georgia, 'Times New Roman', serif;

  --maxw: 1180px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.5;
  min-height: 100dvh;
  background-image:
    radial-gradient(1200px 600px at 75% -10%, rgba(255,179,0,0.06), transparent 60%),
    radial-gradient(900px 500px at 0% 110%, rgba(96,165,250,0.05), transparent 60%),
    repeating-linear-gradient(0deg, transparent 0 2px, rgba(255,255,255,0.012) 2px 3px);
}

.skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--amber); color: #1a1300; padding: 8px 14px;
  font-family: var(--mono); font-weight: 700; text-decoration: none;
  z-index: 200; border-radius: 0 0 8px 0;
}
.skip:focus { left: 0; }

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

/* ---------- HEADER ---------- */
.terminal-head {
  max-width: var(--maxw); margin: 0 auto;
  padding: 22px 22px 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark { color: var(--ink); display: inline-flex; }
.brand-words h1 { margin: 0; font-family: var(--serif); font-weight: 400;
  font-size: clamp(26px, 5vw, 40px); letter-spacing: 0.2px; line-height: 1; }
.brand-words h1 .amp { color: var(--amber); }
.tagline { margin: 4px 0 0; font-family: var(--mono); font-size: 12px;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-dim); }

.head-status {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--ink-dim);
  padding: 8px 12px; border: 1px solid var(--border); border-radius: 999px;
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(0,0,0,0.18));
}
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--amber);
  box-shadow: 0 0 10px var(--amber); }
.live-text { color: var(--amber); font-weight: 700; }
.trip-count { color: var(--ink); }

@keyframes blink { 0%,49% {opacity:1} 50%,100% {opacity:0.25} }
.live-dot { animation: blink 1.4s steps(1,end) infinite; }

/* ---------- CONTROL DECK ---------- */
main { max-width: var(--maxw); margin: 0 auto; padding: 0 22px 40px; }

.control-deck {
  display: grid;
  grid-template-columns: 1fr 220px auto;
  gap: 14px;
  align-items: end;
  padding: 16px;
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 18px 40px -28px #000;
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--ink-mute);
}
.control-wrap { position: relative; display: flex; }

#search {
  flex: 1; width: 100%;
  font-family: var(--mono); font-size: 15px;
  color: var(--ink); background: #06090e;
  border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 56px 12px 14px;
  letter-spacing: 0.02em;
}
#search::placeholder { color: var(--ink-mute); }
#search:focus { border-color: var(--amber); background: #080c12; }
.field-hint {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em;
  color: var(--ink-mute); border: 1px solid var(--border);
  padding: 2px 6px; border-radius: 5px; pointer-events: none;
}

#filter {
  appearance: none; -webkit-appearance: none;
  font-family: var(--mono); font-size: 14px;
  color: var(--ink); background: #06090e;
  border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 36px 12px 14px; width: 100%; cursor: pointer;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--amber) 50%),
    linear-gradient(135deg, var(--amber) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
#filter:focus { border-color: var(--amber); outline-offset: 1px; }
#filter option { background: #0e131c; color: var(--ink); }

.saved-toggle {
  font-family: var(--mono); font-size: 13px; letter-spacing: 0.06em;
  color: var(--ink); background: #06090e;
  border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 16px; cursor: pointer; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 9px; height: 100%;
  transition: border-color .15s, color .15s, background .15s;
}
.saved-toggle:hover { border-color: var(--amber); }
.sf-dot { width: 9px; height: 9px; border-radius: 2px; background: var(--ink-mute); transition: background .15s; }
.saved-toggle[aria-pressed="true"] {
  color: #1a1300; background: var(--amber); border-color: var(--amber);
  font-weight: 700;
}
.saved-toggle[aria-pressed="true"] .sf-dot { background: #1a1300; }
.saved-toggle .sf-on { display: none; }
.saved-toggle .sf-off { display: inline; }
.saved-toggle[aria-pressed="true"] .sf-on { display: inline; }
.saved-toggle[aria-pressed="true"] .sf-off { display: none; }

/* ---------- LEGEND ---------- */
.legend {
  display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 0;
}
.chip {
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.06em;
  color: var(--ink-dim); background: transparent;
  border: 1px solid var(--border); border-radius: 999px;
  padding: 6px 12px 6px 10px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px;
  transition: color .15s, border-color .15s, background .15s;
}
.chip:hover { color: var(--ink); border-color: var(--ink-mute); }
.chip[aria-pressed="true"] { color: #0a0d13; background: var(--ink); border-color: var(--ink); font-weight: 700; }
.chip .chip-bar { width: 12px; height: 4px; border-radius: 2px; background: var(--c, var(--ink-mute)); }
.chip[data-line="Art"] .chip-bar { background: var(--art); }
.chip[data-line="Film"] .chip-bar { background: var(--film); }
.chip[data-line="Food"] .chip-bar { background: var(--food); }
.chip[data-line="Literature"] .chip-bar { background: var(--literature); }
.chip[data-line="Music"] .chip-bar { background: var(--music); }
.chip[data-line="Outdoors"] .chip-bar { background: var(--outdoors); }
.chip[data-line="Walks"] .chip-bar { background: var(--walks); }

/* ---------- BOARD ---------- */
.board { margin-top: 16px; }
.board-frame {
  background: linear-gradient(180deg, #0a0e16, #080b11);
  border: 1px solid var(--border); border-radius: 14px;
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 24px 60px -40px #000;
}
.board-header {
  display: grid;
  grid-template-columns: 92px 120px minmax(0,1fr) 150px 90px 96px;
  gap: 10px; align-items: center;
  padding: 11px 16px;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--ink-mute);
  background: linear-gradient(180deg, rgba(255,179,0,0.05), transparent);
  border-bottom: 1px solid var(--border);
}
.board-header .h-act { text-align: right; }
.h-fare { text-align: right; }

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

.row { border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: none; }

.row-main {
  display: grid;
  grid-template-columns: 92px 120px minmax(0,1fr) 150px 90px 96px;
  gap: 10px; align-items: center;
  width: 100%; text-align: left;
  padding: 14px 16px;
  background: transparent; border: none; color: inherit; cursor: pointer;
  font-family: inherit;
  position: relative;
}
.row-main::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--c, transparent); opacity: 0; transition: opacity .15s;
}
.row-main:hover::before { opacity: 1; }
.row-main:hover { background: linear-gradient(90deg, rgba(255,179,0,0.04), transparent 40%); }
.row-main:focus-visible { background: rgba(255,179,0,0.08); }

.r-dep {
  font-family: var(--mono); font-weight: 700; font-size: 15px;
  color: var(--amber); letter-spacing: 0.02em; line-height: 1.15;
}
.r-dep .dep-day { display: block; font-size: 10px; font-weight: 400;
  letter-spacing: 0.14em; color: var(--ink-mute); text-transform: uppercase; }

.r-line { display: inline-flex; align-items: center; gap: 8px; }
.line-bar { width: 4px; height: 22px; border-radius: 2px; background: var(--c); flex: none; }
.line-name { font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--c); font-weight: 700; }

.r-dest { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dest-title { font-family: var(--sans); font-size: 16px; font-weight: 600;
  color: var(--ink); letter-spacing: -0.01em; }
.dest-sub { font-family: var(--mono); font-size: 11px; color: var(--ink-mute);
  letter-spacing: 0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.r-plat { font-family: var(--mono); font-size: 12px; color: var(--ink-dim);
  line-height: 1.3; }
.r-plat .plat-ven { color: var(--ink); }

.r-fare { font-family: var(--mono); font-size: 13px; text-align: right;
  color: var(--ink); font-weight: 600; }
.r-fare.free { color: var(--music); }
.r-fare .fare-cur { color: var(--ink-mute); font-weight: 400; font-size: 11px; }

.r-act { text-align: right; position: relative; }
.board-btn {
  display: inline-block; font-family: var(--mono); font-size: 11px;
  letter-spacing: 0.14em; color: var(--ink-mute); transition: color .15s;
}
.row-main:hover .board-btn, .row-main:focus-visible .board-btn { color: var(--amber); }
.board-btn .arrow { display: inline-block; transition: transform .15s; }
.row-main:hover .arrow, .row-main:focus-visible .arrow { transform: translateX(3px); }
.saved-pin {
  position: absolute; right: -2px; top: -2px; color: var(--amber);
  font-size: 12px;
}

/* split-flap entrance */
@keyframes flap-in {
  0%   { transform: rotateX(-88deg); opacity: 0; }
  60%  { opacity: 1; }
  100% { transform: rotateX(0); opacity: 1; }
}
.row { transform-origin: top center; }
.row { animation: flap-in .42s cubic-bezier(.2,.7,.2,1) both; }
.row:nth-child(1) { animation-delay: .02s; }
.row:nth-child(2) { animation-delay: .06s; }
.row:nth-child(3) { animation-delay: .10s; }
.row:nth-child(4) { animation-delay: .14s; }
.row:nth-child(5) { animation-delay: .18s; }
.row:nth-child(6) { animation-delay: .22s; }
.row:nth-child(7) { animation-delay: .26s; }
.row:nth-child(8) { animation-delay: .30s; }
.row:nth-child(9) { animation-delay: .34s; }
.row:nth-child(10) { animation-delay: .38s; }

/* ---------- EMPTY STATE ---------- */
.empty { padding: 48px 20px; display: flex; justify-content: center; }
.empty-flap { text-align: center; max-width: 420px; }
.empty-rows { display: flex; gap: 6px; justify-content: center; margin-bottom: 16px; }
.empty-rows span { width: 88px; height: 18px; border-radius: 3px;
  background: repeating-linear-gradient(90deg, var(--line) 0 12px, transparent 12px 16px); }
.empty-title { font-family: var(--serif); font-size: 24px; margin: 0 0 6px; color: var(--ink); }
.empty-sub { font-family: var(--mono); font-size: 13px; color: var(--ink-mute); margin: 0 0 18px; }
.reset-btn {
  font-family: var(--mono); font-size: 13px; letter-spacing: 0.06em;
  color: #1a1300; background: var(--amber); border: none; border-radius: 8px;
  padding: 11px 18px; cursor: pointer; font-weight: 700;
}
.reset-btn:hover { background: #ffc640; }

/* ---------- TRIP PLAN ---------- */
.trip-plan { margin-top: 26px; }
.trip-head { display: flex; align-items: baseline; justify-content: space-between;
  padding: 0 2px 10px; border-bottom: 1px dashed var(--border); }
.trip-head h2 { font-family: var(--serif); font-weight: 400; font-size: 22px;
  margin: 0; }
.trip-sub { font-family: var(--mono); font-size: 12px; color: var(--ink-mute);
  letter-spacing: 0.04em; }
.trip-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.trip-list li {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--border); border-left: 4px solid var(--c, var(--ink-mute));
  border-radius: 8px;
}
.trip-list .stub { font-family: var(--mono); font-size: 13px; color: var(--amber);
  font-weight: 700; min-width: 52px; }
.trip-list .stub-name { font-family: var(--mono); font-size: 10px;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--c); display: block; }
.trip-list .stub-title { font-family: var(--sans); font-weight: 600; font-size: 14px; }
.trip-list .stub-ven { font-family: var(--mono); font-size: 11px; color: var(--ink-mute); }
.trip-list .stub-body { flex: 1; min-width: 0; }
.trip-list button.open-item {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em;
  color: var(--ink-dim); background: transparent; border: 1px solid var(--border);
  border-radius: 6px; padding: 6px 10px; cursor: pointer;
}
.trip-list button.open-item:hover { color: var(--amber); border-color: var(--amber); }
.trip-list button.remove {
  font-family: var(--mono); font-size: 11px; color: #ff7b7b;
  background: transparent; border: 1px solid var(--border); border-radius: 6px;
  padding: 6px 10px; cursor: pointer;
}
.trip-list button.remove:hover { color: #ff9a9a; border-color: #ff7b7b; }
.trip-empty { font-family: var(--mono); font-size: 13px; color: var(--ink-mute);
  padding: 14px 2px; }

/* ---------- FOOTER ---------- */
.terminal-foot { max-width: var(--maxw); margin: 0 auto;
  padding: 22px; font-family: var(--mono); font-size: 11px; color: var(--ink-mute);
  letter-spacing: 0.04em; border-top: 1px solid var(--line); }

/* ---------- DETAIL: BOARDING PASS DIALOG ---------- */
.pass-dialog {
  border: none; background: transparent; padding: 0; max-width: 720px;
  width: min(720px, 94vw); color: var(--ink);
}
.pass-dialog::backdrop { background: rgba(4,6,10,0.78); backdrop-filter: blur(3px); }

.pass {
  --c: var(--amber);
  display: grid; grid-template-columns: 188px 1fr;
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  overflow: hidden; box-shadow: 0 30px 80px -30px #000;
  position: relative;
}
.pass::after {
  content: ""; position: absolute; left: 188px; top: 0; bottom: 0; width: 1px;
  background-image: linear-gradient(180deg, var(--border) 50%, transparent 0);
  background-size: 1px 8px;
}

.pass-stub {
  background: linear-gradient(180deg, var(--c), rgba(0,0,0,0.25));
  color: #15110a; padding: 18px 14px; display: flex; flex-direction: column;
  gap: 10px; position: relative;
}
.pass-stub .stub-band { font-family: var(--mono); font-size: 10px;
  letter-spacing: 0.18em; text-transform: uppercase; opacity: 0.7; }
.pass-stub .stub-line { font-family: var(--mono); font-weight: 700; font-size: 13px;
  letter-spacing: 0.08em; text-transform: uppercase; }
.pass-stub .stub-time { font-family: var(--mono); font-size: 30px; font-weight: 700;
  line-height: 1; letter-spacing: -0.01em; }
.pass-stub .stub-time .stub-end { display:block; font-size: 11px; font-weight: 400;
  letter-spacing: 0.08em; opacity: 0.75; margin-top: 4px; }
.pass-stub .stub-fare { font-family: var(--mono); font-size: 13px; font-weight: 700;
  margin-top: auto; }
.pass-stub .stub-notch { position: absolute; right: -10px; top: 50%; transform: translateY(-50%);
  width: 20px; height: 20px; border-radius: 50%; background: var(--bg); border: 1px solid var(--border); }

.pass-body { padding: 20px 22px 22px; }
.pass-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pass-eyebrow { font-family: var(--mono); font-size: 11px; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--c); font-weight: 700; }
.close-detail {
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.06em;
  color: var(--ink-dim); background: transparent; border: 1px solid var(--border);
  border-radius: 999px; padding: 6px 12px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
.close-detail:hover { color: var(--amber); border-color: var(--amber); }

#pass-title { font-family: var(--serif); font-weight: 400; font-size: clamp(24px,4vw,32px);
  margin: 12px 0 4px; line-height: 1.1; }
.pass-summary { font-family: var(--sans); font-size: 15px; color: var(--ink-dim);
  margin: 0 0 16px; max-width: 56ch; }

.pass-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
  padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}
.pg { display: flex; flex-direction: column; gap: 3px; }
.pg .pg-l { font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--ink-mute); }
.pg .pg-v { font-family: var(--mono); font-size: 13px; color: var(--ink); font-weight: 600; }
.pg .pg-v.free { color: var(--music); }

.pass-body-block { margin-bottom: 14px; }
.pass-body-block p {
  font-family: var(--sans); font-size: 14.5px; color: var(--ink); margin: 0 0 8px;
  max-width: 60ch;
}
.pass-access {
  font-family: var(--mono); font-size: 12px; color: var(--ink-dim);
  padding: 10px 12px; background: #06090e; border: 1px solid var(--line);
  border-left: 3px solid var(--c); border-radius: 6px; line-height: 1.5;
}
.pass-access .ax-l { display: block; font-size: 10px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--c); margin-bottom: 3px; }

.save-item {
  width: 100%; margin-top: 16px;
  font-family: var(--mono); font-size: 14px; letter-spacing: 0.08em;
  font-weight: 700; border-radius: 10px; padding: 14px 16px; cursor: pointer;
  border: 1px solid var(--c); color: var(--c); background: transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  transition: background .15s, color .15s;
}
.save-item:hover { background: rgba(255,255,255,0.04); }
.save-item[aria-pressed="true"] { color: #15110a; background: var(--c); }
.save-item .si-icon { font-size: 16px; }

dialog[open] { animation: pass-in .22s ease both; }
@keyframes pass-in {
  from { transform: translateY(10px) scale(.98); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 860px) {
  .control-deck { grid-template-columns: 1fr; gap: 12px; }
  .board-header { display: none; }
  .row-main {
    grid-template-columns: 64px 1fr;
    grid-template-areas:
      "dep dest"
      "line line"
      "plat fare"
      "act act";
    gap: 8px 12px; padding: 14px;
  }
  .row-main::before { width: 100%; height: 3px; bottom: 0; top: auto; }
  .r-dep { grid-area: dep; }
  .r-line { grid-area: line; }
  .r-dest { grid-area: dest; }
  .r-plat { grid-area: plat; }
  .r-fare { grid-area: fare; text-align: right; }
  .r-act { grid-area: act; text-align: left; border-top: 1px dashed var(--line); padding-top: 8px; }
  .board-btn { color: var(--amber); }
  .saved-pin { right: 0; top: 0; }

  .pass { grid-template-columns: 1fr; }
  .pass::after { display: none; }
  .pass-stub { flex-direction: row; align-items: center; flex-wrap: wrap; gap: 14px; }
  .pass-stub .stub-time { font-size: 26px; }
  .pass-stub .stub-fare { margin-top: 0; }
  .pass-stub .stub-notch { display: none; }
  .pass-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .terminal-head { padding: 16px 16px 10px; }
  main { padding: 0 16px 32px; }
  .head-status { font-size: 10px; }
  .trip-count { display: none; }
  .row-main { grid-template-areas:
      "dep dest"
      "line line"
      "act act"
      "plat fare"; }
}

@media (prefers-reduced-motion: reduce) {
  .live-dot { animation: none; }
  .row { animation: none !important; }
  dialog[open] { animation: none !important; }
  * { transition: none !important; }
  .board-btn .arrow { transform: none !important; }
}
