/* ==========================================================================
   AD Roadmap — "Route atlas" theme
   A printed road atlas for autonomous-driving engineers: light, editorial,
   precise. Signature element: the centerline (dashed lane marking).
   ========================================================================== */

:root {
  --paper: #F4F5F2;
  --surface: #FBFBF8;
  --ink: #1C2532;
  --ink-soft: #555F6C;
  --hairline: #D9DDD3;
  --accent: #C77817;
  --accent-ink: #9C5E0D; /* darker amber for small text: 4.77:1 on paper */
  --accent-soft: #F6E8D4;
  --link: #2456A6;
  --hue-f: #2F5AA8;
  --hue-m: #0E7C74;
  --hue-e: #7A55C7;
  --hue-p: #B35C1E;
  --plate: #182230;
  --plate-ink: #D9E0E8;
  --font-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --measure: 1120px;
  --topbar-h: 64px;
}

/* ---------- base ------------------------------------------------------- */

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

[hidden] { display: none !important; }

html {
  scroll-padding-top: calc(var(--topbar-h) + 20px);
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

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

::selection { background: var(--accent-soft); }

h1, h2, h3 { line-height: 1.15; }

p { margin: 0 0 1em; }

a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -48px;
  z-index: 100;
  padding: 8px 14px;
  background: var(--ink);
  color: var(--surface);
  font-family: var(--font-mono);
  font-size: 12px;
  border-radius: 4px;
  transition: top 0.15s ease;
}
.skip-link:focus { top: 8px; }

/* ---------- shared type ------------------------------------------------- */

.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.eyebrow::before {
  content: "";
  width: 26px;
  border-top: 2px solid var(--accent);
  flex: none;
}

.section {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 72px 24px 8px;
}

.section h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(28px, 4vw, 40px);
  letter-spacing: -0.01em;
  margin: 0 0 18px;
}

.section-intro {
  max-width: 720px;
  color: var(--ink-soft);
  font-size: 17px;
}

.note {
  font-size: 14px;
  color: var(--ink-soft);
  border-left: 2px solid var(--hairline);
  padding-left: 14px;
  max-width: 760px;
}

.caveat {
  font-size: 13.5px;
  color: var(--ink-soft);
  max-width: 760px;
}

/* hover-reveal heading anchors */
.anchor {
  font-family: var(--font-mono);
  font-size: 0.6em;
  font-weight: 400;
  color: var(--accent-ink);
  text-decoration: none;
  margin-left: 10px;
  opacity: 0;
  transition: opacity 0.15s ease;
  vertical-align: middle;
}
h2:hover .anchor, h3:hover .anchor, .anchor:focus-visible { opacity: 1; }
@media (prefers-reduced-motion: reduce) {
  .anchor { transition: none; }
}

/* ---------- top bar ------------------------------------------------------ */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(244, 245, 242, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--hairline);
}

.topbar-inner {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.wordmark {
  font-family: var(--font-display);
  font-weight: 620;
  font-size: 19px;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.01em;
  flex: none;
}
.wordmark::after {
  content: "";
  display: block;
  border-top: 2px dashed var(--accent);
  margin-top: 1px;
}

.site-nav {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
  flex: 1 1 auto;
  min-width: 0;
}
.site-nav::-webkit-scrollbar { display: none; }

.site-nav a {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-decoration: none;
  padding: 6px 9px;
  border-radius: 4px;
  white-space: nowrap;
}
.site-nav a:hover { color: var(--ink); background: rgba(28, 37, 50, 0.05); }
.site-nav a[aria-current="true"] {
  color: var(--ink);
  box-shadow: inset 0 -2px 0 var(--accent);
}

.tools {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: none;
  margin-left: auto;
  flex-wrap: wrap;
}

.chips {
  display: flex;
  gap: 4px;
  align-items: center;
}

.chip {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 9px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
  line-height: 1.4;
}
.chip:hover { border-color: var(--ink-soft); }
.chip-f { color: var(--hue-f); }
.chip-m { color: var(--hue-m); }
.chip-e { color: var(--hue-e); }
.chip-p { color: var(--hue-p); }
.chip.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--surface);
}

