/* AI Model Comparison — Editorial Specification Sheet Design System
   Reference object: printed technical product specification table & journal data sheet.
   Signature cues: 2px deep forest-green rule beneath table headers; tabular monospace prices;
   warm archival paper canvas with crisp white elevated data sheets. */

:root {
  --bg: #faf8f4;
  --surface: #ffffff;
  --surface-alt: #f3f0e8;
  --surface-tint: #f7f5ef;
  --text: #15181c;
  --text-soft: #373e48;
  --muted: #5b6370;
  --primary: #1a4d3c;
  --primary-dark: #13392c;
  --primary-soft: rgb(26 77 60 / .075);
  --primary-mid: rgb(26 77 60 / .14);
  --primary-line: rgb(26 77 60 / .24);
  --accent: #b8540a;
  --accent-soft: rgb(184 84 10 / .09);
  --line: rgb(21 24 28 / .11);
  --line-strong: rgb(21 24 28 / .2);

  --font-serif: "Newsreader", Georgia, "Times New Roman", serif;
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --radius-sm: 5px;
  --radius: 8px;
  --radius-lg: 12px;

  --shadow-1: 0 1px 2px rgb(21 24 28 / .05), 0 1px 3px rgb(21 24 28 / .04);
  --shadow-2: 0 10px 28px -8px rgb(21 24 28 / .1), 0 2px 6px rgb(21 24 28 / .04);

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;

  --fs-12: 12px;
  --fs-13: 13px;
  --fs-14: 14px;
  --fs-15: 15px;
  --fs-16: 16px;
  --fs-17: 17px;
  --fs-18: 18px;
  --fs-20: 20px;
  --fs-22: 22px;
  --fs-28: 28px;
  --fs-36: 36px;
  --fs-48: 48px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-17);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ===== Typography ===== */
h1, h2, h3, h4 {
  font-family: var(--font-serif);
  color: var(--text);
  line-height: 1.16;
  letter-spacing: -0.018em;
  text-wrap: balance;
  margin: 0 0 var(--space-3);
}
h1 { font-size: clamp(32px, 4.4vw, 50px); font-weight: 600; font-optical-sizing: auto; }
h2 { font-size: clamp(24px, 2.4vw, 30px); font-weight: 600; margin-top: var(--space-7); }
h3 { font-size: var(--fs-20); font-weight: 600; margin-top: var(--space-6); line-height: 1.25; }
h4 { font-size: var(--fs-17); font-weight: 600; margin-top: var(--space-5); font-family: var(--font-sans); }

p { margin: 0 0 var(--space-4); max-width: 66ch; text-wrap: pretty; color: var(--text-soft); }
strong { font-weight: 600; color: var(--text); }
em { font-style: italic; }
small { font-size: var(--fs-14); color: var(--muted); }

a {
  color: var(--primary);
  text-decoration: underline;
  text-decoration-color: rgb(26 77 60 / .38);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 150ms ease, text-decoration-color 150ms ease;
}
a:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--primary-soft);
  color: var(--primary-dark);
  padding: 2px 6px;
  border-radius: 4px;
}

:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 3px; }
::selection { background: rgb(26 77 60 / .16); color: var(--text); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 12px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--primary);
  color: #fff;
  font-size: var(--fs-14);
  font-weight: 600;
  text-decoration: none;
  border-radius: var(--radius-sm);
}
.skip-link:focus { left: 16px; }

/* ===== Container ===== */
.wrap {
  width: 100%;
  max-width: 1140px;
  margin-inline: auto;
  padding-inline: 24px;
}

/* ===== Header & Navigation ===== */
.site-head {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgb(250 248 244 / .9);
  backdrop-filter: saturate(1.2) blur(10px);
  -webkit-backdrop-filter: saturate(1.2) blur(10px);
  border-bottom: 1px solid var(--line);
}

.head-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
  min-height: 64px;
  position: relative;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  flex-shrink: 0;
  padding-block: 6px;
}
.brand:hover { color: var(--text); }
.brand-mark {
  display: block;
  flex-shrink: 0;
  border-radius: 6px;
  box-shadow: 0 1px 2px rgb(26 77 60 / .24);
}
.brand-text {
  font-family: var(--font-serif);
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
}
.brand-text em {
  font-style: normal;
  color: var(--accent);
}

