:root {
  color-scheme: light;
  --paper: #f7f5ef;
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --ink: #152432;
  --ink-soft: #4c5b67;
  --muted: #71808b;
  --line: #d7ddd9;
  --line-strong: #b9c5c1;
  --navy: #183b5b;
  --navy-2: #0f2b45;
  --teal: #0f766e;
  --teal-soft: #dff4ef;
  --amber: #b65f16;
  --amber-soft: #fff0dd;
  --qwen: #4d8d3c;
  --gemma: #df781f;
  --chatgpt: #3f75ad;
  --danger: #a53e3e;
  --danger-soft: #fae7e7;
  --shadow: 0 16px 50px rgb(25 46 62 / 10%);
  --shadow-small: 0 6px 22px rgb(25 46 62 / 8%);
  --radius: 18px;
  --radius-small: 11px;
  --content: 1220px;
  --prose: 790px;
  --header-height: 70px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --paper: #0d1821;
  --surface: #13232f;
  --surface-raised: #172a38;
  --ink: #edf5f6;
  --ink-soft: #c0cdd1;
  --muted: #91a3aa;
  --line: #2e414c;
  --line-strong: #415965;
  --navy: #92c5e8;
  --navy-2: #08131c;
  --teal: #65d4c7;
  --teal-soft: #153b3b;
  --amber: #f3ad68;
  --amber-soft: #402b1e;
  --qwen: #8ac978;
  --gemma: #ffab61;
  --chatgpt: #87b7e4;
  --danger: #f19b9b;
  --danger-soft: #482527;
  --shadow: 0 18px 60px rgb(0 0 0 / 28%);
  --shadow-small: 0 7px 24px rgb(0 0 0 / 22%);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 24px);
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 92% 0%, rgb(15 118 110 / 9%), transparent 28rem),
    var(--paper);
  color: var(--ink);
  font-family: Inter, Aptos, "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 17px;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--teal);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--amber);
}

img,
svg {
  max-width: 100%;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 4px;
  border-radius: 4px;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 10px;
  left: 10px;
  padding: 10px 16px;
  background: var(--surface);
  border: 2px solid var(--teal);
  border-radius: 8px;
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.reading-progress {
  position: fixed;
  z-index: 1001;
  top: 0;
  left: 0;
  width: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--teal), var(--amber));
}

.site-header {
  position: sticky;
  z-index: 100;
  top: 0;
  min-height: var(--header-height);
  border-bottom: 1px solid rgb(255 255 255 / 12%);
  background: rgb(15 43 69 / 95%);
  color: white;
  backdrop-filter: blur(18px);
}

.nav-wrap {
  width: min(calc(100% - 36px), var(--content));
  min-height: var(--header-height);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: white;
  font-weight: 750;
  text-decoration: none;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.brand-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid rgb(255 255 255 / 35%);
  border-radius: 11px;
  background: linear-gradient(145deg, rgb(101 212 199 / 35%), rgb(255 255 255 / 7%));
  font-family: Georgia, serif;
  font-size: 19px;
}

.site-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
}

.site-nav a {
  padding: 8px 10px;
  border-radius: 8px;
  color: #dce8ef;
  font-size: 14px;
  font-weight: 650;
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  background: rgb(255 255 255 / 12%);
  color: white;
}

.nav-actions {
  display: flex;
  gap: 7px;
}

.icon-button,
.menu-button {
  width: 40px;
  height: 40px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgb(255 255 255 / 25%);
  border-radius: 10px;
  background: rgb(255 255 255 / 8%);
  color: white;
  cursor: pointer;
  font: inherit;
}

.menu-button {
  display: none;
}

