/* robotaxi.fyi — dark-first data site.
   Status colours are a single-hue ordinal blue ramp (deployment maturity),
   stepped separately for each surface. */

:root {
  color-scheme: dark;

  --page: #0d0d0d;
  --surface: #1a1a19;
  --surface-2: #121211;
  --ink: #ffffff;
  --ink-2: #c3c2b7;
  --ink-3: #898781;
  --line: rgba(255, 255, 255, 0.10);
  --line-strong: rgba(255, 255, 255, 0.18);
  --grid: #2c2c2a;

  --land: #1c1c1b;
  --land-line: #3a3a3766;

  --planned: #184f95;
  --testing: #256abf;
  --pilot: #3987e5;
  --supervised: #6da7ec;
  --driverless: #9ec5f4;

  --accent: #9ec5f4;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 32px -16px rgba(0, 0, 0, 0.7);

  --wrap: 1180px;
  --radius: 10px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

:root[data-theme="light"] {
  color-scheme: light;

  --page: #f9f9f7;
  --surface: #fcfcfb;
  --surface-2: #f2f2ee;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --ink-3: #6f6e69;
  --line: rgba(11, 11, 11, 0.10);
  --line-strong: rgba(11, 11, 11, 0.20);
  --grid: #e1e0d9;

  --land: #e8e7e1;
  --land-line: #cfcec6;

  --planned: #6da7ec;
  --testing: #3987e5;
  --pilot: #256abf;
  --supervised: #184f95;
  --driverless: #0d366b;

  --accent: #1c5cab;
  --shadow: 0 1px 2px rgba(11, 11, 11, 0.06), 0 12px 28px -18px rgba(11, 11, 11, 0.25);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;

    --page: #f9f9f7;
    --surface: #fcfcfb;
    --surface-2: #f2f2ee;
    --ink: #0b0b0b;
    --ink-2: #52514e;
    --ink-3: #6f6e69;
    --line: rgba(11, 11, 11, 0.10);
    --line-strong: rgba(11, 11, 11, 0.20);
    --grid: #e1e0d9;

    --land: #e8e7e1;
    --land-line: #cfcec6;

    --planned: #6da7ec;
    --testing: #3987e5;
    --pilot: #256abf;
    --supervised: #184f95;
    --driverless: #0d366b;

    --accent: #1c5cab;
    --shadow: 0 1px 2px rgba(11, 11, 11, 0.06), 0 12px 28px -18px rgba(11, 11, 11, 0.25);
  }
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

h1, h2, h3 { line-height: 1.15; letter-spacing: -0.02em; margin: 0; font-weight: 600; }
p { margin: 0; }
a { color: inherit; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 clamp(1rem, 4vw, 2.5rem); }

.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: -9999px; top: 0; z-index: 50;
  background: var(--surface); color: var(--ink); padding: 0.75rem 1rem;
  border: 1px solid var(--line-strong); border-radius: 0 0 var(--radius) 0;
}
.skip:focus { left: 0; }

:where(a, button, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- header ---------- */
.bar {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--page) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.bar__inner {
  max-width: var(--wrap); margin: 0 auto;
  padding: 0.65rem clamp(1rem, 4vw, 2.5rem);
  display: flex; align-items: center; gap: 1.5rem;
}

.brand {
  display: inline-flex; align-items: center; gap: 0.55rem;
  text-decoration: none; font-weight: 600; letter-spacing: -0.03em; font-size: 1.05rem;
}
.brand__mark {
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--driverless);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--driverless) 22%, transparent);
}
.brand__dot { color: var(--ink-3); }

.nav { display: flex; gap: 1.25rem; margin-left: auto; font-size: 0.875rem; }
.bar .switch { margin-left: 0.25rem; }
.nav a {
  color: var(--ink-2); text-decoration: none; padding: 0.25rem 0;
  border-bottom: 1px solid transparent; transition: color 0.15s, border-color 0.15s;
}
.nav a:hover { color: var(--ink); border-bottom-color: var(--accent); }

