/* numberstoport.com v2 — departures board. See ../DESIGN_NOTES.md */

@font-face { font-family: "Barlow"; src: url("/fonts/barlow-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Barlow"; src: url("/fonts/barlow-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Barlow"; src: url("/fonts/barlow-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Barlow"; src: url("/fonts/barlow-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Barlow Condensed"; src: url("/fonts/barlow-condensed-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Barlow Condensed"; src: url("/fonts/barlow-condensed-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Barlow Condensed"; src: url("/fonts/barlow-condensed-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --ground: #EEF1F4;
  --surface: #FFFFFF;
  --ink: #0E1A2B;
  --ink-2: #26334A;
  --muted: #5A6577;
  --faint: #8C96A5;
  --rule: #D5DBE2;
  --rule-strong: #B8C1CC;

  --signal: #FFC20E;
  --signal-deep: #F2B200;

  --board: #121418;
  --board-edge: #2A2E35;
  --tile-top: #262A31;
  --tile-bot: #1D2026;
  --tile-split: #08090B;
  --glyph: #F4F0E6;
  --board-label: #8A93A2;
  --go: #4ADE80;
  --hold: #FFB547;
  --stop: #F87171;

  --error: #C0271C;
  --ok: #117A48;

  --ui: "Barlow", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --flap: "Barlow Condensed", "Arial Narrow", ui-sans-serif, sans-serif;

  --gutter: clamp(1.25rem, 4vw, 3.5rem);
  --r-card: 14px;
  --r-control: 10px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--ui);
  font-size: 1.0625rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--ink); text-underline-offset: 0.2em; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 1rem; top: -4rem; z-index: 10; background: var(--ink); color: #fff; padding: .6rem 1rem; border-radius: 8px; }
.skip:focus { top: 1rem; }

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

/* ------------------------------------------------------------------ top bar */

.top {
  max-width: 80rem; margin: 0 auto;
  padding: calc(1.25rem + env(safe-area-inset-top, 0px)) var(--gutter) 0;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.mark { display: inline-flex; align-items: center; gap: .7rem; text-decoration: none; color: var(--ink); }
.mark-tile {
  position: relative; display: grid; place-items: center;
  width: 2.1rem; height: 2.6rem; border-radius: 5px;
  background: linear-gradient(var(--tile-top) 0 50%, var(--tile-bot) 50% 100%);
  color: var(--signal); font-family: var(--flap); font-weight: 700; font-size: 1.75rem; line-height: 1;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.06), 0 2px 6px rgba(14,26,43,.25);
}
.mark-tile::after { content: ""; position: absolute; left: 0; right: 0; top: calc(50% - .5px); height: 1px; background: var(--tile-split); }
.mark-name { font-weight: 700; font-size: 1.1875rem; letter-spacing: -.005em; }

.top-status {
  display: inline-flex; align-items: center; gap: .5rem;
  font-size: .9375rem; font-weight: 600; color: var(--muted);
}
.lamp { width: .55rem; height: .55rem; border-radius: 50%; background: #1FB763; box-shadow: 0 0 0 3px rgba(31,183,99,.18); }
body.is-closed .lamp { background: #E09A1B; box-shadow: 0 0 0 3px rgba(224,154,27,.2); }

/* ------------------------------------------------------------------ layout */

.stage {
  max-width: 80rem; margin: 0 auto;
  padding: clamp(2.25rem, 5.5vw, 4.5rem) var(--gutter) clamp(3rem, 7vw, 6rem);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(22rem, 29rem);
  column-gap: clamp(2.5rem, 6vw, 6.5rem);
  align-items: start;
}

/* ------------------------------------------------------------------ intro */

h1 {
  margin: 0;
  font-size: clamp(2.6rem, 4.7vw, 4.125rem);
  line-height: 1;
  font-weight: 700;
  letter-spacing: -.032em;
  max-width: 15ch;
  text-wrap: balance;
}
.lede {
  margin: 1.4rem 0 0; max-width: 33rem;
  font-size: clamp(1.125rem, 1.4vw, 1.25rem); line-height: 1.55; color: var(--muted);
  text-wrap: pretty;
}

.assure {
  list-style: none; margin: 1.75rem 0 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: .6rem 1.75rem;
  font-size: .9688rem; font-weight: 600; color: var(--ink-2);
}
.assure li { display: inline-flex; align-items: center; gap: .5rem; }
.assure svg { font-size: 1.1rem; color: var(--ink); stroke-width: 2.2; }

.order-again { margin: 2rem 0 0; }
.btn-ghost {
  display: inline-flex; align-items: center; min-height: 2.9rem; padding: 0 1.2rem;
  border: 1.5px solid var(--ink); border-radius: var(--r-control);
  font-weight: 700; text-decoration: none; color: var(--ink);
}
.btn-ghost:hover { background: var(--ink); color: #fff; }

/* ------------------------------------------------------------------ steps */

.steps { margin-top: clamp(2.25rem, 5vw, 3.25rem); max-width: 40rem; }
.step { margin: 0; padding: 0; border: 0; min-width: 0; }
.steps > * + * { margin-top: 2rem; }
.step-row { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 1.5rem 3rem; }

.step-head {
  display: flex; align-items: center; gap: .7rem; padding: 0; margin-bottom: .8rem;
  font-weight: 700; font-size: 1.0625rem; color: var(--ink);
}
.step-no {
  display: grid; place-items: center; flex: none;
  width: 1.65rem; height: 1.65rem; border-radius: 5px;
  background: var(--signal); color: var(--ink);
  font-family: var(--flap); font-weight: 700; font-size: 1.125rem; line-height: 1;
}
.step.is-done .step-no { background: var(--ink); color: var(--signal); }

.msg { margin: .5rem 0 0; font-size: .9375rem; color: var(--muted); min-height: 1.45em; }
.msg.is-error { color: var(--error); font-weight: 600; }
.msg.is-ok { color: var(--ok); font-weight: 600; }

/* carriers */
.carriers { display: grid; grid-template-columns: repeat(auto-fill, minmax(11.25rem, 1fr)); gap: .75rem; }
.carrier { position: relative; display: block; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.carrier input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
.carrier-card {
  position: relative; display: flex; align-items: center; gap: .85rem;
  padding: .8rem .9rem; min-height: 4.4rem;
  background: var(--surface); border: 1.5px solid var(--surface); border-radius: var(--r-card);
  box-shadow: 0 1px 2px rgba(14,26,43,.06), 0 0 0 1px var(--rule);
  transition: box-shadow .15s ease, transform .15s ease;
}
.carrier-card img { width: 2.75rem; height: 2.75rem; border-radius: 8px; display: block; flex: none; }
.carrier-text { display: grid; line-height: 1.2; min-width: 0; }
.carrier-name { font-weight: 700; font-size: 1.0625rem; }
.carrier-price { font-size: .9688rem; color: var(--muted); font-variant-numeric: tabular-nums; margin-top: .15rem; }
.carrier-check {
  position: absolute; top: -.45rem; right: -.45rem;
  display: grid; place-items: center; width: 1.45rem; height: 1.45rem; border-radius: 50%;
  background: var(--ink); color: var(--signal); font-size: .85rem;
  opacity: 0; transform: scale(.6); transition: opacity .15s ease, transform .15s ease;
}
.carrier-check svg { stroke-width: 3; }
.carrier:hover .carrier-card { box-shadow: 0 4px 14px rgba(14,26,43,.09), 0 0 0 1px var(--rule-strong); transform: translateY(-1px); }
.carrier input:checked + .carrier-card { border-color: var(--ink); box-shadow: 0 6px 18px rgba(14,26,43,.12); }
.carrier input:checked + .carrier-card .carrier-check { opacity: 1; transform: scale(1); }
.carrier input:checked + .carrier-card .carrier-price { color: var(--ink); font-weight: 600; }
.carrier input:focus-visible + .carrier-card { outline: 3px solid var(--ink); outline-offset: 3px; }

/* inputs */
.steps input[type="text"], .steps input[type="email"] {
  display: block; width: 100%;
  font: inherit; color: var(--ink);
  background: var(--surface);
  border: 1.5px solid var(--rule); border-radius: var(--r-control);
  padding: .8rem 1rem;
  -webkit-appearance: none; appearance: none;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.steps input::placeholder { color: #A9B2BE; opacity: 1; }
.steps input:hover { border-color: var(--rule-strong); }
.steps input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 4px rgba(255,194,14,.45); }
.steps input[aria-invalid="true"] { border-color: var(--error); }

.steps #area {
  width: 8.5rem; font-size: 2rem; font-weight: 700; letter-spacing: .12em; line-height: 1.15;
  font-variant-numeric: tabular-nums; padding: .55rem 1rem;
}
.steps #email { font-size: 1.1875rem; font-weight: 500; }

.stepper {
  display: inline-flex; align-items: stretch; height: 3.9rem;
  background: var(--surface); border: 1.5px solid var(--rule); border-radius: var(--r-control); overflow: hidden;
}
.stepper:focus-within { border-color: var(--ink); box-shadow: 0 0 0 4px rgba(255,194,14,.45); }
.steps .stepper input#qty {
  width: 3.4rem; text-align: center; border: 0; border-radius: 0; box-shadow: none; padding: 0;
  font-size: 1.75rem; font-weight: 700; font-variant-numeric: tabular-nums;
}
.step-btn {
  width: 3.1rem; display: grid; place-items: center; font-size: 1.15rem;
  background: transparent; border: 0; color: var(--ink); cursor: pointer;
}
.step-btn:hover:not(:disabled) { background: var(--ground); }
.step-btn:disabled { color: #BAC2CC; cursor: default; }
.step-qty.is-single { display: none; }

/* ------------------------------------------------------------------ rail */

.rail { position: sticky; top: 1.5rem; display: grid; gap: 1rem; }

/* the board */
.board {
  position: relative;
  background: var(--board);
  border-radius: 16px;
  padding: 1.1rem 1.1rem 1.25rem;
  box-shadow:
    inset 0 0 0 1px var(--board-edge),
    inset 0 1px 0 rgba(255,255,255,.05),
    0 24px 48px -22px rgba(14,26,43,.55),
    0 2px 4px rgba(14,26,43,.18);
  color: var(--glyph);
}
.board-head {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0 .15rem .85rem; margin-bottom: .35rem;
  border-bottom: 1px solid #23272E;
}
.board-title { font-weight: 600; font-size: .9375rem; color: #C9CED6; }
.board-clock { display: inline-flex; gap: 2px; }
.board-clock .flap { --tw: 15px; --th: 22px; --fs: 20px; --tone: #C9CED6; }

.board-rows { display: grid; }
.b-row {
  display: grid; grid-template-columns: 5.4rem minmax(0, 1fr); align-items: center; gap: .6rem;
  padding: .45rem .15rem;
}
.b-row + .b-row { border-top: 1px solid #1B1E23; }
.b-row.is-group-start { border-top: 1px solid #2C3038; margin-top: .3rem; padding-top: .75rem; }
.b-label { font-size: .8125rem; font-weight: 500; color: var(--board-label); line-height: 1.2; }
.b-val { container-type: inline-size; min-width: 0; }
.b-tiles { display: flex; gap: 2px; }

/* one split-flap tile */
.flap {
  --tw: min(23px, calc((100cqw - (var(--n, 14) - 1) * 2px) / var(--n, 14)));
  --th: calc(var(--tw) * 1.42);
  --fs: calc(var(--tw) * 1.34);
  position: relative; flex: none;
  width: var(--tw); height: var(--th);
  border-radius: 3px;
  font-family: var(--flap); font-weight: 700; font-size: var(--fs);
  color: var(--tone, var(--glyph));
  perspective: 240px;
}
.flap > span {
  position: absolute; left: 0; right: 0; overflow: hidden;
  backface-visibility: hidden;
}
.flap > span > b {
  position: absolute; left: 0; right: 0; height: var(--th);
  display: grid; place-items: center; font-weight: inherit; line-height: 1;
}
.f-top, .f-fold { top: 0; height: 50%; background: var(--tile-top); border-radius: 3px 3px 0 0; transform-origin: 50% 100%; }
.f-bot, .f-fall { bottom: 0; height: 50%; background: var(--tile-bot); border-radius: 0 0 3px 3px; transform-origin: 50% 0; }
.f-bot > b, .f-fall > b { top: auto; bottom: 0; }
.f-top > b, .f-fold > b { top: 0; }
.f-fold, .f-fall { z-index: 2; visibility: hidden; }
.flap::after {
  content: ""; position: absolute; left: 0; right: 0; top: calc(50% - .5px); height: 1px;
  background: var(--tile-split); z-index: 3;
}
/* the hinge notches either side of the split, as on a real flap */
.flap::before {
  content: ""; position: absolute; left: -1px; right: -1px; top: calc(50% - 2px); height: 4px; z-index: 4;
  background:
    radial-gradient(circle at 0 50%, var(--board) 1.6px, transparent 2px) left / 4px 4px no-repeat,
    radial-gradient(circle at 100% 50%, var(--board) 1.6px, transparent 2px) right / 4px 4px no-repeat;
  pointer-events: none;
}
.f-top { box-shadow: inset 0 1px 0 rgba(255,255,255,.05); }
.f-fold { background: linear-gradient(#2B3037, var(--tile-top)); }
.f-fall { background: linear-gradient(var(--tile-bot), #16191D); }

.b-row.tone-go   { --tone: var(--go); }
.b-row.tone-hold { --tone: var(--hold); }
.b-row.tone-stop { --tone: var(--stop); }
.b-row.is-dim    { --tone: #5F6773; }

/* ------------------------------------------------------------------ panels */

.panel {
  background: var(--surface); border-radius: var(--r-card);
  padding: 1.25rem 1.25rem 1.3rem;
  box-shadow: 0 1px 2px rgba(14,26,43,.06), 0 0 0 1px var(--rule);
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.panel-head h2 { margin: 0; font-size: 1.125rem; font-weight: 700; }
.secure { display: inline-flex; align-items: center; gap: .35rem; font-size: .875rem; font-weight: 600; color: var(--muted); }
.send-to { margin: -.25rem 0 1rem; font-size: .9375rem; color: var(--muted); overflow-wrap: anywhere; }
.send-to b { color: var(--ink); font-weight: 600; }

.payment-element { margin-bottom: 1.1rem; }
.payment-element:empty { display: none; }
.pay-wait { margin: 0 0 1rem; font-size: .9375rem; color: var(--muted); }
.pay-wait:empty { display: none; }

.pay-btn {
  display: flex; align-items: center; justify-content: center; gap: .6rem; width: 100%;
  min-height: 3.6rem; padding: .75rem 1rem;
  font: inherit; font-size: 1.1875rem; font-weight: 700; letter-spacing: .005em;
  font-variant-numeric: tabular-nums;
  color: var(--ink); background: var(--signal);
  border: 0; border-radius: var(--r-control); cursor: pointer;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,.12);
  transition: background-color .12s ease, transform .08s ease;
}
.pay-btn:hover:not(:disabled) { background: var(--signal-deep); }
.pay-btn:active:not(:disabled) { transform: translateY(1px); }
.pay-btn:disabled { background: #E3E7EC; color: #8C96A5; box-shadow: none; cursor: not-allowed; }
.pay-btn.is-busy { background: var(--signal-deep); cursor: progress; }
.pay-btn.is-busy::before {
  content: ""; width: 1rem; height: 1rem; border-radius: 50%;
  border: 2.5px solid rgba(14,26,43,.25); border-top-color: var(--ink);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.pay-error { margin: .8rem 0 0; color: var(--error); font-weight: 600; font-size: .9375rem; }
.pay-error:empty { display: none; }
.fine { margin: .9rem 0 0; font-size: .875rem; line-height: 1.5; color: var(--muted); }
.fine:empty { display: none; }

/* results */
.lines { display: grid; gap: .6rem; }
.line-card {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .8rem .95rem; border: 1px solid var(--rule); border-radius: var(--r-control);
}
.line-card .lc-num { font-weight: 700; font-size: 1.0625rem; font-variant-numeric: tabular-nums; }
.line-card .lc-sub { font-size: .875rem; color: var(--muted); }
.btn-copy {
  font: inherit; font-size: .9375rem; font-weight: 700; flex: none;
  min-height: 2.5rem; padding: 0 1rem; border-radius: 8px; cursor: pointer;
  background: var(--signal); color: var(--ink); border: 0;
}
.btn-copy:hover { background: var(--signal-deep); }
.btn-copy.is-done { background: var(--ink); color: var(--signal); }
.btn-dark {
  margin-top: .75rem; width: 100%; min-height: 3.1rem;
  font: inherit; font-weight: 700; font-size: 1rem;
  background: var(--ink); color: #fff; border: 0; border-radius: var(--r-control); cursor: pointer;
}
.btn-dark:hover { background: #1B2A40; }

/* ------------------------------------------------------------------ states */

body.is-closed .steps, body.is-closed .pay, body.is-closed .assure { display: none; }
body.has-order .steps, body.has-order .pay, body.has-order .assure { display: none; }

/* ------------------------------------------------------------------ narrow */

@media (max-width: 960px) {
  .stage { grid-template-columns: minmax(0, 1fr); row-gap: 1.75rem; }
  .intro { display: contents; }
  h1 { order: 1; } .lede { order: 2; margin-top: -.5rem; } .assure { order: 3; margin-top: 0; } .order-again { order: 4; margin-top: 0; }
  .rail { order: 5; position: static; }
  .steps { order: 6; margin-top: .5rem; max-width: none; }
  /* ordering on a phone: board as the hero, then the steps, then pay at the end */
  body.is-open:not(.has-order) .rail { display: contents; }
  body.is-open:not(.has-order) .board { order: 5; }
  body.is-open:not(.has-order) .pay { order: 7; }
  body.is-open:not(.has-order) .result { order: 8; }
}

@media (max-width: 520px) {
  .top-status { font-size: .875rem; }
  .mark-name { font-size: 1.0625rem; }
  .carriers { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .6rem; }
  .step-row { gap: 1rem; }
  .steps #area { width: 100%; }
  .b-row { grid-template-columns: 4.3rem minmax(0, 1fr); gap: .45rem; }
  .board { padding: .95rem .85rem 1.05rem; }
  .assure { gap: .55rem 1.25rem; font-size: .9375rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