.hero {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(130deg, rgb(15 43 69 / 96%), rgb(15 118 110 / 90%)),
    var(--navy-2);
  color: white;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.17;
  background-image:
    linear-gradient(rgb(255 255 255 / 15%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(255 255 255 / 15%) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(to right, transparent, black 65%);
}

.hero-inner {
  position: relative;
  z-index: 1;
  width: min(calc(100% - 36px), var(--content));
  margin: 0 auto;
  padding: clamp(64px, 8vw, 116px) 0 clamp(54px, 7vw, 90px);
}

.hero-narrow .hero-inner {
  padding-top: 54px;
  padding-bottom: 48px;
}

.eyebrow {
  margin: 0 0 15px;
  color: #9ce6dd;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.hero h1 {
  max-width: 980px;
  margin: 0;
  color: white;
  font-family: Georgia, "Iowan Old Style", serif;
  font-size: clamp(42px, 6vw, 78px);
  font-weight: 650;
  line-height: 1.04;
  letter-spacing: -0.04em;
}

.hero-narrow h1 {
  font-size: clamp(38px, 5vw, 62px);
}

.hero-deck {
  max-width: 850px;
  margin: 24px 0 0;
  color: #e4f0f3;
  font-family: Georgia, "Iowan Old Style", serif;
  font-size: clamp(19px, 2.2vw, 25px);
  line-height: 1.5;
}

.hero-meta,
.button-row {
  margin-top: 30px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 11px;
  border: 1px solid rgb(255 255 255 / 28%);
  border-radius: 999px;
  background: rgb(255 255 255 / 8%);
  color: #f4f9fa;
  font-size: 13px;
  font-weight: 700;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--teal);
  color: white;
  font-size: 14px;
  font-weight: 750;
  text-decoration: none;
  box-shadow: var(--shadow-small);
}

.button:hover {
  background: var(--amber);
  color: white;
}

.button.secondary {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  box-shadow: none;
}

.button.ghost {
  border-color: rgb(255 255 255 / 35%);
  background: transparent;
  color: white;
  box-shadow: none;
}

.publication {
  width: min(calc(100% - 36px), var(--content));
  margin: 0 auto;
  padding: 42px 0 90px;
}

.article-grid {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  align-items: start;
  gap: clamp(28px, 5vw, 72px);
}

.page-toc {
  position: sticky;
  top: calc(var(--header-height) + 24px);
  max-height: calc(100vh - var(--header-height) - 48px);
  overflow: auto;
  padding: 16px 0 18px;
  border-top: 3px solid var(--teal);
}

.page-toc strong {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.page-toc a {
  display: block;
  padding: 7px 9px;
  border-left: 2px solid transparent;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.35;
  text-decoration: none;
}

.page-toc a:hover,
.page-toc a.is-visible {
  border-left-color: var(--teal);
  background: var(--teal-soft);
  color: var(--ink);
}

.article {
  min-width: 0;
}

.article > section,
.section-block {
  margin-bottom: 64px;
}

.article h2,
.article h3,
.article h4 {
  color: var(--navy);
  line-height: 1.2;
  text-wrap: balance;
}

.article h2 {
  margin: 0 0 22px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  font-family: Georgia, "Iowan Old Style", serif;
  font-size: clamp(30px, 4vw, 45px);
  letter-spacing: -0.025em;
}

.article h3 {
  margin: 40px 0 14px;
  font-size: 24px;
  letter-spacing: -0.018em;
}

.article h4 {
  margin: 28px 0 10px;
  font-size: 18px;
}

.article p,
.article li {
  max-width: var(--prose);
}

.lead {
  max-width: 860px !important;
  color: var(--ink-soft);
  font-family: Georgia, "Iowan Old Style", serif;
  font-size: 22px;
  line-height: 1.6;
}

.hero .lead {
  color: #e4f0f3;
}

.abstract {
  padding: clamp(24px, 4vw, 38px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-small);
}

.abstract .eyebrow {
  color: var(--teal);
}

.abstract h2 {
  font-size: 32px;
}

.abstract p {
  max-width: 900px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 26px 0 36px;
}

.metric {
  min-height: 154px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--surface);
  box-shadow: var(--shadow-small);
}

.metric .value {
  display: block;
  margin: 8px 0 4px;
  color: var(--navy);
  font-family: Georgia, serif;
  font-size: 38px;
  font-weight: 700;
  line-height: 1;
}

.metric .label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.metric p {
  margin: 10px 0 0;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.45;
}

.model-chatgpt {
  border-top: 4px solid var(--chatgpt);
}

.model-gemma {
  border-top: 4px solid var(--gemma);
}

.model-qwen {
  border-top: 4px solid var(--qwen);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin: 26px 0;
}

.card {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-small);
}

.card h3 {
  margin-top: 0;
}

.card p:last-child,
.callout p:last-child {
  margin-bottom: 0;
}

.callout {
  max-width: 900px;
  margin: 26px 0;
  padding: 20px 22px;
  border-left: 5px solid var(--teal);
  border-radius: 0 var(--radius-small) var(--radius-small) 0;
  background: var(--teal-soft);
}

.callout.warning {
  border-left-color: var(--amber);
  background: var(--amber-soft);
}