.bar__end { display: flex; align-items: center; gap: 0.75rem; }
.stamp {
  font-size: 0.75rem; color: var(--ink-3); white-space: nowrap;
  border: 1px solid var(--line); border-radius: 999px; padding: 0.2rem 0.6rem;
}
.theme {
  background: none; border: 1px solid var(--line); color: var(--ink-2);
  width: 30px; height: 30px; border-radius: 999px; cursor: pointer;
  font-size: 0.9rem; line-height: 1; display: grid; place-items: center;
}
.theme:hover { color: var(--ink); border-color: var(--line-strong); }

/* The region switch outranks the section links and the date stamp for space —
   it is the control that changes what the page shows. */
@media (max-width: 1080px) {
  .nav { display: none; }
  .bar .switch { margin-left: auto; }
}
@media (max-width: 620px) {
  .bar__inner { gap: 0.6rem; }
  .stamp { display: none; }
  .switch__btn { padding: 0.35rem 0.7rem; font-size: 0.8rem; }
}

/* ---------- hero ---------- */
.hero {
  padding: clamp(3rem, 8vw, 6rem) 0 clamp(2rem, 5vw, 3.5rem);
  background:
    radial-gradient(90rem 32rem at 18% -18%, color-mix(in srgb, var(--pilot) 16%, transparent), transparent 70%),
    linear-gradient(var(--page), var(--page));
  border-bottom: 1px solid var(--line);
}

.kicker {
  font-size: 0.75rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-3); margin-bottom: 1.1rem;
}

.hero h1 {
  font-size: clamp(2.1rem, 5.6vw, 3.6rem);
  max-width: 24ch;
  margin-bottom: 1.25rem;
}

.lede {
  font-size: clamp(1.02rem, 1.6vw, 1.175rem);
  color: var(--ink-2); max-width: 68ch;
}

