/* JZ Gateway — transit-map identity.
   One bold element (the map); everything else stays quiet. */

:root {
  --paper: #F2F4F1;
  --paper-2: #E7EBE6;
  --ink: #17202A;
  --ink-2: #4F5B66;
  --ink-3: #7A858E;
  --rule: #D3D9D3;
  --panel: #17202A;
  --panel-ink: #E9EDEA;
  --panel-dim: #8E9AA4;
  --ok: #0E8F6A;
  --bad: #D23A2A;

  /* line colours: one per client protocol */
  --l1: #E0452F; /* vermilion */
  --l2: #2C5BD4; /* cobalt */
  --l3: #0E8F6A; /* jade */
  --l4: #E29A12; /* saffron */
  --l5: #8250B8; /* plum */
  --l6: #12919F; /* teal */

  --font: "Overpass", "Helvetica Neue", Arial, sans-serif;
  --mono: "Overpass Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --measure: 62ch;
  --gutter: 16px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #121A23;
    --paper-2: #1A2430;
    --ink: #E6EAE7;
    --ink-2: #A3AEB6;
    --ink-3: #75818B;
    --rule: #2A3642;
    --panel: #0C1219;
    --panel-ink: #E6EAE7;
    --panel-dim: #7F8B95;
    --ok: #2FC08F;
    --bad: #F0614F;
    --l1: #F2604B;
    --l2: #5A86F2;
    --l3: #2FB88A;
    --l4: #F2B33C;
    --l5: #A57AD9;
    --l6: #33B5C2;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #121A23; --paper-2: #1A2430; --ink: #E6EAE7; --ink-2: #A3AEB6; --ink-3: #75818B;
  --rule: #2A3642; --panel: #0C1219; --panel-ink: #E6EAE7; --panel-dim: #7F8B95;
  --ok: #2FC08F; --bad: #F0614F;
  --l1: #F2604B; --l2: #5A86F2; --l3: #2FB88A; --l4: #F2B33C; --l5: #A57AD9; --l6: #33B5C2;
  color-scheme: dark;
}

@media (min-width: 720px) { :root { --gutter: 32px; } }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.6;
  font-feature-settings: "kern", "liga";
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.wrap { width: 100%; max-width: 1180px; margin-inline: auto; padding-inline: var(--gutter); }

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--l2); outline-offset: 3px; border-radius: 4px; }

code, pre { font-family: var(--mono); }
p code, dd code, .lede code {
  font-size: 0.88em;
  background: var(--paper-2);
  padding: 0.12em 0.4em;
  border-radius: 4px;
  white-space: nowrap;
}

h1, h2, h3 { margin: 0; font-weight: 800; letter-spacing: -0.02em; }
h2 { font-size: clamp(1.75rem, 3.2vw, 2.25rem); line-height: 1.1; }
h3 { font-size: 1.0625rem; line-height: 1.3; font-weight: 700; letter-spacing: -0.005em; }

.skip {
  position: absolute; left: var(--gutter); top: -60px;
  background: var(--ink); color: var(--paper); padding: 8px 14px; border-radius: 6px; z-index: 10;
}
.skip:focus { top: 12px; }

/* ---------- top bar ---------- */
.bar { border-bottom: 1px solid var(--rule); }
.bar-inner { display: flex; align-items: center; gap: 24px; min-height: 64px; }
.mark { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 800; letter-spacing: -0.01em; font-size: 1.0625rem; }
.glyph { width: 26px; height: 26px; flex: none; }
.glyph path { stroke: var(--l1); stroke-width: 4; fill: none; }
.glyph path + rect, .glyph rect { fill: var(--paper); stroke: var(--ink); stroke-width: 3; }
.nav { display: none; gap: 22px; font-size: 0.9375rem; color: var(--ink-2); }
.nav a { text-decoration: none; }
.nav a:hover { color: var(--ink); text-decoration: underline; }
.bar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
@media (min-width: 760px) { .nav { display: flex; } }