.nav {
  display: flex;
  align-items: center;
  gap: 6px;
}
.nav a {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-14);
  font-weight: 500;
  color: var(--text-soft);
  text-decoration: none;
  white-space: nowrap;
  transition: color 150ms ease, background-color 150ms ease;
}
.nav a:hover {
  color: var(--primary);
  background: var(--primary-soft);
}
.nav a[aria-current="page"] {
  color: var(--primary);
  font-weight: 600;
  background: var(--primary-soft);
}
.nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: -16px;
  height: 2px;
  background: var(--primary);
  border-radius: 2px 2px 0 0;
}

.nav-toggle {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: var(--fs-14);
  font-weight: 500;
  cursor: pointer;
  transition: border-color 150ms ease, background-color 150ms ease;
}
.nav-toggle:hover { border-color: var(--primary-line); background: var(--surface-tint); }
.nav-toggle-icon {
  position: relative;
  display: inline-block;
  width: 16px;
  height: 12px;
}
.nav-toggle-icon::before,
.nav-toggle-icon::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 1.75px;
  background: currentColor;
  border-radius: 2px;
  transition: transform 160ms ease, top 160ms ease;
}
.nav-toggle-icon::before { top: 2px; box-shadow: 0 4px 0 currentColor; }
.nav-toggle-icon::after { top: 10px; }
.nav-toggle[aria-expanded="true"] .nav-toggle-icon::before {
  top: 5px;
  box-shadow: none;
  transform: rotate(45deg);
}
.nav-toggle[aria-expanded="true"] .nav-toggle-icon::after {
  top: 5px;
  transform: rotate(-45deg);
}

/* ===== Hero ===== */
main { padding-bottom: 0; }

.hero {
  padding-block: 44px 36px;
  background:
    radial-gradient(900px 320px at 85% 0%, rgb(26 77 60 / .05), transparent 70%),
    linear-gradient(180deg, #fdfcf9 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--line);
  position: relative;
}
.hero::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -4px;
  height: 1px;
  background: var(--line);
}

.hero-inner { max-width: 78ch; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-size: var(--fs-12);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin: 0 0 14px;
}
.eyebrow::before {
  content: "";
  width: 14px;
  height: 2px;
  background: var(--accent);
  border-radius: 1px;
}

.hero h1 {
  max-width: 24ch;
  margin-bottom: 18px;
}

.lede {
  font-size: clamp(17px, 1.4vw, 19px);
  line-height: 1.58;
  color: var(--muted);
  max-width: 62ch;
  margin-bottom: 22px;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 18px;
}

.stamp {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: var(--fs-13);
  line-height: 1.45;
  color: var(--primary-dark);
  border: 1px solid var(--primary-line);
  border-radius: 999px;
  padding: 6px 14px;
  background: var(--surface);
  box-shadow: var(--shadow-1);
  font-variant-numeric: tabular-nums;
}
.stamp b {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--primary);
  white-space: nowrap;
}
.stamp-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 3px rgb(26 77 60 / .16);
  flex-shrink: 0;
}

.hero-meta-note {
  font-size: var(--fs-13);
  color: var(--muted);
  letter-spacing: 0.01em;
}

/* ===== Main Content & Desktop Reading Layout ===== */
.section {
  padding-block: 40px 64px;
}

/* Full-width lead band (populated progressively for table-first pages) */
.lead-band {
  margin-bottom: 48px;
}
.lead-band > h2:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

/* 2-column reading layout when TOC rail is present */
.reading-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 236px;
  gap: 56px;
  align-items: start;
}
.reading-main { min-width: 0; }

/* Sticky right-hand "On this page" rail */
.toc-rail {
  position: sticky;
  top: 86px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 2px solid var(--primary);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
}
.toc-rail .toc-title {
  margin: 0 0 12px;
  max-width: none;
  font-size: var(--fs-12);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}
.toc-rail .toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.toc-rail .toc-list > li {
  margin: 0;
  padding: 0;
}
.toc-rail .toc-list > li::before {
  display: none;
}
.toc-rail .toc-list a {
  display: block;
  padding: 5px 0 5px 12px;
  border-left: 2px solid transparent;
  font-size: var(--fs-13);
  line-height: 1.4;
  color: var(--muted);
  text-decoration: none;
  transition: color 140ms ease, border-color 140ms ease, background-color 140ms ease;
}
.toc-rail .toc-list a:hover {
  color: var(--primary);
  border-left-color: var(--primary-line);
}
.toc-rail .toc-list a.is-active {
  color: var(--primary);
  font-weight: 600;
  border-left-color: var(--primary);
  background: linear-gradient(90deg, var(--primary-soft), transparent);
}