/* ---------- stat tiles ---------- */
.tiles {
  margin-top: clamp(2rem, 5vw, 3rem);
  display: grid; gap: 1px;
  grid-template-columns: repeat(3, 1fr);
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
@media (max-width: 860px) { .tiles { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .tiles { grid-template-columns: 1fr; } }

.tile { background: var(--surface); padding: 1.25rem 1.3rem 1.35rem; }
.tile__value {
  font-size: clamp(1.9rem, 3.6vw, 2.4rem); font-weight: 600;
  letter-spacing: -0.035em; line-height: 1.05;
}
.tile__unit { font-size: 0.55em; color: var(--ink-3); margin-left: 0.15em; letter-spacing: 0; }
.tile__label {
  font-size: 0.875rem; font-weight: 500; margin-top: 0.35rem;
}
.tile__note {
  font-size: 0.8rem; color: var(--ink-3); margin-top: 0.5rem; line-height: 1.45;
}
.tile__src { color: var(--ink-3); text-decoration: underline; text-decoration-color: var(--line-strong); }
.tile__src:hover { color: var(--accent); }

/* ---------- sections ---------- */
.section { padding: clamp(3rem, 7vw, 5rem) 0; }
.section--alt { background: var(--surface-2); border-block: 1px solid var(--line); }
.section--map { padding-bottom: clamp(2rem, 5vw, 3rem); }

.section__head { margin-bottom: 1.75rem; }
.section__head h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
.section__sub { color: var(--ink-2); max-width: 62ch; margin-top: 0.6rem; font-size: 0.95rem; }

/* ---------- legend ---------- */
.legend {
  list-style: none; margin: 0 0 1.5rem; padding: 0;
  display: grid; gap: 0.35rem 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}
.legend li { display: grid; grid-template-columns: auto 1fr; gap: 0 0.5rem; align-items: baseline; }
.legend__label { font-size: 0.85rem; font-weight: 500; }
.legend__blurb {
  grid-column: 2; font-size: 0.775rem; color: var(--ink-3); line-height: 1.4;
}

.swatch {
  width: 10px; height: 10px; border-radius: 50%; display: inline-block;
  transform: translateY(1px);
}
.swatch--driverless { background: var(--driverless); }
.swatch--supervised { background: var(--supervised); }
.swatch--pilot { background: var(--pilot); }
.swatch--testing { background: var(--testing); }
.swatch--planned { background: var(--planned); }

/* ---------- region switch ----------
   One control in the sticky header drives the map panel and the city list.
   Visibility is CSS, keyed off <html data-region>, so a no-JS page keeps both
   regions on screen instead of hiding half the content. */
.switch {
  display: inline-flex; gap: 2px; padding: 3px;
  background: var(--surface-2); border: 1px solid var(--line-strong);
  border-radius: 999px;
}
.switch__btn {
  display: inline-flex; align-items: baseline; gap: 0.4rem;
  border: 0; background: none; color: var(--ink-2); cursor: pointer;
  font: inherit; font-size: 0.85rem; font-weight: 500; white-space: nowrap;
  padding: 0.35rem 0.9rem; border-radius: 999px;
  transition: color 0.15s, background-color 0.15s;
}
.switch__btn:hover { color: var(--ink); }
.switch__btn.is-on {
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow);
}
.switch__n {
  font-size: 0.72rem; color: var(--ink-3); font-variant-numeric: tabular-nums;
}
/* Narrow screens shorten the label rather than drop the wordmark. This has to
   sit after the base rule, not up in the header's media block. */
.switch__short { display: none; }
@media (max-width: 620px) {
  .switch__long { display: none; }
  .switch__short { display: inline; }
}
.switch__btn.is-on .switch__n { color: var(--accent); }

html.js[data-region="us"] .region-eu,
html.js[data-region="eu"] .region-us { display: none; }

/* ---------- map ---------- */
.maps { position: relative; }

.panel { margin: 0; }
.panel svg {
  display: block; width: 100%; height: auto;
  max-height: min(68vh, 640px);
  overflow: hidden;
}
.panel figcaption {
  margin-top: 0.9rem; font-size: 0.8rem; color: var(--ink-3);
  padding-top: 0.9rem; border-top: 1px solid var(--line);
}

.land { fill: var(--land); stroke: var(--land-line); stroke-width: 0.6; }

.mark { cursor: pointer; }
.mark__hit { fill: transparent; }
.mark__dot { stroke: var(--page); stroke-width: 1.4; }
.mark__halo { fill: none; stroke: none; }

.mark--driverless .mark__dot { fill: var(--driverless); }
.mark--supervised .mark__dot { fill: var(--supervised); }
.mark--pilot .mark__dot { fill: var(--pilot); }
.mark--testing .mark__dot { fill: var(--testing); }
.mark--planned .mark__dot { fill: var(--planned); stroke-width: 1; }

.mark--driverless .mark__halo {
  stroke: color-mix(in srgb, var(--driverless) 40%, transparent);
  stroke-width: 1.2;
}

.mark:hover .mark__halo,
.mark:focus-visible .mark__halo,
.mark.is-on .mark__halo {
  stroke: var(--ink); stroke-width: 1.4;
}

.mark__label {
  fill: var(--ink-2); font-size: 10.5px; font-weight: 500;
  font-family: var(--font); paint-order: stroke;
  stroke: var(--page); stroke-width: 3px; stroke-linejoin: round;
  pointer-events: none;
}

.tip {
  position: absolute; z-index: 10; pointer-events: none;
  max-width: 290px; padding: 0.7rem 0.85rem;
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: 8px; box-shadow: var(--shadow); font-size: 0.8rem;
  transform: translate(-50%, calc(-100% - 14px));
}
.tip strong { display: block; font-size: 0.9rem; margin-bottom: 0.1rem; }
.tip__where { color: var(--ink-3); display: block; margin-bottom: 0.45rem; }
.tip ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 0.2rem; }
.tip li { display: flex; gap: 0.4rem; align-items: baseline; color: var(--ink-2); }

.fineprint { font-size: 0.75rem; color: var(--ink-3); margin-top: 1.25rem; max-width: 70ch; }

