/* ─── Roadmap ──────────────────────────────────────────
   Layout: a route strip of phase "stations" up top, then method,
   overview table + dependency map, then phases beside a sticky rail.
   Uses the site tokens from style.css (or the artifact's copy). */
.rm {
  --font-display: 'Space Grotesk', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --rm-surface: color-mix(in srgb, var(--bg-card) 88%, transparent);
  --rm-line: var(--border);
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  font-family: var(--font-body);
  color: var(--text);
}

[data-track="math"]  { --track: var(--accent5); }
[data-track="ml"]    { --track: var(--accent); }
[data-track="rl"]    { --track: var(--accent3); }
[data-track="gpu"]   { --track: var(--accent2); }
[data-track="drone"] { --track: var(--accent4); }
[data-track="quad"]  { --track: var(--accent3); }
[data-track="cap"]   { --track: var(--accent); }

.rm-num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 0.92em; }

.rm-eyebrow {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--track, var(--accent));
  margin: 0 0 10px;
}

.rm h1, .rm h2, .rm h3, .rm h4 { font-family: var(--font-display); color: var(--white); text-wrap: balance; margin: 0; }

.rm a { color: inherit; }
.rm a:focus-visible, .rm input:focus-visible, .rm summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ─── Hero ───────────────────────────────────────────── */
.rm-hero {
  padding: 136px 0 56px;
  display: grid;
  gap: 22px;
}

.rm-hero h1 {
  font-size: clamp(44px, 7vw, 84px);
  line-height: 1;
  letter-spacing: -0.03em;
  font-weight: 700;
  background: linear-gradient(120deg, var(--white) 30%, var(--accent3) 62%, var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.rm-lede { max-width: 60ch; font-size: 18px; line-height: 1.6; color: var(--text-dim); margin: 0; }

.rm-facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, auto));
  justify-content: start;
  gap: 12px 40px;
  margin: 10px 0 0;
}
.rm-facts dt {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.rm-facts dd { margin: 4px 0 0; font-size: 15px; color: var(--text); font-weight: 500; }

.rm-progress {
  height: 4px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--text-muted) 22%, transparent);
  overflow: hidden;
  max-width: 560px;
}
.rm-progress-fill {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent5), var(--accent), var(--accent3), var(--accent4));
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Route strip: one station per phase, ring fills with progress. */
.rm-route {
  list-style: none;
  margin: 26px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  position: relative;
}
.rm-route::before {
  content: '';
  position: absolute;
  top: 21px;
  left: calc(100% / 14);
  right: calc(100% / 14);
  height: 2px;
  background: repeating-linear-gradient(90deg, var(--rm-line) 0 8px, transparent 8px 14px);
}
.rm-route li { position: relative; }
.rm-route a {
  display: grid;
  justify-items: center;
  gap: 10px;
  text-align: center;
  text-decoration: none;
}
.rm-station {
  --size: 44px;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  display: grid;
  place-items: center;
  position: relative;
  background: conic-gradient(var(--track) calc(var(--pct, 0) * 1%), color-mix(in srgb, var(--track) 16%, var(--bg)) 0);
  transition: transform var(--transition);
}
.rm-station::after {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--bg);
}
.rm-station b {
  position: relative;
  z-index: 1;
  font-family: var(--font-mono);
  font-size: 15px;
  color: var(--track);
}
.rm-route a.is-complete .rm-station::after { background: var(--track); }
.rm-route a.is-complete .rm-station b { color: var(--bg); }
.rm-route a:hover .rm-station { transform: translateY(-3px); }
.rm-station-label { font-size: 12.5px; color: var(--text-dim); line-height: 1.3; }

/* ─── Sections ───────────────────────────────────────── */
.rm-section { padding: 64px 0; border-top: 1px solid var(--rm-line); }
.rm-section-head { margin-bottom: 28px; }
.rm-section h2 { font-size: clamp(28px, 3.6vw, 40px); line-height: 1.15; }
.rm-subtitle { font-size: 18px; margin: 44px 0 6px !important; }
.rm-caption { font-size: 14px; color: var(--text-dim); margin: 0 0 18px; max-width: 70ch; }