/* ===== Prose Typography & Rhythm ===== */
.prose { max-width: none; }
.prose h2 {
  margin-top: 52px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
  scroll-margin-top: 88px;
}
.prose > h2:first-child,
.prose .lead-band > h2:first-child,
.prose .reading-main > h2:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}
.prose h3 {
  margin-top: 30px;
  margin-bottom: 10px;
  scroll-margin-top: 88px;
}
.prose p {
  margin-bottom: 18px;
}

.prose ul:not(.toc-list) {
  margin: 0 0 22px;
  padding: 0;
  list-style: none;
  max-width: 66ch;
}
.prose ul:not(.toc-list) > li {
  position: relative;
  padding-left: 20px;
  margin-bottom: 11px;
  color: var(--text-soft);
}
.prose ul:not(.toc-list) > li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 11px;
  width: 6px;
  height: 6px;
  border-radius: 1.5px;
  background: var(--primary);
  opacity: 0.72;
}

/* Editorial numbered lists (01, 02, 03) */
.prose ol {
  counter-reset: editorial-step;
  list-style: none;
  margin: 22px 0 28px;
  padding: 0;
  max-width: 68ch;
  border-top: 1px solid var(--line);
}
.prose ol > li {
  counter-increment: editorial-step;
  position: relative;
  padding: 16px 0 16px 52px;
  margin: 0;
  border-bottom: 1px solid var(--line);
  color: var(--text-soft);
}
.prose ol > li::before {
  content: counter(editorial-step, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 14px;
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 600;
  line-height: 1;
  color: var(--primary);
  opacity: 0.55;
  font-variant-numeric: tabular-nums;
}

/* Notes & Source footnotes under tables */
.prose .table-footnote {
  max-width: none;
  margin: -6px 0 24px;
  padding: 14px 18px;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-left: 3px solid var(--primary);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: var(--fs-14);
  line-height: 1.6;
  color: var(--text-soft);
}

/* Editorial key-value spec cards (auto-grouped definition blocks) */
.spec-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 20px 0 28px;
}
.spec-grid--odd > .spec-card:last-child {
  grid-column: 1 / -1;
}
.spec-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 2px solid var(--primary-line);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-1);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
.spec-card:hover {
  border-top-color: var(--primary);
  box-shadow: var(--shadow-2);
}
.prose .spec-card p {
  margin: 0;
  max-width: none;
  font-size: var(--fs-15);
  line-height: 1.6;
  color: var(--text-soft);
}
.prose .spec-card p > strong:first-child {
  display: block;
  font-family: var(--font-serif);
  font-size: var(--fs-18);
  font-weight: 600;
  line-height: 1.25;
  color: var(--text);
  margin-bottom: 6px;
}

/* Editorial FAQ cards */
.faq-list {
  margin: 18px 0 28px;
  border-top: 1px solid var(--line);
  max-width: 70ch;
}
.faq-item {
  border-bottom: 1px solid var(--line);
  padding: 18px 0;
}
.prose .faq-item h3 {
  margin: 0 0 8px;
  font-family: var(--font-sans);
  font-size: var(--fs-17);
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
}
.prose .faq-item p {
  margin: 0;
  font-size: var(--fs-15);
  line-height: 1.62;
  color: var(--muted);
}
.prose .faq-item p > strong:first-child {
  display: block;
  font-size: var(--fs-16);
  color: var(--text);
  margin-bottom: 6px;
}

/* ===== KPI Summary Strip ===== */
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-1);
  margin: 22px 0 20px;
}
.kpi-cell {
  background: var(--surface);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.kpi-label {
  font-size: var(--fs-12);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.kpi-value {
  font-family: var(--font-mono);
  font-size: clamp(19px, 1.8vw, 23px);
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
}
.kpi-value.is-accent { color: var(--primary); }
.kpi-sub {
  font-size: var(--fs-12);
  color: var(--muted);
}

/* ===== Comparison Table Card ===== */
.table-card {
  margin: 22px 0 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-2);
  overflow: hidden;
}

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 16px;
  padding: 13px 18px;
  background: var(--surface-tint);
  border-bottom: 1px solid var(--line);
}