.status { display: inline-flex; align-items: center; gap: 8px; font-size: 0.875rem; color: var(--ink-2); white-space: nowrap; }
.status i { width: 9px; height: 9px; border-radius: 50%; background: var(--ink-3); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink-3) 22%, transparent); }
.status[data-state="ok"] i { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent); }
.status[data-state="down"] i { background: var(--bad); box-shadow: 0 0 0 3px color-mix(in srgb, var(--bad) 22%, transparent); }
@media (max-width: 420px) { .status > span { display: none; } }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 0 20px;
  border-radius: 999px;
  border: 2px solid var(--ink);
  font: 700 0.9375rem/1 var(--font);
  text-decoration: none;
  color: var(--ink);
  background: transparent;
  transition: background-color .15s ease, color .15s ease;
}
.btn:hover { background: var(--ink); color: var(--paper); }
.btn-primary { background: var(--ink); color: var(--paper); }
.btn-primary:hover { background: var(--l1); border-color: var(--l1); color: #fff; }
.btn-quiet { min-height: 36px; padding: 0 14px; border-width: 1.5px; font-size: 0.875rem; }

/* ---------- hero ---------- */
.hero { padding-top: clamp(48px, 9vw, 104px); padding-bottom: 8px; }
.hero h1 {
  font-size: clamp(2.6rem, 7.4vw, 5.5rem);
  line-height: 0.98;
  letter-spacing: -0.035em;
  max-width: 17ch;
  text-wrap: balance;
}
.lede { margin: 28px 0 0; max-width: 54ch; font-size: clamp(1.0625rem, 1.6vw, 1.25rem); color: var(--ink-2); line-height: 1.55; }
.lede code { color: var(--ink); }
.ctas { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.fine { margin: 14px 0 0; font-size: 0.875rem; color: var(--ink-3); }

/* ---------- the map ---------- */
.map-wrap { margin: clamp(40px, 6vw, 72px) 0 0; padding: 0; }
.map { display: block; width: 100%; height: auto; overflow: visible; }
.map .line { fill: none; stroke-linecap: round; stroke-linejoin: round; transition: opacity .2s ease; }
.map .line.planned { stroke: var(--ink-3); stroke-dasharray: 2 14; opacity: .8; }
.map .term { fill: var(--paper); stroke-width: 4; }
.map .term.planned { stroke: var(--ink-3); }
.map .station { fill: var(--paper); stroke: var(--ink); }
.map .leader { stroke: var(--ink-3); stroke-width: 1.5; stroke-dasharray: 2 4; }
.map .station-name { font: 600 15px var(--mono); fill: var(--ink); }
.map .station-sub { font: 400 13px var(--font); fill: var(--ink-3); }
.map .lbl-name { font: 700 16px var(--font); fill: var(--ink); letter-spacing: -0.01em; }
.map .lbl-sub { font: 400 12.5px var(--mono); fill: var(--ink-3); }
.map .lbl-planned { font: 600 14px var(--font); fill: var(--ink-3); }
.map .stop { cursor: pointer; outline: none; }
.map .stop .hit { fill: transparent; }
.map .stop:focus-visible .lbl-name { text-decoration: underline; }
.map.focus .line:not(.on), .map.focus .term:not(.on) { opacity: .16; }
.map.focus .stop:not(.on) .lbl-name { fill: var(--ink-3); }
.map.compact .lbl-name { font-size: 13px; }
.map.compact .station-name { font-size: 12px; }
.map.compact .station-sub { font-size: 11px; }
.map.compact .lbl-planned { font-size: 12px; }

.map.draw .line:not(.planned) { stroke-dasharray: var(--len); stroke-dashoffset: var(--len); }
.map.drawn .line:not(.planned) { stroke-dashoffset: 0; transition: stroke-dashoffset 1.1s cubic-bezier(.6,.05,.25,1) var(--delay, 0s), opacity .2s ease; }
.map.draw .line.planned, .map.draw .term, .map.draw .stop, .map.draw .station-g { opacity: 0; }
.map.drawn .line.planned, .map.drawn .term, .map.drawn .stop, .map.drawn .station-g { opacity: 1; transition: opacity .5s ease var(--delay, .9s); }
@media (prefers-reduced-motion: reduce) {
  .map.draw .line:not(.planned) { stroke-dasharray: none; stroke-dashoffset: 0; }
  .map.draw .line.planned, .map.draw .term, .map.draw .stop, .map.draw .station-g { opacity: 1; }
}

.map-caption {
  margin-top: 18px; min-height: 3.2em;
  font-size: 0.9375rem; color: var(--ink-2);
  border-top: 1px solid var(--rule); padding-top: 14px;
  display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline;
}
.map-caption strong { color: var(--ink); font-weight: 700; }
.map-caption code { font-size: 0.85em; background: var(--paper-2); padding: 0.1em 0.45em; border-radius: 4px; }
.sw-0 { background: var(--l1); } .sw-1 { background: var(--l2); } .sw-2 { background: var(--l3); }
.sw-3 { background: var(--l4); } .sw-4 { background: var(--l5); } .sw-5 { background: var(--l6); }
.map-caption .swatch { display: inline-block; width: 22px; height: 6px; border-radius: 3px; vertical-align: middle; margin-right: 2px; }

/* ---------- sections ---------- */
.section { padding-top: clamp(72px, 10vw, 128px); }
.section-head { max-width: var(--measure); margin-bottom: 32px; }
.section-head p { margin: 12px 0 0; color: var(--ink-2); }

/* connect */
.connect { display: grid; gap: 40px; align-items: start; }
@media (min-width: 980px) { .connect { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 56px; } }
.connect-text > p { margin: 14px 0 0; color: var(--ink-2); max-width: 46ch; }
.endpoints { margin: 28px 0 0; padding: 0; }
.endpoints > div { padding: 14px 0; border-top: 1px solid var(--rule); }
.endpoints > div:last-child { border-bottom: 1px solid var(--rule); }
.endpoints dt { font-size: 0.875rem; color: var(--ink-3); font-weight: 600; }
.endpoints dd { margin: 4px 0 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.endpoints dd > code.url { font-size: 0.95rem; background: none; padding: 0; color: var(--ink); white-space: normal; overflow-wrap: anywhere; }
.endpoints .dd-text { display: block; color: var(--ink-2); font-size: 0.9375rem; }

.copy {
  font: 600 0.8125rem/1 var(--font);
  color: var(--ink-2);
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 6px 11px 5px;
  cursor: pointer;
}
.copy:hover { color: var(--ink); border-color: var(--ink-3); }
.copy[data-done] { color: var(--ok); border-color: var(--ok); }

.code { position: relative; background: var(--panel); color: var(--panel-ink); border-radius: 14px; overflow: hidden; }
.tabs { display: flex; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid color-mix(in srgb, var(--panel-ink) 12%, transparent); padding: 0 8px; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  flex: none;
  font: 600 0.875rem/1 var(--font);
  color: var(--panel-dim);
  background: none; border: 0;
  padding: 16px 12px 14px;
  border-bottom: 3px solid transparent;
  cursor: pointer;
}
.tabs button:hover { color: var(--panel-ink); }
.tabs button[aria-selected="true"] { color: var(--panel-ink); border-bottom-color: var(--l1); }
.tabs button:focus-visible { outline-offset: -3px; }
.panels pre { margin: 0; padding: 22px 22px 26px; overflow-x: auto; font-size: 0.875rem; line-height: 1.7; tab-size: 4; }
.panels pre:focus-visible { outline-offset: -3px; }
.panels .k { color: #F0A07A; }
.panels .s { color: #9FD6B8; }
.panels .c { color: var(--panel-dim); }
.panels mark { background: color-mix(in srgb, var(--l4) 22%, transparent); color: inherit; border-radius: 3px; box-shadow: -4px 0 0 color-mix(in srgb, var(--l4) 22%, transparent), 4px 0 0 color-mix(in srgb, var(--l4) 22%, transparent); }
.copy-code { position: absolute; top: 11px; right: 12px; color: var(--panel-dim); border-color: color-mix(in srgb, var(--panel-ink) 18%, transparent); background: var(--panel); }
.copy-code:hover { color: var(--panel-ink); border-color: var(--panel-dim); }
@media (max-width: 560px) { .copy-code { display: none; } }

/* models */
.table-scroll { overflow-x: auto; border-top: 2px solid var(--ink); }
.model-table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; min-width: 620px; }
.model-table th { text-align: left; font-weight: 600; font-size: 0.8125rem; color: var(--ink-3); padding: 12px 16px 10px 0; border-bottom: 1px solid var(--rule); }
.model-table td { padding: 13px 16px 12px 0; border-bottom: 1px solid var(--rule); vertical-align: baseline; }
.model-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.model-table td.model { font-family: var(--mono); font-size: 0.875rem; font-weight: 600; word-break: break-all; }
.model-table td.provider { color: var(--ink-2); }
.model-table td.speaks { color: var(--ink-2); font-size: 0.875rem; }
.model-table .unit { color: var(--ink-3); font-size: 0.8125rem; }
.model-table:has(.state-row) { min-width: 0; }
.model-table .state-row td { color: var(--ink-2); padding: 28px 0; }
.model-table .state-row strong { color: var(--ink); display: block; margin-bottom: 4px; }

/* journey: a real sequence, drawn as stops on one line */
.stops { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; position: relative; }
.stops li { position: relative; padding: 0 0 32px 44px; }
.stops li::before {
  content: ""; position: absolute; left: 8px; top: 2px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--paper); border: 4px solid var(--l2);
  z-index: 1;
}
.stops li::after { content: ""; position: absolute; left: 15px; top: 10px; bottom: -10px; width: 6px; background: var(--l2); }
.stops li:last-child::after { display: none; }
.stops li:last-child { padding-bottom: 0; }
.stops h3 { margin-bottom: 6px; }
.stops p { margin: 0; color: var(--ink-2); font-size: 0.9375rem; max-width: 40ch; }
@media (min-width: 900px) {
  .stops { grid-template-columns: repeat(5, 1fr); gap: 28px; }
  .stops li { padding: 44px 0 0; }
  .stops li::before { left: 0; top: 0; }
  .stops li::after { left: 9px; right: -37px; top: 6px; bottom: auto; width: auto; height: 6px; }
}

/* rules */
.rule-list { margin: 0; display: grid; gap: 0; }
.rule-list > div { display: grid; gap: 6px; padding: 20px 0; border-top: 1px solid var(--rule); }
.rule-list > div:last-child { border-bottom: 1px solid var(--rule); }
.rule-list dt { font-weight: 700; }
.rule-list dd { margin: 0; color: var(--ink-2); max-width: var(--measure); }
@media (min-width: 760px) { .rule-list > div { grid-template-columns: 260px 1fr; gap: 32px; } }

/* footer */
.foot { margin-top: clamp(80px, 11vw, 140px); border-top: 1px solid var(--rule); padding: 28px 0 40px; font-size: 0.875rem; color: var(--ink-2); }
.foot-inner { display: flex; flex-wrap: wrap; gap: 12px 32px; justify-content: space-between; align-items: baseline; }
.foot p { margin: 0; }
.foot ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 22px; }
