/* The Right-Sized LLM Benchmark — minimal scaffold styles. Phase 5 layers on the rich
   chart styling. Tone: serious, readable, tasteful — closer to a docs site
   than a marketing landing. */

:root {
  --color-bg: #fafaf7;
  --color-fg: #1a1a1a;
  --color-muted: #6b6b6b;
  --color-accent: #2a5d9f;
  --color-border: #e4e4dc;
  --color-card-bg: #ffffff;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --max-width: 1100px;
  --pad: 1.5rem;
}

* { box-sizing: border-box; }

html { font-size: 16px; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--color-fg);
  background: var(--color-bg);
  line-height: 1.55;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--pad);
}

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

h1, h2, h3 {
  line-height: 1.2;
  margin: 1.5em 0 0.5em;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.1rem; }

code, pre {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  border-radius: 3px;
}
code { padding: 0.1em 0.3em; }
pre { padding: 0.75rem; overflow-x: auto; }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* Header */
.site-header {
  border-bottom: 1px solid var(--color-border);
  background: var(--color-card-bg);
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 1rem;
  padding-bottom: 1rem;
}
.brand { display: flex; align-items: baseline; gap: 0.75rem; text-decoration: none; color: var(--color-fg); }
.brand-tagline { color: var(--color-muted); font-size: 0.85rem; }
.site-nav { display: flex; gap: 1rem; flex-wrap: wrap; font-size: 0.95rem; }
.site-nav a { text-decoration: none; color: var(--color-fg); }
.site-nav a:hover { color: var(--color-accent); }
.site-nav a.active { color: var(--color-accent); font-weight: 600; }

/* Main */
main { padding: 2rem 0 3rem; }

.page-header h1 { margin-top: 0; }
.lede { color: var(--color-muted); font-size: 1.1rem; margin-top: 0.25rem; }

/* Hero / landing
   .lede width is bumped so the hero paragraphs span the full container
   (matching the slider + heatmap below), instead of capping at a prose
   reading-width that left the right half visually empty. */
.hero h1 { font-size: 2.3rem; }
.hero .lede { max-width: 100%; width: 100%; }
.snapshot-date { color: var(--color-muted); font-size: 0.9rem; font-family: var(--font-mono); }

/* Slider controls */
.slider-controls {
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  align-items: center;
}
.slider-group { flex: 1 1 320px; }
.slider-group label { display: block; font-size: 0.95rem; }
.slider-group input[type="range"] { width: 100%; margin-top: 0.5rem; }
.toggle-group { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; font-size: 0.9rem; }
.toggle-label { color: var(--color-muted); }

/* Sections */
section { margin: 2.5rem 0; }
.section-blurb { color: var(--color-muted); }

/* Category grid (landing) */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}
.category-card {
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 1rem;
}
.category-card h3 { margin-top: 0; }
.category-card h3 a { text-decoration: none; }
.category-blurb { color: var(--color-muted); font-size: 0.9rem; }
.placeholder { font-size: 0.85rem; color: var(--color-muted); }

/* Heatmap placeholder */
.heatmap-placeholder,
.composite-placeholder {
  background: var(--color-card-bg);
  border: 1px dashed var(--color-border);
  border-radius: 6px;
  padding: 2rem;
  text-align: center;
  color: var(--color-muted);
}

/* Tables */
table { border-collapse: collapse; width: 100%; margin: 1rem 0; }
th, td { text-align: left; padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--color-border); }
th { font-weight: 600; color: var(--color-muted); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; }

/* Judge panel */
.judge-table { background: var(--color-card-bg); border: 1px solid var(--color-border); border-radius: 6px; overflow: hidden; }
.panel-meta { color: var(--color-muted); font-size: 0.9rem; }

/* Model pages */
.model-meta { display: grid; grid-template-columns: max-content 1fr; gap: 0.4rem 1rem; margin-top: 0.5rem; }
.model-meta dt { color: var(--color-muted); font-size: 0.9rem; }

.model-static-meta { margin-bottom: 1.5rem; }
.model-dynamic-stats { margin-top: 1rem; margin-bottom: 2rem; }
.verdict-paragraph { font-size: 1.05rem; }

