/* fair-GRPO project page ---------------------------------------------------- */

:root {
  --bg: #ffffff;
  --bg-alt: #f7f8fa;
  --bg-sunken: #eef0f4;
  --fg: #16181d;
  --fg-muted: #5b6270;
  --fg-faint: #868d9b;
  --rule: #e2e5ea;
  --accent: #2f4f9e;
  --accent-soft: #eaeffb;
  --warn: #b3282d;
  --warn-soft: #fdeeee;
  --good: #1f7a4d;
  --maxw: 940px;
  --radius: 10px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Helvetica, Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101216;
    --bg-alt: #171a20;
    --bg-sunken: #1d2129;
    --fg: #e8eaee;
    --fg-muted: #a3abb9;
    --fg-faint: #79808d;
    --rule: #272c35;
    --accent: #8fa9e8;
    --accent-soft: #1b2233;
    --warn: #f08a8d;
    --warn-soft: #2a1a1c;
    --good: #6cc79a;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

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

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- header --------------------------------------------------------------- */

header { padding: 68px 0 40px; border-bottom: 1px solid var(--rule); }

.venue {
  display: inline-block;
  font-size: 12.5px;
  font-weight: 650;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 22px;
}

h1 {
  font-family: var(--serif);
  font-size: clamp(30px, 5vw, 46px);
  line-height: 1.18;
  letter-spacing: -.015em;
  font-weight: 600;
  margin: 0 0 6px;
  text-wrap: balance;
}

h1 .sub {
  display: block;
  font-size: .62em;
  color: var(--fg-muted);
  font-weight: 400;
  margin-top: 10px;
}

.authors { margin: 26px 0 8px; font-size: 17px; line-height: 2; }
.authors a { color: var(--fg); border-bottom: 1px solid var(--rule); }
.authors a:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }
.authors sup { color: var(--accent); font-size: .72em; font-weight: 700; padding-left: 1px; }

.affils { color: var(--fg-muted); font-size: 14.5px; line-height: 1.9; margin-bottom: 4px; }
.affils sup { color: var(--accent); font-weight: 700; }

/* --- buttons -------------------------------------------------------------- */

.links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 17px;
  border-radius: 999px;
  border: 1px solid var(--rule);
  background: var(--bg-alt);
  color: var(--fg);
  font-size: 14.5px;
  font-weight: 550;
  transition: border-color .15s, background .15s, transform .1s;
}
.btn:hover { text-decoration: none; border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { color: #fff; filter: brightness(1.1); }
.btn svg { width: 16px; height: 16px; flex: none; }

/* --- sections ------------------------------------------------------------- */

section { padding: 46px 0; border-bottom: 1px solid var(--rule); }
section:last-of-type { border-bottom: none; }

h2 {
  font-family: var(--serif);
  font-size: 27px;
  font-weight: 600;
  letter-spacing: -.01em;
  margin: 0 0 18px;
}

h3 {
  font-size: 17px;
  font-weight: 650;
  margin: 30px 0 10px;
}

p { margin: 0 0 16px; }
p:last-child { margin-bottom: 0; }

.lede { font-size: 18px; }

/* --- warning -------------------------------------------------------------- */

.warning {
  background: var(--warn-soft);
  border-left: 3px solid var(--warn);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 13px 18px;
  font-size: 14.5px;
  color: var(--fg-muted);
  margin: 0 0 26px;
}
.warning strong { color: var(--warn); }

/* --- tldr ----------------------------------------------------------------- */

.tldr {
  background: var(--bg-alt);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 26px 28px;
  margin: 6px 0 0;
}
.tldr h2 { margin-top: 0; }

.statgrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin: 22px 0 4px;
}
.stat {
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.stat .num {
  font-family: var(--serif);
  font-size: 31px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -.02em;
  display: block;
}
.stat .lbl {
  display: block;
  font-size: 12.5px;
  color: var(--fg-muted);
  margin-top: 7px;
  line-height: 1.45;
}
.stat.base .num { color: var(--fg-faint); }
.stat.grpo .num { color: var(--accent); }
.stat.icl  .num { color: var(--good); }
.stat.rlhf .num { color: var(--fg-muted); }

/* --- figures -------------------------------------------------------------- */

figure { margin: 26px 0; }
figure img {
  width: 100%;
  height: auto;
  display: block;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: #fff;
}
figcaption {
  font-size: 14px;
  color: var(--fg-muted);
  margin-top: 11px;
  line-height: 1.6;
}
figcaption b { color: var(--fg); font-weight: 650; }

.figrow {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}
.figrow figure { margin: 0; }

/* --- table ---------------------------------------------------------------- */

.tablewrap { overflow-x: auto; margin: 22px 0 14px; -webkit-overflow-scrolling: touch; }

table {
  border-collapse: collapse;
  width: 100%;
  min-width: 620px;
  font-size: 14.5px;
  font-variant-numeric: tabular-nums;
}
th, td { padding: 7px 10px; text-align: right; }
th:first-child, td:first-child,
th:nth-child(2), td:nth-child(2) { text-align: left; }
thead th {
  border-bottom: 1.5px solid var(--fg);
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--fg-muted);
  font-weight: 650;
  white-space: nowrap;
}
tbody tr { border-bottom: 1px solid var(--rule); }
tbody tr:last-child { border-bottom: none; }

tr.family td {
  background: var(--bg-sunken);
  font-weight: 650;
  border-top: 1px solid var(--rule);
}
tr.family td:first-child { display: flex; align-items: center; gap: 8px; }
tr.family img { width: 15px; height: 15px; object-fit: contain; }

td.best { font-weight: 700; color: var(--fg); }
td.second { text-decoration: underline; text-underline-offset: 3px; }
td.variant { color: var(--fg-muted); }
tr.avg { background: var(--accent-soft); }
tr.avg td { font-weight: 600; }

.tnote { font-size: 13.5px; color: var(--fg-muted); line-height: 1.6; }

/* --- lists ---------------------------------------------------------------- */

ul.clean { margin: 0 0 16px; padding-left: 20px; }
ul.clean li { margin-bottom: 9px; }
ul.clean li::marker { color: var(--fg-faint); }

/* --- code / bibtex -------------------------------------------------------- */

.codebox { position: relative; }
pre {
  background: var(--bg-sunken);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 18px 20px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.65;
  margin: 0;
}
code { font-family: var(--mono); font-size: .89em; }
p code, li code, td code {
  background: var(--bg-sunken);
  padding: 1.5px 5px;
  border-radius: 4px;
}

.copy {
  position: absolute;
  top: 10px;
  right: 10px;
  border: 1px solid var(--rule);
  background: var(--bg);
  color: var(--fg-muted);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  font-family: var(--sans);
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.copy:hover { color: var(--accent); border-color: var(--accent); }

/* --- release table -------------------------------------------------------- */

table.release { min-width: 520px; }
table.release td, table.release th { text-align: left; }
table.release td:last-child, table.release th:last-child { text-align: right; }

/* --- footer --------------------------------------------------------------- */

footer {
  padding: 34px 0 60px;
  color: var(--fg-faint);
  font-size: 13.5px;
  border-top: 1px solid var(--rule);
}
footer p { margin-bottom: 8px; }

@media (max-width: 600px) {
  body { font-size: 16px; }
  header { padding: 44px 0 30px; }
  section { padding: 36px 0; }
  .wrap { padding: 0 18px; }
}
