/* Chabi signage: the site as a 1970s transit system. Apps are stops on the Chabi line, plans are fare cards.
   Black sign bands with white lettering, coloured route bullets, a strict grid, and one colour that is
   Chabi's alone: brass-key gold. Every page uses this one stylesheet. */

/* ── Fonts (self-hosted; see src/pages.ts) ─────────────────────────────── */

@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  src: url(/static/fonts/archivo.woff2) format("woff2-variations");
}
@font-face {
  font-family: "Google Sans";
  font-style: normal;
  font-display: swap;
  font-weight: 500;
  src: url(/static/fonts/google-sans-500.woff2) format("woff2");
}
@font-face {
  font-family: "Martian Mono";
  font-style: normal;
  font-display: swap;
  font-weight: 100 800;
  src: url(/static/fonts/martian-mono-wght.woff2) format("woff2-variations");
}

/* ── Tokens ─────────────────────────────────────────────────────────────── */

:root {
  /* tokens:light */
  --page: #F3F0E7;
  --panel: #FBFAF6;
  --ink: #121212;
  --dim: color-mix(in srgb, var(--ink) 66%, var(--page));
  --rule: color-mix(in srgb, var(--ink) 16%, var(--page));
  --band: #141414;
  --band-ink: #F7F5EF;
  --gold: #E0A526;
  --on-gold: #121212;
  --notice: #F5C518;
  --code-bg: #17191B;
  --code-ink: #E9E5DA;
  --tile: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64'%3E%3Cpath d='M0 .5H64M0 32.5H64M.5 0V32M32.5 32V64' stroke='%23121212' stroke-opacity='.055' fill='none'/%3E%3C/svg%3E");
  --light: rgba(255, 255, 255, 0.55);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    /* tokens:dark */
    --page: #0F1011;
    --panel: #191B1D;
    --ink: #ECE8DD;
    --dim: color-mix(in srgb, var(--ink) 66%, var(--page));
    --rule: color-mix(in srgb, var(--ink) 18%, var(--page));
    --band: #1E2022;
    --band-ink: #F7F5EF;
    --gold: #F2B632;
    --on-gold: #121212;
    --tile: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64'%3E%3Cpath d='M0 .5H64M0 32.5H64M.5 0V32M32.5 32V64' stroke='%23ECE8DD' stroke-opacity='.04' fill='none'/%3E%3C/svg%3E");
    --light: rgba(242, 182, 50, 0.06);
    color-scheme: dark;
  }
}
:root {
  --font-sans: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "Martian Mono", ui-monospace, Menlo, Consolas, monospace;
  --gutter: clamp(16px, 4vw, 40px);
  --radius: 6px;
}

/* Route colours: set --route and --route-ink on anything that wears an app's colour.
   Lettering colours match ROUTE_COLORS in src/signage.ts (test/contrast.test.ts keeps them in step). */