.search-box { position: relative; }
.search-box label {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.search-box input {
  font-family: var(--font-mono);
  font-size: 12.5px;
  padding: 6px 12px;
  width: 190px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
}
.search-box input::placeholder { color: var(--ink-soft); }
.search-box input:focus-visible { outline-offset: 1px; }

.search-status {
  position: absolute;
  top: calc(100% + 6px);
  right: 4px;
  margin: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-soft);
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 4px;
  padding: 3px 8px;
  white-space: nowrap;
  z-index: 60;
}

/* ---------- hero --------------------------------------------------------- */

.hero {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 96px 24px 40px;
}

.hero h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(40px, 6.4vw, 72px);
  letter-spacing: -0.02em;
  margin: 0 0 24px;
  max-width: 14ch;
}
.hero-title-sub { display: block; color: var(--ink-soft); font-weight: 560; }

.lede {
  max-width: 680px;
  font-size: 17.5px;
  color: var(--ink-soft);
}

/* the horizontal centerline route strip */
.route-strip {
  margin: 56px 0 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 6px;
}
.route-strip::-webkit-scrollbar { display: none; }
.route-strip ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: flex-start;
  min-width: 640px;
  position: relative;
}
.route-strip ol::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 7px;
  border-top: 2px dashed var(--hairline);
}
.route-strip li { flex: 1 0 0; position: relative; }

.waypoint {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  padding-top: 0;
}
.waypoint-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--paper);
  border: 2px solid var(--ink-soft);
  position: relative;
  z-index: 1;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.waypoint-num {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  transition: color 0.15s ease;
}
.waypoint:hover .waypoint-dot,
.waypoint:focus-visible .waypoint-dot {
  border-color: var(--accent);
  background: var(--accent);
}
.waypoint:hover .waypoint-num,
.waypoint:focus-visible .waypoint-num { color: var(--accent-ink); }
@media (prefers-reduced-motion: reduce) {
  .waypoint-dot, .waypoint-num { transition: none; }
}

/* ---------- classification key ------------------------------------------ */

.legend h2 { margin-bottom: 28px; }

.legend-grid {
  list-style: none;
  margin: 0 0 28px;
  padding: 28px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px 32px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 8px;
}
.legend-item {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  font-size: 14.5px;
}
.legend-item p { margin: 0; }
.legend-name {
  font-weight: 600;
  font-size: 14px;
  margin: 0 0 2px;
}
.legend-note {
  grid-column: 1 / -1;
  border-top: 1px dashed var(--hairline);
  padding-top: 18px;
  color: var(--ink-soft);
  font-size: 14px;
}

/* maturity badges — letter(s) always visible, hue is redundant encoding */
.badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  line-height: 1;
  color: #FFFFFF;
  background: var(--ink-soft);
  padding: 4px 7px;
  border-radius: 3px;
  white-space: nowrap;
  vertical-align: 0.08em;
  margin-right: 2px;
}
.badge-f { background: var(--hue-f); }
.badge-m { background: var(--hue-m); }
.badge-e { background: var(--hue-e); }
.badge-p { background: var(--hue-p); }
.badge-f.badge-m { background: linear-gradient(120deg, var(--hue-f) 50%, var(--hue-m) 50%); }
.badge-f.badge-e { background: linear-gradient(120deg, var(--hue-f) 50%, var(--hue-e) 50%); }
.badge-f.badge-p { background: linear-gradient(120deg, var(--hue-f) 50%, var(--hue-p) 50%); }
.badge-m.badge-e { background: linear-gradient(120deg, var(--hue-m) 50%, var(--hue-e) 50%); }
.badge-m.badge-p { background: linear-gradient(120deg, var(--hue-m) 50%, var(--hue-p) 50%); }
.badge-e.badge-p { background: linear-gradient(120deg, var(--hue-e) 50%, var(--hue-p) 50%); }

/* ---------- roadmap spine ----------------------------------------------- */

.spine { position: relative; margin-top: 44px; }

.spine-track {
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 19px;
  width: 0;
  border-left: 2px dashed var(--hairline);
}
.spine-fill {
  position: absolute;
  top: 0;
  left: -2px;
  height: 100%;
  width: 0;
  border-left: 2px solid var(--accent);
  transform-origin: top;
  transform: scaleY(0);
}
html:not(.js) .spine-fill { display: none; }

.phases {
  list-style: none;
  margin: 0;
  padding: 0;
}

