/* Co-RL project page — hand-written CSS, no frameworks.
   Palette derives from the paper's own chart colors: violet = Co-RL / Qwen,
   blue = Llama, green = positive delta, red = negative delta / collapse.
   Visual lineage: the demystify-agent-skills project page (same group). */

:root {
  --paper: #f8f7f3;
  --paper-deep: #efede7;
  --ink: #1b222c;
  --muted: #67707b;
  --line: #dcdcd4;
  --violet: #7b50a2;
  --violet-dark: #5d3a80;
  --violet-soft: #ece4f3;
  --blue: #0072b2;
  --blue-soft: #e2eef6;
  --red: #be3737;
  --red-soft: #f7e4e4;
  --amber-soft: #f8ecd4;
  --gray-bar: #a9b2b9;
  --card: #ffffff;
  --shadow: 0 12px 32px rgba(64, 45, 94, .07);
  --sans: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: "Libre Baskerville", Georgia, serif;
  --mono: "DM Mono", "SFMono-Regular", Consolas, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16.5px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--violet-dark); }
h1, h2 { font-family: var(--serif); font-weight: 400; line-height: 1.22; }
h3 { font-weight: 600; }
code { font-family: var(--mono); font-size: .92em; }

.shell, .section-shell { width: min(1180px, calc(100% - 48px)); margin: 0 auto; }
.section-block { padding: 88px 0 8px; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(248, 247, 243, .88);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
  border-bottom: 1px solid var(--line);
}
.nav { display: flex; align-items: center; justify-content: space-between; min-height: 58px; }
.brand {
  font-family: var(--mono); font-size: 13px; letter-spacing: .14em;
  color: var(--ink); text-decoration: none; font-weight: 500;
}
.brand b { color: var(--violet); font-weight: 500; }
.nav-links { display: flex; gap: 20px; flex-wrap: wrap; }
.nav-links a {
  color: var(--muted); text-decoration: none; font-size: 13.5px;
  padding: 4px 0; border-bottom: 2px solid transparent; transition: color .15s ease;
}
.nav-links a:hover { color: var(--ink); border-bottom-color: var(--violet); }
.nav-toggle {
  display: none; background: none; border: 1px solid var(--line); border-radius: 8px;
  font-family: var(--mono); font-size: 12px; padding: 6px 12px; cursor: pointer; color: var(--ink);
}

/* ---------- hero ---------- */
.hero { padding: 74px 0 24px; text-align: center; }
.kicker, .eyebrow {
  font-family: var(--mono); font-size: 12px; letter-spacing: .17em;
  text-transform: uppercase; color: var(--violet-dark); margin: 0 0 18px;
}
.hero h1 { font-size: clamp(30px, 4.6vw, 52px); margin: 0 auto 22px; max-width: 980px; }
.hero h1 em { font-style: normal; color: var(--violet); }
.hero-question {
  font-family: var(--serif); font-size: clamp(17px, 2vw, 21px); color: var(--muted);
  max-width: 780px; margin: 0 auto 26px; line-height: 1.5;
}
.signal-highlight {
  background: linear-gradient(transparent 58%, var(--amber-soft) 58%);
  color: var(--ink); padding: 0 2px;
}
.authors { max-width: 860px; margin: 0 auto 6px; font-size: 15.5px; line-height: 1.9; }
.authors span { white-space: nowrap; margin: 0 9px; }
.authors sup { font-family: var(--mono); font-size: 10.5px; color: var(--muted); }
.affiliations { color: var(--muted); font-size: 14px; margin: 0 auto 8px; max-width: 760px; }
.author-notes { font-size: 12.5px; color: var(--muted); font-family: var(--mono); margin: 0 0 26px; }
.hero-links { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-bottom: 44px; }
.button {
  display: inline-block; text-decoration: none; border-radius: 999px;
  font-size: 14.5px; font-weight: 600; padding: 10px 24px;
  border: 1.5px solid var(--ink); transition: transform .15s ease, box-shadow .15s ease;
}
.button:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.button-dark { background: var(--ink); color: var(--paper); }
.button-light { background: transparent; color: var(--ink); }

/* ---------- hover micro-interactions ---------- */
.step-card, .contrast-cell, .control-card {
  transition: transform .18s ease, box-shadow .18s ease;
}
.step-card:hover, .contrast-cell:hover, .control-card:hover {
  transform: translateY(-2px); box-shadow: var(--shadow);
}
.media-card { transition: box-shadow .2s ease; overflow: hidden; }
.media-card:hover { box-shadow: var(--shadow); }
.media-button img { transition: transform .25s ease; }
.media-button:hover img, .media-button:focus-visible img { transform: scale(1.015); }
.data-table tbody tr { transition: box-shadow .12s ease; }
.data-table tbody tr:hover td { box-shadow: inset 0 0 0 99px rgba(27, 34, 44, .045); }

