/* HWE Bench — global styles
 * Read STYLE.md (.design/branding/hwe-bench/patterns/STYLE.md) before editing.
 */

@import url('tokens.css');
@import url('reset.css');

/* ── base ─────────────────────────────────────────────────────── */

html { font-size: 16px; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--text-lg);
  line-height: var(--lh-lg);
  font-feature-settings: "ss01", "cv11";  /* Inter tabular figures */
  text-rendering: optimizeLegibility;
}

/* ── headings ──────────────────────────────────────────────────── */

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.01em;
}

h1 {
  font-size: var(--text-3xl);
  line-height: var(--lh-3xl);
  margin-top: var(--s-16);
  margin-bottom: var(--s-6);
}
h1.hero {
  font-size: var(--text-hero);
  line-height: var(--lh-hero);
  margin-top: var(--s-20);
  margin-bottom: var(--s-8);
  letter-spacing: -0.02em;
}
h2 {
  font-size: var(--text-2xl);
  line-height: var(--lh-2xl);
  margin-top: var(--s-12);
  margin-bottom: var(--s-4);
}
h3 {
  font-size: var(--text-xl);
  line-height: var(--lh-xl);
  margin-top: var(--s-8);
  margin-bottom: var(--s-3);
}

/* ── prose ─────────────────────────────────────────────────────── */

p { margin: var(--s-6) 0; }
p + p { margin-top: var(--s-4); }

strong { font-weight: 600; }
em { font-style: italic; }

/* mono in prose: numbers, identifiers */
code, kbd, samp, .mono {
  font-family: var(--font-mono);
  font-size: 0.92em;
}

pre {
  background: var(--bg-sunk);
  padding: var(--s-4) var(--s-6);
  margin: var(--s-6) 0;
  font-family: var(--font-mono);
  font-size: var(--text-base);
  line-height: var(--lh-sm);
  overflow-x: auto;
}
pre code { font-size: inherit; }

/* ── links ─────────────────────────────────────────────────────── */

a { color: var(--accent); transition: text-underline-offset 0.1s ease; }
a:hover, a:focus-visible { text-decoration: underline; text-underline-offset: 2px; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
a.ext::after { content: " ↗"; color: var(--ink-muted); }

/* ── layout: page wrapper, nav, footer ─────────────────────────── */

.page {
  max-width: var(--w-page);
  margin: 0 auto;
  padding: 0 var(--s-6);
}

nav.top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: var(--s-6) 0;
  border-bottom: var(--rule-w) solid var(--rule);
  flex-wrap: wrap;
  gap: var(--s-4);
}
nav.top .wordmark {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--text-xl);
  letter-spacing: -0.01em;
}
nav.top .wordmark .alt { color: var(--ink-soft); font-weight: 600; }
nav.top ul {
  display: flex;
  list-style: none;
  gap: var(--s-6);
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0;
}
nav.top ul a { color: var(--ink); }
nav.top ul a[aria-current="page"] { color: var(--accent); }
nav.top .version {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--ink-muted);
  letter-spacing: 0;
  text-transform: none;
}
nav.top .meta {
  display: flex;
  align-items: baseline;
  gap: var(--s-4);
}
nav.top .repo {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--ink-muted);
  letter-spacing: 0;
  text-transform: none;
}
nav.top .repo:hover, nav.top .repo:focus-visible {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 2px;
}
nav.top .repo .star {
  color: var(--ink-muted);
  margin: 0 0.15em 0 0.2em;
  font-size: 0.95em;
}
nav.top .repo:hover .star,
nav.top .repo:focus-visible .star { color: var(--accent); }
nav.top .repo .star-count {
  font-variant-numeric: tabular-nums;
  color: var(--ink-muted);
}
nav.top .repo:hover .star-count,
nav.top .repo:focus-visible .star-count { color: var(--ink); }

footer.bot {
  margin-top: var(--s-24);
  padding: var(--s-8) 0 var(--s-12);
  border-top: var(--rule-w) solid var(--rule);
  color: var(--ink-soft);
  font-size: var(--text-sm);
}
footer.bot .manifesto {
  font-family: var(--font-mono);
  font-style: italic;
  color: var(--ink-muted);
  margin-top: var(--s-3);
  font-size: var(--text-sm);
}

/* ── content widths ────────────────────────────────────────────── */

.prose { max-width: var(--w-prose); }
.wide  { max-width: var(--w-wide); }

/* ── hero ──────────────────────────────────────────────────────── */

.hero-block {
  padding: var(--s-20) 0 var(--s-16);
  max-width: var(--w-wide);
}
.hero-eyebrow {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--s-3);
}
.hero-block h1.hero { margin-top: 0; }
.hero-lede {
  font-size: var(--text-xl);
  line-height: 1.45;
  color: var(--ink-soft);
  max-width: 56ch;
  margin-top: var(--s-6);
}
.hero-thesis {
  margin-top: var(--s-12);
  padding-left: var(--s-6);
  border-left: 3px solid var(--accent);
  font-family: var(--font-mono);
  font-size: var(--text-base);
  color: var(--ink);
  max-width: 60ch;
}
.hero-thesis .label {
  display: block;
  font-size: var(--text-xs);
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--s-2);
}

