:root {
  --paper: #ffffff;
  --paper-2: #f4f5f6;
  --ink: #1e2226;
  --ink-2: #4a5157;
  --ink-3: #737b83;
  --rule: #dde1e4;
  --rule-light: #eef0f2;

  /* One green ramp for the OriGent line (base -> SFT -> RL), neutral grays for other models */
  --base: #c0c6cc;
  --sft: #57a27b;
  --rl: #164f36;
  --other: #6b7580;
  --gold: #b8860b;

  --serif: Charter, "Bitstream Charter", "Sitka Text", Cambria, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --mono: "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

:focus-visible {
  outline: 2px solid var(--rl);
  outline-offset: 2px;
}

.mono {
  font-family: var(--mono);
  font-size: 0.86em;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
}

.nav-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 28px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 700;
  font-size: 1.15rem;
}

.brand-mark {
  color: var(--rl);
  flex-shrink: 0;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 18px;
  font-family: var(--sans);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 22px;
}

.nav-links a {
  text-decoration: none;
  color: var(--ink-2);
  font-size: 0.875rem;
  padding: 4px 0;
  border-bottom: 1px solid transparent;
}

.nav-links a:hover {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

.nav-divider {
  width: 1px;
  height: 16px;
  background: var(--rule);
}

.nav-github {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: var(--ink);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 4px 10px 4px 8px;
  border: 1px solid var(--rule);
  border-radius: 5px;
  background: var(--paper);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.nav-github:hover {
  border-color: var(--ink-3);
  background: var(--paper-2);
}

.nav-github .link-icon {
  width: 15px;
  height: 15px;
}

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 28px;
}

/* Hero */
.hero {
  padding: 76px 0 64px;
  border-bottom: 1px solid var(--rule);
}

.hero h1 {
  margin: 0;
  max-width: 920px;
  font-size: clamp(2.125rem, 4.6vw, 3rem);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.012em;
}

.hero-authors {
  margin: 14px 0 0;
  font-family: var(--sans);
  font-size: 0.9375rem;
  color: var(--ink-2);
}

.author-sep {
  margin: 0 5px;
  color: var(--ink-3);
}

.hero-sub {
  margin: 18px 0 0;
  max-width: 40em;
  font-size: 1.1875rem;
  line-height: 1.55;
  color: var(--ink-2);
}

.hero-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
  font-family: var(--sans);
  font-size: 0.9rem;
  font-weight: 600;
}

.hero-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ink);
  text-decoration: none;
  padding: 5px 12px 5px 9px;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--paper);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.hero-link:hover {
  border-color: var(--ink-3);
  background: var(--paper-2);
}

.link-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* Hero result: base + SFT gain + RL gain on one 0-100% scale */
.result {
  margin: 64px 0 0;
}

.result-caption {
  margin-bottom: 14px;
  font-family: var(--sans);
  font-size: 0.875rem;
  color: var(--ink-2);
}

.result-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 36px;
}

.result-labels {
  position: relative;
  height: 40px;
  font-family: var(--sans);
  font-size: 0.8125rem;
  color: var(--ink-2);
}

.result-labels span {
  position: absolute;
  top: 0;
  bottom: 0;
  padding-left: 8px;
  border-left: 1px solid var(--ink-3);
  white-space: nowrap;
  line-height: 1.3;
}

.result-labels b {
  margin-left: 3px;
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.result-labels .swatch {
  margin-right: 6px;
  vertical-align: -1px;
}

.result-bar {
  position: relative;
  height: 30px;
  background: var(--paper-2);
}

.seg {
  position: absolute;
  top: 0;
  bottom: 0;
}

.seg-base {
  background: var(--base);
}

.seg-sft {
  background: var(--sft);
  border-left: 2px solid var(--paper);
}

.seg-rl {
  background: var(--rl);
  border-left: 2px solid var(--paper);
  border-radius: 0 3px 3px 0;
}

.result-axis {
  position: relative;
  height: 24px;
  font-family: var(--sans);
  font-size: 0.75rem;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.result-axis span {
  position: absolute;
  top: 6px;
  transform: translateX(-50%);
}

.result-axis span:first-child {
  transform: none;
}

.result-axis span:last-child {
  transform: translateX(-100%);
}

.result-total {
  padding-bottom: 24px;
}

.result-num {
  font-size: 3.5rem;
  font-weight: 700;
  line-height: 0.95;
  color: var(--rl);
  font-variant-numeric: lining-nums;
}

.result-note {
  margin-top: 6px;
  font-family: var(--sans);
  font-size: 0.8125rem;
  color: var(--ink-2);
}

/* Sections */
.section {
  padding: 80px 0;
  border-bottom: 1px solid var(--rule);
}

.section:last-of-type {
  border-bottom: none;
}

.section-header {
  max-width: 44em;
  margin-bottom: 44px;
}

.section-header h2 {
  margin: 0;
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.008em;
}

.section-desc {
  margin: 12px 0 0;
  color: var(--ink-2);
}

/* Figures and tables (no boxes: whitespace and rules do the grouping) */
.card {
  min-width: 0;
}

.card-table {
  margin-top: 64px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  min-height: 35px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

/* Collapsible table: the summary is the card head */
.table-details > summary {
  margin-bottom: 0;
  cursor: pointer;
  list-style: none;
}

.table-details > summary::-webkit-details-marker {
  display: none;
}

.table-details[open] > summary {
  margin-bottom: 16px;
}

.details-toggle {
  padding: 4px 10px;
  border: 1px solid var(--rule);
  border-radius: 4px;
  font-family: var(--sans);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
}

.table-details > summary:hover .details-toggle {
  border-color: var(--ink-3);
}

.table-details .when-open,
.table-details[open] .when-closed {
  display: none;
}

.table-details[open] .when-open {
  display: inline;
}

.card-title {
  margin: 0;
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.35;
}

.chart-note {
  margin: 10px 0 0;
  max-width: 46em;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--ink-2);
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 64px 56px;
  align-items: start;
}

.grid-asymmetric {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 56px;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 64px;
}

/* Segmented controls */
.chip-group {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--rule);
  border-radius: 5px;
  font-family: var(--sans);
}

.chip {
  border: none;
  background: transparent;
  color: var(--ink-2);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: 3px;
  white-space: nowrap;
  cursor: pointer;
}

.chip:hover:not(.active) {
  color: var(--ink);
  background: var(--paper-2);
}

.chip.active {
  background: var(--ink);
  color: #ffffff;
}

/* Legend */
.legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 16px;
  font-family: var(--sans);
  font-size: 0.8125rem;
  color: var(--ink-2);
}