/* ---------- filters ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1.5rem; }
.pill {
  font: inherit; font-size: 0.8rem; cursor: pointer;
  background: var(--surface); color: var(--ink-2);
  border: 1px solid var(--line); border-radius: 999px; padding: 0.3rem 0.8rem;
  transition: color 0.15s, border-color 0.15s;
}
.pill:hover { color: var(--ink); border-color: var(--line-strong); }
.pill.is-on { color: var(--ink); border-color: var(--accent); }
.pill__n { color: var(--ink-3); margin-left: 0.45rem; font-variant-numeric: tabular-nums; }

/* ---------- cities ---------- */
.group + .group { margin-top: 2.5rem; }
.group__title {
  font-size: 0.8rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 600;
  display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: baseline;
  padding-bottom: 0.7rem; border-bottom: 1px solid var(--line); margin-bottom: 0.25rem;
}
.group__count { letter-spacing: 0; text-transform: none; font-weight: 400; }
.group__empty { display: none; font-size: 0.9rem; color: var(--ink-3); padding: 1.1rem 0.25rem; }
.group.is-empty .group__empty { display: block; }
#cities .table-wrap { margin-top: 1rem; }
#cities .group__title + .table-wrap { margin-top: 1rem; }
#cities > .group__title:last-of-type { margin-top: 3rem; }

.city { border-bottom: 1px solid var(--line); }
.city > summary {
  display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; align-items: baseline;
  padding: 0.85rem 0.25rem; cursor: pointer; list-style: none;
}
.city > summary::-webkit-details-marker { display: none; }
.city > summary::after {
  content: "+"; margin-left: auto; color: var(--ink-3); font-size: 1.1rem;
  line-height: 1; width: 1rem; text-align: center;
}
.city[open] > summary::after { content: "–"; }
.city > summary:hover { background: color-mix(in srgb, var(--surface) 60%, transparent); }
.city:target { background: color-mix(in srgb, var(--pilot) 10%, transparent); }

.city__head { display: flex; flex-wrap: wrap; gap: 0.25rem 0.6rem; align-items: baseline; }
.city__name { font-weight: 600; font-size: 1.02rem; }
.city__where { color: var(--ink-3); font-size: 0.82rem; }
.city__meta {
  display: grid; grid-template-columns: 11.5rem 5.5rem; gap: 0.75rem;
  align-items: baseline; justify-items: start; margin-left: auto;
}
.city__count { font-size: 0.75rem; color: var(--ink-3); white-space: nowrap; }

.chip {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: 0.75rem; color: var(--ink-2); white-space: nowrap;
  border: 1px solid var(--line); border-radius: 999px; padding: 0.1rem 0.55rem;
}

.city__body { padding: 0.25rem 0.25rem 1.4rem; max-width: 80ch; }
.city__note { color: var(--ink-2); font-size: 0.925rem; }
.city__mode {
  font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-3); margin-top: 0.75rem;
}

.ops { list-style: none; margin: 0.5rem 0 0; padding: 0; display: grid; gap: 1px; }
.op {
  display: grid; gap: 0.15rem 0.8rem; align-items: baseline;
  grid-template-columns: minmax(7rem, auto) auto auto;
  padding: 0.6rem 0; border-top: 1px solid var(--line);
}
.op__name { font-weight: 500; font-size: 0.925rem; }
.op__since { font-size: 0.78rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.op__note { grid-column: 1 / -1; font-size: 0.85rem; color: var(--ink-2); }

.city__sources { font-size: 0.775rem; color: var(--ink-3); margin-top: 1rem; }
.city__sources a { color: var(--ink-3); text-decoration: underline; text-decoration-color: var(--line-strong); }
.city__sources a:hover { color: var(--accent); }

@media (max-width: 620px) {
  .city__meta { margin-left: 0; width: 100%; grid-template-columns: auto auto; justify-content: start; }
  .op { grid-template-columns: 1fr auto; }
}

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; font-size: 0.875rem; min-width: 720px; }
.table th, .table td { text-align: left; padding: 0.7rem 0.9rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table thead th {
  font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 600; background: var(--surface);
}
.table tbody tr:last-child th, .table tbody tr:last-child td { border-bottom: 0; }
.table tbody th { font-weight: 600; white-space: nowrap; }
.table td.wide { color: var(--ink-2); min-width: 22rem; }

/* ---------- company cards ---------- */
.cards {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
}
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.25rem 1.3rem 1.1rem;
  display: flex; flex-direction: column; gap: 0.85rem;
}
.card[hidden] { display: none; }
.card__head { display: flex; flex-wrap: wrap; gap: 0.3rem 0.75rem; align-items: baseline; }
.card__name { font-size: 1.1rem; }
.card__kind {
  font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-3); margin-left: auto;
}
.card__blurb { font-size: 0.9rem; color: var(--ink-2); }