.phase {
  position: relative;
  padding: 0 0 28px 64px;
}

.phase-num {
  position: absolute;
  left: 0;
  top: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--paper);
  border: 2px solid var(--ink-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  z-index: 1;
}

.phase-card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  padding: 22px 26px;
  max-width: 760px;
}
.phase-card h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 21px;
  margin: 0 0 12px;
}
.phase-row {
  font-size: 14.5px;
  margin: 0 0 10px;
}
.field-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 3px;
}

.checkpoint {
  margin-top: 16px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  background: linear-gradient(90deg, rgba(199, 120, 23, 0.08), rgba(199, 120, 23, 0.02));
  padding: 12px 16px;
  border-radius: 0 6px 6px 0;
}
.checkpoint p { margin: 0; font-size: 14px; }

/* sequencing rule */
.sequencing {
  margin-top: 48px;
  border-top: 1px solid var(--hairline);
  padding-top: 36px;
  max-width: 760px;
}
.sequencing h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 24px;
  margin: 0 0 10px;
}
.seq-list {
  list-style: none;
  counter-reset: seq;
  margin: 22px 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.seq-list li {
  counter-increment: seq;
  display: flex;
  align-items: baseline;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 6px;
  padding: 10px 16px;
  font-size: 14.5px;
}
.seq-list li::before {
  content: counter(seq, decimal-leading-zero);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-ink);
  flex: none;
}

/* ---------- module sections ---------------------------------------------- */

.module { border-top: 1px solid var(--hairline); margin-top: 56px; }
.module-head { margin-bottom: 8px; }

.tier { margin-top: 40px; }
.tier-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 22px;
  margin: 0 0 16px;
}

/* ledger tables */
.ledger { overflow-x: auto; }
.ledger table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  line-height: 1.5;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  overflow: hidden;
}
.resource-table { table-layout: fixed; }
.ledger td { overflow-wrap: break-word; }
.ledger th {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-align: left;
  color: var(--ink-soft);
  padding: 12px 14px;
  border-bottom: 1px solid var(--hairline);
  background: var(--paper);
  white-space: nowrap;
}
.ledger td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--hairline);
  vertical-align: top;
}
.ledger tbody tr:last-child td { border-bottom: 0; }
.ledger tbody tr { transition: background 0.12s ease; }
.ledger tbody tr:hover { background: rgba(28, 37, 50, 0.025); }
@media (prefers-reduced-motion: reduce) {
  .ledger tbody tr { transition: none; }
}

.ledger .col-link a::after {
  content: "\2197"; /* ↗ */
  font-size: 0.8em;
  margin-left: 3px;
  text-decoration: none;
  display: inline-block;
}
.ledger .col-limits {
  color: var(--ink-soft);
  background: rgba(28, 37, 50, 0.03);
}
.res-name { font-weight: 600; }
.res-name .badge { margin-right: 6px; }
.res-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.6;
  color: var(--ink-soft);
  margin-top: 7px;
}

tr.empty-row td {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-soft);
  text-align: center;
  padding: 14px;
  font-style: normal;
}

/* stacked-card reflow */
@media (max-width: 900px) {
  .ledger { overflow-x: visible; }
  .ledger table, .ledger thead, .ledger tbody, .ledger tr, .ledger td { display: block; }
  .ledger table { background: transparent; border: 0; border-radius: 0; }
  .ledger thead {
    position: absolute;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  .ledger tbody tr {
    background: var(--surface);
    border: 1px solid var(--hairline);
    border-radius: 8px;
    margin-bottom: 16px;
    padding: 6px 4px;
  }
  .ledger tbody tr:hover { background: var(--surface); }
  .ledger td {
    border-bottom: 1px dashed var(--hairline);
    padding: 10px 16px;
  }
  .ledger td:last-child { border-bottom: 0; }
  .ledger td::before {
    content: attr(data-label);
    display: block;
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-soft);
    margin-bottom: 3px;
  }
  .ledger .col-limits { background: transparent; }
  .resource-table { table-layout: auto; }
}

/* ---------- interfaces / blueprint plate --------------------------------- */

.interfaces { border-top: 1px solid var(--hairline); margin-top: 56px; }