.filter-pills {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.filter-pill {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-soft);
  font-family: var(--font-sans);
  font-size: var(--fs-13);
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  line-height: 1.2;
  transition: background-color 140ms ease, color 140ms ease, border-color 140ms ease;
}
.filter-pill:hover {
  border-color: var(--primary-line);
  color: var(--primary);
}
.filter-pill.is-active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}
.filter-pill .pill-count {
  margin-left: 5px;
  font-family: var(--font-mono);
  font-size: var(--fs-12);
  opacity: 0.78;
}

.table-search-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}
.table-search {
  width: 210px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-13);
  transition: border-color 140ms ease, box-shadow 140ms ease;
}
.table-search::placeholder { color: var(--muted); opacity: 0.85; }
.table-search:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.table-count {
  font-family: var(--font-mono);
  font-size: var(--fs-12);
  color: var(--muted);
  white-space: nowrap;
}

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Signature table rules: 2px forest-green line under thead */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-14);
  font-variant-numeric: tabular-nums;
  line-height: 1.45;
  background: var(--surface);
}
.table-card.is-model-table table { min-width: 720px; }

thead th {
  background: var(--surface);
  text-align: left;
  font-family: var(--font-sans);
  font-size: var(--fs-12);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding: 14px 16px;
  border-bottom: 2px solid var(--primary);
  white-space: nowrap;
  vertical-align: bottom;
  transition: color 140ms ease, background-color 140ms ease;
}
thead th:first-child { padding-left: 20px; }
thead th:last-child { padding-right: 20px; }

tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  color: var(--text);
  transition: background-color 120ms ease;
}
tbody td:first-child {
  padding-left: 20px;
  font-weight: 600;
  color: var(--text);
}
tbody td:last-child { padding-right: 20px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:nth-child(even) td { background: rgb(243 240 232 / .42); }
tbody tr:hover td { background: rgb(26 77 60 / .055); }
tbody tr.is-hidden { display: none; }

/* Numeric columns & spacing buffer next to text columns */
th[align="right"],
td[align="right"],
th.is-num,
td.is-num {
  text-align: right;
  font-family: var(--font-mono);
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
th.col-gap-left,
td.col-gap-left {
  padding-left: 28px;
}
th.is-rank,
td.is-rank {
  width: 82px;
  text-align: center;
}
.table-card.is-rank-table tbody td:nth-child(2) {
  font-weight: 600;
  color: var(--text);
}

/* Model & Maker column refinements */
.table-card.is-model-table tbody td:nth-child(1) {
  white-space: nowrap;
  font-size: 14.5px;
}
.table-card.is-model-table tbody td:nth-child(2) {
  color: var(--muted);
  font-size: var(--fs-13);
  white-space: nowrap;
}

/* Sortable headers */
th.is-sortable {
  cursor: pointer;
  user-select: none;
}
th.is-sortable:hover {
  color: var(--primary);
  background: var(--primary-soft);
}
th.is-sortable::after {
  content: "\2195";
  display: inline-block;
  margin-left: 6px;
  font-size: var(--fs-12);
  opacity: 0.35;
  vertical-align: middle;
}
th.is-sortable[data-dir="asc"],
th.is-sortable[data-dir="desc"] {
  color: var(--primary);
  background: rgb(26 77 60 / .045);
}
th.is-sortable[data-dir="asc"]::after {
  content: "\2191";
  opacity: 1;
  color: var(--primary);
}
th.is-sortable[data-dir="desc"]::after {
  content: "\2193";
  opacity: 1;
  color: var(--primary);
}
td.is-sorted-col {
  background-image: linear-gradient(rgb(26 77 60 / .03), rgb(26 77 60 / .03));
}

/* Inline value + micro-bar cells */
.cell-metric {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  min-width: 72px;
}
.cell-metric-val {
  display: inline-flex;
  align-items: baseline;
  gap: 1px;
  line-height: 1.1;
}
.cell-currency {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}
.cell-metric.is-best .cell-metric-val {
  color: var(--primary);
  font-weight: 600;
}
.cell-bar {
  width: 68px;
  height: 4px;
  border-radius: 999px;
  background: rgb(21 24 28 / .07);
  overflow: hidden;
  display: flex;
  justify-content: flex-end;
}
.cell-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--primary);
  opacity: 0.58;
}
.cell-bar--price .cell-bar-fill {
  background: var(--accent);
  opacity: 0.65;
}
.cell-metric.is-best .cell-bar--price .cell-bar-fill {
  background: var(--primary);
  opacity: 0.85;
}

