:root {
  --bg: #f6f5f0;
  --surface: #ffffff;
  --ink: #18202c;
  --muted: #586273;
  --rule: #dfdcd2;
  --accent: #1f7a45;        /* guideway green */
  --accent-soft: #e2f1e6;
  --rail: #c7361f;          /* tier 3: rail */
  --mesh: #1f7a45;          /* tier 2: AGT mesh */
  --local: #2563b8;         /* tier 1: local vehicles */
  --gold: #e3a512;
  --night: #121a26;
  --night-card: #1b2535;
  --night-line: #2c3a50;
  --night-ink: #eef1f6;
  --night-muted: #a9b3c4;
  --serif: "IBM Plex Serif", Georgia, serif;
  --sans: "IBM Plex Sans", system-ui, -apple-system, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f151f;
    --surface: #172030;
    --ink: #e7ebf2;
    --muted: #a3adbf;
    --rule: #283447;
    --accent: #4cc27c;
    --accent-soft: #15291e;
    --rail: #f0705a;
    --mesh: #4cc27c;
    --local: #6aa2f0;
  }
}
:root[data-theme="dark"] {
  --bg: #0f151f;
  --surface: #172030;
  --ink: #e7ebf2;
  --muted: #a3adbf;
  --rule: #283447;
  --accent: #4cc27c;
  --accent-soft: #15291e;
  --rail: #f0705a;
  --mesh: #4cc27c;
  --local: #6aa2f0;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 60px; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.65 var(--sans); }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 760px; }

/* nav */
nav.top { position: sticky; top: 0; z-index: 10; background: rgba(18, 26, 38, 0.94); backdrop-filter: blur(6px); border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
nav.top .wrap { display: flex; align-items: center; gap: 20px; height: 52px; overflow-x: auto; }
nav.top .brand { color: #fff; font-weight: 600; text-decoration: none; letter-spacing: 0.03em; white-space: nowrap; }
nav.top .brand span { color: #4cc27c; }
nav.top .links { display: flex; gap: 16px; margin-left: auto; }
nav.top .links a { color: #c9d0dd; text-decoration: none; font-size: 14px; white-space: nowrap; }
nav.top .links a:hover { color: #fff; }

/* hero: the three tiers in one street */
.hero { background: linear-gradient(180deg, #dcecf6 0%, #eef5ea 70%); color: #142030; position: relative; }
.hero .wrap { padding-top: 48px; padding-bottom: 8px; }
.badge { display: inline-block; font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; padding: 4px 10px; border-radius: 3px; background: #142030; color: #fff; }
.hero h1 { font: 600 clamp(32px, 5.6vw, 56px)/1.08 var(--serif); margin: 14px 0 12px; max-width: 18ch; }
.hero .sub { font-size: clamp(17px, 2.2vw, 21px); max-width: 52ch; margin: 0 0 8px; color: #24324a; }
.hero .appno { font-size: 14px; color: #44546d; margin: 0; }
.hero svg { display: block; width: 100%; height: auto; }

/* sections */
section { padding: 64px 0; border-bottom: 1px solid var(--rule); }
section.dark { background: var(--night); color: var(--night-ink); border-bottom: none; }
section.dark .muted, section.dark .kicker { color: var(--night-muted); }
section.dark a { color: #6fd79a; }
.kicker { font-size: 13px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); margin: 0 0 8px; }
h2 { font: 600 clamp(26px, 3.6vw, 36px)/1.2 var(--serif); margin: 0 0 18px; }
h3 { font: 600 20px/1.3 var(--sans); margin: 0 0 8px; }
.lede { font: 400 20px/1.6 var(--serif); }
.muted { color: var(--muted); }

.grid { display: grid; gap: 22px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--rule); border-radius: 6px; padding: 20px; }
section.dark .card { background: var(--night-card); border-color: var(--night-line); }
.card p { margin: 0; }
.card p + p { margin-top: 8px; }
.stat { font: 600 34px/1 var(--serif); color: var(--accent); display: block; margin-bottom: 8px; }
section.dark .stat { color: var(--gold); }
.src { font-size: 13px; color: var(--muted); margin-top: 8px !important; }
section.dark .src { color: var(--night-muted); }

.split { display: grid; grid-template-columns: 1fr 1fr; gap: 36px; align-items: start; }
@media (max-width: 820px) { .split { grid-template-columns: 1fr; } }

/* tiers */
.tier { border-top: 5px solid; }
.tier.t3 { border-top-color: var(--rail); }
.tier.t2 { border-top-color: var(--mesh); }
.tier.t1 { border-top-color: var(--local); }
.tier .n { font: 600 13px/1 var(--sans); letter-spacing: 0.08em; text-transform: uppercase; display: block; margin-bottom: 10px; }
.t3 .n { color: var(--rail); } .t2 .n { color: var(--mesh); } .t1 .n { color: var(--local); }
.tier ul { margin: 10px 0 0; padding-left: 18px; }

/* figures */
figure { margin: 0; }
figure img { border-radius: 6px; }
figure.drawing a { display: block; background: #fff; border: 1px solid var(--rule); border-radius: 6px; padding: 12px; }
figure.drawing img { margin: 0 auto; border-radius: 0; }
figcaption { font-size: 14px; color: var(--muted); margin-top: 8px; }
section.dark figcaption { color: var(--night-muted); }
.wide { margin: 28px 0 0; }
.wide img { width: 100%; }

/* nesting diagram */
.nest { display: block; width: 100%; height: auto; max-width: 760px; margin: 8px auto 0; }

/* custody ledger */
ol.ledger { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
ol.ledger li { display: grid; grid-template-columns: 120px 1fr; gap: 14px; padding: 12px 16px; background: var(--surface); border: 1px solid var(--rule); border-left: 4px solid var(--accent); border-radius: 6px; }
ol.ledger b { font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); padding-top: 2px; }
@media (max-width: 520px) { ol.ledger li { grid-template-columns: 1fr; gap: 2px; } }

/* booking window example */
.window { font: 15px/1.6 ui-monospace, "SF Mono", Menlo, monospace; background: var(--night-card); color: var(--night-ink); border-radius: 6px; padding: 18px 20px; overflow-x: auto; white-space: pre; }
.window .k { color: var(--night-muted); }
.say { font: 400 18px/1.6 var(--serif); border-left: 3px solid var(--accent); padding: 4px 0 4px 18px; margin: 18px 0 0; }

/* ask list */
ol.asks { margin: 0; padding-left: 22px; }
ol.asks li { margin-bottom: 10px; }
.cta { display: inline-block; background: var(--gold); color: #1a1406; font-weight: 600; text-decoration: none; padding: 12px 20px; border-radius: 5px; margin-top: 18px; }
section.dark .cta { color: #1a1406; }

blockquote { margin: 0; padding: 18px 22px; border-left: 3px solid var(--accent); background: var(--surface); font: 400 17px/1.65 var(--serif); }
section.dark blockquote { background: var(--night-card); }
blockquote span { display: block; font: 14px/1.5 var(--sans); color: var(--muted); margin-top: 8px; }
section.dark blockquote span { color: var(--night-muted); }

ol.claims { padding-left: 0; list-style: none; margin: 0; display: grid; gap: 10px; }
ol.claims li { background: var(--surface); border: 1px solid var(--rule); border-radius: 6px; padding: 14px 18px; }
ol.claims b { color: var(--accent); }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 22px; margin: 0; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; }
@media (max-width: 520px) { dl.facts { grid-template-columns: 1fr; } dl.facts dd { margin-bottom: 8px; } }

footer { padding: 36px 0 48px; font-size: 14px; color: var(--muted); }
footer p { margin: 0 0 8px; max-width: 760px; }