.route-vermilion { --route: #E2432A; --route-ink: #121212; }
.route-cobalt { --route: #1F5FBF; --route-ink: #FFFFFF; }
.route-green { --route: #1F8F4F; --route-ink: #121212; }
.route-sky { --route: #2BA3D9; --route-ink: #121212; }
.route-orange { --route: #F07A1A; --route-ink: #121212; }
.route-brown { --route: #8C5A2B; --route-ink: #FFFFFF; }
.route-slate { --route: #6B7280; --route-ink: #FFFFFF; }
.route-chabi { --route: var(--gold); --route-ink: var(--on-gold); }

/* ── Base ───────────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--ink);
  background-color: var(--page);
  /* A wall of running-bond subway tile, lit from above. */
  background-image: radial-gradient(120% 70% at 50% -10%, var(--light), transparent 70%), var(--tile);
  background-attachment: fixed, scroll;
  font: 400 17px/1.55 var(--font-sans);
  font-stretch: 100%;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
main { flex: 1; }
::selection { background: var(--gold); color: var(--on-gold); }

h1, h2, h3 { margin: 0; text-wrap: balance; }
h1 { font-weight: 900; font-stretch: 125%; font-size: clamp(34px, 5vw, 56px); line-height: 1.04; letter-spacing: -0.015em; }
h2 { font-weight: 800; font-stretch: 118%; font-size: clamp(24px, 3vw, 32px); line-height: 1.12; letter-spacing: -0.01em; }
h3 { font-weight: 700; font-stretch: 100%; font-size: 21px; line-height: 1.25; }
p { margin: 0 0 1em; }
small, .small { font-size: 14px; }
.dim { color: var(--dim); }
.b { font-weight: 700; }

a { color: inherit; text-decoration: underline; text-decoration-color: var(--gold); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 4px; }
mark { background: var(--gold); color: var(--on-gold); padding: 0 0.15em; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
code { font-family: var(--font-mono); font-size: 0.86em; }
:not(pre) > code { background: color-mix(in srgb, var(--ink) 8%, transparent); padding: 0.08em 0.35em; border-radius: 3px; overflow-wrap: anywhere; }

/* Keyboard focus: gold ring with an ink edge, visible on gold buttons, panels and bands alike. */
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; box-shadow: 0 0 0 2px var(--ink); border-radius: 2px; }

.wrap { width: 100%; max-width: 1280px; margin: 0 auto; padding: 0 var(--gutter); }
.prose { max-width: 72ch; }
.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; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 10; background: var(--gold); color: var(--on-gold); padding: 10px 16px; font-weight: 700; border-radius: var(--radius); text-decoration: none; }
.skip:focus { top: 12px; }

/* A small label naming what follows. Condensed, sentence case. */
.kicker { margin: 0 0 8px; font-weight: 600; font-stretch: 75%; font-size: 16px; letter-spacing: 0.01em; color: var(--dim); }

/* ── Sign band ──────────────────────────────────────────────────────────── */
/* Black with white lettering, and the thin white rule near the top that the 1970s signs carried. */

.band {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px var(--gutter) 13px;
  background: linear-gradient(var(--band) 0 6px, var(--band-ink) 6px 7px, var(--band) 7px);
  color: var(--band-ink);
}
.band a { color: inherit; }
.band-label { margin: 0; font-weight: 700; font-stretch: 112%; font-size: clamp(18px, 2.2vw, 24px); letter-spacing: -0.005em; }
.band .dim { color: color-mix(in srgb, var(--band-ink) 70%, var(--band)); }

/* The top band: logo and name on the left, the main links on the right; a menu on phones. */
.band-top { position: relative; z-index: 2; justify-content: space-between; padding-top: 15px; padding-bottom: 12px; }
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; font-weight: 800; font-stretch: 118%; font-size: 22px; letter-spacing: -0.01em; }
.brand:hover { text-decoration: none; }
.nav, .menu nav { display: flex; align-items: center; gap: clamp(14px, 2.4vw, 30px); }
.band-top nav a { font-weight: 600; font-size: 16px; text-decoration: none; padding: 4px 0; border-bottom: 3px solid transparent; }
.band-top nav a:hover { border-bottom-color: color-mix(in srgb, var(--band-ink) 45%, var(--band)); }
.band-top nav a[aria-current="page"] { border-bottom-color: var(--gold); }
.menu { display: none; }
.menu summary { list-style: none; cursor: pointer; font-weight: 700; padding: 6px 12px; border: 2px solid var(--band-ink); border-radius: var(--radius); }
.menu summary::-webkit-details-marker { display: none; }
.menu[open] nav { position: absolute; right: var(--gutter); top: calc(100% + 6px); flex-direction: column; align-items: stretch; gap: 0; min-width: 200px; padding: 8px 16px; background: var(--band); border-radius: 8px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25); }
.menu[open] nav a { padding: 10px 0; }
@media (max-width: 640px) {
  .nav { display: none; }
  .menu { display: block; }
}

/* Signed in or out: landing.js sets html.signed-in before the first paint. */
html:not(.signed-in) .when-in, html.signed-in .when-out { display: none !important; }

/* The footer: end of the line. */
.band-end { margin-top: clamp(56px, 8vw, 96px); padding-top: 26px; padding-bottom: 30px; }
.end { width: 100%; max-width: 1280px; margin: 0 auto; display: grid; gap: 12px; }
.end nav { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.end nav a { font-size: 15px; text-decoration-color: color-mix(in srgb, var(--band-ink) 40%, var(--band)); }
.end p { margin: 0; font-size: 14px; }

/* ── Route bullets ──────────────────────────────────────────────────────── */

.bullet {
  --size: 32px;
  flex: none;
  display: inline-grid;
  place-items: center;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  background: var(--route, var(--gold));
  color: var(--route-ink, var(--on-gold));
  font-weight: 800;
  font-stretch: 80%;
  font-size: calc(var(--size) * 0.4);
  line-height: 1;
  letter-spacing: 0.02em;
}
.bullet-sm { --size: 20px; }
.bullet-lg { --size: 56px; }
.bullet svg { width: 100%; height: 100%; display: block; }
.bullet-logo { display: block; }
.kb-disc { fill: var(--gold); }
.code-tag { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.02em; color: var(--dim); white-space: nowrap; }

/* ── Route lines and stops ──────────────────────────────────────────────── */

.line { position: relative; display: flex; justify-content: space-between; gap: 12px; }
.line::before {
  content: "";
  position: absolute;
  left: 16px;
  right: 16px;
  top: calc(var(--rail-at, 28px) - 4px);
  height: 8px;
  border-radius: 4px;
  background: var(--gold);
}
.stop { position: relative; display: grid; justify-items: center; gap: 6px; text-align: center; min-width: 0; }
.stop .bullet { --size: 56px; box-shadow: 0 0 0 5px var(--page); }
.stop-name { font-weight: 700; font-stretch: 87.5%; font-size: 17px; line-height: 1.2; overflow-wrap: anywhere; }
.stop-empty .bullet { background: var(--page); color: var(--dim); border: 3px dashed var(--dim); }

.line-vertical { display: grid; gap: 4px; padding: 0; margin: 0; list-style: none; position: relative; }
.line-vertical::before { content: ""; position: absolute; left: 14px; top: 16px; bottom: 16px; width: 4px; border-radius: 2px; background: var(--gold); }
.line-vertical > li { position: relative; display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 10px 0; }
.line-vertical .bullet { box-shadow: 0 0 0 4px var(--page); }

/* Contents of a long page: a thin line with a dot per section; the section in view is filled gold. */
.stoplist { position: relative; display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; font-size: 15px; }
.stoplist::before { content: ""; position: absolute; left: 6px; top: 12px; bottom: 12px; width: 2px; background: var(--rule); }
.stoplist a { position: relative; display: block; padding: 5px 0 5px 26px; color: var(--dim); text-decoration: none; line-height: 1.3; }
.stoplist a::before {
  content: "";
  position: absolute;
  left: 0;
  top: 9px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--page);
  border: 2px solid var(--dim);
  transition: background-color 0.2s, border-color 0.2s;
}
.stoplist a:hover { color: var(--ink); }
.stoplist a.is-current { color: var(--ink); font-weight: 700; }
.stoplist a.is-current::before { background: var(--gold); border-color: var(--gold); }

/* ── Fare cards and tickets ─────────────────────────────────────────────── */

.fare {
  position: relative;
  display: grid;
  gap: 10px;
  align-content: start;
  padding: 34px 22px 22px;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: var(--panel);
  overflow: hidden;
}
/* The magnetic stripe. */
.fare::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 14px; background: var(--band); }
.fare-name { font-weight: 800; font-stretch: 112%; font-size: 22px; }
.fare-price { font-weight: 900; font-stretch: 125%; font-size: 40px; line-height: 1; letter-spacing: -0.02em; }
.fare-price small { font-weight: 600; font-stretch: 100%; font-size: 16px; letter-spacing: 0; }

/* Credits as a row of segments: plan credits gold, top-ups hatched, the rest empty. */
.fare-bar { display: flex; height: 14px; border-radius: 3px; overflow: hidden; background: var(--rule); }
.fare-bar > span { height: 100%; transition: flex-basis 0.6s cubic-bezier(0.2, 0.7, 0.2, 1); }
.fare-seg-plan { background: var(--gold); }
.fare-seg-topup { background: repeating-linear-gradient(-45deg, var(--ink) 0 3px, transparent 3px 7px); }

/* A single-ride ticket: punched notches on the short edges. */
.ticket {
  --notch: 9px;
  position: relative;
  display: grid;
  gap: 2px;
  padding: 14px 22px;
  background: var(--panel);
  border: 2px solid var(--ink);
  border-radius: 4px;
  -webkit-mask: radial-gradient(circle var(--notch) at 0 50%, transparent 98%, #000) left / 51% 100% no-repeat,
    radial-gradient(circle var(--notch) at 100% 50%, transparent 98%, #000) right / 51% 100% no-repeat;
  mask: radial-gradient(circle var(--notch) at 0 50%, transparent 98%, #000) left / 51% 100% no-repeat,
    radial-gradient(circle var(--notch) at 100% 50%, transparent 98%, #000) right / 51% 100% no-repeat;
}
.ticket-price { font-weight: 900; font-stretch: 118%; font-size: 26px; line-height: 1.1; }

/* ── Buttons and fields ─────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 18px;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  font-size: 16px;
  line-height: 1.1;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}
.btn:hover { background: var(--ink); color: var(--page); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: default; transform: none; }
.btn:disabled:hover { background: transparent; color: var(--ink); }
.btn-primary { background: var(--gold); color: var(--on-gold); border-color: var(--gold); }
.btn-primary:hover { background: color-mix(in srgb, var(--gold) 85%, var(--ink)); color: var(--on-gold); }
.btn-primary:disabled:hover { background: var(--gold); color: var(--on-gold); }
.btn-small { min-height: 32px; padding: 5px 12px; font-size: 14px; }
.btn.busy { cursor: progress; }
.btn.busy::after { content: ""; width: 0.55em; height: 0.55em; border-radius: 50%; background: currentColor; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.field { display: grid; gap: 6px; margin: 0 0 16px; }
.field-label { font-weight: 600; font-stretch: 87.5%; font-size: 15px; }
/* Cloudflare Turnstile draws a 65px-high iframe here; reserve the space so the form doesn't jump. */
.captcha { min-height: 65px; margin: 0 0 8px; }
/* Account page: why a balance is below zero (a reversed payment), in the error colour so it's read. */
.fare-debt { padding-left: 10px; border-left: 3px solid #E2432A; }
/* Account page: a cancelled plan's end date, in the gold of the line so it isn't missed. */
.notice-ends { margin: 0 0 16px; padding: 12px 16px; border-left: 4px solid var(--gold); background: var(--panel, transparent); }
input:not([type="checkbox"]):not([type="radio"]), textarea, select {
  width: 100%;
  padding: 11px 12px;
  border: 0;
  border-bottom: 2px solid var(--ink);
  border-radius: 3px 3px 0 0;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
}
textarea { resize: vertical; font-family: var(--font-mono); font-size: 14px; line-height: 1.6; }
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--ink) 45%, var(--panel)); }
input:focus-visible, textarea:focus-visible, select:focus-visible { border-bottom-color: var(--gold); box-shadow: none; outline-offset: 0; }

/* ── Panels, notices, messages ──────────────────────────────────────────── */

.panel { background: var(--panel); border: 2px solid var(--ink); border-radius: 10px; padding: clamp(18px, 3vw, 28px); }
.notice { background: var(--notice); color: var(--on-gold); border-left: 12px solid var(--on-gold); padding: 22px 24px; border-radius: 0 6px 6px 0; }
.notice a { text-decoration-color: currentColor; }
.error { border-left: 6px solid #E2432A; background: color-mix(in srgb, #E2432A 12%, var(--panel)); padding: 10px 14px; border-radius: 0 4px 4px 0; font-weight: 600; }
.ok { border-left: 6px solid var(--gold); background: color-mix(in srgb, var(--gold) 16%, var(--panel)); padding: 10px 14px; border-radius: 0 4px 4px 0; font-weight: 600; }
[hidden] { display: none !important; }

/* ── Code ───────────────────────────────────────────────────────────────── */

.codeblock { position: relative; margin: 8px 0 22px; border-radius: 8px; background: var(--code-bg); color: var(--code-ink); }
.codeblock pre { margin: 0; padding: 18px 20px; overflow-x: auto; font: 13px/1.75 var(--font-mono); counter-reset: ln; }
.codeblock pre code { display: block; padding-left: 4.5ch; position: relative; white-space: pre; font-size: inherit; background: none; padding-top: 0; padding-bottom: 0; }
.codeblock pre code::before { counter-increment: ln; content: counter(ln); position: absolute; left: 0; width: 2.5ch; text-align: right; color: color-mix(in srgb, var(--code-ink) 45%, var(--code-bg)); }
.codeblock .c { color: color-mix(in srgb, var(--code-ink) 66%, var(--code-bg)); }
.codeblock mark { background: var(--gold); color: #121212; }
.codeblock .copy { position: absolute; top: 10px; right: 10px; min-height: 30px; padding: 4px 10px; font-size: 13px; color: var(--code-ink); border-color: color-mix(in srgb, var(--code-ink) 40%, var(--code-bg)); background: var(--code-bg); }
.codeblock .copy:hover { background: var(--code-ink); color: var(--code-bg); }
/* The AI prompt in the docs: prose, so it wraps, and scrolls inside its box rather than running the page long. */
.prompt { margin: 8px 0 14px; border-radius: 8px; background: var(--code-bg); color: var(--code-ink); }
.prompt pre { margin: 0; padding: 18px 20px; max-height: 360px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; font: 13px/1.7 var(--font-mono); }
.prompt-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 4px 0 12px; }

/* ── Tables ─────────────────────────────────────────────────────────────── */

.scroll { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th, .table td { text-align: left; vertical-align: top; padding: 10px 18px 10px 0; border-bottom: 1px solid var(--rule); }
.table thead th { font-weight: 700; font-stretch: 87.5%; border-bottom: 2px solid var(--ink); }
.table tbody th { font-weight: 600; }
.table .nowrap { white-space: nowrap; }
/* On phones each row becomes a small card, every value with its column's name. */
@media (max-width: 640px) {
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table th, .table td { display: block; width: 100%; }
  .table tr { padding: 12px 0; border-bottom: 1px solid var(--rule); }
  .table th, .table td { padding: 3px 0; border: 0; }
  .table tbody th { font-weight: 700; font-size: 16px; }
  .table td[data-label]::before { content: attr(data-label); display: block; font-weight: 600; font-stretch: 87.5%; font-size: 13px; color: var(--dim); }
  .table .nowrap, .ref-section .table code { white-space: normal; }
  .ref-section .table td.dim { min-width: 0; }
}

/* ── Station board (big numbers on a band) ──────────────────────────────── */

.board { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 18px 28px; padding: 22px 24px; background: var(--band); color: var(--band-ink); border-radius: 10px; }
.board-n { display: block; font-weight: 900; font-stretch: 118%; font-size: 34px; line-height: 1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.board-label { display: block; margin-top: 6px; font-size: 14px; color: color-mix(in srgb, var(--band-ink) 72%, var(--band)); }

/* ── Shared page pieces ─────────────────────────────────────────────────── */

.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.split { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: clamp(28px, 5vw, 72px); align-items: start; }
@media (max-width: 1100px) { .split { grid-template-columns: minmax(0, 1fr); } }

/* ── Landing ────────────────────────────────────────────────────────────── */

.hero { padding-top: clamp(48px, 9vw, 112px); }
.hero-title { max-width: 15ch; font-size: clamp(44px, 8.2vw, 112px); line-height: 0.98; letter-spacing: -0.025em; }
.hero-lede { max-width: 54ch; margin: 28px 0 0; font-size: clamp(18px, 1.6vw, 21px); line-height: 1.5; }

/* The Chabi line: a gold rail with the stops on it, ending at the developer's own app. */
.hero-line { margin-top: clamp(48px, 7vw, 88px); }
.routemap { position: relative; margin: 0; padding: 0; --rail: 10px; --bullet: 64px; }
.routemap-rail { position: absolute; left: calc(var(--bullet) / 2); right: calc(var(--bullet) / 2); top: calc(var(--bullet) / 2 - var(--rail) / 2); height: var(--rail); border-radius: 5px; background: var(--gold); transform-origin: left center; }
.routemap-stops { position: relative; display: flex; justify-content: space-between; margin: 0; padding: 0; list-style: none; }
.routemap .stop { width: var(--bullet); justify-items: center; overflow: visible; }
.routemap .stop .bullet { --size: var(--bullet); font-size: 22px; box-shadow: 0 0 0 7px var(--page); }
.routemap .stop-name, .routemap .code-tag { width: max-content; max-width: 22vw; }
.routemap .stop-name { font-size: 19px; margin-top: 6px; }
.routemap .stop-empty .bullet { font-size: 30px; font-weight: 500; }

/* Platforms: the two halves of the page, signed like station platforms. */
.platforms-wrap { margin-top: clamp(56px, 8vw, 104px); }
.platforms { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: clamp(32px, 4vw, 48px); }
/* The platform not shown is quiet (dim, faint outline); the one shown is a lit sign with a gold edge and a
   pointer down to its half of the page. */
.platform {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 16px;
  align-items: center;
  padding: 16px 20px 15px;
  border: 2px solid var(--rule);
  border-radius: 8px;
  background: transparent;
  color: var(--dim);
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s;
}
.platform-n { grid-row: 1 / 3; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; border: 3px solid currentColor; font-weight: 800; font-size: 22px; }
.platform-name { font-weight: 800; font-stretch: 112%; font-size: clamp(20px, 2.4vw, 26px); line-height: 1.1; }
.platform-sub { font-size: 15px; }
.platform:hover { border-color: var(--ink); color: var(--ink); }
.platform[aria-selected="true"] {
  background: linear-gradient(var(--band) 0 6px, var(--band-ink) 6px 7px, var(--band) 7px);
  color: var(--band-ink);
  border: 3px solid var(--gold);
  padding: 15px 19px 14px;
}
.platform[aria-selected="true"] .platform-sub { color: color-mix(in srgb, var(--band-ink) 72%, var(--band)); }
.platform[aria-selected="true"] .platform-n { background: var(--gold); color: var(--on-gold); border-color: var(--gold); }
.platform[aria-selected="true"]::after {
  content: "";
  position: absolute;
  left: 32px;
  bottom: -14px;
  border: 12px solid transparent;
  border-bottom: 0;
  border-top-color: var(--gold);
}

.panel-dev h2, .panel-users h2 { margin-bottom: 14px; max-width: 24ch; }
.steps { gap: 10px; margin-top: 4px; }
.steps > li { grid-template-columns: 32px minmax(0, 1fr); align-items: start; padding: 4px 0 14px; }
.steps .bullet { margin-top: 1px; }
.fares { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 18px; margin-top: 28px; }
.tickets-title { margin: 36px 0 14px; }
.tickets { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; max-width: 760px; }

@media (max-width: 760px) {
  /* The line runs down the page instead of across it. */
  .routemap { --bullet: 52px; }
  .routemap-rail { left: calc(var(--bullet) / 2 - var(--rail) / 2); right: auto; top: calc(var(--bullet) / 2); bottom: calc(var(--bullet) / 2); width: var(--rail); height: auto; transform-origin: center top; }
  .routemap-stops { flex-direction: column; gap: 22px; }
  .routemap .stop { width: auto; grid-template-columns: var(--bullet) auto; grid-template-rows: auto auto; justify-items: start; column-gap: 16px; row-gap: 0; text-align: left; }
  .routemap .stop .bullet { grid-row: 1 / 3; font-size: 18px; }
  .routemap .stop-name { margin-top: 0; align-self: end; max-width: none; }
  .routemap .code-tag { align-self: start; max-width: none; }
  .platforms { grid-template-columns: 1fr; }
}

/* The page's one moment: the line draws itself and each stop opens as the line reaches it. Content is all in
   the HTML; this only changes how it arrives, and only when motion is welcome. */
@media (prefers-reduced-motion: no-preference) {
  .landing .hero-title { animation: rise 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
  .landing .hero-lede { animation: rise 0.7s 0.08s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
  .landing .routemap-rail { animation: draw-x 1.3s 0.25s cubic-bezier(0.55, 0.05, 0.25, 1) both; }
  .landing .routemap .stop .bullet { animation: stop-open 0.45s cubic-bezier(0.3, 1.6, 0.5, 1) both; }
  .landing .routemap .stop .stop-name, .landing .routemap .stop .code-tag { animation: rise 0.45s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
  .landing .routemap .stop[data-n="0"] > * { animation-delay: 0.3s; }
  .landing .routemap .stop[data-n="1"] > * { animation-delay: 0.68s; }
  .landing .routemap .stop[data-n="2"] > * { animation-delay: 1.06s; }
  .landing .routemap .stop[data-n="3"] > * { animation-delay: 1.44s; }
  .landing .routemap .stop-empty .bullet { animation: stop-open 0.45s 1.44s cubic-bezier(0.3, 1.6, 0.5, 1) both, beckon 1.2s 2s ease-in-out 1; }
  .landing .platforms { animation: rise 0.7s 0.16s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
  @media (max-width: 760px) { .landing .routemap-rail { animation-name: draw-y; } }
}
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes draw-x { from { transform: scaleX(0); } }
@keyframes draw-y { from { transform: scaleY(0); } }
@keyframes stop-open { from { transform: scale(0.3); opacity: 0; } }
@keyframes beckon { 50% { box-shadow: 0 0 0 7px var(--page), 0 0 0 11px var(--gold); } }

/* ── Reference pages (docs, privacy, terms) ──────────────────────────────── */

/* The page's own sign: which manual, the page's name, what it covers. */
.pagesign {
  margin-top: clamp(28px, 5vw, 56px);
  padding: 26px clamp(20px, 3vw, 36px) 28px;
  border-radius: 10px;
  background: linear-gradient(var(--band) 0 8px, var(--band-ink) 8px 9px, var(--band) 9px);
  color: var(--band-ink);
}
.pagesign h1 { font-size: clamp(40px, 6vw, 72px); line-height: 1; margin: 6px 0 14px; }
.pagesign-manual { margin: 0; font-weight: 700; font-stretch: 87.5%; font-size: 17px; color: var(--gold); }
.pagesign-summary { margin: 0; max-width: 60ch; font-size: 19px; }
.pagesign-date { margin: 10px 0 0; font-size: 14px; color: color-mix(in srgb, var(--band-ink) 68%, var(--band)); }

.reference { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: clamp(32px, 5vw, 72px); margin-top: clamp(32px, 4vw, 48px); align-items: start; }
.reference-nav { position: sticky; top: 24px; max-height: calc(100vh - 48px); overflow-y: auto; padding-bottom: 12px; }
.reference-body { min-width: 0; }
.ref-section { padding-bottom: 28px; margin-bottom: 36px; border-bottom: 2px solid var(--rule); scroll-margin-top: 24px; }
.ref-section:last-child { border-bottom: 0; }
.ref-section h2 { margin-bottom: 16px; }
.ref-section > p, .ref-section > ul, .ref-section > ol, .ref-section > dl { max-width: 72ch; }
.ref-section p.b { margin: 26px 0 8px; font-size: 18px; }
.ref-section .note { margin-top: -8px; font-size: 15px; }
.ref-section ul.dash { padding-left: 1.2em; margin: 0 0 1em; }
.ref-section ul.dash li { margin-bottom: 8px; }
.ref-section ul.dash li::marker { color: var(--gold); content: "■  "; font-size: 0.8em; }
.ref-section ol.numbered { padding-left: 1.4em; margin: 0 0 1em; }
.ref-section ol.numbered li { margin-bottom: 10px; padding-left: 4px; }
.ref-section ol.numbered li::marker { font-weight: 800; }
.ref-section dl.opts { display: grid; grid-template-columns: minmax(150px, 220px) minmax(0, 1fr); gap: 8px 24px; margin: 0 0 1em; }
.ref-section dl.opts dt { font-weight: 700; overflow-wrap: anywhere; }
.ref-section dl.opts dd { margin: 0 0 10px; }
.ref-section .table { margin: 6px 0 14px; }
.ref-section .table td.dim { min-width: 28ch; }
.ref-section .table code { white-space: nowrap; }

@media (max-width: 1180px) {
  /* The stops become a strip that stays in view, so code samples get the full width. */
  .reference { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .reference-nav { top: 0; z-index: 1; margin: 0 calc(var(--gutter) * -1); padding: 10px var(--gutter); max-height: none; overflow: visible; background: var(--page); border-bottom: 2px solid var(--rule); }
  .reference-nav .stoplist { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
  .reference-nav .stoplist::before { display: none; }
  .reference-nav .stoplist a { white-space: nowrap; padding: 6px 12px; border: 2px solid var(--rule); border-radius: 999px; }
  .reference-nav .stoplist a::before { display: none; }
  .reference-nav .stoplist a.is-current { background: var(--gold); border-color: var(--gold); color: var(--on-gold); }
  .ref-section { scroll-margin-top: 72px; }
  .ref-section dl.opts { grid-template-columns: minmax(0, 1fr); gap: 0; }
}

/* ── Notices (404, stopped sign-ins) ────────────────────────────────────── */

.notice-page { max-width: 880px; padding-top: clamp(40px, 8vw, 96px); }
.notice h1 { font-size: clamp(30px, 4.6vw, 48px); line-height: 1.08; margin: 6px 0 14px; overflow-wrap: anywhere; }
.notice h1 code { font-size: 0.82em; background: rgba(18, 18, 18, 0.1); padding: 0 0.2em; }
.notice-kind { margin: 0; font-weight: 700; font-stretch: 87.5%; font-size: 17px; }
.notice-lede { font-size: 19px; }
.notice p:last-child { margin-bottom: 0; }
.detours { display: flex; flex-wrap: wrap; gap: 12px 28px; margin-top: 28px; }
.detour { display: inline-flex; align-items: center; gap: 12px; font-weight: 700; font-size: 18px; text-decoration: none; }
.detour:hover span:last-child { text-decoration: underline; text-decoration-color: var(--gold); text-decoration-thickness: 3px; text-underline-offset: 4px; }

/* ── Sign-in, consent, account, developer portal (drawn by wallet.js) ─── */

/* The gate: a narrow panel with a fare-card stripe, for sign-in and consent. Account and portal widen it. */
.gate {
  max-width: 540px;
  margin: clamp(32px, 6vw, 72px) auto 0;
  padding: 0 clamp(20px, 4vw, 32px) 28px;
  background: var(--panel);
  border: 2px solid var(--ink);
  border-radius: 12px;
  overflow: hidden;
}
.gate::before { content: ""; display: block; height: 16px; margin: 0 calc(clamp(20px, 4vw, 32px) * -1) 24px; background: linear-gradient(var(--band) 0 5px, var(--band-ink) 5px 6px, var(--band) 6px); }
.gate h1 { font-size: clamp(28px, 4vw, 36px); line-height: 1.1; margin-bottom: 12px; }
.gate form { margin-top: 20px; }
.gate .row { margin: 18px 0 8px; }
.gate .btn-primary { min-width: 140px; }
.gate.wide, html.has-session :is(.view-account, .view-developers) .gate:has(> .loading:only-child) {
  max-width: none;
  margin-top: clamp(28px, 5vw, 56px);
  padding: 0;
  background: none;
  border: 0;
  overflow: visible;
}
.gate.wide::before, html.has-session :is(.view-account, .view-developers) .gate:has(> .loading:only-child)::before { display: none; }

.loading { color: var(--dim); }
.loading::after { content: ""; display: inline-block; width: 0.5em; height: 0.5em; margin-left: 0.4em; border-radius: 50%; background: var(--gold); animation: blink 1s steps(1) infinite; }

.row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 16px 0; }
.link-btn { appearance: none; padding: 4px 0; border: 0; background: none; color: inherit; font: inherit; font-weight: 600; text-decoration: underline; text-decoration-color: var(--gold); text-decoration-thickness: 2px; text-underline-offset: 3px; cursor: pointer; }
.link-btn:hover { text-decoration-thickness: 4px; }
.gate-links { display: flex; flex-wrap: wrap; gap: 6px 22px; margin: 4px 0 12px; font-size: 15px; }
.divider { display: flex; align-items: center; gap: 14px; margin: 20px 0; color: var(--dim); font-size: 14px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 2px; background: var(--rule); }
.btn-wide { width: 100%; }
/* "Continue with Google", to Google's sign-in branding guidelines: light theme (white, #747775 1px stroke, #1F1F1F
   text) or dark (#131314, #8E918F, #E3E3E3) following the page, Google Sans Medium 14/20, the official "G" at
   20px with 12px before it and 10px after, 4px corners. Same height as the buttons beside it, for equal prominence. */
.btn-google {
  position: relative;
  overflow: hidden;
  gap: 10px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid #747775;
  border-radius: 4px;
  background: #FFFFFF;
  color: #1F1F1F;
  font: 500 14px/20px "Google Sans", Arial, sans-serif;
}
/* Hover and focus: a state layer over the whole button, logo included (the G's image has the button's own
   background, so tinting only the background would leave a square around it). */
.btn-google::after { content: ""; position: absolute; inset: 0; background: currentColor; opacity: 0; transition: opacity 0.15s; pointer-events: none; }
.btn-google:hover { background: #FFFFFF; color: #1F1F1F; }
.btn-google:hover::after { opacity: 0.08; }
.btn-google:focus-visible::after { opacity: 0.12; }
.btn-google img { width: 20px; height: 20px; flex: none; }
@media (prefers-color-scheme: dark) {
  .btn-google { background: #131314; border-color: #8E918F; color: #E3E3E3; }
  .btn-google:hover { background: #131314; color: #E3E3E3; }
}
input.code { font-family: var(--font-mono); font-size: 24px; letter-spacing: 0.35em; }
.confirm { border-left: 6px solid var(--ink); background: var(--panel); padding: 10px 14px; margin-top: 12px; border-radius: 0 4px 4px 0; }

/* Consent: the app's bullet joins the gold line that ends at Chabi's key. */
.join { display: flex; align-items: center; margin: 4px 0 22px; }
.join .bullet { --size: 56px; font-size: 20px; }
.join-rail { width: 96px; height: 8px; background: var(--gold); }
.join-chabi { width: 56px; height: 56px; display: block; }
@media (prefers-reduced-motion: no-preference) {
  .join .bullet { animation: join-in 0.45s 0.1s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
  .join-rail { transform-origin: right center; animation: draw-x 0.35s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
}
@keyframes join-in { from { transform: translateX(-40px); opacity: 0; } }

/* Signed-in pages: a header across the top, then sections. */
.section { margin-top: clamp(32px, 4vw, 48px); }
.section-title { font-size: 24px; font-stretch: 112%; padding-bottom: 10px; margin-bottom: 18px; border-bottom: 2px solid var(--ink); }
.account { display: grid; grid-template-columns: minmax(0, 1fr); column-gap: clamp(32px, 5vw, 64px); }
@media (min-width: 960px) {
  .account { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .account > .span { grid-column: 1 / -1; }
}
.account h1 { font-size: clamp(34px, 5vw, 56px); margin-bottom: 8px; }

/* Account */
.account-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 440px); gap: 24px 48px; align-items: end; }
@media (max-width: 760px) { .account-head { grid-template-columns: minmax(0, 1fr); } }
.fare-balance .fare-price { font-size: clamp(40px, 6vw, 56px); }
.plan-list { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--ink); }
.plan { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 16px; align-items: center; padding: 14px 0 14px 14px; border-bottom: 1px solid var(--rule); border-left: 6px solid transparent; }
.plan > :not(.btn) { grid-column: 1; }
.plan > .btn { grid-column: 2; grid-row: 1 / 4; }
.plan.is-current { border-left-color: var(--gold); background: color-mix(in srgb, var(--gold) 10%, transparent); }
.plan-name { font-weight: 800; font-stretch: 112%; font-size: 19px; }
.plan-price { font-weight: 700; }
.ticket-btn { appearance: none; cursor: pointer; text-align: left; font: inherit; color: var(--ink); transition: background-color 0.15s, transform 0.1s; }
.ticket-btn:hover { background: color-mix(in srgb, var(--gold) 22%, var(--panel)); }
.ticket-btn:active { transform: translateY(1px); }
.plans .tickets { max-width: none; }

.grants { margin-top: 4px; }
.grant { grid-template-columns: 32px minmax(0, 1fr) auto !important; }
.grant-name { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; min-width: 0; }
.grant-name strong { overflow-wrap: anywhere; }

.usage-total { font-size: 18px; }
.bars { display: flex; align-items: flex-end; gap: 5px; height: 120px; padding-bottom: 2px; border-bottom: 2px solid var(--ink); }
.bar { flex: 1; min-height: 2px; background: var(--gold); border-radius: 3px 3px 0 0; }
.usage-table { display: grid; margin-top: 18px; }
.usage-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--rule); font-size: 15px; }
.usage-row > * { overflow-wrap: anywhere; }

.field-inline { display: flex; gap: 10px; align-items: stretch; }
.field-inline input { flex: 1; min-width: 0; }
.btn-danger { border-color: #E2432A; color: var(--ink); }
.btn-danger:hover { background: #E2432A; color: #121212; border-color: #E2432A; }
form.danger { grid-column: 1 / -1; margin-top: 18px; padding: 18px 20px; border: 2px solid #E2432A; border-radius: 10px; background: var(--panel); }

/* Developer portal */
.portal .board { margin-top: 22px; }
.apps { display: grid; gap: 16px; }
.app { padding: 18px 20px; background: var(--panel); border: 2px solid var(--ink); border-radius: 10px; min-width: 0; }
.app-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-bottom: 14px; }
.app-name { font-weight: 800; font-stretch: 112%; font-size: 21px; overflow-wrap: anywhere; min-width: 0; }
.app-status { padding: 2px 10px; border-radius: 999px; background: var(--notice); color: var(--on-gold); font-weight: 700; font-size: 13px; }
.kv { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 4px 14px; align-items: start; margin: 0 0 10px; }
.kv-value { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; min-width: 0; }
.kv code { overflow-wrap: anywhere; }
.uris { flex-direction: column; align-items: flex-start; }
.app .bars { height: 56px; margin-top: 6px; }
.hint { margin: -2px 0 8px; }
@media (max-width: 560px) { .kv { grid-template-columns: minmax(0, 1fr); } }

/* ── Motion off ─────────────────────────────────────────────────────────── */

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