/* Open-weights & Rank badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  font-family: var(--font-sans);
  font-size: var(--fs-12);
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
}
.badge--open {
  background: rgb(26 77 60 / .1);
  color: var(--primary-dark);
  border: 1px solid rgb(26 77 60 / .22);
}
.badge--open::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
}
.badge--closed {
  background: transparent;
  color: var(--muted);
  font-weight: 500;
  padding-inline: 2px;
}
.badge--rank1 {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
}

/* Decision table (/best) accent on recommended model column */
.table-card.is-decision-table tbody td:nth-child(1) {
  font-weight: 500;
  color: var(--text-soft);
}
.table-card.is-decision-table tbody td:nth-child(2) {
  font-weight: 600;
  color: var(--primary);
  white-space: nowrap;
}
.table-card.is-kv-table thead th:first-child,
.table-card.is-kv-table tbody td:first-child {
  width: 240px;
  color: var(--text-soft);
  font-weight: 600;
  white-space: nowrap;
}
.table-card.is-kv-table tbody td:nth-child(2) {
  color: var(--text);
}

/* Empty filter state */
.table-empty {
  padding: 28px 20px;
  text-align: center;
  font-size: var(--fs-14);
  color: var(--muted);
}

/* Integrated Workload Cost Estimator Footer */
.calc-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 16px;
  padding: 12px 18px;
  background: var(--surface-tint);
  border-top: 1px solid var(--line);
  font-size: var(--fs-13);
}
.calc-left {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.calc-label {
  font-weight: 600;
  color: var(--text);
  margin-right: 4px;
}
.calc-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.calc-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-soft);
  font-family: var(--font-sans);
  font-size: var(--fs-12);
  font-weight: 500;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
}
.calc-btn:hover {
  border-color: var(--primary-line);
  color: var(--primary);
}
.calc-btn.is-active {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary-dark);
  font-weight: 600;
}
.calc-inputs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.calc-field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-12);
  color: var(--muted);
}
.calc-field input {
  width: 64px;
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: var(--fs-12);
  text-align: right;
}
.calc-field input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-soft);
}
.calc-reset {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: var(--fs-12);
  text-decoration: underline;
  cursor: pointer;
  padding: 4px 2px;
}
.calc-reset:hover { color: var(--accent); }
.calc-col-head { color: var(--primary) !important; }
.calc-col-cell {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--primary-dark);
  background-image: linear-gradient(rgb(26 77 60 / .04), rgb(26 77 60 / .04));
}

/* ===== Related Guides Strip ===== */
.related {
  border-top: 1px solid var(--line);
  background: var(--surface-tint);
  padding-block: 48px 56px;
}
.related-head { margin-bottom: 24px; }
.related-head .eyebrow { margin-bottom: 8px; }
.related-h {
  margin: 0;
  font-size: clamp(22px, 2vw, 26px);
  font-weight: 600;
}
.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}
.related-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow-1);
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}
.related-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-2);
  color: var(--text);
}
.related-kicker {
  font-size: var(--fs-12);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
}
.related-card strong {
  font-family: var(--font-serif);
  font-size: var(--fs-18);
  font-weight: 600;
  line-height: 1.25;
  color: var(--text);
}
.related-card span:last-child {
  font-size: var(--fs-13);
  line-height: 1.5;
  color: var(--muted);
}

/* ===== Footer ===== */
.site-foot {
  background: var(--surface-alt);
  border-top: 1px solid var(--line);
  padding-block: 52px 36px;
  font-size: var(--fs-14);
  color: var(--muted);
}
.foot-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 40px;
  margin-bottom: 36px;
}
.foot-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text);
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}
.foot-brand em { font-style: normal; color: var(--accent); }
.foot-brand:hover { color: var(--text); }
.foot-desc {
  margin: 0;
  max-width: 44ch;
  font-size: var(--fs-14);
  line-height: 1.6;
  color: var(--muted);
}
.foot-grid h2.foot-h {
  font-family: var(--font-sans);
  font-size: var(--fs-12);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text);
  margin: 4px 0 14px;
  padding: 0;
  border: 0;
  line-height: 1.4;
}
.foot-grid ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.foot-grid li { margin-bottom: 9px; }
.foot-grid li a {
  color: var(--text-soft);
  text-decoration: none;
  font-size: var(--fs-14);
}
.foot-grid li a:hover {
  color: var(--primary);
  text-decoration: underline;
}