.num { font-family: var(--sans); font-weight: 700; color: var(--violet-dark); white-space: nowrap; }
.num.bad { color: var(--red); }

/* ---------- shared section furniture ---------- */
.section-head .eyebrow { margin-bottom: 10px; }
.section-head h2 { font-size: clamp(34px, 4.6vw, 54px); line-height: 1.14; letter-spacing: -0.4px; margin: 0 0 18px; }
.section-head p.lede { color: var(--muted); font-size: 18px; line-height: 1.65; margin: 0 0 8px; }

.media-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px; margin: 26px 0 8px;
}
.media-button { display: block; width: 100%; border: 0; padding: 0; background: none; cursor: zoom-in; }
.media-card figcaption { font-size: 13.5px; color: var(--muted); padding: 12px 6px 2px; line-height: 1.55; }

.callout {
  border-left: 3px solid var(--violet); background: var(--violet-soft);
  border-radius: 0 12px 12px 0; padding: 14px 18px; margin: 20px 0;
  font-size: 15px; line-height: 1.6;
}
.callout.honesty { border-left-color: var(--red); background: var(--red-soft); }
.callout.scope { border-left-color: var(--gray-bar); background: var(--paper-deep); font-size: 14px; color: #3c4450; }
.callout .tag {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase;
  display: block; margin-bottom: 6px; color: inherit; opacity: .75;
}


.pair-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 20px 0; }
.pair-grid p { margin: 0; font-size: 14.5px; color: var(--ink); line-height: 1.6; }
.pair-grid em { color: var(--muted); font-style: normal; font-size: 13px; }

/* ---------- rephrase pair flow ---------- */
.pair-flow { display: grid; grid-template-columns: minmax(0, 1fr) 96px minmax(0, 1fr); align-items: stretch; margin: 22px 0 10px; }
.rp-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 20px 24px; }
.rp-card:first-child { border-top: 3px solid var(--gray-bar); }
.rp-card:last-child { border-top: 3px solid var(--violet); }
.rp-tag { font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); display: block; margin-bottom: 10px; }
.rp-card:last-child .rp-tag { color: var(--violet-dark); }
.rp-card p { margin: 0; font-family: var(--serif); font-size: 16.5px; line-height: 1.65; color: var(--ink); }
.rp-arrow { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; }
.rp-circle {
  width: 44px; height: 44px; border-radius: 50%; background: var(--violet-soft); color: var(--violet-dark);
  display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 600;
}
.rp-arrow .rp-label { font-family: var(--mono); font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); text-align: center; line-height: 1.5; }
.answer-badge {
  text-align: center; margin: 14px 0 0; font-family: var(--mono); font-size: 12.5px; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted);
}
.answer-badge b { color: var(--violet-dark); font-size: 15px; }