.chart-legend {
  margin-bottom: 10px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

.swatch-line {
  display: inline-block;
  width: 18px;
  height: 2px;
}

.swatch-line.dashed {
  height: 0;
  border-top: 2px dashed currentColor;
}

/* Charts */
.chart-wrap {
  position: relative;
  width: 100%;
}

.chart-wrap svg {
  display: block;
  width: 100%;
  height: auto;
  user-select: none;
  font-family: var(--sans);
  font-variant-numeric: tabular-nums;
}

.chart-tooltip {
  position: fixed;
  z-index: 200;
  pointer-events: none;
  max-width: 300px;
  padding: 9px 12px;
  border-radius: 4px;
  background: var(--ink);
  color: #eceef0;
  font-family: var(--sans);
  font-size: 0.8125rem;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
  opacity: 0;
  transition: opacity 0.08s;
}

.chart-tooltip.visible {
  opacity: 1;
}

.tt-title {
  margin-bottom: 3px;
  font-weight: 600;
  color: #ffffff;
}

.tt-sub {
  margin-top: 2px;
  font-weight: 400;
  color: #c4c9ce;
}

.tt-row {
  display: flex;
  justify-content: space-between;
  gap: 18px;
}

.tt-key {
  color: #a9b0b7;
}

.tt-swatch {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 6px;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.4);
}

/* Tables */
.table-scroll {
  width: 100%;
  overflow-x: auto;
}

/* Three-rule tables, as in the paper */
table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--sans);
  font-size: 0.875rem;
  border-top: 1.5px solid var(--ink);
  border-bottom: 1.5px solid var(--ink);
}

table.data-table th {
  text-align: left;
  font-weight: 600;
  color: var(--ink);
  padding: 9px 14px;
  border-bottom: 1px solid var(--ink);
  white-space: nowrap;
}

table.data-table td {
  padding: 8px 14px;
  border-bottom: 1px solid var(--rule-light);
  vertical-align: middle;
}

table.data-table th:first-child,
table.data-table td:first-child {
  padding-left: 0;
}

table.data-table th:last-child,
table.data-table td:last-child {
  padding-right: 0;
}

table.data-table th.num,
table.data-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

table.data-table td.num,
table.data-table td.mono {
  white-space: nowrap;
}

table.data-table tbody tr:last-child td {
  border-bottom: none;
}

table.data-table tbody tr:hover td {
  background: #f7f8f9;
}

table.data-table tr.row-total td {
  border-top: 1px solid var(--ink);
  font-weight: 600;
}

table.data-table td.strong {
  font-weight: 600;
}

a.inline-link {
  color: var(--rl);
  text-decoration: none;
  border-bottom: 1px solid rgba(22, 79, 54, 0.35);
}

a.inline-link:hover {
  border-bottom-color: var(--rl);
}

a.repo-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--rl);
  font-weight: 500;
  text-decoration: none;
}

a.repo-link > span:first-of-type {
  border-bottom: 1px solid rgba(22, 79, 54, 0.3);
}

a.repo-link:hover > span:first-of-type {
  border-bottom-color: var(--rl);
}

.repo-icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  color: var(--ink);
}

.ext-arrow {
  font-family: var(--sans);
  font-size: 0.78em;
  color: var(--ink-3);
}

a.repo-link:hover .ext-arrow {
  color: var(--rl);
}

/* Code */
.code-card {
  overflow: hidden;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--paper-2);
}

.code-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 12px 0 6px;
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
  flex-wrap: wrap;
}

.code-label {
  padding: 11px 12px 9px;
  font-family: var(--sans);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ink);
}

.copy-btn {
  padding: 4px 10px;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
}

.copy-btn:hover {
  border-color: var(--ink-3);
}

pre.code-body {
  margin: 0;
  padding: 18px 20px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.8125rem;
  line-height: 1.7;
  color: var(--ink);
}

/* Footer */
.site-footer {
  padding: 32px 0 48px;
  border-top: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 0.8125rem;
  color: var(--ink-3);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-links {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.footer-links a {
  color: var(--ink-2);
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--ink);
  text-decoration: underline;
}

@media (max-width: 980px) {
  .grid-2,
  .grid-asymmetric {
    grid-template-columns: 1fr;
  }
  .nav-links,
  .nav-divider {
    display: none;
  }
}

@media (max-width: 720px) {
  .hero {
    padding: 48px 0 44px;
  }
  .section {
    padding: 56px 0;
  }
  .section-header h2 {
    font-size: 1.625rem;
  }
  .result-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .result-total {
    padding-bottom: 0;
  }
  .result-labels {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 16px;
    height: auto;
    margin-bottom: 10px;
  }
  .result-labels span {
    position: static;
    padding-left: 0;
    border-left: none;
  }
}