.foot-colophon {
  padding-top: 22px;
  border-top: 1px solid var(--line);
}
.foot-colophon p {
  margin: 0;
  max-width: 84ch;
  font-size: var(--fs-12);
  line-height: 1.65;
  color: var(--muted);
}

/* ===== Responsive Breakpoints ===== */
@media (max-width: 1024px) {
  .reading-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  .toc-rail {
    position: static;
    order: -1;
    padding: 14px 16px;
  }
  .toc-rail .toc-list {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
  }
  .toc-rail .toc-list a {
    border-left: 0;
    padding: 5px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--bg);
    font-size: var(--fs-12);
  }
  .toc-rail .toc-list a.is-active {
    border-color: var(--primary);
    background: var(--primary-soft);
  }
  .kpi-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .nav-toggle { display: inline-flex; }
  .nav {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 8px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-2);
    z-index: 50;
  }
  .nav.is-open { display: flex; }
  .nav a {
    padding: 12px 14px;
    font-size: var(--fs-15);
    border-radius: var(--radius-sm);
  }
  .nav a[aria-current="page"]::after { display: none; }

  .spec-grid { grid-template-columns: 1fr; }
  .foot-grid { grid-template-columns: 1fr 1fr; gap: 28px; }
  .foot-lead { grid-column: 1 / -1; }
}

@media (max-width: 640px) {
  body { font-size: var(--fs-16); }
  .wrap { padding-inline: 18px; }
  .head-inner { min-height: 58px; }
  .brand-text { font-size: 19px; }

  .hero { padding-block: 28px 26px; }
  .hero h1 { font-size: clamp(27px, 7.6vw, 36px); margin-bottom: 14px; }
  .lede { font-size: var(--fs-16); line-height: 1.55; margin-bottom: 18px; }
  .stamp { font-size: var(--fs-12); padding: 7px 13px; border-radius: 12px; }

  .section { padding-block: 28px 48px; }
  .lead-band { margin-bottom: 36px; }

  .kpi-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-cell { padding: 12px 14px; }
  .kpi-value { font-size: 17px; }

  .table-toolbar { padding: 12px 14px; }
  .table-search-wrap { width: 100%; margin-left: 0; }
  .table-search { flex: 1 1 auto; width: auto; min-width: 0; }

  .table-card.is-model-table tbody td:first-child,
  .table-card.is-model-table thead th:first-child {
    position: sticky;
    left: 0;
    z-index: 2;
    background: var(--surface);
    box-shadow: 1px 0 0 var(--line);
  }
  .table-card.is-model-table tbody tr:nth-child(even) td:first-child {
    background: #f8f6f0;
  }
  .table-card.is-model-table tbody tr:hover td:first-child {
    background: #eef3f0;
  }

  thead th, tbody td { padding: 11px 12px; }
  thead th:first-child, tbody td:first-child { padding-left: 14px; }
  thead th:last-child, tbody td:last-child { padding-right: 14px; }
  th.col-gap-left, td.col-gap-left { padding-left: 16px; }
  .table-card.is-kv-table thead th:first-child,
  .table-card.is-kv-table tbody td:first-child { width: auto; white-space: normal; }

  .calc-bar { padding: 12px 14px; }
  .prose ol > li { padding: 14px 0 14px 40px; }
  .prose ol > li::before { font-size: 21px; top: 13px; }

  .related { padding-block: 36px 44px; }
  .related-grid { grid-template-columns: 1fr; }
  .foot-grid { grid-template-columns: 1fr; gap: 24px; }
}

/* ===== Print & Accessibility ===== */
@media print {
  .site-head, .site-foot, .related, .toc-rail, .table-toolbar, .calc-bar, .nav-toggle { display: none !important; }
  body { background: #fff; color: #000; font-size: 12pt; }
  .hero { background: none; padding-block: 0 16px; }
  .hero::after { display: none; }
  .table-card { box-shadow: none; border-color: #999; }
  .reading-grid { display: block; }
  a { color: inherit; text-decoration: none; }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
