/* ============================================================
   TERMINAL CNF
   An airport departures hall at night: warm black, sodium-amber
   signage, split-flap boards and boarding passes. Amber means
   "look at this"; green/red only ever say "cheaper/pricier than
   usual" and always come with an arrow or a word beside them.
   ============================================================ */
:root {
  color-scheme: dark;

  --bg:          #0c0b09;
  --panel:       #151410;
  --panel-2:     #1c1a15;
  --panel-hover: #221f19;
  --line:        #2c2922;
  --line-strong: #423d32;

  --cream:  #f3ecdb;
  --text-2: #b8b09f;
  --text-3: #8d8676;

  --amber:      #ffb21a;
  --amber-soft: #2e2208;
  --amber-line: #5c4210;
  --green:      #62d69d;
  --green-soft: #0f271b;
  --red:        #ff7c68;
  --red-soft:   #31150f;
  --blue:       #86b9ff;
  --blue-soft:  #122238;
  --violet:     #cfb0ff;
  --violet-soft:#261b36;

  --f-display: "Big Shoulders Display", "Arial Narrow", "Roboto Condensed", sans-serif;
  --f-mono:    "Martian Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --f-ui:      "Instrument Sans", "Segoe UI", system-ui, sans-serif;

  --sp-1: .25rem; --sp-2: .5rem; --sp-3: .75rem; --sp-4: 1rem;
  --sp-5: 1.5rem; --sp-6: 2rem;  --sp-7: 3rem;   --sp-8: 4.5rem;

  --r-sm: 4px; --r-md: 8px; --r-lg: 14px; --r-full: 999px;

  --ease: cubic-bezier(.2, .8, .3, 1);
  --z-bar: 20;
}

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

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--cream);
  font-family: var(--f-ui);
  font-size: .9375rem;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

