:root {
  color-scheme: light dark;
  --page: #f4f6f7;
  --surface: #ffffff;
  --surface-2: #eef2f3;
  --ink: #172023;
  --muted: #59666b;
  --line: #cbd4d7;
  --teal: #006b61;
  --on-teal: #ffffff;
  --teal-strong: #005149;
  --blue: #285a8c;
  --red: #a63a3a;
  --amber: #835b00;
  --soft-teal: #e1f2ee;
  --soft-blue: #e6eef8;
  --soft-red: #f7e9e7;
  --soft-amber: #f8efd8;
  --shadow: 0 8px 22px rgba(25, 38, 42, 0.07);
}

@media (prefers-color-scheme: dark) {
  :root {
    --page: #111719;
    --surface: #192124;
    --surface-2: #222d31;
    --ink: #eff4f4;
    --muted: #b2bec1;
    --line: #354247;
    --teal: #79d7c7;
    --on-teal: #07111f;
    --teal-strong: #9be6d8;
    --blue: #9bc5f2;
    --red: #f3a4a0;
    --amber: #e7c46d;
    --soft-teal: #173832;
    --soft-blue: #1b3047;
    --soft-red: #432626;
    --soft-amber: #3d3218;
    --shadow: none;
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.58;
}

a {
  color: var(--teal);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

button,
select {
  font: inherit;
}

.site-header,
main,
.site-footer {
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.brand img {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 50%;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.site-nav a,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 10px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}

.site-nav a {
  padding-inline: 8px;
  font-size: 14px;
}

.site-nav a[aria-current="page"] {
  border-color: var(--teal);
  color: var(--teal);
}

.hero {
  min-height: 330px;
  display: grid;
  align-content: center;
  padding: 42px 0 38px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.hero-copy {
  max-width: 930px;
}

.eyebrow,
.kicker {
  margin: 0 0 8px;
  color: var(--teal);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 900px;
  margin-bottom: 14px;
  font-size: clamp(38px, 6vw, 64px);
  line-height: 1.02;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 8px;
  font-size: 28px;
  line-height: 1.16;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 7px;
  font-size: 18px;
  line-height: 1.3;
  letter-spacing: 0;
}

.lede {
  max-width: 880px;
  color: var(--muted);
  font-size: 18px;
}

.hero-actions,
.button-row,
.legend,
.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hero-actions {
  margin-top: 20px;
}

.button {
  border-color: var(--teal);
  background: var(--teal);
  color: var(--on-teal);
  cursor: pointer;
}

.button.secondary {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.section {
  padding: 34px 0 0;
}

.section-heading {
  max-width: 850px;
  margin-bottom: 16px;
}

.section-note,
.muted {
  color: var(--muted);
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin-top: 20px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.summary-strip div {
  min-width: 0;
  padding: 13px;
  background: var(--surface);
}

.summary-strip strong,
.summary-strip span {
  display: block;
}

.summary-strip span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 14px;
}

.callout {
  padding: 18px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--teal);
  border-radius: 6px;
  background: var(--surface);
}

.callout.verdict {
  border-left-color: var(--red);
  background: var(--soft-red);
}

.callout.caution {
  border-left-color: var(--amber);
  background: var(--soft-amber);
}

.callout p:last-child,
.panel p:last-child,
.learning-card p:last-child {
  margin-bottom: 0;
}

.status-pill,
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 27px;
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 800;
}

.status-measured {
  color: var(--teal);
  background: var(--soft-teal);
}

.status-partial {
  color: var(--blue);
  background: var(--soft-blue);
}

.status-conditional {
  color: var(--amber);
  background: var(--soft-amber);
}

.status-open,
.status-vendor {
  color: var(--red);
  background: var(--soft-red);
}

.panel,
.learning-card,
.source-card,
.quiz-shell {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel,
.learning-card,
.source-card {
  padding: 16px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.card-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.learning-card {
  min-width: 0;
}

.learning-card .card-label {
  display: block;
  margin-bottom: 7px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.formula-flow,
.tile-flow,
.study-flow {
  display: grid;
  gap: 9px;
}

.formula-flow {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.formula-step,
.tile-block,
.study-step {
  position: relative;
  min-width: 0;
  min-height: 112px;
  display: grid;
  align-content: center;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.formula-step:not(:last-child)::after,
.study-step:not(:last-child)::after {
  content: ">";
  position: absolute;
  z-index: 2;
  top: 50%;
  right: -9px;
  width: 17px;
  height: 24px;
  display: grid;
  place-items: center;
  transform: translateY(-50%);
  background: var(--page);
  color: var(--muted);
  font-weight: 800;
}

.formula-step strong,
.formula-step code,
.formula-step span {
  display: block;
  overflow-wrap: anywhere;
}

.formula-step code {
  margin: 4px 0;
  color: var(--blue);
  font-size: 16px;
  font-weight: 800;
}

.formula-step span,
.tile-block span,
.study-step span {
  color: var(--muted);
  font-size: 14px;
}

.architecture-explorer {
  display: grid;
  grid-template-columns: minmax(240px, 0.75fr) minmax(0, 1.4fr);
  gap: 14px;
}

.stage-list {
  display: grid;
  gap: 7px;
}

.stage-button {
  width: 100%;
  min-height: 62px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 11px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.stage-button:hover,
.stage-button[aria-selected="true"] {
  border-color: var(--teal);
  background: var(--soft-teal);
}

.stage-number {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--teal);
  font-weight: 800;
}

.stage-button strong,
.stage-button span {
  display: block;
}

.stage-button span {
  color: var(--muted);
  font-size: 13px;
}

.stage-detail-host {
  min-width: 0;
}

.stage-detail {
  min-height: 420px;
}

.stage-detail[hidden] {
  display: none;
}

.detail-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.detail-meta div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
}

.detail-meta strong,
.detail-meta span {
  display: block;
}

.detail-meta span {
  margin-top: 4px;
  color: var(--muted);
}

.tile-flow {
  grid-template-columns: 1.25fr 0.8fr 0.8fr;
  grid-template-areas:
    "ace sram router"
    "ace simd router"
    "ace risc router";
}

.tile-block {
  min-height: 88px;
}

.tile-block.ace {
  grid-area: ace;
  min-height: 282px;
  border-color: var(--teal);
  background: var(--soft-teal);
}

.tile-block.sram { grid-area: sram; }
.tile-block.simd { grid-area: simd; }
.tile-block.risc { grid-area: risc; }
.tile-block.router {
  grid-area: router;
  border-color: var(--blue);
  background: var(--soft-blue);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.metric {
  min-width: 0;
  padding: 14px;
  border-top: 3px solid var(--teal);
  background: var(--surface);
}

.metric strong,
.metric span,
.metric small {
  display: block;
}

.metric strong {
  font-size: 24px;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.metric span {
  margin-top: 5px;
  font-weight: 700;
}

.metric small {
  margin-top: 7px;
  color: var(--muted);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

thead th {
  background: var(--surface-2);
  color: var(--ink);
  font-size: 13px;
  text-transform: uppercase;
}

tbody tr:last-child th,
tbody tr:last-child td {
  border-bottom: 0;
}

tbody th {
  width: 19%;
}

.evidence-title {
  min-width: 220px;
}

.evidence-title strong,
.evidence-title span {
  display: block;
}

.evidence-title span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.source-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.source-card {
  min-width: 0;
  overflow-wrap: anywhere;
  box-shadow: none;
}

.source-card small,
.source-card span {
  display: block;
  color: var(--muted);
}

.source-card a {
  font-weight: 800;
}

.study-flow {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.study-step {
  min-height: 150px;
}

.study-step b,
.study-step strong,
.study-step span {
  display: block;
}

.study-step b {
  color: var(--teal);
  font-size: 12px;
  text-transform: uppercase;
}

.study-step strong {
  margin: 5px 0;
}

.question-list {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: claim-counter;
}

.claim-item {
  position: relative;
  padding: 20px 0 20px 52px;
  counter-increment: claim-counter;
}

.claim-item + .claim-item {
  border-top: 1px solid var(--line);
}

.claim-item::before {
  content: counter(claim-counter, decimal-leading-zero);
  position: absolute;
  top: 20px;
  left: 0;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--teal);
  background: var(--surface-2);
  font-size: 12px;
  font-weight: 900;
}

.claim-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.claim-heading h3 {
  margin: 2px 0 0;
  font-size: 19px;
  line-height: 1.35;
}

.claim-heading .status-pill {
  white-space: nowrap;
}

.claim-answer {
  margin: 11px 0 0;
}

.claim-limit {
  margin: 12px 0 0;
  padding-left: 12px;
  border-left: 3px solid var(--amber);
  color: var(--muted);
}

.claim-sources {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 14px;
  align-items: baseline;
  margin-top: 13px;
  font-size: 13px;
}

.claim-source-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.claim-sources a {
  font-weight: 800;
  text-underline-offset: 3px;
}

.quiz-shell {
  overflow: hidden;
}

.quiz-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: end;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.field {
  display: grid;
  gap: 5px;
}

.field label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.field select {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 10px;
  background: var(--surface);
  color: var(--ink);
}

.quiz-progress {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 14px 16px 0;
}

.progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-2);
}

.progress-bar {
  width: 0;
  height: 100%;
  background: var(--teal);
  transition: width 180ms ease;
}

.quiz-body {
  min-height: 430px;
  padding: 18px;
}

.quiz-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 12px;
}

.quiz-question {
  max-width: 900px;
  font-size: 24px;
  line-height: 1.25;
}

.quiz-question:focus-visible,
.quiz-summary-title:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 4px;
}

.option-list {
  display: grid;
  gap: 8px;
  margin: 18px 0;
}

.option {
  width: 100%;
  min-height: 54px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 11px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.option:hover,
.option[aria-checked="true"] {
  border-color: var(--blue);
  background: var(--soft-blue);
}

.option.correct {
  border-color: var(--teal);
  background: var(--soft-teal);
}

.option.incorrect {
  border-color: var(--red);
  background: var(--soft-red);
}

.option:disabled {
  cursor: default;
  opacity: 1;
}

.option-key {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  font-weight: 800;
}

.option-result {
  grid-column: 2;
  justify-self: start;
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 2px 8px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 850;
  line-height: 1.4;
}

.quiz-feedback {
  min-height: 86px;
  margin: 12px 0;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
}

.quiz-feedback[hidden] {
  display: none;
}

.quiz-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
}

.empty-state {
  min-height: 260px;
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-top: 42px;
  padding: 22px 0 34px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.site-footer p {
  margin-bottom: 0;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

code {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 4px;
  background: var(--surface-2);
  color: var(--ink);
}

@media (max-width: 960px) {
  .summary-strip,
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .formula-flow {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .formula-step::after,
  .study-step::after {
    display: none !important;
  }

  .card-grid,
  .study-flow {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .study-step {
    min-height: 128px;
  }
}

@media (max-width: 760px) {
  .site-header,
  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .site-nav {
    justify-content: flex-start;
  }

  .hero {
    min-height: 300px;
    padding: 34px 0 30px;
  }

  h1 {
    font-size: 40px;
  }

  .architecture-explorer,
  .card-grid,
  .card-grid.two,
  .source-grid,
  .quiz-toolbar {
    grid-template-columns: 1fr;
  }

  .stage-detail {
    min-height: 0;
  }

  .tile-flow {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "ace ace"
      "sram simd"
      "risc router";
  }

  .tile-block.ace {
    min-height: 190px;
  }

  .detail-meta,
  .formula-flow,
  .study-flow {
    grid-template-columns: 1fr;
  }

  .formula-step,
  .study-step {
    min-height: 96px;
  }

  .claim-heading {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .claim-heading .status-pill {
    justify-self: start;
  }

  .quiz-body {
    min-height: 470px;
  }
}

@media (max-width: 480px) {
  .site-header,
  main,
  .site-footer {
    width: min(100% - 22px, 1160px);
  }

  h1 {
    font-size: 34px;
  }

  h2 {
    font-size: 24px;
  }

  .summary-strip,
  .metric-grid,
  .tile-flow {
    grid-template-columns: 1fr;
  }

  .tile-flow {
    grid-template-areas:
      "ace"
      "sram"
      "simd"
      "risc"
      "router";
  }

  .quiz-question {
    font-size: 21px;
  }
}

@media print {
  .site-header,
  .hero-actions,
  .quiz-toolbar,
  .quiz-actions {
    display: none;
  }

  body,
  .panel,
  .learning-card,
  .source-card {
    background: #ffffff;
    color: #000000;
    box-shadow: none;
  }
}