.rm-thesis {
  font-family: var(--font-display);
  font-size: clamp(18px, 2vw, 22px);
  line-height: 1.5;
  color: var(--text);
  max-width: 62ch;
  margin: 0 0 36px;
}

.rm-rules {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  border-block: 1px solid var(--rm-line);
}
.rm-rule { padding: 22px 22px 22px 0; }
.rm-rule + .rm-rule { padding-left: 22px; border-left: 1px solid var(--rm-line); }
.rm-rule h3 { font-size: 16px; margin-bottom: 8px; }
.rm-rule p { font-size: 14px; line-height: 1.6; color: var(--text-dim); margin: 0; }

.rm-week { margin-top: 36px; }
.rm-week-title {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 10px;
}
.rm-week-bar { display: flex; gap: 4px; border-radius: 10px; overflow: hidden; }
.rm-week-seg {
  min-width: 0;
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-size: 13px;
  color: var(--white);
  background: color-mix(in srgb, var(--seg) 22%, var(--bg-card));
  border-top: 3px solid var(--seg);
}
.rm-week-seg span { color: var(--text-dim); }
.rm-week-seg[data-seg="0"] { --seg: var(--accent); }
.rm-week-seg[data-seg="1"] { --seg: var(--accent3); }
.rm-week-seg[data-seg="2"] { --seg: var(--accent4); }
.rm-week-seg[data-seg="3"] { --seg: var(--accent2); }
.rm-week-legend {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 28px;
  font-size: 13.5px;
  color: var(--text-dim);
}
.rm-week-legend b { color: var(--text); font-weight: 600; }

/* ─── Overview table ─────────────────────────────────── */
.rm-table-wrap { overflow-x: auto; border: 1px solid var(--rm-line); border-radius: var(--radius); background: var(--rm-surface); }
.rm-table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 720px; }
.rm-table th, .rm-table td { text-align: left; padding: 14px 16px; border-bottom: 1px solid var(--rm-line); vertical-align: top; }
.rm-table tbody tr:last-child > * { border-bottom: 0; }
.rm-table thead th {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.rm-table tbody th { font-weight: 600; white-space: nowrap; }
.rm-table tbody th a { text-decoration: none; display: inline-flex; align-items: center; gap: 10px; color: var(--white); }
.rm-table tbody th a:hover { color: var(--track); }
.rm-table td { color: var(--text-dim); }
.rm-table td.rm-num { white-space: nowrap; color: var(--text); }
.rm-sub { display: block; font-size: 11.5px; color: var(--text-muted); }
.rm-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--track); flex: none; }
.rm-mini { display: inline-block; width: 64px; height: 4px; border-radius: 999px; background: color-mix(in srgb, var(--text-muted) 22%, transparent); overflow: hidden; margin-right: 10px; vertical-align: middle; }
.rm-mini-fill { display: block; height: 100%; width: 0; background: var(--track); transition: width 0.4s ease; }

/* ─── Dependency graph ───────────────────────────────── */
.rm-graph-wrap { overflow-x: auto; padding: 8px 0; }
.rm-graph { display: block; max-width: none; font-family: var(--font-mono); }
.rm-edge { fill: none; stroke: var(--text-muted); stroke-width: 1.5; }
.rm-edge-par { stroke-dasharray: 4 4; }
.rm-arrow { fill: var(--text-muted); }
.rm-node rect { fill: var(--bg-card); stroke: var(--rm-line); stroke-width: 1; transition: stroke var(--transition); }
.rm-node rect.rm-node-bar { fill: var(--track); stroke: none; }
.rm-node:hover rect:not(.rm-node-bar) { stroke: var(--track); }
.rm-node-num { font-size: 10px; letter-spacing: 0.08em; fill: var(--track); }
.rm-node-title { font-family: var(--font-display); font-size: 13.5px; font-weight: 600; fill: var(--white); }

