/*
 * THE PUBLIC CIRCUIT PAGES (/tracks, /tracks/<slug>).
 *
 * Static documents written by tools/build-track-pages.mjs, so this is plain CSS in one cacheable
 * file rather than the app's bundle. The register is the homepage's (src/landing.css): paper ground,
 * near-black ink, purple actions, Barlow Condensed headings over DM Sans, and the dark aubergine
 * panel with a lavender trace that the homepage and the dashboard draw circuits in. Light only,
 * like the homepage. No animation, no script needed to read any of it.
 */
@font-face {
  font-family: 'Barlow Condensed';
  src: url('/fonts/barlow-condensed-semibold.ttf') format('truetype');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'DM Sans';
  src: url('/fonts/dm-sans.ttf') format('truetype');
  font-weight: 100 1000;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #f6f5f2;
  --surface: #fff;
  --ink: #22231f;
  --muted: #575b55;
  --accent: #5f3db5;
  --accent-hover: #4c3096;
  --rule: #dcdbd3;
  --dark: #211f27;
  --dark-2: #2b2833;
  --light: #f7f4fa;
  --dim: #c6c0cb;
  --lavender: #b4a0ff;
  --tint: #efe9fb;
  --tint-ink: #3d2a78;
  --head: 'Barlow Condensed', 'DM Sans', system-ui, sans-serif;
  --body: 'DM Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --gutter: clamp(16px, 4vw, 56px);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 16px/1.6 var(--body); }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
img, svg { max-width: 100%; }

.skip { position: absolute; left: 12px; top: -64px; z-index: 10; padding: 10px 14px; border-radius: 6px; background: var(--ink); color: #fff; }
.skip:focus { top: 12px; color: #fff; }
.wrap { max-width: 1180px; margin: 0 auto; padding-inline: var(--gutter); }

/* ── Header ─────────────────────────────────────────────────────────────── */
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 68px; }
.brand { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; color: var(--ink); font-size: 17px; font-weight: 600; letter-spacing: -.03em; text-decoration: none; white-space: nowrap; }
.brand:hover { color: var(--ink); }
.top nav { display: flex; align-items: center; gap: clamp(14px, 2.4vw, 26px); font-size: 14px; }
.top nav a { display: inline-flex; align-items: center; min-height: 44px; color: var(--muted); text-decoration: none; white-space: nowrap; }
.top nav a:hover, .top nav a[aria-current] { color: var(--ink); }
.top nav .nav-cta { min-height: 40px; padding: 0 14px; border-radius: 6px; background: var(--ink); color: var(--paper); font-weight: 600; }
.top nav .nav-cta:hover { background: var(--accent); color: #fff; }

/* ── Breadcrumb ─────────────────────────────────────────────────────────── */
.crumbs ol { display: flex; flex-wrap: wrap; margin: 6px 0 0; padding: 0; list-style: none; color: var(--muted); font-size: 13.5px; }
.crumbs li + li::before { content: '/'; margin: 0 8px; opacity: .6; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--ink); text-decoration: underline; }

/* ── Type ───────────────────────────────────────────────────────────────── */
h1, h2 { margin: 0; font-family: var(--head); font-weight: 600; letter-spacing: -.005em; line-height: 1; text-wrap: balance; }
h1 { max-width: 14ch; font-size: clamp(44px, 6vw, 78px); line-height: .95; }
h2 { font-size: clamp(32px, 3.6vw, 46px); }
h3 { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: -.01em; line-height: 1.3; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 18px; color: var(--accent); font-size: 14px; font-weight: 600; }
.eyebrow::before { content: ''; width: 18px; height: 2px; background: currentColor; }
.aka { margin: 16px 0 0; color: var(--muted); font-size: 14.5px; }
.lede { max-width: 46ch; margin: 20px 0 0; color: var(--muted); font-size: clamp(17px, 1.4vw, 19px); line-height: 1.55; }
.small { margin: 14px 0 0; color: var(--muted); font-size: 13.5px; }
.section-lede { max-width: 64ch; margin: 14px 0 0; color: var(--muted); }

/* ── Actions ────────────────────────────────────────────────────────────── */
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 26px; margin-top: 28px; }
.cta { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; padding: 14px 22px; border-radius: 6px; background: var(--accent); color: #fff; font-size: 15px; font-weight: 600; text-decoration: none; }
.cta:hover { background: var(--accent-hover); color: #fff; }
.cta span { font-size: 17px; }
.secondary { display: inline-flex; align-items: center; min-height: 44px; color: var(--ink); font-size: 15px; font-weight: 600; text-decoration: underline; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); text-underline-offset: 6px; }
.secondary:hover { color: var(--accent); text-decoration-color: currentColor; }

/* ── Hero and the map panel ─────────────────────────────────────────────── */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(28px, 5vw, 72px); align-items: center; padding: clamp(24px, 4vw, 52px) 0 clamp(44px, 6vw, 80px); }
.hero-copy { min-width: 0; }
.map-panel { min-width: 0; margin: 0; padding: 16px 18px 20px; border-radius: 14px; background: var(--dark); color: var(--light); }
.panel-head { display: flex; justify-content: space-between; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid #3a3642; font-size: 13px; font-weight: 600; }
.panel-head span + span { color: var(--dim); font-weight: 400; }
.map-svg { display: block; width: 100%; height: auto; max-height: min(72vh, 600px); margin: 14px auto 0; overflow: visible; }
.road-bed { fill: none; stroke: var(--dark-2); stroke-width: 16px; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.road { fill: none; stroke: var(--lavender); stroke-width: 3.5px; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.turn circle { fill: var(--dark); stroke: var(--light); stroke-width: 2.5; }
.turn line { stroke: var(--dim); stroke-width: 1; opacity: .6; }
.turn text { fill: var(--light); font-family: var(--body); font-size: 17px; font-weight: 600; dominant-baseline: central; }

/* ── Sections ───────────────────────────────────────────────────────────── */
.block { padding: clamp(40px, 6vw, 72px) 0; border-top: 1px solid var(--rule); }
.block > p { max-width: 64ch; }
.more { font-weight: 600; }

/* The layouts: a ruled list, two columns where there is room. */
.layouts { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); gap: 0 40px; margin: 28px 0 0; padding: 0; list-style: none; }
.layout { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 18px; align-items: start; padding: 20px 0; border-top: 1px solid var(--rule); }
.glyph { display: grid; place-items: center; aspect-ratio: 4 / 3; padding: 8px; border-radius: 8px; background: var(--dark); }
.glyph-svg { display: block; width: 100%; height: 100%; }
.glyph-svg .road-bed { stroke-width: 7px; }
.glyph-svg .road { stroke-width: 2px; }
.layout-body { min-width: 0; }
.figures { margin: 4px 0 0; font-size: 15px; font-variant-numeric: tabular-nums; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; }
.tags span { padding: 2px 9px; border-radius: 999px; background: var(--tint); color: var(--tint-ink); font-size: 12.5px; font-weight: 500; line-height: 1.6; }
.note { margin: 8px 0 0; color: var(--muted); font-size: 13.5px; }
.unmapped { margin: 8px 0 0; padding-top: 18px; border-top: 1px solid var(--rule); color: var(--muted); font-size: 14.5px; }

/* The three steps. */
.steps { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1fr); gap: 28px 40px; margin: 30px 0 0; padding: 0; list-style: none; counter-reset: step; }
.steps > li { padding-top: 14px; border-top: 2px solid var(--ink); counter-increment: step; }
.steps > li::before { content: counter(step, decimal-leading-zero); display: block; margin-bottom: 10px; color: var(--accent); font: 600 30px/1 var(--head); }
.steps p { margin: 8px 0 0; color: var(--muted); font-size: 15px; }
.loggers { display: grid; gap: 6px; margin: 12px 0 0; padding: 0; list-style: none; color: var(--muted); font-size: 14px; line-height: 1.45; }
.loggers b { color: var(--ink); font-weight: 600; }
.analyse .actions { margin-top: 36px; }

/* Other circuits. */
.links { display: flex; flex-wrap: wrap; gap: 10px; margin: 22px 0 0; padding: 0; list-style: none; }
.links a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border: 1px solid var(--rule); border-radius: 6px; background: var(--surface); color: var(--ink); font-weight: 500; text-decoration: none; }
.links a:hover { border-color: var(--accent); color: var(--accent); }

/* ── The index ──────────────────────────────────────────────────────────── */
.intro { padding: clamp(24px, 4vw, 52px) 0 clamp(28px, 4vw, 48px); }
.intro h1 { max-width: 18ch; }
.intro .lede { max-width: 60ch; }
.state { padding: 28px 0 20px; border-top: 1px solid var(--rule); scroll-margin-top: 16px; }
.state h2 { font-size: clamp(28px, 3vw, 38px); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 12px 28px; margin: 18px 0 0; padding: 0; list-style: none; }
.card { position: relative; display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 16px; align-items: center; padding: 12px; border-radius: 10px; }
.card:hover { background: var(--surface); }
.card h3 a { color: var(--ink); text-decoration: none; }
.card h3 a::after { content: ''; position: absolute; inset: 0; border-radius: 10px; }
.card h3 a:hover { color: var(--accent); }
.card .figures { color: var(--muted); font-size: 13.5px; line-height: 1.45; }
.card:focus-within { outline: 3px solid var(--accent); outline-offset: 2px; }
.card h3 a:focus-visible { outline: none; }

/* ── Footer ─────────────────────────────────────────────────────────────── */
.foot { padding: 28px 0 44px; border-top: 1px solid var(--rule); color: var(--muted); font-size: 13.5px; }
.foot p { max-width: 80ch; margin: 10px 0 0; }
.foot-links { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 22px; }
.foot-links a:not(.brand) { display: inline-flex; align-items: center; min-height: 44px; color: var(--muted); }
.foot-links a:not(.brand):hover { color: var(--ink); }

/* ── Narrow screens ─────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .hero { grid-template-columns: minmax(0, 1fr); }
  .steps { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .hide-narrow { display: none !important; }
  .map-panel { padding: 12px 12px 14px; }
  .layout { grid-template-columns: 88px minmax(0, 1fr); gap: 14px; }
  .card { grid-template-columns: 80px minmax(0, 1fr); padding: 10px 0; }
}
@media (max-width: 400px) {
  .top { gap: 10px; }
  .top nav { gap: 12px; }
  .brand { font-size: 16px; gap: 8px; }
}