.callout.danger {
  border-left-color: var(--danger);
  background: var(--danger-soft);
}

.callout strong:first-child {
  color: var(--navy);
}

.evidence-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0;
}

.evidence-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 750;
}

.evidence-tag.direct::before,
.evidence-tag.inferred::before,
.evidence-tag.proposed::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.evidence-tag.direct::before {
  background: var(--qwen);
}

.evidence-tag.inferred::before {
  background: var(--amber);
}

.evidence-tag.proposed::before {
  background: var(--chatgpt);
}

.table-wrap {
  margin: 24px 0 34px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--surface);
  box-shadow: var(--shadow-small);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

caption {
  padding: 14px 16px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 650;
  text-align: left;
}

th {
  padding: 13px 14px;
  background: var(--navy-2);
  color: white;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-align: left;
  text-transform: uppercase;
}

td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.45;
  vertical-align: top;
}

tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover {
  background: var(--teal-soft);
}

.num {
  text-align: right;
  white-space: nowrap;
}

.winner {
  color: var(--teal);
  font-weight: 800;
}

.risk {
  color: var(--danger);
  font-weight: 800;
}

.formula {
  max-width: 900px;
  margin: 22px 0;
  padding: 19px 22px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-left: 5px solid var(--navy);
  border-radius: var(--radius-small);
  background: var(--surface);
  box-shadow: var(--shadow-small);
}

.formula math {
  display: block;
  min-width: max-content;
  color: var(--ink);
  font-family: "Cambria Math", STIX Two Math, serif;
  font-size: 1.22em;
  text-align: center;
}

.formula figcaption {
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.figure-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
  margin: 28px 0;
}

.figure-card {
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-small);
}

.figure-card.wide {
  grid-column: 1 / -1;
}

.figure-button {
  width: 100%;
  min-height: 260px;
  display: grid;
  place-items: center;
  padding: 14px;
  border: 0;
  background:
    linear-gradient(45deg, rgb(15 118 110 / 3%), transparent),
    #ffffff;
  cursor: zoom-in;
}

.figure-button img {
  width: 100%;
  max-height: 650px;
  object-fit: contain;
}

.figure-card figcaption {
  padding: 16px 18px 18px;
  border-top: 1px solid var(--line);
}

.figure-card figcaption strong {
  display: block;
  margin-bottom: 5px;
  color: var(--navy);
  font-size: 15px;
}

.figure-card figcaption span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.citation {
  padding: 14px 0 14px 42px;
  border-bottom: 1px solid var(--line);
  text-indent: -42px;
}

.citation:last-child {
  border-bottom: 0;
}

.citation-number {
  display: inline-block;
  width: 38px;
  color: var(--teal);
  font-weight: 800;
  text-indent: 0;
}

