/* Shared by the map (style.css) and the other pages (page.css): colour tokens, type, the brand and type badges. */
:root {
  color-scheme: light;
  --page: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --ink: #101418;
  --ink-2: #4a5361;
  --muted: #6b7482;
  --hairline: #e3e6eb;
  --border: rgba(16, 20, 24, 0.1);
  --accent: #1f6feb;
  --brand: #ec1d24;
  --good: #12a150;
  --critical: #d92d2d;
  --bar: #1f6feb;
  --bar-soft: #d3e3fd;
  --shadow: 0 1px 2px rgba(16, 20, 24, 0.06), 0 2px 8px rgba(16, 20, 24, 0.05);
  --radius: 10px;
  --marker-tile: #ffffff;
  --marker-edge: rgba(16, 20, 24, 0.16);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  /* Incident types. The glyph on each marker carries the type too, so colour is never the only cue. */
  --t-collision: #e0383a;
  --t-breakdown: #e89a00;
  --t-hazard: #16a374;
  --t-closure: #5a48c4;
  --t-slowdown: #1f6feb;
  --t-congestion: #ea6a2f;
  --t-roadworks: #8a919c;
  --t-other: #8a919c;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0b0d10;
    --surface: #13161a;
    --surface-2: #1b1f25;
    --ink: #f1f3f6;
    --ink-2: #b3bbc6;
    --muted: #8a93a0;
    --hairline: #252a31;
    --border: rgba(255, 255, 255, 0.09);
    --accent: #4c8dff;
    --bar: #4c8dff;
    --bar-soft: #1b3a6b;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 2px 10px rgba(0, 0, 0, 0.35);
    --glyph-tone: #fff;
    --marker-tile: #262b33;
    --marker-edge: rgba(255, 255, 255, 0.16);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0b0d10;
  --surface: #13161a;
  --surface-2: #1b1f25;
  --ink: #f1f3f6;
  --ink-2: #b3bbc6;
  --muted: #8a93a0;
  --hairline: #252a31;
  --border: rgba(255, 255, 255, 0.09);
  --accent: #4c8dff;
  --bar: #4c8dff;
  --bar-soft: #1b3a6b;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 2px 10px rgba(0, 0, 0, 0.35);
  --glyph-tone: #fff;
  --marker-tile: #262b33;
  --marker-edge: rgba(255, 255, 255, 0.16);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { font-family: var(--font); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
time, .num { font-variant-numeric: tabular-nums; }

/* ---- Brand ---- */
.brand { display: flex; align-items: center; gap: 9px; color: var(--ink); text-decoration: none; }
.brand-name, .brand h1 { font-size: 17px; font-weight: 700; letter-spacing: -0.02em; margin: 0; }
.brand-name .tld, .brand h1 .tld { color: var(--muted); font-weight: 500; }
/* The logo's triangle is white: on a light header it needs a faint edge to show; on dark it stands out as is. */
.brand-logo { display: block; width: 28px; height: 24px; filter: drop-shadow(0 0 0.6px rgba(16, 20, 24, 0.55)) drop-shadow(0 1px 1.5px rgba(16, 20, 24, 0.16)); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand-logo { filter: none; }
}
:root[data-theme="dark"] .brand-logo { filter: none; }

/* ---- Site navigation (map header and page header) ---- */
.site-nav { display: flex; align-items: center; gap: 2px; }
.site-nav a {
  color: var(--ink-2); text-decoration: none; font-size: 14px; font-weight: 500;
  padding: 6px 10px; border-radius: 7px;
}
.site-nav a:hover { color: var(--ink); background: var(--surface-2); }
.site-nav a[aria-current="page"] { color: var(--ink); background: var(--surface-2); }

/* ---- Type badges (glyph() in shared/describe.js: chips, lists, pages and the map) ----
   A tile like the site's cards, with the type's symbol in its colour (nudged darker on light, lighter on
   dark, so it reads). Collisions are the one solid tile; a sudden slowdown (only a possible incident)
   has a coloured edge. */
/* --s: the badge's size; each place sets its own (lists 20px, filters 16px, pages 22px, the map 18–24px). */
.glyph {
  --c: var(--t-other);
  --s: 20px;
  --tile: var(--surface);
  width: var(--s); height: var(--s); border-radius: calc(var(--s) * 0.28);
  background: var(--tile); border: 1px solid var(--border);
  color: color-mix(in srgb, var(--c) 80%, var(--glyph-tone, #000));
  display: inline-grid; place-items: center; flex: none;
}
.glyph svg { width: 68%; height: 68%; display: block; }
.glyph.g-collision { background: var(--c); border-color: var(--c); color: #fff; }
.glyph.g-slowdown { border: 1.5px solid currentColor; }

/* ---- Road numbers (roadPlate() in shared/describe.js) ----
   Like the number panels on UK road signs: a white line just inside the edge, white on blue for motorways
   and yellow on green for A roads. The same colours on light and dark, as on the real signs. */
.plate {
  display: inline-block; padding: 0 5px; border: 1.5px solid #fff; border-radius: 4px;
  background: var(--plate); box-shadow: 0 0 0 1px var(--plate);
  font-size: 0.85em; font-weight: 700; line-height: 1.45; letter-spacing: 0.01em;
  white-space: nowrap; vertical-align: 0.08em; text-decoration: none;
}
.plate.plate-m { --plate: #0f5bb0; color: #fff; }
.plate.plate-a { --plate: #00703c; color: #ffd200; }
a.plate:hover { text-decoration: none; filter: brightness(1.15); }

/* ---- "Add to home screen" bar (install.js): slim, at the very top, until closed ---- */
.install-bar {
  display: flex; align-items: center; gap: 10px; padding: 6px 8px 6px 16px;
  background: var(--surface-2); border-bottom: 1px solid var(--hairline); color: var(--ink-2);
  font: 13px/1.4 var(--font);
}
.install-bar img { flex: none; }
.install-bar p { margin: 0; flex: 1; min-width: 0; }
.install-bar p svg { vertical-align: -3px; }
.install-bar b { color: var(--ink); font-weight: 600; }
.install-go {
  margin-left: 4px; font: inherit; font-weight: 600; font-size: 12px; padding: 3px 11px; border-radius: 6px;
  border: 0; background: var(--ink); color: var(--surface); cursor: pointer;
}
.install-go:hover { opacity: 0.88; }
.install-close {
  flex: none; width: 28px; height: 28px; border: 0; border-radius: 6px; background: none;
  color: var(--muted); font-size: 20px; line-height: 1; cursor: pointer;
}
.install-close:hover { color: var(--ink); background: var(--hairline); }
