/* ═══════════════════════════════════════════════════════════════
   quodeq benchmarks

   Loads after blog.css and reuses its paper, type and rules. What
   it adds is what a data page needs and an essay does not: tables,
   a metadata strip, code samples and a results card.
   ═══════════════════════════════════════════════════════════════ */

/* ── Tables ───────────────────────────────────────────────────── */

.bench-table-wrap {
  margin: 0 0 1.75rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.blog-post__body > .bench-table-wrap {
  max-width: none;
}

.bench-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  line-height: 1.45;
}

.bench-table th {
  padding: 0 0.875rem 0.625rem 0;
  border-bottom: 1px solid var(--rule-strong);
  font-family: var(--mono);
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: left;
  vertical-align: bottom;
  color: var(--muted-mono);
}

.bench-table td {
  padding: 0.625rem 0.875rem 0.625rem 0;
  border-bottom: 1px solid var(--rule-soft);
  vertical-align: top;
}

.bench-table th:last-child,
.bench-table td:last-child {
  padding-right: 0;
}

.bench-table .bench-num {
  font-family: var(--mono);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--ink-soft);
}

.bench-table .bench-label {
  color: var(--ink-strong);
}

.bench-table strong {
  font-weight: 700;
  color: var(--accent);
}

.bench-table .bench-label strong {
  color: var(--ink-strong);
}

/* Rows that are quodeq's own, in tables that also list other tools. */
.bench-table .bench-own td {
  background: var(--surface-solid);
}

.bench-table .bench-own td:first-child {
  box-shadow: inset 2px 0 0 var(--accent-line);
  padding-left: 0.75rem;
}

/* ── Data page body ───────────────────────────────────────────── */

.bench-post .blog-post__body > p:first-of-type {
  font-size: inherit;
  line-height: inherit;
  color: inherit;
}

.blog-post__body h3 {
  max-width: 42rem;
  margin: 2.75rem 0 1rem;
  font-size: 1.1875rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.3;
  color: var(--ink-strong);
}

.blog-post__body ul,
.blog-post__body ol {
  margin: 0 0 1.5rem;
  padding-left: 1.25rem;
}

.blog-post__body li {
  margin-bottom: 0.5rem;
}

.blog-post__body li::marker {
  color: var(--accent);
}

.bench-code {
  margin: 0 0 1.5rem;
  padding: 1rem 1.125rem;
  overflow-x: auto;
  border-left: 2px solid var(--accent-line);
  background: var(--surface-solid);
  font-family: var(--mono);
  font-size: 0.8125rem;
  line-height: 1.6;
}

.blog-post__body .bench-code code {
  padding: 0;
  background: none;
  font-size: inherit;
}

/* ── Metadata strip under the title ───────────────────────────── */

.bench-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.875rem 2.25rem;
  margin: 2rem 0 0;
  padding-top: 1.125rem;
  border-top: 1px solid var(--rule);
}

.bench-meta dt {
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted-mono);
}

.bench-meta dd {
  margin: 0.25rem 0 0;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--ink-strong);
}

/* ── Index ────────────────────────────────────────────────────── */

.bench-rules {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.75rem;
  margin-top: 2rem;
  padding: 0.875rem 0;
  border-top: 1px solid var(--rule-soft);
  border-bottom: 1px solid var(--rule-soft);
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-mono);
}

.bench-card {
  display: block;
  margin-top: 2.5rem;
  padding: 2rem 0 2.25rem;
  border-bottom: 1px solid var(--rule-soft);
  color: var(--ink);
  text-decoration: none;
}

