/* ─────────────────────────────────────────────────────────────
   MemGym — Solarized Light × Anthropic warmth
   Single-file stylesheet. No preprocessor.
   ───────────────────────────────────────────────────────────── */

:root {
  /* color tokens */
  --bg:               #faf7f0;   /* warm cream */
  --surface:          #fdf6e3;   /* Solarized base3 */
  --surface-2:        #f5efdc;   /* slightly darker tier */
  --text:             #073642;   /* Solarized base02 */
  --text-muted:       #586e75;   /* Solarized base01 */
  --accent-primary:   #268bd2;   /* Solarized blue */
  --accent-highlight: #cb4b16;   /* Solarized orange */
  --accent-green:     #859900;   /* SAFE chip */
  --accent-red:       #dc322f;   /* HARMFUL chip */
  --border:           #d3cfc8;
  --border-strong:    #93a1a1;
  --btn-bg:           #073642;
  --btn-text:         #faf7f0;

  /* layout */
  --content-width:    720px;
  --wide-width:       960px;
  --gutter:           clamp(1.25rem, 4vw, 3rem);
  --section-gap:      5rem;

  /* fonts — matched to agenticvbench's pairing */
  --font-body: 'Hanken Grotesk', 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}

/* ─────────── reset / base ─────────── */
*, *::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-body);
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { max-width: 100%; height: auto; display: block; }
a { color: var(--accent-primary); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
code, pre { font-family: var(--font-mono); }

main {
  max-width: var(--wide-width);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

section, footer {
  padding: var(--section-gap) 0;
  border-top: 1px solid var(--border);
}
section:first-of-type { border-top: none; }

.prose {
  max-width: var(--content-width);
  margin: 0 auto;
}

h1, h2, h3 {
  color: var(--text);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.25;
}
h2 {
  font-size: 1.6rem;
  margin: 0 0 1.25rem;
}
h3 { font-size: 1.15rem; margin: 0 0 0.75rem; }

p { margin: 0 0 1rem; }
.muted { color: var(--text-muted); }
.todo  { color: var(--accent-highlight); font-style: italic; }

/* ─────────── hero ─────────── */
.hero { padding: 4.5rem 0 3rem; border-top: none; }
.hero h1 {
  font-size: clamp(2.4rem, 6vw, 3.6rem);
  margin: 0 0 0.4rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.hero .subtitle {
  font-size: 1.25rem;
  color: var(--text-muted);
  margin: 0 0 2rem;
  font-weight: 400;
}
.tldr {
  font-size: 1.15rem;
  line-height: 1.6;
  color: var(--text);
  max-width: 38rem;
  margin: 0 0 0.5rem;
}
.tldr strong { font-weight: 700; }

/* hero buttons */
.hero-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1.5rem;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.7rem 1.15rem;
  border-radius: 8px;
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 0.06s ease, background 0.15s ease, border-color 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary {
  background: var(--btn-bg);
  color: var(--btn-text);
  border: 1px solid var(--btn-bg);
}
.btn-primary:hover { background: #0f4854; }
.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border-strong);
}
.btn-outline:hover { border-color: var(--accent-primary); color: var(--accent-primary); }
.btn-icon { font-size: 1rem; opacity: 0.95; }

/* branded hero buttons */
.btn-arxiv  { background: #b31b1b; color: #fff; border: 1px solid #b31b1b; }
.btn-arxiv:hover  { background: #9a1414; border-color: #9a1414; }
.btn-github { background: #24292f; color: #fff; border: 1px solid #24292f; }
.btn-github:hover { background: #15181c; border-color: #15181c; }
.btn-hf     { background: #ffae1a; color: #3a2a00; border: 1px solid #f0a000; }
.btn-hf:hover     { background: #ff9d00; border-color: #e09000; }
.btn-bibtex { background: var(--accent-primary); color: #fff; border: 1px solid var(--accent-primary); }
.btn-bibtex:hover { background: #1f73ad; border-color: #1f73ad; }
.btn-disabled,
.btn-disabled:hover {
  background: var(--surface-2);
  color: var(--text-muted);
  border-color: var(--border);
  cursor: not-allowed;
  transform: none;
}

/* ─────────── domain cards ─────────── */
.domain-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
  margin-top: 2rem;
}
.domain-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.5rem 1.4rem;
  display: flex;
  flex-direction: column;
}
.regime-tag {
  align-self: flex-start;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent-primary);
  background: rgba(38, 139, 210, 0.1);
  border-radius: 999px;
  padding: 0.25rem 0.7rem;
  margin-bottom: 0.9rem;
}
.card-title {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0;
}
.card-n { font-size: 0.85rem; color: var(--text-muted); margin: 0.15rem 0 1rem; }
.card-headline {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  margin-bottom: 0.9rem;
}
.card-headline .num {
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--accent-highlight);
  letter-spacing: -0.02em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.card-headline .num-label { font-size: 0.85rem; color: var(--text-muted); }
.card-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0 0 1.2rem;
  flex-grow: 1;
}

/* best-vs-baseline comparison bars */
.score-bar { margin-top: 0.6rem; }
.score-bar .bar-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.82rem;
  margin-bottom: 0.5rem;
}
.score-bar .bar-name {
  flex: 0 0 5.5rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.score-bar .bar-track {
  flex: 1 1 auto;
  height: 11px;
  background: rgba(7, 54, 66, 0.09);
  border-radius: 999px;
  overflow: hidden;
}
.score-bar .bar-fill {
  display: block;
  height: 100%;
  min-width: 3px;
  border-radius: 999px;
}
.score-bar .bar-fill.best     { background: var(--accent-primary); }
.score-bar .bar-fill.baseline { background: var(--border-strong); }
.score-bar .bar-val {
  flex: 0 0 3.4rem;
  text-align: right;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.score-bar .bar-row.best .bar-val     { color: var(--accent-primary); font-weight: 700; }
.score-bar .bar-row.baseline .bar-val { color: var(--text-muted); }

/* ─────────── figures ─────────── */
.figure-section figure { margin: 0; }
figure img {
  width: 100%;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 1.5rem;
}
figcaption {
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.55;
  margin-top: 0.9rem;
  max-width: var(--content-width);
  margin-left: auto;
  margin-right: auto;
}
/* Figure 2, large hero visual — spans the full content container */
.figure-hero { padding-top: 3.5rem; padding-bottom: 3.5rem; }
.figure-hero figure { margin: 0; }
.figure-hero figure img {
  padding: clamp(1rem, 3vw, 2.25rem);
  border-radius: 14px;
}
.figure-hero figcaption {
  text-align: center;
  font-size: 0.95rem;
  margin-top: 1.1rem;
}

/* cost / fast-path callout box */
.callout {
  margin: 1.6rem auto 0;
  padding: 1rem 1.2rem;
  background: rgba(203, 75, 22, 0.06);
  border: 1px solid rgba(203, 75, 22, 0.22);
  border-left: 3px solid var(--accent-highlight);
  border-radius: 10px;
  font-size: 0.94rem;
  line-height: 1.6;
  color: var(--text);
}
.callout strong { color: var(--accent-highlight); }

/* ─────────── leaderboard ─────────── */
.lb-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 1rem 0 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}
.lb-tab {
  font: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 0.4rem 0.9rem;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.lb-tab:hover {
  color: var(--accent-primary);
  background: rgba(38, 139, 210, 0.06);
}
.lb-tab.active {
  color: #fff;
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  font-weight: 600;
}
.lb-tab.active:hover { background: #1f73ad; color: #fff; }

.lb-group { margin: 0 0 2.5rem; }
.lb-group h3 {
  font-size: 1.05rem;
  margin: 0 0 0.4rem;
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
}
.lb-group h3 .lb-track-label {
  font-family: var(--font-mono);
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.8rem;
}
.lb-desc {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin: 0 0 0.75rem;
}

/* placeholder for a known-but-not-yet-populated track */
.lb-empty {
  margin: 0;
  padding: 1.1rem 1.2rem;
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.lb-empty .lb-empty-tag {
  display: inline-block;
  margin-right: 0.5rem;
  padding: 0.1rem 0.5rem;
  border-radius: 6px;
  background: rgba(38, 139, 210, 0.1);
  color: var(--accent-primary);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.lb-table-wrap { overflow-x: auto; }
table.lb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.lb-table thead {
  background: var(--text);
  color: var(--bg);
}
.lb-table th, .lb-table td {
  text-align: left;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.lb-table th {
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-bottom: none;
}
.lb-table tbody tr:last-child td { border-bottom: none; }
.lb-table tbody tr:hover { background: var(--surface-2); }
.lb-table td.notes { white-space: normal; min-width: 220px; color: var(--text-muted); }
.lb-table td.score { font-weight: 600; }
.lb-table td.delta-pos { color: var(--accent-highlight); font-weight: 600; }
.lb-table td.delta-zero { color: var(--text-muted); }
.lb-table td.delta-neg { color: var(--accent-red); font-weight: 600; }
.lb-table tr.baseline-row {
  background: var(--surface-2);
  font-style: italic;
  color: var(--text-muted);
}
.lb-table tr.baseline-row td.score { color: var(--text-muted); font-weight: 400; }
.lb-table tr.baseline-row td:first-child::before {
  content: '— ';
  color: var(--border-strong);
  font-style: normal;
}

.lb-meta { font-size: 0.85rem; margin-top: 0.5rem; }
.lb-error {
  background: rgba(220, 50, 47, 0.07);
  border: 1px solid rgba(220, 50, 47, 0.3);
  color: #a8201d;
  padding: 1rem 1.25rem;
  border-radius: 8px;
  font-size: 0.92rem;
}
.lb-error code { background: rgba(0,0,0,0.06); padding: 1px 5px; border-radius: 3px; }

/* ─────────── citation ─────────── */
#cite pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.1rem 1.25rem;
  font-size: 0.85rem;
  line-height: 1.55;
  overflow-x: auto;
  margin: 0 0 0.8rem;
}
#cite pre code { background: none; padding: 0; color: var(--text); }

/* ─────────── BibTeX dialog ─────────── */
dialog#bibtex-dialog {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.6rem 1.6rem 1.4rem;
  max-width: 640px;
  width: calc(100% - 2rem);
  background: var(--bg);
  color: var(--text);
  box-shadow: 0 24px 60px -20px rgba(7, 54, 66, 0.35);
}
dialog#bibtex-dialog::backdrop {
  background: rgba(7, 54, 66, 0.35);
  backdrop-filter: blur(2px);
}
dialog#bibtex-dialog h3 { margin: 0 0 1rem; padding-right: 2rem; }
#bibtex-close {
  position: absolute;
  top: 0.5rem;
  right: 0.7rem;
  background: transparent;
  border: none;
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0.25rem 0.5rem;
}
#bibtex-close:hover { color: var(--text); }
dialog#bibtex-dialog pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.2rem;
  font-size: 0.82rem;
  line-height: 1.55;
  overflow-x: auto;
  margin: 0 0 1rem;
}

/* ─────────── footer ─────────── */
footer { padding: 2.5rem 0 4rem; }
footer p { font-size: 0.88rem; margin: 0; }

/* ─────────── small screens ─────────── */
@media (max-width: 600px) {
  body { font-size: 16px; }
  .hero { padding: 3rem 0 2rem; }
  .hero h1 { font-size: 2.4rem; }
  .card-headline .num { font-size: 2rem; }
  figure img { padding: 1rem; border-radius: 6px; }
}