.facts { margin: 0; display: grid; gap: 1px; border-top: 1px solid var(--line); }
.fact {
  display: grid; grid-template-columns: 7.5rem 1fr; gap: 0.75rem;
  padding: 0.4rem 0; border-bottom: 1px solid var(--line);
  font-size: 0.8rem;
}
.fact dt { color: var(--ink-3); }
.fact dd { margin: 0; color: var(--ink-2); }

.card__link {
  margin-top: auto; font-size: 0.78rem; color: var(--ink-3);
  text-decoration: underline; text-decoration-color: var(--line-strong);
  word-break: break-all;
}
.card__link:hover { color: var(--accent); }

@media (max-width: 420px) {
  .fact { grid-template-columns: 1fr; gap: 0; }
}

/* ---------- rules ---------- */
.rules { border-top: 1px solid var(--line); }
.rule { border-bottom: 1px solid var(--line); }
.rule > summary {
  display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; align-items: baseline;
  padding: 0.85rem 0.25rem; cursor: pointer; list-style: none;
}
.rule > summary::-webkit-details-marker { display: none; }
.rule > summary::after { content: "+"; margin-left: auto; color: var(--ink-3); }
.rule[open] > summary::after { content: "–"; }
.rule__place { font-weight: 600; font-size: 1rem; min-width: 12rem; }
.rule__verdict { font-size: 0.8rem; color: var(--accent); }
.rule > p { padding: 0 0.25rem 1.4rem; color: var(--ink-2); font-size: 0.9rem; max-width: 80ch; }

/* ---------- timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.event {
  display: grid; grid-template-columns: 7.5rem 1fr; gap: 0.3rem 1.5rem;
  padding: 1.05rem 0; border-top: 1px solid var(--line);
}
.event time {
  font-size: 0.78rem; color: var(--ink-3); font-variant-numeric: tabular-nums;
  padding-top: 0.2rem;
}
.event h3 { font-size: 1rem; }
.event p { grid-column: 2; font-size: 0.875rem; color: var(--ink-2); max-width: 74ch; }
.event p a { color: var(--ink-3); text-decoration: underline; text-decoration-color: var(--line-strong); white-space: nowrap; }
.event p a:hover { color: var(--accent); }

@media (max-width: 620px) {
  .event { grid-template-columns: 1fr; }
  .event p { grid-column: 1; }
}

/* ---------- faq ---------- */
.faqs { border-top: 1px solid var(--line); max-width: 80ch; }
.faq { border-bottom: 1px solid var(--line); }
.faq > summary {
  padding: 0.9rem 0.25rem; cursor: pointer; font-weight: 500; list-style: none;
  display: flex; gap: 1rem;
}
.faq > summary::-webkit-details-marker { display: none; }
.faq > summary::after { content: "+"; margin-left: auto; color: var(--ink-3); }
.faq[open] > summary::after { content: "–"; }
.faq > p { padding: 0 0.25rem 1.4rem; color: var(--ink-2); font-size: 0.9rem; }

/* ---------- footer ---------- */
.foot {
  border-top: 1px solid var(--line); padding: clamp(2.5rem, 6vw, 4rem) 0;
  background: var(--surface-2); font-size: 0.85rem; color: var(--ink-3);
}
.foot .wrap { display: grid; gap: 0.9rem; max-width: 82ch; }
.foot__lead { color: var(--ink-2); }
.foot a { color: var(--ink-2); text-decoration: underline; text-decoration-color: var(--line-strong); }
.foot a:hover { color: var(--accent); }
.foot__meta { padding-top: 0.9rem; border-top: 1px solid var(--line); }