/* ── section dividers ──────────────────────────────────────────── */

section.section {
  padding-top: var(--s-16);
  padding-bottom: var(--s-8);
  border-top: var(--rule-w) solid var(--rule);
}
section.section:first-of-type { border-top: none; }
section.section .eyebrow {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--s-2);
}

/* ── tables ────────────────────────────────────────────────────── */

table.bench {
  width: 100%;
  margin: var(--s-6) 0 var(--s-12);
  font-size: var(--text-sm);
  font-family: var(--font-body);
}
table.bench thead {
  background: var(--bg-sunk);
  border-bottom: var(--rule-w) solid var(--rule);
}
table.bench th {
  text-align: left;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: var(--text-xs);
  color: var(--ink-soft);
  padding: var(--s-4) var(--s-4);
  white-space: nowrap;
}
table.bench th.num, table.bench td.num {
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
table.bench td {
  padding: var(--s-4) var(--s-4);
  border-bottom: var(--rule-w) solid var(--rule);
  vertical-align: top;
}
table.bench tbody tr:nth-child(even) td { background: rgba(0,0,0,0.012); }
table.bench tbody tr:hover td { background: var(--accent-soft); }

table.bench .model-name { font-family: var(--font-mono); color: var(--ink); }

/* human-baseline row (VexRiscv) — coloured red to flag it as the
 * engineered reference. Sets next to model rows so the reader can
 * read it as one entry of the same kind. */
table.bench tr.human-baseline td,
table.bench tr.human-baseline td .model-name { color: var(--c-human); }
table.bench tr.human-baseline { background: rgba(184, 44, 41, 0.04); }
table.bench tr.human-baseline td:first-child { box-shadow: inset 2px 0 var(--c-human); }

/* baseline V0 — fitness anchor, muted so it reads as a reference, not
 * a competitor. Ink-muted text on a slightly-warmer surface. */
table.bench tr.baseline-row td,
table.bench tr.baseline-row td .model-name { color: var(--ink-muted); font-style: italic; }
table.bench tr.baseline-row { background: rgba(0, 0, 0, 0.025); }
table.bench tr.baseline-row td:first-child { box-shadow: inset 2px 0 var(--ink-muted); }

/* outcome tinting (left-edge accent) */
table.bench tr.outcome-improvement td:first-child { box-shadow: inset 2px 0 var(--success); }
table.bench tr.outcome-broken td:first-child       { box-shadow: inset 2px 0 var(--warning); }

table.bench caption {
  caption-side: top;
  text-align: left;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--ink-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: var(--s-3);
}

/* ── definition list (methodology gates etc.) ──────────────────── */

dl.defs { margin: var(--s-8) 0; }
dl.defs dt {
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--ink);
  margin-top: var(--s-6);
  font-size: var(--text-base);
}
dl.defs dd {
  margin: var(--s-2) 0 0 var(--s-6);
  color: var(--ink-soft);
  font-size: var(--text-base);
  line-height: var(--lh-base);
  max-width: var(--w-prose);
}

/* ── stat row (rank cards / big numbers) ───────────────────────── */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--s-6);
  margin: var(--s-8) 0;
}
.stat {
  padding: var(--s-5) 0;
  border-top: var(--rule-w) solid var(--rule);
}
.stat .label {
  font-size: var(--text-xs);
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--s-2);
}
.stat .value {
  font-family: var(--font-mono);
  font-size: var(--text-2xl);
  color: var(--ink);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.stat .sub {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--ink-soft);
  margin-top: var(--s-2);
}

/* ── charts ────────────────────────────────────────────────────── */

figure.chart {
  margin: var(--s-6) 0 var(--s-12);
  max-width: var(--w-wide);
}
figure.chart svg {
  width: 100%;
  height: auto;
  display: block;
}
figure.chart figcaption {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: var(--s-3);
}
.chart text {
  font-family: var(--font-body);
  font-size: 11px;
  fill: var(--ink-soft);
}
.chart .axis-line { stroke: var(--rule); stroke-width: 1; }
.chart .grid       { stroke: var(--rule); stroke-width: 0.5; stroke-dasharray: 2 3; }
.chart .baseline   { stroke: var(--ink-muted); stroke-width: 1; stroke-dasharray: 4 3; }
.chart .axis-label { font-size: 12px; fill: var(--ink); }
.chart .tick       { font-family: var(--font-mono); font-size: 10px; fill: var(--ink-muted); }
.chart .point      { stroke: var(--bg); stroke-width: 2; }
.chart .label      { font-family: var(--font-mono); font-size: 11px; font-weight: 500; }

/* ── responsive ────────────────────────────────────────────────── */

@media (max-width: 720px) {
  body { font-size: var(--text-base); }
  h1.hero { font-size: 2.5rem; }
  h1 { font-size: 2rem; }
  h2 { font-size: 1.5rem; }
  nav.top { flex-direction: column; align-items: flex-start; }
  nav.top ul { gap: var(--s-4); flex-wrap: wrap; }
  table.bench { font-size: var(--text-xs); }
  table.bench th, table.bench td { padding: var(--s-3) var(--s-2); }
  .hero-block { padding: var(--s-12) 0 var(--s-8); }
}