.bench-card__meta {
  font-family: var(--mono);
  font-size: 0.69rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.bench-card__title {
  margin: 0.75rem 0 0;
  font-size: clamp(1.625rem, 3vw, 2.125rem);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.1;
}

.bench-card__excerpt {
  max-width: 62ch;
  margin: 0.875rem 0 1.75rem;
  font-size: 1rem;
  line-height: 1.7;
  color: var(--ink-soft);
}

.bench-card .bench-table-wrap {
  max-width: 44rem;
}

.bench-card:hover .bench-card__title {
  color: var(--accent);
}

.bench-next {
  margin: 1.75rem 0 0;
  font-size: 0.9375rem;
  color: var(--muted);
}

@media (max-width: 720px) {
  .bench-table { font-size: 0.8125rem; }
  .bench-table th,
  .bench-table td { padding-right: 0.625rem; }
  .bench-meta { gap: 0.75rem 1.5rem; }
}

/* ═══════════════════════════════════════════════════════════════
   The data page. The essay column is 42rem; a results page gives
   its tables and figure the full shell so the numbers can be read
   across a row without scrolling.
   ═══════════════════════════════════════════════════════════════ */

body {
  --bench-own: #a83a24;
  --bench-other: #1f6fa8;
}

[data-theme="dark"] body {
  --bench-own: #22d3ee;
  --bench-other: #8b95a5;
}

.bench-post .blog-post__head {
  max-width: none;
}

.bench-post .blog-post__body {
  font-size: 1rem;
  line-height: 1.75;
}

.bench-post .blog-post__body > .bench-figure,
.bench-post .blog-post__body > .bench-abstract {
  max-width: none;
}

.bench-figure {
  margin: 2rem 0 2.5rem;
}

.bench-figure .bench-table-wrap {
  margin-bottom: 0;
}

.bench-caption {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.375rem 0.875rem;
  max-width: none;
  margin-bottom: 0.875rem;
  padding-top: 0.75rem;
  border-top: 2px solid var(--ink-strong);
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--ink-soft);
}

.bench-caption__n {
  font-family: var(--mono);
  font-size: 0.69rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.bench-copy {
  margin-left: auto;
  padding: 0.125rem 0.5rem;
  border: 1px solid var(--rule-strong);
  border-radius: 3px;
  background: none;
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-mono);
  cursor: pointer;
}

.bench-copy:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Numbers line up on the right edge; labels on the left. */
.bench-table .bench-th-num,
.bench-table .bench-num {
  text-align: right;
}

.bench-table tbody tr:hover td {
  background: var(--surface-solid);
}

.bench-post .bench-table th {
  cursor: pointer;
  user-select: none;
}

.bench-post .bench-table th:hover,
.bench-post .bench-table th:focus-visible {
  color: var(--accent);
  outline: none;
}

.bench-table th[aria-sort="descending"]::after { content: " \2193"; }
.bench-table th[aria-sort="ascending"]::after { content: " \2191"; }

/* "found / false alarms (score)" cells. */
.bench-pair {
  display: inline-grid;
  grid-template-columns: 2.75em 0.9em 2.75em;
  justify-items: end;
}

.bench-pair__sep {
  justify-self: center;
  color: var(--faint);
}

.bench-pair__score {
  display: inline-block;
  min-width: 3.25em;
  margin-left: 0.5em;
  color: var(--faint);
}

.bench-table strong .bench-pair__score,
.bench-table strong .bench-pair__sep {
  color: inherit;
}

/* ── Abstract and findings ───────────────────────────────────── */

.bench-abstract {
  margin: 0 0 3rem;
  padding: 1.5rem 1.75rem 1.625rem;
  border-left: 2px solid var(--accent-line);
  background: var(--surface-solid);
}

.blog-post__body .bench-abstract h2 {
  display: block;
  margin: 0 0 0.75rem;
  font-family: var(--mono);
  font-size: 0.69rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}

.blog-post__body .bench-abstract h2::after {
  content: none;
}

.bench-abstract p {
  max-width: 68ch;
  margin: 0;
  font-size: 1.0625rem;
  line-height: 1.72;
  color: var(--ink-strong);
}

.bench-findings {
  max-width: 46rem;
}

.bench-findings li {
  margin-bottom: 0.75rem;
  padding-left: 0.25rem;
}

/* ── Headline numbers ────────────────────────────────────────── */