.blueprint {
  margin: 28px 0 24px;
  background: var(--plate);
  border-radius: 10px;
  padding: 4px 4px 4px;
  border-top: 3px solid var(--accent);
  box-shadow: 0 12px 32px rgba(28, 37, 50, 0.18);
}
.blueprint-cap {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  color: #E0A55C;
  padding: 14px 20px 4px;
}
.blueprint-plate {
  margin: 0;
  padding: 12px 20px 20px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--plate-ink);
  overflow-x: auto;
  white-space: pre;
}
.blueprint-plate::selection { background: rgba(199, 120, 23, 0.4); }

.concepts-list {
  list-style: none;
  counter-reset: concept;
  margin: 8px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.concepts-list li {
  counter-increment: concept;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 6px;
  padding: 14px 16px 14px 52px;
  position: relative;
  font-size: 13.5px;
}
.concepts-list li::before {
  content: counter(concept, decimal-leading-zero);
  position: absolute;
  left: 16px;
  top: 15px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-ink);
}

/* ---------- projects ------------------------------------------------------- */

.projects { border-top: 1px solid var(--hairline); margin-top: 56px; }

.pips {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  margin-right: 6px;
}
.pips-vis { display: inline-flex; gap: 4px; }
.pip {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1.5px solid var(--ink-soft);
  display: inline-block;
}
.pip.on { background: var(--accent); border-color: var(--accent); }
.pips-num {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-soft);
}
.pitfalls { font-size: 13px; }

/* ---------- evidence-limited ---------------------------------------------- */

.evidence {
  border-top: 1px solid var(--hairline);
  margin-top: 56px;
}
.evidence-list {
  list-style: none;
  margin: 20px 0 0;
  padding: 0 0 0 22px;
  border-left: 3px solid var(--accent);
  display: grid;
  gap: 14px;
  max-width: 820px;
}
.evidence-list li {
  font-size: 14.5px;
  padding-left: 4px;
}

/* ---------- reading list ----------------------------------------------------- */

.reading { border-top: 1px solid var(--hairline); margin-top: 56px; }
.reading-table { table-layout: fixed; }
.reading-table th { white-space: normal; }
.reading-table th:first-child { width: 160px; }
.reading-table td:first-child {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
}

.capability-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  max-width: 900px;
}
.capability-list li {
  position: relative;
  padding: 12px 16px 12px 42px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 6px;
  font-size: 14px;
}
.capability-list li::before {
  content: "";
  position: absolute;
  left: 16px;
  top: 16px;
  width: 11px;
  height: 11px;
  border: 2px solid var(--accent);
  border-radius: 2px;
}

/* ---------- footer ---------------------------------------------------------- */

.site-footer {
  max-width: var(--measure);
  margin: 96px auto 0;
  padding: 32px 24px 64px;
  border-top: 1px solid var(--hairline);
}
.footer-provenance {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 12px;
}
.footer-provenance::before {
  content: "";
  display: block;
  width: 64px;
  border-top: 2px dashed var(--accent);
  margin-bottom: 14px;
}

/* ---------- back to top ------------------------------------------------------- */

.to-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--hairline);
  background: var(--ink);
  color: var(--surface);
  font-size: 18px;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(28, 37, 50, 0.25);
  z-index: 40;
}
.to-top:hover { background: var(--accent); border-color: var(--accent); }

/* ---------- scroll reveal ------------------------------------------------------ */

html.js .reveal {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
html.js .reveal.is-visible {
  opacity: 1;
  transform: none;
}
@media (prefers-reduced-motion: reduce) {
  html.js .reveal { opacity: 1; transform: none; transition: none; }
}

/* ---------- responsive ----------------------------------------------------------- */

@media (max-width: 900px) {
  .legend-grid, .concepts-list, .capability-list {
    grid-template-columns: 1fr;
  }
  .section { padding-top: 56px; }
  .hero { padding-top: 64px; }
  .topbar-inner { gap: 8px 16px; }
  .tools { margin-left: 0; width: 100%; justify-content: space-between; }
  .search-box input { width: 150px; }
}

@media (max-width: 560px) {
  .phase { padding-left: 52px; }
  .phase-num { width: 34px; height: 34px; font-size: 11.5px; }
  .spine-track { left: 16px; }
  .phase-card { padding: 18px; }
  .hero h1 { max-width: none; }
}