/* Index lists */
.index-list ul { list-style: none; padding: 0; }
.index-list li { padding: 0.75rem 0; border-bottom: 1px solid var(--color-border); }
.index-list li a { font-weight: 600; }
.index-list li p { margin: 0.25rem 0 0; color: var(--color-muted); font-size: 0.9rem; }

/* Subscribe form */
.subscribe-form { display: flex; gap: 0.5rem; margin: 0.75rem 0; }
.subscribe-form input[type="email"] {
  flex: 1;
  min-width: 0;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  font-family: var(--font-body);
  font-size: 0.95rem;
}
.subscribe-form button {
  padding: 0.5rem 1rem;
  background: var(--color-accent);
  color: white;
  border: 0;
  border-radius: 4px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  cursor: pointer;
}
.subscribe-form button:hover { background: #1f4677; }

/* =========================================================================
   Heatmap
   =========================================================================
   Cells size to fit their content — category header labels never wrap or
   truncate. Wrapper provides horizontal scroll if the table grows past
   container width on narrow viewports.
*/
.heatmap-wrapper { margin: 1rem 0 1.5rem; overflow-x: auto; }
.heatmap-table {
  border-collapse: collapse;
  font-size: 0.85rem;
  table-layout: fixed;
}
.heatmap-table th, .heatmap-table td {
  border: 1px solid var(--color-border);
  padding: 0.35rem 0.4rem;
  vertical-align: middle;
}
.heatmap-table th {
  background: var(--color-card-bg);
  position: sticky;
  top: 0;
  z-index: 1;
}
.heatmap-table th.hm-corner {
  width: 12rem;
  text-align: left;
  white-space: nowrap;
  vertical-align: bottom;
}
/* Column headers rotated 90° (reads bottom-to-top), with text wrapped
   into 2–3 lines so the header strip is shorter. Each "line" becomes a
   vertical column after rotation; long labels like "Financial Analysis
   & Trading Decisions" wrap onto 2–3 strips side-by-side.

   Cell height must accommodate the longest unbreakable single word —
   currently "Infrastructure" at 14 chars × ~0.5rem per char ≈ 7rem.
   Setting 8.5rem gives breathing room so nothing clips at the edge. */
.heatmap-table th.hm-col {
  width: 5.5rem;
  height: 8.5rem;
  padding: 0.4rem 0.3rem 0.6rem;
  text-align: center;
  vertical-align: bottom;
}
.heatmap-table th.hm-col a {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  white-space: normal;
  /* max-height (pre-rotation) limits how long any single rotated "line"
     can grow before wrapping into a new strip. Must be ≤ cell height
     minus padding (8.5rem - 1rem = 7.5rem) so long single words like
     "Infrastructure" sit fully inside the cell. */
  max-height: 7.5rem;
  font-size: 0.75rem;
  line-height: 1.2;
  color: var(--color-accent);
  text-decoration: none;
  display: inline-block;
}
.heatmap-table th.hm-col a:hover { text-decoration: underline; }

/* Summary column — header text rotates to match category headers; data
   cells in tbody keep horizontal numbers. */
.heatmap-table thead th.hm-totals {
  width: 4rem;
  height: 8.5rem;
  padding: 0.4rem 0.3rem 0.6rem;
  text-align: center;
  vertical-align: bottom;
}
.heatmap-table thead th.hm-totals .hm-totals-label {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  white-space: nowrap;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-muted);
  display: inline-block;
}
.heatmap-table tbody td.hm-totals {
  width: 4rem;
  text-align: right;
  font-size: 0.78rem;
  white-space: nowrap;
  vertical-align: middle;
}
.hm-model { font-weight: 500; }
.hm-model a { color: var(--color-accent); text-decoration: none; }
.hm-model a:hover { text-decoration: underline; }
.hm-model small { display: block; color: var(--color-muted); font-size: 0.72rem; font-weight: 400; }

/* Visual separator between provider groups */
.hm-provider-break > td { border-top: 2px solid var(--color-border); }