/* ─── Phases ─────────────────────────────────────────── */
.rm-phases-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 48px; align-items: start; }

.rm-rail { position: sticky; top: calc(96px + env(safe-area-inset-top, 0px)); }
.rm-rail ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; border-left: 1px solid var(--rm-line); }
.rm-rail a {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: baseline;
  padding: 8px 10px 8px 14px;
  margin-left: -1px;
  border-left: 2px solid transparent;
  text-decoration: none;
  font-size: 13.5px;
  color: var(--text-dim);
  transition: color var(--transition), border-color var(--transition);
}
.rm-rail a:hover { color: var(--white); }
.rm-rail a.is-active { color: var(--white); border-left-color: var(--track); }
.rm-rail-num { font-family: var(--font-mono); color: var(--track); }
.rm-rail-count { font-size: 11px; color: var(--text-muted); }
.rm-rail a.is-complete .rm-rail-count { color: var(--track); }

.rm-phase-list { display: grid; gap: 40px; min-width: 0; }

.rm-phase {
  scroll-margin-top: calc(90px + env(safe-area-inset-top, 0px));
  background: var(--rm-surface);
  border: 1px solid var(--rm-line);
  border-radius: var(--radius);
  padding: 34px 36px 30px;
  backdrop-filter: blur(14px);
  min-width: 0;
}

.rm-phase-head { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 22px; align-items: start; }
.rm-phase-num {
  font-family: var(--font-display);
  font-size: 76px;
  font-weight: 700;
  line-height: 0.85;
  color: transparent;
  -webkit-text-stroke: 1.5px var(--track);
}
.rm-phase-head h3 { font-size: clamp(22px, 2.6vw, 30px); line-height: 1.2; }
.rm-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.rm-chip {
  font-family: var(--font-mono);
  font-size: 11.5px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--rm-line);
  color: var(--text-dim);
}
.rm-chip-progress { color: var(--track); border-color: color-mix(in srgb, var(--track) 40%, transparent); }

.rm-outcome {
  margin: 26px 0 0;
  padding: 14px 18px;
  border-left: 3px solid var(--track);
  background: color-mix(in srgb, var(--track) 8%, transparent);
  font-family: var(--font-display);
  font-size: 17px;
  color: var(--white);
}

.rm-why { margin-top: 24px; }
.rm-phase h4 {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--track);
  margin-bottom: 12px;
}
.rm-why p { margin: 0; font-size: 15px; line-height: 1.75; color: var(--text-dim); max-width: 72ch; }
.rm-why .rm-aside { margin-top: 12px; font-size: 14px; color: var(--text-muted); font-style: italic; }

.rm-block { margin-top: 30px; }

