:root {
  --ink: #14221f;
  --muted: #5c6b67;
  --paper: #fbfcfa;
  --surface: #ffffff;
  --surface-soft: #f2f6f3;
  --line: #dce4df;
  --accent: #087f5b;
  --accent-deep: #055c43;
  --accent-soft: #dff5ea;
  --danger: #9c2e2e;
  --danger-soft: #fff0ed;
  --amber: #8a5700;
  --amber-soft: #fff7df;
  --blue: #215b8f;
  --blue-soft: #edf6ff;
  --violet: #60469b;
  --violet-soft: #f5f1ff;
  --shadow: 0 12px 32px rgba(28, 55, 45, 0.08);
  --radius: 16px;
  --focus: #0067c5;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Avenir, "Segoe UI", Helvetica, Arial, sans-serif;
  line-height: 1.55;
}
a { color: var(--accent-deep); text-decoration-thickness: .08em; text-underline-offset: .18em; }
a:hover { color: var(--accent); }
button, input, select { font: inherit; }
button, select, input { min-height: 44px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.skip-link {
  position: fixed;
  z-index: 100;
  top: 10px;
  left: 10px;
  padding: 10px 16px;
  transform: translateY(-150%);
  color: white;
  background: var(--ink);
  border-radius: 8px;
}
.skip-link:focus { transform: translateY(0); }

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 10px clamp(18px, 3vw, 42px);
  background: rgba(251, 252, 250, .96);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; }
.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: white;
  background: var(--ink);
  border-radius: 12px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 13px;
  letter-spacing: .08em;
}
.brand span:last-child, .topbar-status span:last-child { display: flex; flex-direction: column; }
.brand small, .topbar-status small { color: var(--muted); font-size: 12px; }
.topbar-status { display: flex; align-items: center; gap: 9px; text-align: right; }
.pulse { width: 9px; height: 9px; background: var(--accent); border-radius: 50%; box-shadow: 0 0 0 5px var(--accent-soft); }

.shell { display: grid; grid-template-columns: 290px minmax(0, 1fr); max-width: 1600px; margin: 0 auto; }
.sidebar { border-right: 1px solid var(--line); }
.sidebar-inner { position: sticky; top: 73px; max-height: calc(100vh - 73px); padding: 28px 20px 32px; overflow-y: auto; }
.eyebrow {
  margin: 0 0 8px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
}
#primary-nav { display: grid; gap: 3px; }
.nav-link {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 8px;
  align-items: start;
  min-height: 42px;
  padding: 9px 10px;
  color: #33443f;
  border-radius: 9px;
  font-size: 13px;
  line-height: 1.3;
  text-decoration: none;
}
.nav-link:hover { color: var(--ink); background: var(--surface-soft); }
.nav-link[aria-current="page"] { color: var(--accent-deep); background: var(--accent-soft); font-weight: 700; }
.nav-number { color: var(--muted); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 11px; }
.sidebar-meta { display: grid; gap: 4px; margin-top: 24px; padding-top: 16px; color: var(--muted); border-top: 1px solid var(--line); font-size: 11px; }