.bench-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
  padding: 1.375rem 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

.bench-stats__v {
  display: block;
  font-size: clamp(1.5rem, 3vw, 2.125rem);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  color: var(--ink-strong);
}

.bench-stats__k {
  display: block;
  margin-top: 0.375rem;
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-mono);
}

.bench-downloads {
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem 1.5rem;
  margin-top: 1.125rem;
  font-family: var(--mono);
  font-size: 0.69rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.bench-downloads a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--accent-line);
}

/* ── Figure 1 ────────────────────────────────────────────────── */

.bench-plot {
  display: block;
  width: 100%;
  max-width: 760px;
  height: auto;
}

.bf-grid { stroke: var(--rule-soft); stroke-width: 1; }
.bf-diag { stroke: var(--faint); stroke-width: 1.5; stroke-dasharray: 5 5; }
.bf-tick { font-family: var(--mono); font-size: 11px; fill: var(--muted-mono); }
.bf-axis { font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; fill: var(--muted-mono); }
.bf-note { font-family: var(--mono); font-size: 10.5px; fill: var(--faint); }
.bf-label { font-size: 12.5px; fill: var(--ink-soft); }
.bf-label--own { font-weight: 700; fill: var(--ink-strong); }
.bf-own { fill: var(--bench-own); stroke: var(--paper); stroke-width: 2; }
.bf-other { fill: var(--bench-other); stroke: var(--paper); stroke-width: 2; }
.bf-hit { fill: transparent; }
.bf-pt:hover .bf-own,
.bf-pt:hover .bf-other { stroke: var(--ink-strong); }
.bf-pt:hover .bf-label { fill: var(--ink-strong); }

.bench-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  margin-top: 0.875rem;
  font-size: 0.8125rem;
  color: var(--ink-soft);
}

.bench-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

@media (max-width: 720px) {
  .bench-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bench-pair { grid-template-columns: 2.4em 0.7em 2.4em; }
}

/* The report numbers its own sections; the essay step counter would
   double them. */
.bench-post .blog-post__step-number {
  display: none;
}

.bench-post .blog-post__body h2 {
  max-width: none;
}

.bench-post .bench-table td:first-child {
  white-space: nowrap;
}

/* Labels sit on the paper, not on the grid or the diagonal behind them. */
.bf-label {
  paint-order: stroke;
  stroke: var(--paper);
  stroke-width: 4px;
  stroke-linejoin: round;
}

/* The way into a report from the index. Outlined, so it reads as the
   next step without shouting over the data above it. */
.bench-card .bench-figure--plot {
  margin: 1.75rem 0 1.75rem;
}

.bench-card__open {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.6875rem 1.125rem;
  border: 1.5px solid var(--accent);
  border-radius: 4px;
  font-size: 0.9375rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--accent);
  transition: background-color 0.15s ease, color 0.15s ease;
}

.bench-card__arrow {
  transition: transform 0.15s ease;
}

.bench-card:hover .bench-card__open,
.bench-card:focus-visible .bench-card__open {
  background: var(--accent);
  color: var(--paper);
}

.bench-card:hover .bench-card__arrow {
  transform: translateX(3px);
}

.bench-card:hover .bench-card__title {
  color: inherit;
}

@media (prefers-reduced-motion: reduce) {
  .bench-card__open,
  .bench-card__arrow { transition: none; }
}

.bench-card__inside {
  display: block;
  margin-top: 0.875rem;
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-mono);
}

/* Figure 1 reused inside an essay: keep it in the reading column. */
.blog-post:not(.bench-post) .blog-post__body > .bench-figure {
  max-width: 42rem;
}

.bench-caption a {
  color: var(--accent);
}

/* Index card: the chart leads, its caption sits underneath as a note,
   and there is no rule above it. */
.bench-figure--foot .bench-caption {
  margin: 0.75rem 0 0;
  padding-top: 0;
  border-top: 0;
  max-width: 760px;
}