/* ---------- finding rows (reference style) ---------- */
.finding-list { display: flex; flex-direction: column; gap: 14px; margin: 26px 0 6px; }
.finding-row { background: var(--card); border: 1px solid var(--line); border-left-width: 4px; border-radius: 4px; }
.finding-row.edge-violet { border-left-color: var(--violet); }
.finding-row.edge-blue { border-left-color: var(--blue); }
.finding-row.edge-red { border-left-color: var(--red); }
.fr-toggle {
  display: grid; grid-template-columns: 190px minmax(0, 1fr) 24px; gap: 20px; align-items: center;
  width: 100%; text-align: left; background: none; border: 0; cursor: pointer; padding: 20px 22px;
}
.fr-num { font-family: var(--mono); font-size: 11.5px; letter-spacing: .1em; color: #8a6d1f; line-height: 1.5; }
.fr-claim { font-family: var(--sans); font-size: 18px; font-weight: 600; color: var(--ink); line-height: 1.45; }
.fr-icon { font-family: var(--mono); font-size: 19px; color: #b98524; transition: transform .18s ease; }
.finding-row.is-open .fr-icon { transform: rotate(45deg); }
.fr-body { padding: 0 22px 18px calc(190px + 42px); }
.fr-body p { margin: 0; font-size: 14.5px; color: #3c4450; line-height: 1.6; }

/* ---------- panel keys (text mapped to figure panels) ---------- */
.panel-keys { list-style: none; margin: 18px 0 0; padding: 0; }
.panel-keys li {
  display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 12px; align-items: baseline;
  padding: 11px 0; border-top: 1px solid var(--line); font-size: 15px; line-height: 1.55; color: #3c4450;
}
.panel-keys li:last-child { border-bottom: 1px solid var(--line); }
.panel-keys b { font-family: var(--mono); font-weight: 500; font-size: 13px; color: var(--violet-dark); }

/* ---------- split rows ---------- */
.split { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 30px; align-items: center; margin: 8px 0; }
.split > figure { margin: 12px 0; }
.split .sub-head { margin-top: 0; }
.read-chips-stack { flex-direction: column; align-items: flex-start; }

.fig-medium { max-width: 920px; margin-left: auto; margin-right: auto; }
.card-fig { max-width: 440px; margin: 6px auto 0; }

/* ---------- method ---------- */
.step-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 28px 0; }
.step-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 20px; }
.step-card .idx { font-family: var(--mono); font-size: 12px; color: var(--violet); letter-spacing: .12em; display: block; margin-bottom: 8px; }
.step-card strong { display: block; margin-bottom: 6px; font-size: 15.5px; }
.step-card p { margin: 0; font-size: 14px; color: var(--muted); line-height: 1.55; }



.contrast-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 24px 0; }
.contrast-cell { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px; }
.contrast-cell.ours { border-color: var(--violet); box-shadow: inset 0 0 0 1px var(--violet); }
.contrast-cell .eyebrow { margin-bottom: 8px; font-size: 11px; }
.contrast-cell.ours .eyebrow { color: var(--violet); }
.contrast-cell p { margin: 0; font-size: 14px; color: var(--muted); line-height: 1.55; }

.read-chips { display: flex; gap: 10px; flex-wrap: wrap; margin: 14px 0; }
.read-chip {
  font-size: 13px; background: var(--paper-deep); border: 1px solid var(--line);
  border-radius: 999px; padding: 6px 14px; color: #3c4450;
}
.read-chip b { color: var(--red); font-weight: 600; }

/* ---------- verdict scoreboard ---------- */
.panel {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 24px; margin: 26px 0 8px;
}
.controls-row { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.controls-row label { font-family: var(--mono); font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: 8px; }
select {
  font-family: var(--sans); font-size: 14px; padding: 7px 10px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--ink);
}
.toggle-button {
  font-family: var(--mono); font-size: 12px; padding: 7px 14px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 999px; background: var(--paper); color: var(--muted);
  transition: all .15s ease;
}
.toggle-button.is-active { background: var(--violet); border-color: var(--violet); color: #fff; }

.dr-row:hover { background: rgba(123, 80, 162, .06); }
.vc-delta { font-family: var(--mono); font-size: 12.5px; font-weight: 500; border-radius: 6px; padding: 1px 7px; margin-left: 6px; }
.vc-delta.pos { color: var(--violet-dark); background: var(--violet-soft); }
.vc-delta.neg { color: var(--red); background: var(--red-soft); }
.scope-note { font-size: 13.5px; color: var(--muted); border-top: 1px dashed var(--line); margin-top: 18px; padding-top: 14px; line-height: 1.6; }

/* ---------- data tables ---------- */
.data-table-wrap { overflow-x: auto; margin: 16px 0; }
table.data-table { border-collapse: collapse; width: 100%; font-size: 14px; }
.data-table th {
  font-family: var(--mono); font-size: 11px; letter-spacing: .07em; text-transform: uppercase;
  color: var(--muted); text-align: right; padding: 8px 10px; border-bottom: 2px solid var(--ink);
}
.data-table th:first-child { text-align: left; }
.data-table td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: right; font-family: var(--mono); font-size: 13.5px; }
.data-table td:first-child { text-align: left; font-family: var(--sans); font-size: 14px; }
.data-table tr.ref-row td { color: var(--muted); border-bottom-style: dashed; }
.data-table tr.ours-row td:first-child { color: var(--violet-dark); font-weight: 600; }
.data-table td.mark-b { font-weight: 500; color: #000; }
.data-table td.mark-u { text-decoration: underline; text-underline-offset: 3px; }
.data-table td.avg-col, .data-table th.avg-col { background: var(--violet-soft); }
.data-table tr.group-row td {
  font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); background: var(--paper-deep); text-align: left;
}