@media (max-width: 720px) {
  /* On narrow screens, allow horizontal scroll rather than crushing cells. */
  .heatmap-wrapper { overflow-x: auto; }
  .heatmap-table { table-layout: auto; min-width: 720px; }
}

/*
  Divergent cost gradient: cells are colored relative to the
  best-performing (anchor) model's cost on that category.
    .hm-cheaper-N        — model costs LESS than anchor → green (N=1..5, deeper = bigger savings)
    .hm-more-expensive-N — model costs MORE than anchor → red   (N=1..5, deeper = more expensive)
    .hm-neutral          — cost ≈ anchor (within ±0.5%) → cream
    .hm-empty            — model doesn't qualify        → striped grey

  Five fixed shade buckets per side rather than calc-inside-hsl. The
  calc/hsl approach worked in Brave but Safari rendered everything green
  regardless of class. Static colors per bucket sidestep every browser
  CSS quirk. Bucket is picked at render time from |savings| / 20.
*/
.hm-cell {
  text-align: center;
  position: relative;
  padding: 0;
}
.hm-cell.hm-neutral {
  background-color: #f6f5ec;
  color: #7a7766;
}
/* Green scale: lightest at small savings, deepest at ≥80% savings. */
.hm-cell.hm-cheaper-1 { background-color: #e3f1d8; color: #3b5d2c; }
.hm-cell.hm-cheaper-2 { background-color: #cbe5b4; color: #345727; }
.hm-cell.hm-cheaper-3 { background-color: #a9d585; color: #2d4b22; }
.hm-cell.hm-cheaper-4 { background-color: #82bf57; color: #25401d; }
.hm-cell.hm-cheaper-5 { background-color: #5ea83b; color: #1a3414; }
/* Red scale: lightest at small overspend, deepest at ≥80% overspend (≥1.8x). */
.hm-cell.hm-more-expensive-1 { background-color: #f7dfd6; color: #6a3a2b; }
.hm-cell.hm-more-expensive-2 { background-color: #f0c1b1; color: #6a3324; }
.hm-cell.hm-more-expensive-3 { background-color: #e5947b; color: #5a2618; }
.hm-cell.hm-more-expensive-4 { background-color: #d36a4d; color: #471a0f; }
.hm-cell.hm-more-expensive-5 { background-color: #be4729; color: #2e0e07; }
.hm-cell-link {
  display: block;
  padding: 0.5rem 0.5rem;
  color: inherit;
  text-decoration: none;
  line-height: 1.25;
}
.hm-cell-link:hover { background-color: rgba(0, 0, 0, 0.05); }
.hm-cell.hm-empty {
  background-color: #f2f2ee;
  color: #b8b8b0;
  background-image: repeating-linear-gradient(45deg, transparent, transparent 4px, rgba(0,0,0,0.04) 4px, rgba(0,0,0,0.04) 6px);
}
.hm-num { font-variant-numeric: tabular-nums; font-size: 0.95rem; font-weight: 600; display: block; }
.hm-savings { font-size: 0.78rem; font-variant-numeric: tabular-nums; display: block; opacity: 0.85; }
.hm-star { color: #c95d3f; font-size: 0.95rem; }
.hm-totals { text-align: right; font-variant-numeric: tabular-nums; }
.hm-totals small { color: var(--color-muted); display: block; font-size: 0.78rem; }

/* Legend below the heatmap. */
.hm-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: var(--color-muted);
}
.hm-legend-label { font-weight: 500; color: var(--color-fg); }
.hm-legend-gradient {
  display: inline-block;
  height: 0.7rem;
  width: 200px;
  border-radius: 3px;
  background: linear-gradient(
    to right,
    hsl(135, 60%, 60%),
    hsl(135, 60%, 85%),
    #f6f5ec,
    hsl(8, 65%, 80%),
    hsl(8, 65%, 62%)
  );
  border: 1px solid var(--color-border);
}
.hm-legend-tick { font-size: 0.78rem; }
.hm-legend-min::before { content: "←"; margin-right: 0.25em; color: #3f7d4c; }
.hm-legend-max::after  { content: "→"; margin-left: 0.25em; color: #c25240; }
.hm-legend-aside { flex-basis: 100%; font-size: 0.8rem; }

/* =========================================================================
   Composite leaderboard
   ========================================================================= */
.composite-table { width: 100%; font-size: 0.95rem; }
.composite-table th.num, .composite-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.composite-table td.rank { color: var(--color-muted); font-variant-numeric: tabular-nums; }
.composite-table .model-link { font-weight: 600; text-decoration: none; }
.composite-table small { color: var(--color-muted); font-size: 0.82rem; }
.composite-table .rate-pct { color: var(--color-muted); font-size: 0.82rem; margin-left: 0.4em; }
.composite-table .muted { color: var(--color-muted); }
.composite-blurb { color: var(--color-muted); font-size: 0.9rem; }

/* =========================================================================
   Category mini-tables (landing)
   ========================================================================= */
.cat-mini { width: 100%; font-size: 0.85rem; margin-top: 0.5rem; }
.cat-mini th, .cat-mini td { padding: 0.3rem 0.35rem; border-bottom: 1px solid var(--color-border); }
.cat-mini th { font-size: 0.72rem; color: var(--color-muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em; }
.cat-mini th.num, .cat-mini td.num { text-align: right; font-variant-numeric: tabular-nums; }
.cat-mini tbody tr:last-child td { border-bottom: 0; }
.cat-mini a { text-decoration: none; }
.cat-mini a:hover { text-decoration: underline; }
.cat-cta { margin-top: 0.6rem; font-size: 0.85rem; }

/* =========================================================================
   Task page CI bars
   ========================================================================= */
.ci-chart { margin: 1rem 0; }
.ci-svg { width: 100%; max-width: 900px; height: auto; display: block; }
.ci-row { cursor: pointer; }
.ci-row:hover text { fill: var(--color-accent); }
.ci-row-marginal text { fill: var(--color-muted); }
.ci-legend { color: var(--color-muted); font-size: 0.85rem; margin-top: 0.5rem; }
.legend-swatch { display: inline-block; width: 1em; height: 0.7em; vertical-align: middle; margin-right: 0.2em; }
.legend-swatch.legend-solid { background: var(--color-accent); }
.legend-swatch.legend-stripe {
  background: var(--color-accent);
  background-image: repeating-linear-gradient(45deg, transparent, transparent 2px, rgba(255,255,255,0.6) 2px, rgba(255,255,255,0.6) 4px);
  opacity: 0.4;
}

/* =========================================================================
   Cost table on task page
   ========================================================================= */
.cost-table { width: 100%; }
.cost-table th.num, .cost-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.cost-table small { color: var(--color-muted); display: block; font-size: 0.78rem; }
.cost-table .row-anchor { background-color: rgba(201, 93, 63, 0.06); }
.badge {
  display: inline-block;
  padding: 0.05rem 0.45rem;
  font-size: 0.7rem;
  border-radius: 3px;
  margin-left: 0.4em;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  vertical-align: middle;
}
.badge-frontier { background: rgba(201, 93, 63, 0.15); color: #a04a30; }
.savings { color: #3f7d4c; font-weight: 600; }
.more-expensive { color: #c25240; font-weight: 600; font-size: 0.85em; }
.check { color: #3f7d4c; font-weight: 600; }
.task-token-shape { color: var(--color-muted); font-size: 0.85rem; }

/* =========================================================================
   Category page task cards
   ========================================================================= */
.task-card {
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 1rem 1.25rem;
  margin: 1rem 0;
}
.task-card h3 { margin-top: 0; }
.task-card h3 a { text-decoration: none; }
.task-card .task-blurb { color: var(--color-muted); font-size: 0.9rem; }
.task-status { font-style: italic; }
.mini-task-table { width: 100%; font-size: 0.9rem; margin-top: 0.5rem; table-layout: fixed; }
.mini-task-table th.num, .mini-task-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.mini-task-table td.rank { color: var(--color-muted); }
.mini-task-table th { white-space: nowrap; }
.mini-task-table th, .mini-task-table td { width: 25%; }
.more { margin: 0.4rem 0 0; font-size: 0.85rem; }
.row-anchor { background-color: rgba(201, 93, 63, 0.04); }

/* =========================================================================
   Model page
   ========================================================================= */
.scatter-wrapper { max-width: 720px; margin: 1rem 0; }
.scatter-svg { width: 100%; height: auto; display: block; }
.scatter-svg circle { transition: r 0.1s ease; }
.scatter-svg a:hover circle { r: 6; }
.scatter-legend { color: var(--color-muted); font-size: 0.85rem; }
.dot { display: inline-block; width: 0.7em; height: 0.7em; border-radius: 50%; vertical-align: middle; }
.dot-green { background: #3f7d4c; }
.dot-amber { background: #c98a3f; }
.dot-red   { background: #c25240; }
.dot-grey  { background: #9aa6b2; }
.model-task-table { width: 100%; font-size: 0.9rem; }
.model-task-table th.num, .model-task-table td.num { text-align: right; font-variant-numeric: tabular-nums; }

.task-prompts-section { margin-top: 2.5rem; }
.task-prompts-section .prompts-blurb { color: var(--color-muted); font-size: 0.9rem; margin-bottom: 0.75rem; }
.prompt-pair { border: 1px solid var(--color-border); border-radius: 4px; padding: 0.5rem 0.75rem; margin-bottom: 0.6rem; background: #fafaf6; }
.prompt-pair > summary { cursor: pointer; font-size: 0.9rem; }
.prompt-pair > summary code { font-size: 0.82rem; background: #ececdf; padding: 0 0.3rem; border-radius: 2px; }
.prompt-pair > summary .muted { margin-left: 0.4rem; }
.prompt-pair-body { padding-top: 0.5rem; }
.prompt-pair-body h3 { font-size: 0.95rem; margin-top: 0.8rem; margin-bottom: 0.3rem; color: var(--color-muted); }
.prompt-pair-body h3:first-child { margin-top: 0.2rem; }
.prompt-text {
  white-space: pre-wrap;
  font-size: 0.82rem;
  line-height: 1.5;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 3px;
  padding: 0.75rem 0.9rem;
  max-height: 32rem;
  overflow: auto;
}

.confidence-legend {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: #4a4a4a;
  line-height: 1.55;
}
.confidence-legend .cf {
  display: inline-block;
  padding: 0 0.4rem;
  border-radius: 3px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  margin-right: 0.2rem;
}
.confidence-legend .cf-ranked { background: #d9e8d2; color: #2c4a23; }
.confidence-legend .cf-high   { background: #e4eddc; color: #3a4f2b; }
.confidence-legend .cf-medium { background: #f1ecd9; color: #5a4d20; }

/* =========================================================================
   Empty / muted states
   ========================================================================= */
.empty-state {
  background: var(--color-card-bg);
  border: 1px dashed var(--color-border);
  border-radius: 6px;
  padding: 1.5rem;
  text-align: center;
  color: var(--color-muted);
}
.muted { color: var(--color-muted); }

/* =========================================================================
   Rubric
   ========================================================================= */
.rubric {
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 1rem;
  font-size: 0.85rem;
  white-space: pre-wrap;
}

/* =========================================================================
   Hero / lede polish
   ========================================================================= */
.hero { padding: 1rem 0 1.5rem; border-bottom: 1px solid var(--color-border); margin-bottom: 1.5rem; }

/* Footer */
.site-footer {
  border-top: 1px solid var(--color-border);
  background: var(--color-card-bg);
  margin-top: 3rem;
  padding: 2rem 0 1rem;
  font-size: 0.9rem;
}
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 2rem;
}
.footer-col h3 { margin-top: 0; font-size: 1rem; }
.footer-col ul { list-style: none; padding: 0; }
.footer-col li { padding: 0.2rem 0; }
.footer-fineprint { color: var(--color-muted); font-size: 0.85rem; }
.footer-copyright { color: var(--color-muted); margin-top: 1.5rem; text-align: center; font-size: 0.85rem; }