/* Light from the signage above, a vignette, and a little film grain. */
.atmosphere {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60rem 30rem at 12% -8%, rgb(255 178 26 / .10), transparent 60%),
    radial-gradient(50rem 40rem at 100% 0%, rgb(255 120 60 / .05), transparent 60%),
    radial-gradient(ellipse at 50% 120%, rgb(0 0 0 / .7), transparent 60%),
    var(--bg);
}
.atmosphere::after {
  content: ""; position: absolute; inset: 0; opacity: .07; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

main {
  max-width: 1240px;
  margin: 0 auto;
  padding: var(--sp-5) max(var(--sp-4), env(safe-area-inset-right)) var(--sp-8) max(var(--sp-4), env(safe-area-inset-left));
}

h1, h2, h3, p { margin: 0; }
.num { font-variant-numeric: tabular-nums; }
.kicker {
  font-family: var(--f-mono); font-size: .6875rem; font-weight: 500;
  letter-spacing: .12em; text-transform: uppercase; color: var(--text-3);
}
.error { color: var(--red); font-size: .8125rem; margin-top: var(--sp-3); }

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

:where(a, button, input, select):focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

svg {
  width: 1em; height: 1em; fill: none; stroke: currentColor;
  stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: none;
}

/* ---------------- Form controls ---------------- */
input, select {
  font: inherit;
  font-size: 16px; /* no iOS zoom on focus */
  color: var(--cream);
  background: var(--panel-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  padding: .6rem .75rem;
  min-height: 44px;
}
select { cursor: pointer; }
button { font: inherit; cursor: pointer; }

.field { display: grid; gap: var(--sp-1); }
.field > span { font-family: var(--f-mono); font-size: .6875rem; letter-spacing: .12em; text-transform: uppercase; color: var(--text-2); }

.btn-board {
  min-height: 48px;
  background: var(--amber);
  color: #1a1203;
  font-family: var(--f-display);
  font-size: 1.25rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  border: 0; border-radius: var(--r-md);
  padding: .5rem 1rem;
  box-shadow: 0 0 0 1px rgb(255 178 26 / .4), 0 10px 30px -10px rgb(255 178 26 / .55);
  transition: transform .15s var(--ease), filter .15s var(--ease);
}
.btn-board:hover { filter: brightness(1.06); }
.btn-board:active { transform: scale(.98); }
.btn-board[disabled] { opacity: .55; cursor: progress; }

.btn-ghost {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  min-height: 44px; padding: 0 .85rem;
  background: transparent; color: var(--text-2);
  border: 1px solid var(--line-strong); border-radius: var(--r-md);
  font-size: .8125rem;
  transition: color .15s var(--ease), border-color .15s var(--ease);
}
.btn-ghost:hover { color: var(--cream); border-color: var(--text-3); }
.btn-ghost.is-active { color: var(--amber); border-color: var(--amber-line); }

/* ============================================================
   GATE — a boarding pass
   ============================================================ */
#gate { display: grid; place-items: center; min-height: 86dvh; }
.gate-pass {
  --notch: 14px;
  display: grid; grid-template-columns: 1fr 104px;
  width: min(560px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: 0 40px 80px -30px rgb(0 0 0 / .8), 0 0 0 1px rgb(255 178 26 / .06);
  animation: rise .6s var(--ease) both;
}
.gate-main { padding: var(--sp-6) var(--sp-5); }
.gate-main h1 {
  display: flex; align-items: center; gap: var(--sp-3);
  font-family: var(--f-display); font-weight: 900; font-size: clamp(3rem, 12vw, 4.5rem);
  line-height: .9; letter-spacing: .02em; margin: var(--sp-3) 0 var(--sp-3);
}
.gate-main h1 svg { font-size: .45em; color: var(--amber); }
.gate-main h1 span:last-child { color: var(--amber); }
.gate-copy { color: var(--text-2); max-width: 32ch; }
#gate-form { display: grid; gap: var(--sp-3); margin-top: var(--sp-5); }

.gate-stub {
  position: relative;
  display: grid; align-content: start; gap: 2px;
  padding: var(--sp-6) var(--sp-4);
  border-left: 2px dashed var(--line-strong);
  font-family: var(--f-mono); font-size: .625rem; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3);
}
.gate-stub b { font-family: var(--f-display); font-size: 1.75rem; color: var(--cream); letter-spacing: .04em; margin-bottom: var(--sp-3); }
.gate-stub::before, .gate-stub::after {
  content: ""; position: absolute; left: calc(var(--notch) / -2 - 1px);
  width: var(--notch); height: var(--notch); border-radius: 50%; background: var(--bg);
}
.gate-stub::before { top: calc(var(--notch) / -2); box-shadow: inset 0 -1px 0 var(--line); }
.gate-stub::after  { bottom: calc(var(--notch) / -2); box-shadow: inset 0 1px 0 var(--line); }
.barcode {
  display: block; height: 72px; margin-top: auto;
  background: repeating-linear-gradient(90deg, var(--text-2) 0 2px, transparent 2px 4px, var(--text-2) 4px 5px, transparent 5px 8px, var(--text-2) 8px 11px, transparent 11px 12px);
  opacity: .55;
}

.switch-link {
  display: block; margin: var(--sp-4) auto 0; min-height: 44px;
  background: none; border: 0; color: var(--text-3); font-size: .8125rem;
  text-decoration: underline; text-underline-offset: 3px;
}
.switch-link:hover { color: var(--amber); }

/* ============================================================
   HEADER — terminal signage + live clock
   ============================================================ */
.terminal-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: var(--sp-5); flex-wrap: wrap;
  padding-bottom: var(--sp-5); margin-bottom: var(--sp-5);
  border-bottom: 1px solid var(--line);
}
.sign { display: flex; align-items: center; gap: var(--sp-4); }
.sign-code {
  font-family: var(--f-display); font-weight: 900; font-size: 3.5rem; line-height: .85;
  color: #1a1203; background: var(--amber);
  padding: .35rem .6rem .2rem; border-radius: var(--r-md);
  box-shadow: 0 0 40px -8px rgb(255 178 26 / .55);
}
.sign h1 {
  font-family: var(--f-display); font-weight: 800; font-size: clamp(1.6rem, 4vw, 2.4rem);
  line-height: 1; letter-spacing: .01em; text-transform: uppercase; margin-top: var(--sp-1);
}
.clock { text-align: right; display: grid; justify-items: end; gap: 2px; }
.clock-time {
  font-family: var(--f-mono); font-weight: 500; font-size: 1.75rem; line-height: 1;
  color: var(--amber); font-variant-numeric: tabular-nums;
  text-shadow: 0 0 18px rgb(255 178 26 / .35);
}
.updated { font-size: .8125rem; color: var(--text-2); margin-top: var(--sp-1); }
.switch-btn { min-height: 36px; margin-top: var(--sp-2); font-size: .75rem; }
.updated.stale { color: var(--amber); }
.updated.stale::before { content: "▲ "; }

/* ============================================================
   DEPARTURES BOARD
   ============================================================ */
.board {
  position: relative;
  background:
    repeating-linear-gradient(to bottom, rgb(255 255 255 / .018) 0 1px, transparent 1px 3px),
    linear-gradient(180deg, #13120e, #0f0e0b);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--sp-4) var(--sp-4) var(--sp-3);
  margin-bottom: var(--sp-5);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .04), 0 30px 60px -40px rgb(0 0 0 / .9);
  overflow: hidden;
}
.board-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; margin-bottom: var(--sp-3); }
.board-head h2 {
  font-family: var(--f-display); font-weight: 800; font-size: 1.5rem;
  text-transform: uppercase; letter-spacing: .04em; color: var(--amber);
}
.board-cols, .board-row {
  display: grid;
  grid-template-columns: minmax(9rem, 1.5fr) .8fr .9fr .9fr minmax(8rem, 1.2fr);
  gap: var(--sp-3); align-items: center;
}
.board-cols {
  font-family: var(--f-mono); font-size: .625rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--text-3); padding: 0 var(--sp-2) var(--sp-2);
  border-bottom: 1px solid var(--line);
}
.board-rows { list-style: none; margin: 0; padding: 0; }
.board-row {
  padding: .55rem var(--sp-2);
  border-bottom: 1px solid rgb(255 255 255 / .04);
  color: var(--cream); text-decoration: none;
  font-family: var(--f-mono); font-size: .8125rem; font-weight: 500; text-transform: uppercase;
  border-radius: var(--r-sm);
  transition: background .15s var(--ease);
}
.board-rows li:last-child .board-row { border-bottom: 0; }
.board-row:hover { background: rgb(255 178 26 / .06); }
.board-row .dest { display: flex; align-items: baseline; gap: var(--sp-2); min-width: 0; }
.board-row .dest .code { color: var(--amber); font-weight: 600; font-size: .9375rem; white-space: nowrap; flex: none; }
.board-row .dest .city i { font-style: normal; color: var(--text-3); margin-right: 2px; }
.board-row .dest .city { color: var(--text-2); font-size: .6875rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board-row .b-fare { color: var(--amber); font-weight: 600; white-space: nowrap; }
.board-row .status { font-size: .75rem; }
.status.s-good { color: var(--green); }
.status.s-deal { color: var(--amber); }
.status.s-azul { color: var(--blue); }
.status.s-rt   { color: var(--violet); }
.status.s-flat { color: var(--text-3); }
.board-empty { padding: var(--sp-5) var(--sp-2); color: var(--text-2); font-family: var(--f-mono); font-size: .8125rem; }

/* Split-flap tiles: each character sits on its own two-tone tile. */
.flap {
  display: inline-block; position: relative;
  min-width: .72em; padding: 0 .08em; margin-right: 1px;
  text-align: center;
  background: linear-gradient(180deg, #221f19 0 50%, #1a1814 50% 100%);
  border-radius: 2px;
  box-shadow: inset 0 -1px 0 rgb(0 0 0 / .45);
}
.flap::after {
  content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px;
  background: rgb(0 0 0 / .55);
}
.flap.sp { background: transparent; box-shadow: none; }
.flap.sp::after { display: none; }
.flap.spin { color: var(--text-3); }

/* ============================================================
   COUNTERS
   ============================================================ */
.counters {
  display: grid; grid-template-columns: repeat(5, 1fr);
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--panel);
  margin-bottom: var(--sp-5);
  overflow: hidden;
}
.counter { padding: var(--sp-3) var(--sp-4); border-left: 1px solid var(--line); }
.counter:first-child { border-left: 0; }
.counter .value {
  display: block; font-family: var(--f-display); font-weight: 800; font-size: 2.1rem;
  line-height: 1.05; letter-spacing: .01em; margin-top: 2px;
}
.counter.is-deal .value { color: var(--amber); }
.counter.is-good .value { color: var(--green); }

/* ============================================================
   TOOLBAR
   ============================================================ */
.toolbar {
  position: sticky; top: 0; z-index: var(--z-bar);
  display: grid; gap: var(--sp-2);
  padding: var(--sp-3) 0;
  background: linear-gradient(var(--bg) 70%, rgb(12 11 9 / .92));
  border-bottom: 1px solid var(--line);
}
.filters, .view-controls { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; }
.view-controls { justify-content: space-between; }
/* On wider screens every control flows in one wrapping line, with ordering and
   the view switch pushed to the right edge. Phones keep a scrollable filter strip. */
@media (min-width: 721px) {
  .toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
  .filters { display: contents; }
  .view-controls { margin-left: auto; flex-wrap: nowrap; }
}
.toolbar select, .toolbar input[type=date] { font-size: .8125rem; padding: .35rem .55rem; }
.field-inline { display: inline-flex; align-items: center; gap: var(--sp-2); color: var(--text-2); font-size: .8125rem; }
.field-inline.check { min-height: 44px; padding: 0 var(--sp-2); cursor: pointer; }
.field-inline.check input { min-height: 0; width: 18px; height: 18px; accent-color: var(--amber); }
.range input[type=range] { width: 130px; min-height: 0; padding: 0; border: 0; background: none; accent-color: var(--amber); }
.range output { font-family: var(--f-mono); font-size: .75rem; color: var(--amber); }

.segmented { display: inline-flex; background: var(--panel); border: 1px solid var(--line-strong); border-radius: var(--r-md); padding: 3px; }
.seg {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  min-height: 38px; padding: 0 .85rem;
  background: transparent; border: 0; border-radius: 6px;
  color: var(--text-2); font-size: .8125rem;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.seg[aria-pressed="true"] { background: var(--amber); color: #1a1203; font-weight: 600; }

.count { margin: var(--sp-4) 0 var(--sp-3); font-family: var(--f-mono); font-size: .6875rem; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); }
.empty {
  text-align: center; color: var(--text-2); padding: var(--sp-7) var(--sp-4);
  border: 1px dashed var(--line-strong); border-radius: var(--r-lg);
}

/* ============================================================
   BOARDING PASSES (cards by destination)
   ============================================================ */
.passes {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: var(--sp-4); align-items: start;
}
.pass {
  --notch: 16px;
  position: relative;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  transition: border-color .2s var(--ease), transform .2s var(--ease), box-shadow .2s var(--ease);
}
/* Only the first paint deals the passes in; re-renders (opening one, filtering) must not replay it. */
.passes.booting .pass { animation: rise .5s var(--ease) both; animation-delay: calc(var(--i, 0) * 35ms); }
.pass:hover { border-color: var(--line-strong); transform: translateY(-2px); box-shadow: 0 18px 40px -24px rgb(0 0 0 / .9); }
.pass.is-alert { border-color: var(--amber-line); }
.pass.is-alert::before {
  content: ""; position: absolute; left: 18px; right: 18px; top: -1px; height: 2px;
  background: var(--amber); border-radius: 0 0 2px 2px; box-shadow: 0 0 14px rgb(255 178 26 / .6);
}

.pass-top {
  display: grid; grid-template-columns: 1fr 128px;
  width: 100%; padding: 0; text-align: left;
  background: none; border: 0; color: inherit;
  border-radius: var(--r-lg) var(--r-lg) 0 0;
}
.pass-main { display: block; padding: var(--sp-4) var(--sp-4) var(--sp-3); min-width: 0; }
.pass-route { display: grid; grid-template-columns: auto 1fr auto; align-items: end; gap: var(--sp-2); }
.iata { display: grid; min-width: 0; }
.iata b { font-family: var(--f-display); font-weight: 900; font-size: 2.6rem; line-height: .9; letter-spacing: .02em; }
.iata small { font-size: .6875rem; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 11ch; }
.iata:last-child { text-align: right; justify-items: end; }
.iata:last-child b { color: var(--amber); }
.flight-path {
  position: relative; align-self: center; height: 16px; margin-bottom: 14px;
  border-top: 2px dotted var(--line-strong);
  top: 8px;
}
.flight-path svg {
  position: absolute; left: 50%; top: -9px; transform: translateX(-50%) rotate(90deg);
  font-size: 16px; color: var(--text-2); background: var(--panel-2); padding: 0 2px; box-sizing: content-box;
}
.pass-meta { display: grid; grid-template-columns: repeat(3, auto); justify-content: start; gap: var(--sp-5); margin-top: var(--sp-3); }
.pass-meta span { display: grid; }
.pass-meta i { font-style: normal; font-family: var(--f-mono); font-size: .5625rem; letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); }
.pass-meta em { font-style: normal; font-weight: 600; font-size: .875rem; }

.pass-stub {
  position: relative; display: grid; align-content: space-between; justify-items: end; gap: var(--sp-2);
  padding: var(--sp-4) var(--sp-4) var(--sp-3);
  border-left: 2px dashed var(--line-strong);
  text-align: right;
}
.pass-stub::before, .pass-stub::after {
  content: ""; position: absolute; left: calc(var(--notch) / -2 - 1px);
  width: var(--notch); height: var(--notch); border-radius: 50%; background: var(--bg);
}
.pass-stub::before { top: calc(var(--notch) / -2 - 1px); box-shadow: inset 0 -1px 0 var(--line); }
.pass-stub::after  { bottom: calc(var(--notch) / -2 - 1px); box-shadow: inset 0 1px 0 var(--line); }
.pass.open .pass-stub::after { display: none; }
.fare-label { font-family: var(--f-mono); font-size: .5625rem; letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); }
.fare {
  display: block; font-family: var(--f-display); font-weight: 800; font-size: 2rem; line-height: 1;
  letter-spacing: .01em; font-variant-numeric: tabular-nums;
}
.fare small { font-size: .55em; color: var(--text-2); font-weight: 700; margin-right: 2px; }