/* ---------- explorer extras ---------- */
.sub-head { font-family: var(--serif); font-weight: 400; font-size: 27px; margin: 52px 0 12px; }
.heat-note { font-size: 13px; color: var(--muted); border-top: 1px dashed var(--line); margin-top: 14px; padding-top: 12px; line-height: 1.6; }


/* ---------- controls cards ---------- */
.cards-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 28px 0 8px; }
.control-card { background: var(--card); border: 1px solid var(--line); border-radius: 4px; border-top: 4px solid var(--violet); padding: 22px; display: flex; flex-direction: column; }
.control-card.accent-violet { border-top-color: var(--violet); }
.control-card.accent-blue { border-top-color: var(--blue); }
.control-card.accent-amber { border-top-color: #d99e2f; }
.control-card.accent-violet .eyebrow { color: var(--violet-dark); }
.control-card.accent-blue .eyebrow { color: #1c6a94; }
.control-card.accent-amber .eyebrow { color: #8a6d1f; }
.card-link { font-family: var(--mono); font-size: 13px; color: var(--ink); text-decoration: none; margin-top: 12px; }
.card-link:hover { color: var(--violet-dark); }
.control-card .eyebrow { font-size: 11px; margin-bottom: 8px; }
.control-card h3 { margin: 0 0 8px; font-size: 19.5px; line-height: 1.35; }
.card-fig { width: 100%; height: auto; margin-top: auto; padding-top: 10px; }
.control-card p { font-size: 13.5px; color: var(--muted); line-height: 1.55; margin: 0 0 10px; }

.code-block {
  background: #241f2e; color: #ece7f2; border-radius: 14px; padding: 18px 22px;
  overflow-x: auto; margin: 18px 0; position: relative;
}
.code-block pre { margin: 0; font-family: var(--mono); font-size: 13px; line-height: 1.8; }
.code-block .c { color: #8f84a4; }

/* ---------- bibtex ---------- */
.bibtex-block { background: #241f2e; border-radius: 16px; padding: 22px 26px; margin: 26px 0; }
.bibtex-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.bibtex-head span { font-family: var(--mono); font-size: 11.5px; letter-spacing: .16em; text-transform: uppercase; color: #b9a5d6; }
#copy-bibtex {
  font-family: var(--mono); font-size: 12px; cursor: pointer; border-radius: 999px;
  border: 1px solid #4d4260; background: transparent; color: #ece7f2; padding: 6px 16px;
}
#copy-bibtex:hover { border-color: #b9a5d6; }
.bibtex-block pre { margin: 0; font-family: var(--mono); font-size: 13px; line-height: 1.7; color: #ece7f2; overflow-x: auto; }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); margin-top: 90px; padding: 30px 0 40px; }
.site-footer p { font-size: 13px; color: var(--muted); line-height: 1.7; margin: 0; }

/* ---------- lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 90; background: rgba(27, 34, 44, .86);
  display: flex; align-items: center; justify-content: center; padding: 4vh 4vw;
}
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100%; max-height: 92vh; width: auto; border-radius: 10px; background: #fff; }
.lightbox-close {
  position: absolute; top: 18px; right: 22px; background: none; border: 0; cursor: pointer;
  color: #fff; font-size: 30px; line-height: 1; font-family: var(--mono);
}
.no-scroll { overflow: hidden; }

/* ---------- full-bleed band ---------- */
.band { background: var(--paper-deep); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 60px 0; margin-top: 88px; }
.band .section-block { padding-top: 0; }

/* ---------- focus & motion ---------- */
:focus-visible { outline: 2.5px solid var(--violet); outline-offset: 2px; border-radius: 4px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* ---------- responsive ---------- */
@media (max-width: 940px) {
  .step-grid, .contrast-strip, .cards-3 { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  body { font-size: 15.5px; }
    .nav-toggle { display: block; }
  .nav-links {
    display: none; position: absolute; top: 58px; left: 0; right: 0;
    background: var(--paper); border-bottom: 1px solid var(--line);
    flex-direction: column; padding: 14px 24px; gap: 12px;
  }
  .nav-links.is-open { display: flex; }
  .section-block { padding-top: 64px; }
  .hero { padding-top: 48px; }
  .panel { padding: 16px; }
    .dr-label { width: auto; flex: 1; }
  .dr-nums { width: auto; font-size: 12px; }
  .pair-flow { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .rp-arrow { flex-direction: row; }
  .rp-circle { transform: rotate(90deg); }
  .dr-nums em { display: inline; }
}

/* anchor offset for the sticky header */
section[id], div[id="bibtex"] { scroll-margin-top: 72px; }