.rm-concepts { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.rm-concepts li { position: relative; padding-left: 22px; font-size: 14.5px; line-height: 1.6; color: var(--text); }
.rm-concepts li::before { content: '?'; position: absolute; left: 0; top: 0; font-family: var(--font-mono); font-weight: 600; color: var(--track); }

.rm-sizes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.rm-size { border: 1px solid var(--rm-line); border-radius: var(--radius-sm); padding: 14px 16px; }
.rm-size p { margin: 0; font-size: 13.5px; line-height: 1.55; color: var(--text-dim); }
.rm-size .rm-size-name { font-family: var(--font-display); font-size: 16px; font-weight: 600; color: var(--white); margin-bottom: 6px; }
.rm-size-name .rm-num { color: var(--track); font-weight: 400; font-size: 12px; margin-left: 6px; }

/* Checklists */
.rm-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; counter-reset: rm; }
.rm-check { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 12px; padding: 10px 12px; margin: 0 -12px; border-radius: var(--radius-sm); transition: background var(--transition); }
.rm-check:hover { background: color-mix(in srgb, var(--track) 6%, transparent); }
.rm-check input { margin: 3px 0 0; width: 17px; height: 17px; accent-color: var(--track); cursor: pointer; }
.rm-check label { display: grid; gap: 3px; cursor: pointer; min-width: 0; }
.rm-papers .rm-check, .rm-steps .rm-check { counter-increment: rm; }
.rm-papers .rm-res-head::before, .rm-steps .rm-step::before {
  content: counter(rm) '.';
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--track);
  margin-right: 8px;
}
.rm-res-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 8px; }
.rm-res-title { font-weight: 600; font-size: 15px; color: var(--white); }
.rm-res-title a { text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--track) 50%, transparent); text-underline-offset: 3px; }
.rm-res-title a:hover { text-decoration-color: var(--track); color: var(--track); }
.rm-res-by { font-size: 13px; color: var(--text-dim); }
.rm-res-note { font-size: 14px; line-height: 1.6; color: var(--text-dim); }
.rm-step { color: var(--text); }
.rm-tag {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  padding: 1px 7px;
  border-radius: 4px;
  border: 1px solid var(--rm-line);
  color: var(--text-dim);
}
.rm-tag-free { color: var(--accent3); border-color: color-mix(in srgb, var(--accent3) 40%, transparent); }
.rm-tag-paid { color: var(--accent4); border-color: color-mix(in srgb, var(--accent4) 40%, transparent); }

.rm-check.is-done .rm-res-title,
.rm-check.is-done .rm-step { text-decoration: line-through; text-decoration-color: var(--text-muted); color: var(--text-muted); }
.rm-check.is-done .rm-res-title a { color: var(--text-muted); }

.rm-build {
  background: color-mix(in srgb, var(--bg-dark) 60%, transparent);
  border: 1px solid var(--rm-line);
  border-radius: var(--radius-sm);
  padding: 20px 22px 14px;
}
.rm-build .rm-check { margin: 0 -10px; padding: 8px 10px; }

.rm-exit { border-top: 1px dashed var(--rm-line); padding-top: 22px; }

.rm-callout {
  margin: 24px 0 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid color-mix(in srgb, var(--accent4) 40%, transparent);
  background: color-mix(in srgb, var(--accent4) 8%, transparent);
}

.rm-more { margin-top: 26px; border-top: 1px solid var(--rm-line); padding-top: 16px; }
.rm-more summary {
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  list-style-position: outside;
}
.rm-more summary:hover { color: var(--track); }
.rm-more .rm-list { margin-top: 12px; }

.rm-foot { padding: 40px 0 72px; border-top: 1px solid var(--rm-line); font-size: 13.5px; color: var(--text-muted); }
.rm-foot a { color: var(--accent); }

/* ─── Responsive ─────────────────────────────────────── */
@media (max-width: 960px) {
  .rm-phases-layout { grid-template-columns: minmax(0, 1fr); }
  .rm-rail { display: none; }
  .rm-rules { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rm-rule:nth-child(3) { padding-left: 0; border-left: 0; }
  .rm-rule:nth-child(n+3) { border-top: 1px solid var(--rm-line); }
}

@media (max-width: 640px) {
  .rm { padding: 0 16px; }
  .rm-hero { padding-top: 112px; }
  .rm-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rm-route { grid-template-columns: repeat(4, minmax(0, 1fr)); row-gap: 18px; }
  .rm-route::before { display: none; }
  .rm-rules { grid-template-columns: minmax(0, 1fr); }
  .rm-rule, .rm-rule + .rm-rule { padding: 18px 0; border-left: 0; }
  .rm-rule + .rm-rule { border-top: 1px solid var(--rm-line); }
  .rm-week-bar { flex-direction: column; }
  .rm-week-seg { flex: none !important; }
  .rm-week-legend { grid-template-columns: minmax(0, 1fr); }
  .rm-phase { padding: 24px 18px; }
  .rm-phase-head { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .rm-phase-num { font-size: 52px; }
  .rm-sizes { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  .rm *, .rm *::before, .rm *::after { transition: none !important; }
}