.next-page {
  margin-top: 70px;
  padding: 26px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.next-page a {
  font-weight: 800;
  text-decoration: none;
}

.site-footer {
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.footer-inner {
  width: min(calc(100% - 36px), var(--content));
  margin: 0 auto;
  padding: 36px 0 46px;
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: 32px;
  color: var(--ink-soft);
  font-size: 13px;
}

.footer-inner strong {
  color: var(--ink);
}

.footer-links a {
  display: block;
  margin: 4px 0;
}

.back-to-top {
  position: fixed;
  z-index: 90;
  right: 20px;
  bottom: 20px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-small);
  cursor: pointer;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: 160ms ease;
}

.back-to-top.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

dialog.figure-dialog {
  width: min(95vw, 1500px);
  max-height: 94vh;
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 30px 100px rgb(0 0 0 / 45%);
}

dialog.figure-dialog::backdrop {
  background: rgb(4 12 18 / 80%);
  backdrop-filter: blur(7px);
}

.dialog-toolbar {
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
}

.dialog-toolbar strong {
  font-size: 14px;
}

.dialog-close {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

.dialog-image {
  width: 100%;
  max-height: calc(94vh - 60px);
  display: block;
  padding: 16px;
  object-fit: contain;
  background: white;
}

[data-reveal] {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 420ms ease, transform 420ms ease;
}

[data-reveal].revealed {
  opacity: 1;
  transform: none;
}

@media (max-width: 1040px) {
  .site-nav {
    position: fixed;
    top: var(--header-height);
    right: 18px;
    left: 18px;
    display: none;
    padding: 12px;
    border: 1px solid rgb(255 255 255 / 18%);
    border-radius: 14px;
    background: var(--navy-2);
    box-shadow: var(--shadow);
  }

  .site-nav.open {
    display: grid;
  }

  .site-nav a {
    padding: 11px 12px;
  }

  .menu-button {
    display: inline-grid;
  }

  .nav-actions {
    margin-left: auto;
  }

  .article-grid {
    grid-template-columns: 1fr;
  }

  .page-toc {
    position: static;
    max-height: none;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .page-toc strong {
    grid-column: 1 / -1;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  body {
    font-size: 16px;
  }

  .brand span:last-child {
    display: none;
  }

  .hero-inner,
  .publication,
  .nav-wrap,
  .footer-inner {
    width: min(calc(100% - 24px), var(--content));
  }

  .metric-grid,
  .card-grid,
  .figure-grid,
  .footer-inner {
    grid-template-columns: 1fr;
  }

  .figure-card.wide {
    grid-column: auto;
  }

  .page-toc {
    grid-template-columns: 1fr;
  }

  .next-page {
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }

  [data-reveal] {
    opacity: 1;
    transform: none;
  }
}

@media print {
  :root {
    --paper: white;
    --surface: white;
    --ink: black;
    --ink-soft: #222;
    --line: #bbb;
  }

  body {
    background: white;
    font-size: 10.5pt;
  }

  .site-header,
  .page-toc,
  .button-row,
  .back-to-top,
  .reading-progress,
  .site-footer,
  .next-page {
    display: none !important;
  }

  .hero {
    border: 0;
    background: white;
    color: black;
  }

  .hero h1,
  .hero-deck,
  .eyebrow {
    color: black;
  }

  .hero-inner {
    padding: 20mm 0 12mm;
  }

  .publication {
    width: 100%;
    padding: 0;
  }

  .article-grid {
    display: block;
  }

  .figure-card,
  .card,
  .metric,
  .abstract,
  .formula,
  .table-wrap {
    break-inside: avoid;
    box-shadow: none;
  }

  a {
    color: black;
    text-decoration: none;
  }
}

code {
  padding: 0.12em 0.34em;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: color-mix(in srgb, var(--surface) 72%, var(--teal-soft));
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 0.88em;
  overflow-wrap: anywhere;
}

pre {
  margin: 1.4rem 0;
  padding: 1.15rem 1.25rem;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--navy-2);
  color: #eff7f8;
  box-shadow: var(--shadow-small);
}

pre code {
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  white-space: pre;
  overflow-wrap: normal;
}

.article ol,
.article ul {
  padding-left: 1.35rem;
}

.article li + li {
  margin-top: 0.45rem;
}

@media print {
  pre {
    white-space: pre-wrap;
    color: #111;
    background: #f5f5f5;
  }
}

/* FIVE_SYSTEM_EXPANSION */
[data-reveal] { opacity: 1 !important; transform: none !important; }
.brand { flex: 0 0 auto; }
.site-nav { min-width: 0; justify-content: flex-end; }
.site-nav a { padding-inline: 8px; font-size: 13px; white-space: nowrap; }
code { font-family: "SFMono-Regular", Consolas, monospace; font-size: .88em; color: var(--teal); overflow-wrap: anywhere; }
.implementation-steps { display: grid; gap: .8rem; margin: 1.6rem 0 2rem; }
.implementation-steps article { display: grid; grid-template-columns: 3.1rem 1fr; gap: 1rem; padding: 1.1rem; border: 1px solid var(--line); border-radius: 1rem; background: var(--surface); }
.implementation-steps article > span { display: grid; place-items: center; width: 2.7rem; height: 2.7rem; border-radius: 50%; color: white; background: var(--teal); font-weight: 800; }
.implementation-steps h3 { margin: 0 0 .35rem; font-size: 1.02rem; }
.implementation-steps p { margin: 0; }
.table-note { margin-top: .6rem; color: var(--muted); font-size: .88rem; }
.download-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.download-grid .card { color: inherit; text-decoration: none; transition: transform .2s ease, border-color .2s ease; }
.download-grid .card:hover { transform: translateY(-3px); border-color: var(--teal); }
.compact table { font-size: .78rem; }
.compact code { font-size: .72rem; }
.model-hnlp { color: #6a4c93; }
.model-bert { color: #c44e52; }
@media (max-width: 760px) { .download-grid { grid-template-columns: 1fr; } .implementation-steps article { grid-template-columns: 1fr; } }