.pass-foot {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-4) var(--sp-3);
  border-top: 1px solid var(--line);
}
.pass-toggle {
  display: inline-flex; align-items: center; gap: var(--sp-1);
  font-family: var(--f-mono); font-size: .625rem; letter-spacing: .12em; text-transform: uppercase; color: var(--text-2);
}
.chevron { font-size: 1rem; transition: transform .2s var(--ease); }
.pass.open .chevron { transform: rotate(180deg); }
.pass-top:hover + .pass-foot .pass-toggle, .pass-foot:hover .pass-toggle { color: var(--amber); }

.badges { display: flex; flex-wrap: wrap; gap: var(--sp-1); margin-top: var(--sp-3); }
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--f-mono); font-size: .625rem; font-weight: 500; letter-spacing: .06em; text-transform: uppercase;
  padding: .2rem .5rem; border-radius: var(--r-sm);
  border: 1px solid transparent;
}
.badge svg { font-size: .75rem; }
.badge.azul  { background: var(--blue-soft);   color: var(--blue);   border-color: #203a5e; }
.badge.watch { background: var(--amber-soft);  color: var(--amber);  border-color: var(--amber-line); }
.badge.rt    { background: var(--violet-soft); color: var(--violet); border-color: #3d2c56; }
.badge.low   { background: var(--green-soft);  color: var(--green);  border-color: #1d4532; }
.badge.reg   { background: transparent;        color: var(--text-2); border-color: var(--line-strong); }

.delta { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; font-family: var(--f-mono); font-size: .6875rem; font-weight: 500; }
.delta.down { color: var(--green); }
.delta.up   { color: var(--red); }
.delta.flat { color: var(--text-3); }

.spark { display: block; width: 96px; height: 26px; overflow: visible; }
.spark path { fill: none; stroke-width: 1.6; stroke: var(--text-3); }
.spark.down path { stroke: var(--green); }
.spark.up path   { stroke: var(--red); }
.spark.down { color: var(--green); }
.spark.up   { color: var(--red); }
.spark circle { fill: currentColor; stroke: var(--panel); stroke-width: 2; }

/* ---------------- Expanded: calendar + dates ---------------- */
.pass-body { border-top: 2px dashed var(--line-strong); padding: var(--sp-4); display: grid; gap: var(--sp-4); }
.month { display: grid; gap: var(--sp-2); }
.month h3 { font-family: var(--f-display); font-size: 1.125rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); }
.dow, .grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.dow span { text-align: center; font-family: var(--f-mono); font-size: .625rem; color: var(--text-3); }
.day {
  display: grid; align-content: center; justify-items: center; gap: 1px;
  aspect-ratio: 1; min-height: 42px; padding: 2px;
  border-radius: var(--r-sm); border: 1px solid transparent;
  background: rgb(255 255 255 / .025); color: var(--text-3);
  font-family: var(--f-mono); font-size: .6875rem; text-decoration: none;
}
.day.empty { background: transparent; }
.day .d { font-weight: 600; }
.day .p { font-size: .5625rem; font-variant-numeric: tabular-nums; }
a.day { color: var(--cream); transition: transform .12s var(--ease); }
a.day:hover { border-color: var(--cream); transform: scale(1.06); }
/* Price tiers — the tier is also spelled out in each cell's title. */
a.day.t1 { background: #113a2a; color: #8ff0c2; }
a.day.t2 { background: #1f3a1d; color: #bfe393; }
a.day.t3 { background: #3a2c0b; color: #ffcf66; }
a.day.t4 { background: #3d1b15; color: #ffa594; }
a.day.best { outline: 2px solid var(--amber); outline-offset: -2px; box-shadow: 0 0 16px -2px rgb(255 178 26 / .55); }

.legend { display: flex; flex-wrap: wrap; gap: var(--sp-3); font-size: .6875rem; color: var(--text-3); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }

.dates { width: 100%; border-collapse: collapse; font-size: .8125rem; }
.dates th { text-align: left; font-family: var(--f-mono); font-weight: 500; font-size: .5625rem; letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); padding-bottom: var(--sp-1); }
.dates td { padding: .45rem 0; border-top: 1px solid var(--line); }
.dates td:last-child, .dates th:last-child { text-align: right; }

a.buy { color: var(--amber); text-decoration: none; font-weight: 600; }
a.buy:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ============================================================
   TABLE — a denser board
   ============================================================ */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--panel); }
table#table { width: 100%; border-collapse: collapse; font-size: .8125rem; }
#table th {
  text-align: left; padding: 0; border-bottom: 1px solid var(--line-strong);
  font-family: var(--f-mono); font-size: .5625rem; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: var(--text-3);
}
#table th:not(:has(button)) { padding: var(--sp-3); }
#table th button {
  width: 100%; text-align: left; background: none; border: 0; color: inherit; font: inherit; letter-spacing: inherit; text-transform: inherit;
  padding: var(--sp-3);
}
#table th[aria-sort="ascending"]  button { color: var(--amber); }
#table th[aria-sort="descending"] button { color: var(--amber); }
#table th[aria-sort="ascending"]  button::after { content: " ▲"; }
#table th[aria-sort="descending"] button::after { content: " ▼"; }
#table td { padding: .6rem var(--sp-3); border-bottom: 1px solid var(--line); vertical-align: middle; }
#table td:first-child { font-family: var(--f-mono); font-weight: 500; }
#table tbody tr:last-child td { border-bottom: 0; }
#table tbody tr:hover td { background: var(--panel-hover); }
#table tr.is-alert td:first-child { box-shadow: inset 3px 0 0 var(--amber); }
.muted { color: var(--text-2); font-size: .8125rem; }
.more { display: flex; margin: var(--sp-4) auto 0; }

/* ============================================================
   MOTION
   ============================================================ */
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

.board-row .meta { display: none; font-size: .625rem; color: var(--text-2); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .counters { grid-template-columns: repeat(3, 1fr); }
  .counter:nth-child(4) { border-left: 0; }
  .counter:nth-child(n+4) { border-top: 1px solid var(--line); }
}

@media (max-width: 720px) {
  main { padding-top: var(--sp-4); }
  .terminal-head { align-items: center; }
  .sign-code { font-size: 2.6rem; }
  .clock { justify-items: start; text-align: left; }
  .clock-time { font-size: 1.25rem; }

  .board { padding: var(--sp-3); }
  .board-cols { display: none; }
  .board-row {
    grid-template-columns: 1fr auto;
    grid-template-areas: "dest fare" "meta status";
    row-gap: 2px; padding: .6rem var(--sp-1);
  }
  .board-row .dest   { grid-area: dest; }
  .board-row .b-fare { grid-area: fare; justify-self: end; }
  .board-row .when, .board-row .cia { display: none; }
  .board-row .status { grid-area: status; justify-self: end; }
  .board-row .meta   { grid-area: meta; display: block; }

  .counters { grid-template-columns: repeat(2, 1fr); }
  .counter { border-left: 0; border-top: 1px solid var(--line); }
  .counter:nth-child(-n+2) { border-top: 0; }
  .counter:nth-child(even) { border-left: 1px solid var(--line); }
  .counter:last-child { grid-column: span 2; border-left: 0; }
  .counter .value { font-size: 1.7rem; }

  .passes { grid-template-columns: 1fr; }

  .filters { flex-wrap: nowrap; overflow-x: auto; padding-bottom: var(--sp-1); scrollbar-width: none; }
  .filters::-webkit-scrollbar { display: none; }
  .filters > * { flex: none; }

  .table-wrap { border: 0; background: none; overflow: visible; }
  #table thead { display: none; }
  #table, #table tbody, #table tr, #table td { display: block; width: 100%; }
  #table tr { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--sp-3); margin-bottom: var(--sp-2); }
  #table td { border: 0; padding: var(--sp-1) 0; display: flex; justify-content: space-between; gap: var(--sp-3); }
  #table td::before { content: attr(data-label); font-family: var(--f-mono); font-size: .5625rem; letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); }
  #table tr.is-alert { border-color: var(--amber-line); }
  #table tr.is-alert td:first-child { box-shadow: none; }
}

@media (max-width: 440px) {
  .gate-pass { grid-template-columns: 1fr; }
  .gate-stub { display: none; }
  .pass-top { grid-template-columns: 1fr; }
  .pass-stub {
    border-left: 0; border-top: 2px dashed var(--line-strong);
    grid-template-columns: 1fr auto; align-items: end; justify-items: start; text-align: left;
  }
  .pass-stub::before, .pass-stub::after { top: calc(var(--notch) / -2 - 1px); bottom: auto; }
  .pass-stub::before { left: calc(var(--notch) / -2 - 1px); }
  .pass-stub::after  { left: auto; right: calc(var(--notch) / -2 - 1px); display: block !important; }
  .iata b { font-size: 2.2rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; transition-duration: .01ms !important; }
}

/* ---------- History: date chart + route summary ---------- */
.hist-chart { margin: 0 0 1.25rem; }
.hist-chart figcaption, .hist-route h4 { font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); margin-bottom: .4rem; }
.hist-chart svg { width: 100%; height: auto; display: block; }
.hist-chart .series { fill: none; stroke: var(--amber); stroke-width: 2; stroke-linejoin: round; }
.hist-chart .today { fill: var(--amber); stroke: none; }
.hist-chart .rule-med { stroke: var(--text-3); stroke-dasharray: 4 4; stroke-width: 1; }
/* The global `svg` rule strokes everything with currentColor; text must opt out or it
   comes out outlined and fat. */