.bench-figure--foot .bench-legend {
  margin-top: 0.75rem;
}

.bench-figure--foot .bench-caption {
  margin-top: 1.125rem;
}

.bench-card .bench-figure--plot {
  margin: 1.5rem 0 2rem;
}

/* ── Review fixes ─────────────────────────────────────────────── */

/* Small chart text was set in the faintest ink, under 4.5:1 on paper. */
.bf-note,
.bench-pair__sep,
.bench-pair__score {
  color: var(--muted-mono);
  fill: var(--muted-mono);
}

/* Give the slash equal air on both sides. */
.bench-pair {
  grid-template-columns: 2.75em 1.4em 2.75em;
}

/* Wide tables scroll sideways on a narrow screen. Keep the row label
   in view while they do, and fade the right edge so it is clear there
   is more. */
.bench-table td:first-child,
.bench-table th:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--paper);
}

.bench-table .bench-own td:first-child {
  background: color-mix(in srgb, var(--ink) 4%, var(--paper));
}

.bench-table tbody tr:hover td:first-child {
  background: color-mix(in srgb, var(--ink) 4%, var(--paper));
}

@media (max-width: 860px) {
  .bench-table-wrap {
    mask-image: linear-gradient(to right, #000 calc(100% - 2rem), transparent);
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 2rem), transparent);
    padding-right: 1.5rem;
  }

  .bench-pair { grid-template-columns: 2.4em 1.1em 2.4em; }

  /* The chart keeps a readable size and scrolls instead of shrinking
     its labels to nothing. */
  .bench-figure--plot {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .bench-plot {
    min-width: 620px;
  }

  .bench-caption .bench-copy {
    margin-left: 0;
  }
}

/* ── Index card layout ───────────────────────────────────────────
   Wide screens: the chart on the left, how to read it and the way in
   on the right. Narrow screens: the same pieces stacked, each with
   room around it. */

.bench-card__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.75rem;
  margin-top: 2rem;
}

.bench-card__side {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.bench-card__kicker {
  font-family: var(--mono);
  font-size: 0.69rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.bench-card__read {
  max-width: 34ch;
  margin: 0.75rem 0 0;
  font-size: 1rem;
  line-height: 1.65;
  color: var(--ink-soft);
}

.bench-card__side .bench-legend {
  flex-direction: column;
  gap: 0.625rem;
  margin: 1.5rem 0 0;
  padding: 1.125rem 0;
  border-top: 1px solid var(--rule-soft);
  border-bottom: 1px solid var(--rule-soft);
  width: 100%;
  font-size: 0.875rem;
}

.bench-card__side .bench-card__open {
  margin-top: 2rem;
}

.bench-card__side .bench-card__inside {
  margin-top: 1.125rem;
  line-height: 1.8;
}

@media (min-width: 1000px) {
  .bench-card__grid {
    grid-template-columns: minmax(0, 720px) minmax(0, 1fr);
    gap: 3rem;
    align-items: center;
  }
}

.bf-arrow {
  fill: none;
  stroke: var(--muted-mono);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.bf-note--better {
  font-size: 11.5px;
  letter-spacing: 0.06em;
}

.bench-card__excerpt {
  max-width: 56ch;
  margin: 1rem 0 0;
  font-size: 1.0625rem;
  line-height: 1.65;
}

.bench-card__facts {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem 3rem;
  margin: 2rem 0 0;
  padding: 1.25rem 0;
  border-top: 1px solid var(--rule-soft);
  border-bottom: 1px solid var(--rule-soft);
}

.bench-card__facts dd {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  color: var(--ink-strong);
}

.bench-card__facts dt {
  margin-top: 0.375rem;
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-mono);
}

.bench-card__grid {
  margin-top: 2.75rem;
}

.bench-card__read--note {
  margin-top: 0.875rem;
  font-size: 0.9375rem;
  color: var(--muted);
}

@media (max-width: 720px) {
  .bench-card__facts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem 1.5rem;
  }
}