main { min-width: 0; padding: clamp(20px, 3vw, 44px); }
.scope-banner {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(270px, .85fr);
  overflow: hidden;
  margin-bottom: 24px;
  border: 1px solid #b9d8ca;
  border-radius: 20px;
  box-shadow: var(--shadow);
}
.scope-go, .scope-no-go { padding: clamp(22px, 4vw, 42px); }
.scope-go { background: var(--accent-soft); }
.scope-no-go { color: #5d1f1f; background: var(--danger-soft); border-left: 1px solid #efc6be; }
.scope-banner h1 { margin: 0 0 8px; font-size: clamp(30px, 4vw, 48px); line-height: 1.05; letter-spacing: -.04em; }
.scope-banner p:last-child { margin-bottom: 0; }

.controls { margin-bottom: 34px; padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.search-field label, .filter-grid label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 700; }
.search-field input, select {
  width: 100%;
  padding: 10px 12px;
  color: var(--ink);
  background: white;
  border: 1px solid #b9c7c1;
  border-radius: 9px;
}
.search-field input { font-size: 16px; }
.filter-grid { display: grid; grid-template-columns: repeat(4, minmax(130px, 1fr)) auto; gap: 12px; align-items: end; margin-top: 14px; }
#clear-filters { padding: 8px 14px; color: var(--ink); background: var(--surface-soft); border: 1px solid var(--line); border-radius: 9px; cursor: pointer; }
#clear-filters:hover { background: #e8efeb; }
.result-status { min-height: 1.4em; margin: 12px 0 0; color: var(--muted); font-size: 13px; }

.page-header { margin: 0 0 28px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.page-kicker { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.page-header h2 { max-width: 900px; margin: 0 0 12px; font-size: clamp(28px, 4vw, 44px); line-height: 1.12; letter-spacing: -.035em; }
.page-meta { display: flex; flex-wrap: wrap; gap: 8px; }
.badge { display: inline-flex; align-items: center; min-height: 26px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; color: #40514b; background: white; font-size: 12px; }
.badge.status { color: var(--accent-deep); background: var(--accent-soft); border-color: #b9e2cf; }
.badge.gate { color: #5d1f1f; background: var(--danger-soft); border-color: #efc6be; }

.evidence-layout { display: grid; gap: 18px; }
.evidence-block { padding: clamp(20px, 3vw, 30px); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.evidence-block h3 { margin: 0 0 15px; font-size: 18px; }
.evidence-block ul { margin: 0; padding-left: 1.2rem; }
.evidence-block li + li { margin-top: 9px; }
.evidence-block.facts { background: #f0faf5; border-color: #c5e6d5; }
.evidence-block.assumptions { background: var(--amber-soft); border-color: #ead79d; }
.evidence-block.options { background: var(--blue-soft); border-color: #c8dff2; }
.evidence-block.risks { background: var(--danger-soft); border-color: #efc6be; }
.evidence-block.recommendations { background: var(--violet-soft); border-color: #dbd0f3; }
.section-footnotes { display: grid; gap: 14px; margin-top: 22px; padding: 20px; background: var(--surface-soft); border-radius: 12px; }
.section-footnotes p { margin: 0; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .88em; overflow-wrap: anywhere; }

.result-grid { display: grid; gap: 12px; }
.result-card { padding: 20px; background: white; border: 1px solid var(--line); border-radius: 12px; }
.result-card h3 { margin: 5px 0 8px; font-size: 19px; }
.result-card p { margin: 0; color: var(--muted); }
.result-card a { color: var(--ink); text-decoration: none; }
.result-card a:hover { color: var(--accent); text-decoration: underline; }
.empty-state { padding: 42px 24px; text-align: center; background: white; border: 1px dashed #aab9b3; border-radius: 12px; }

.artifact-table-wrap { overflow-x: auto; margin-top: 22px; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; background: white; font-size: 13px; }
th, td { padding: 12px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
th { color: var(--muted); background: var(--surface-soft); font-size: 11px; letter-spacing: .05em; text-transform: uppercase; }
tr:last-child td { border-bottom: 0; }
.artifact-status { font-weight: 700; }
.artifact-status.authoritative { color: var(--accent-deep); }
.artifact-status.superseded { color: var(--amber); }
.artifact-status.rejected { color: var(--danger); }
.download-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; padding: 0; list-style: none; }
.download-list a { display: block; min-height: 100%; padding: 16px; color: var(--ink); background: white; border: 1px solid var(--line); border-radius: 12px; text-decoration: none; }
.download-list a:hover { border-color: var(--accent); }
.download-list small { display: block; margin-top: 7px; color: var(--muted); }

.roadmap-teaser, .whiteboard-teaser {
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 20px;
  margin-bottom: 24px;
  padding: clamp(22px, 3vw, 32px);
  color: #17253a;
  background: linear-gradient(135deg, #edf6ff, #f5f1ff);
  border: 1px solid #c9d9ed;
  border-radius: var(--radius);
}
.whiteboard-teaser { color: var(--ink); background: linear-gradient(135deg, #e7f7ef, #fff7df); border-color: #b9d8ca; }
.whiteboard-teaser h3 { margin: 0 0 8px; font-size: clamp(23px, 3vw, 31px); }
.whiteboard-teaser p { margin: 0 0 16px; }
.whiteboard-boundary { padding: 18px; color: #5d1f1f; background: var(--danger-soft); border: 1px solid #efc6be; border-radius: 12px; }
.whiteboard-downloads { grid-column: 1 / -1; padding-top: 18px; border-top: 1px solid #b9d8ca; }
.whiteboard-downloads h4 { margin: 0 0 6px; font-size: 17px; }
.whiteboard-downloads > p { color: var(--muted); }
.whiteboard-downloads .download-list { margin-bottom: 0; }
.roadmap-teaser h3, .section-heading h3, .next-learning-step h3, .evidence-baseline h3 { margin: 0 0 8px; font-size: clamp(21px, 3vw, 28px); }
.roadmap-teaser p { margin: 0; }
.roadmap-teaser .next-step { padding: 18px; background: rgba(255, 255, 255, .78); border-radius: 12px; }
.roadmap-teaser .next-step p { margin: 7px 0 14px; }
.button-link { display: inline-block; padding: 9px 14px; color: white; background: var(--accent-deep); border-radius: 8px; text-decoration: none; font-weight: 700; }
.button-link:hover { color: white; background: var(--accent); }
.section-heading { margin: 42px 0 18px; }
.section-heading p:last-child { max-width: 900px; color: var(--muted); }
.next-learning-step { margin-bottom: 34px; padding: clamp(22px, 3vw, 32px); color: #35265c; background: var(--violet-soft); border: 1px solid #dbd0f3; border-radius: var(--radius); }
.next-learning-step p:last-child { margin-bottom: 0; font-size: 18px; }
.track-map { display: grid; gap: 10px; padding: 0; list-style: none; }
.track-row { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(180px, .9fr) minmax(180px, 1fr); align-items: stretch; }
.track-node { display: grid; grid-template-columns: 42px 1fr; gap: 10px; align-items: center; padding: 14px; border: 1px solid; border-radius: 12px; }
.capability-track { color: #17496f; background: var(--blue-soft); border-color: #c8dff2; }
.application-track { color: #463172; background: var(--violet-soft); border-color: #dbd0f3; }
.track-node strong { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.track-connection { display: grid; grid-template-columns: 30px 1fr; gap: 8px; align-items: center; padding: 7px 12px; color: var(--muted); text-align: center; }
.track-connection span { color: var(--accent); font-size: 24px; font-weight: 800; }
.track-connection small { text-align: left; }
.evidence-baseline { margin: 32px 0; padding: clamp(22px, 3vw, 30px); background: var(--amber-soft); border: 1px solid #ead79d; border-radius: var(--radius); }
.evidence-baseline ul { margin-bottom: 0; }
.phase-grid { display: grid; gap: 18px; }
.phase-card { scroll-margin-top: 90px; padding: clamp(20px, 3vw, 30px); background: white; border: 1px solid var(--line); border-left: 6px solid var(--blue); border-radius: var(--radius); box-shadow: var(--shadow); }
.phase-card > header { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-start; justify-content: space-between; margin-bottom: 20px; }
.phase-card h3 { margin: 0; font-size: 23px; }
.evidence-status { max-width: 340px; padding: 6px 10px; color: var(--amber); background: var(--amber-soft); border: 1px solid #ead79d; border-radius: 999px; font-size: 12px; font-weight: 700; }
.phase-details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; overflow: hidden; margin: 0; background: var(--line); border: 1px solid var(--line); border-radius: 12px; }
.phase-details > div { padding: 15px; background: white; }
.phase-details dt { margin-bottom: 5px; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.phase-details dd { margin: 0; }
.phase-details ul { margin: 0; padding-left: 1.2rem; }
.phase-skill { margin: 16px 0 0; }
.skill-register { margin-top: 44px; }
.skill-register > ol { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; padding: 0; list-style: none; }
.skill-register > ol > li { scroll-margin-top: 90px; padding: 18px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 12px; }
.skill-register h3 { margin: 0 0 10px; font-size: 15px; }
.skill-register p { margin: 7px 0 0; }
.scope-reminder { margin-top: 30px; padding: 18px; color: #5d1f1f; background: var(--danger-soft); border: 1px solid #efc6be; border-radius: 12px; }

.loading-panel, .error-panel { padding: 32px; background: white; border: 1px solid var(--line); border-radius: var(--radius); }
.error-panel { color: var(--danger); border-color: #efc6be; background: var(--danger-soft); }
footer { display: flex; justify-content: space-between; gap: 18px; padding: 24px clamp(18px, 3vw, 42px); color: var(--muted); border-top: 1px solid var(--line); font-size: 12px; }
.noscript { margin: 20px; padding: 18px; color: var(--danger); background: var(--danger-soft); }

@media (max-width: 1050px) {
  .filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #clear-filters { width: 100%; }
  .scope-banner, .roadmap-teaser, .whiteboard-teaser { grid-template-columns: 1fr; }
  .scope-no-go { border-top: 1px solid #efc6be; border-left: 0; }
  .track-row { grid-template-columns: 1fr; }
  .track-connection { grid-template-columns: 30px 1fr; text-align: left; }
  .track-connection span { transform: rotate(90deg); }
}
@media (max-width: 780px) {
  .topbar { position: static; align-items: flex-start; }
  .topbar-status { display: none; }
  .shell { display: block; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar-inner { position: static; max-height: none; padding: 16px 18px; }
  #primary-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sidebar-meta { display: none; }
  main { padding: 20px 16px 34px; }
  .phase-details { grid-template-columns: 1fr; }
  footer { flex-direction: column; }
}
@media (max-width: 520px) {
  #primary-nav, .filter-grid { grid-template-columns: 1fr; }
  .scope-go, .scope-no-go { padding: 22px 18px; }
  .page-header h2 { font-size: 28px; }
  th, td { padding: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
@media print {
  .topbar, .sidebar, .controls, footer { display: none; }
  .shell { display: block; }
  main { padding: 0; }
  .scope-banner, .evidence-block { break-inside: avoid; box-shadow: none; }
}