.hist-chart .axis, .hist-chart .rule-label { fill: var(--text-3); stroke: none; font-size: 10px; font-family: inherit; }
.hist-route { margin-bottom: 1.25rem; }
.hist-route h3 { font-size: .95rem; margin: 0 0 .35rem; }
.hist-facts { display: flex; flex-wrap: wrap; gap: .35rem 1.25rem; margin: 0 0 .9rem; color: var(--text-3); font-size: .85rem; }
.hist-facts b { color: var(--cream); font-weight: 600; }
.hist-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 1rem 1.5rem; }
.bar-row { display: grid; grid-template-columns: 5.4rem 1fr auto; align-items: center; gap: .5rem; font-size: .8rem; padding: .12rem 0; }
.bar-key { white-space: nowrap; }   /* "121–180 d" must not wrap onto two lines */
.bar-track { height: .45rem; border-radius: 99px; background: var(--line); overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--text-2); border-radius: inherit; }
.bar-row.is-low .bar-fill { background: var(--green); }
.bar-row.is-low .bar-val { color: var(--green); }
.hist-note { color: var(--text-3); font-size: .85rem; margin: 0 0 1rem; }

/* ---------------- Promotions (blog posts) ---------------- */
.promos {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--sp-4) var(--sp-4) var(--sp-3);
  margin-bottom: var(--sp-5);
}
.promos .board-head { margin-bottom: var(--sp-2); }
.pseg {
  display: inline-flex; align-items: center;
  min-height: 38px; padding: 0 .85rem;
  background: transparent; border: 0; border-radius: 6px;
  color: var(--text-2); font-size: .8125rem; cursor: pointer;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.pseg[aria-pressed="true"] { background: var(--amber); color: #1a1203; font-weight: 600; }
.promo-rows { list-style: none; margin: var(--sp-3) 0 0; padding: 0; }
.promo-row {
  display: grid; grid-template-columns: 5.5rem 5.5rem minmax(0, 1fr);
  gap: var(--sp-3); align-items: start;
  padding: .6rem var(--sp-2);
  border-bottom: 1px solid rgb(255 255 255 / .04);
  border-left: 2px solid transparent;
}
.promo-row:last-child { border-bottom: 0; }
.promo-row.from-bh { border-left-color: var(--amber); background: rgb(255 178 26 / .05); }
.promo-age { font-family: var(--f-mono); font-size: .6875rem; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); padding-top: .2rem; }
.promo-row > .badge { justify-self: start; }
.promo-body { min-width: 0; }
.promo-title { color: var(--cream); text-decoration: none; font-weight: 500; overflow-wrap: anywhere; }
a.promo-title:hover, a.promo-title:focus-visible { color: var(--amber); text-decoration: underline; }
.promo-tags { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-1); margin-top: var(--sp-1); }
.promo-source { font-family: var(--f-mono); font-size: .6875rem; color: var(--text-3); margin-left: var(--sp-1); }

@media (max-width: 640px) {
  .promos { padding: var(--sp-3); }
  .promo-row { grid-template-columns: auto minmax(0, 1fr); }
  .promo-row .promo-body { grid-column: 1 / -1; }
}

/* ---------------- Round trips by stay ---------------- */
.pass-return {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  border-top: 1px dashed var(--line);
  font-family: var(--f-mono); font-size: .75rem; color: var(--text-2);
}
.pass-return a { color: var(--violet); text-decoration: none; }
.pass-return a:hover, .pass-return a:focus-visible { text-decoration: underline; }
.pass-return.is-missing { color: var(--text-3); }
.pass.is-unpaired { opacity: .55; }
.pass.is-unpaired:hover, .pass.is-unpaired:focus-within { opacity: .8; }
#table.no-pair .col-pair { display: none; }

/* ---------------- Trip mode ---------------- */
.trip-mode {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3) var(--sp-5);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--sp-3) var(--sp-4);
  margin-bottom: var(--sp-5);
}
.tseg, .chip {
  display: inline-flex; align-items: center;
  background: transparent; border: 0; border-radius: 6px;
  color: var(--text-2); cursor: pointer;
  transition: background .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease);
}
.tseg {
  min-height: 44px; padding: 0 1.25rem;
  font-family: var(--f-display); font-size: 1.15rem; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase;
}
.tseg[aria-pressed="true"] { background: var(--amber); color: #1a1203; }
/* min-width 0: on phones the chip strip scrolls instead of widening the page. */
.stays { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); flex: 1 1 22rem; min-width: 0; }
.stay-chips { display: flex; flex-wrap: wrap; gap: var(--sp-1); }
.chip {
  min-height: 36px; padding: 0 .7rem;
  border: 1px solid var(--line-strong); border-radius: var(--r-full);
  font-family: var(--f-mono); font-size: .75rem;
}
.chip:hover { color: var(--cream); border-color: var(--text-3); }
.chip[aria-pressed="true"] { background: var(--violet-soft); border-color: var(--violet); color: var(--violet); font-weight: 600; }
.stay-hint { flex-basis: 100%; margin: 0; font-size: .75rem; color: var(--text-3); }

/* ---------------- Folded filters ---------------- */
#more-btn .chevron { transition: transform .15s var(--ease); }
#more-btn[aria-expanded="true"] .chevron { transform: rotate(180deg); }
.more-filters { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; }
@media (min-width: 721px) {
  .more-filters { flex-basis: 100%; order: 1; }   /* its own row, under the view controls */
}

@media (max-width: 720px) {
  .trip-mode { padding: var(--sp-3); }
  .trip-seg { width: 100%; }
  .tseg { flex: 1; justify-content: center; }
  .stay-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; max-width: 100%; }
  .stay-chips::-webkit-scrollbar { display: none; }
  .chip { flex: none; }
  #more-btn { order: -1; }   /* the filter strip scrolls sideways: keep this one in view */
}
/* The paired pass's breakdown: two short lines, so it fits the 128px stub. */
.fare-split { font-family: var(--f-mono); font-size: .6875rem; line-height: 1.5; color: var(--text-2); white-space: nowrap; }
