/* BIABench site — calm academic minimalism.
   One accent (deep teal), warm near-black on off-white, thin rules, no shadows. */

:root {
  --bg: #ffffff;
  --bg-2: #f4f4f4;
  --text: #111111;
  --text-2: #565656;
  --text-3: #8a8a8a;
  --rule: #d2d2d2;
  --rule-2: #e7e7e7;
  --accent: #111111;
  --accent-2: #000000;
  --heat: 17, 17, 17;          /* rgb of the accent, used for the single-hue scale */
  --thumb: #ececec;
  --serif: "Newsreader", "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: -apple-system, system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
  --measure: 70ch;
  --wide: 1232px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e0e0e;
    --bg-2: #1a1a1a;
    --text: #f2f2f2;
    --text-2: #aeaeae;
    --text-3: #7d7d7d;
    --rule: #343434;
    --rule-2: #232323;
    --accent: #f2f2f2;
    --accent-2: #ffffff;
    --heat: 242, 242, 242;
    --thumb: #232323;
  }
}
:root[data-theme="dark"] {
  --bg: #0e0e0e;
  --bg-2: #1a1a1a;
  --text: #f2f2f2;
  --text-2: #aeaeae;
  --text-3: #7d7d7d;
  --rule: #343434;
  --rule-2: #232323;
  --accent: #f2f2f2;
  --accent-2: #ffffff;
  --heat: 242, 242, 242;
  --thumb: #232323;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } .cite pre::after { transition: none; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 18px;
  line-height: 1.55;
  font-feature-settings: "kern", "liga";
}

/* With a monochrome palette a link cannot be marked by hue, so it carries a rule. */
a { color: var(--accent); text-decoration: none; border-bottom: 1px solid var(--rule); }
a:hover { border-bottom-color: currentColor; }
a:focus-visible, button:focus-visible, th[tabindex]:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 500;
  letter-spacing: -0.005em;
  line-height: 1.15;
  margin: 0;
}
h1 { font-size: clamp(2.4rem, 6vw, 3.6rem); }
/* Uppercase carries more visual weight than mixed case, so the size comes down
   a step and the tracking opens up. */
h2 {
  font-size: clamp(1.4rem, 2.6vw, 1.75rem); margin-bottom: 0.5rem;
  text-transform: uppercase; letter-spacing: 0.05em;
}
h3 { font-size: 1.15rem; margin-bottom: 0.25rem; }
p { margin: 0 0 1rem; max-width: var(--measure); }
code, pre { font-family: var(--mono); font-size: 0.86em; }
code { background: var(--bg-2); padding: 0.05em 0.3em; }
pre {
  background: var(--bg-2);
  border-left: 2px solid var(--rule);
  padding: 0.9rem 1.1rem;
  overflow-x: auto;
  line-height: 1.45;
  max-width: 100%;
}
pre code { background: none; padding: 0; font-size: 1em; }

.wrap { max-width: var(--wide); margin: 0 auto; padding: 0 clamp(1rem, 4vw, 2.5rem); }

/* ---------- header ---------- */
.site-header {
  border-bottom: 1px solid var(--rule);
  background: var(--bg);
}
.site-header .wrap {
  display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
  padding-top: 0.9rem; padding-bottom: 0.9rem; flex-wrap: wrap;
}
.brand { font-family: var(--serif); font-size: 1.25rem; color: var(--text); border: 0; }
.site-nav { display: flex; gap: 1.3rem; flex-wrap: wrap; }
.site-nav a, .theme-toggle {
  font-size: 1rem; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--text-2);
}
.site-nav a:hover { color: var(--text); }
.theme-toggle {
  font-family: inherit; background: none; border: 0;
  border-bottom: 1px solid transparent; padding: 0; cursor: pointer;
}
.theme-toggle:hover { color: var(--text); border-bottom-color: currentColor; }

/* ---------- hero ---------- */
.hero { padding: clamp(2.5rem, 6vw, 4.5rem) 0 clamp(2rem, 4.5vw, 3rem); border-top: 0; }
.hero h1 { margin-bottom: 1.2rem; }
.hero .wrap { text-align: center; }
.hero .lede {
  font-family: var(--serif); font-size: clamp(1.15rem, 2.2vw, 1.4rem); line-height: 1.45;
  max-width: none; margin-left: auto; margin-right: auto; color: var(--text);
  text-wrap: balance;
}
.hero-links { display: flex; gap: 0.6rem; flex-wrap: wrap; justify-content: center; margin-top: 1.8rem; }
.btn {
  display: inline-block; padding: 0.5rem 1rem;
  border: 1px solid var(--text); color: var(--text); font-size: 1rem;
  border-radius: 2px;
}
.btn:hover { background: var(--text); color: var(--bg); border-bottom-color: var(--text); }


/* ---------- sections ---------- */
section { padding: clamp(2rem, 4.5vw, 3.25rem) 0; border-top: 1px solid var(--rule); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.section-head p { margin: 0; color: var(--text-2); }
/* Footnotes span the full column, matching the table or figure they annotate. */
.note { font-size: 0.8rem; color: var(--text-2); max-width: none; margin-top: 0.9rem; }

/* ---------- tabs ---------- */
[hidden] { display: none !important; }
.tabs { display: flex; flex-wrap: wrap; border-bottom: 1px solid var(--rule); margin-bottom: 1.25rem; }
.tab {
  font: inherit; font-size: 1rem; color: var(--text-2);
  background: none; border: 0; border-bottom: 2px solid transparent;
  padding: 0.5rem 0.95rem; margin-bottom: -1px; cursor: pointer;
}
.tab:first-child { padding-left: 0; }
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--text); }

/* ---------- tables ---------- */
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.2rem; margin-bottom: 0.9rem; font-size: 0.8rem; color: var(--text-2); }
.filters label { display: inline-flex; align-items: center; gap: 0.35rem; }
.filters select { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--rule); border-radius: 2px; padding: 0.15rem 0.35rem; }
.filters-status { margin-left: auto; }
.chip { display: inline-block; margin-left: 0.4rem; padding: 0 0.4rem; border: 1px solid var(--rule); border-radius: 2px; font-size: 0.7rem; color: var(--text-2); text-decoration: none; vertical-align: 1px; }
a.chip:hover { color: var(--text); border-color: var(--text); }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table {
  border-collapse: collapse; width: 100%;
  font-size: 0.9rem; font-variant-numeric: tabular-nums;
}
th, td { padding: 0.5rem 0.6rem; text-align: center; white-space: nowrap; border-bottom: 1px solid var(--rule-2); vertical-align: baseline; }
th { font-weight: 600; color: var(--text-2); font-size: 0.9rem; letter-spacing: 0.03em; text-transform: uppercase; border-bottom: 1px solid var(--rule); }
th:first-child, td:first-child, th.left, td.left { text-align: left; }
tbody tr:hover { background: var(--bg-2); }
th[tabindex] { cursor: pointer; user-select: none; }
th[tabindex]:hover { color: var(--text); }
th .arrow { display: inline-block; width: 0.9em; color: var(--accent); }
th[tabindex]:not(.left):not(:first-child)::before { content: ""; display: inline-block; width: 0.9em; }
th[aria-sort="none"] .arrow { visibility: hidden; }
td .harness { font-weight: 600; }
.mark { color: var(--accent); font-weight: 600; }

.rank { color: var(--text-3); font-variant-numeric: tabular-nums; }

/* Cost-versus-outcome scatter */
/* Same type size as the tables; the chart renders at its design width, so 1 unit = 1 px. */
.chart { width: 100%; max-width: 1200px; height: auto; display: block; }
.chart .axis { stroke: var(--rule); stroke-width: 1; }
.chart .tick { fill: var(--text-3); font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.chart .axis-label { fill: var(--text-2); font-size: 0.9rem; }
.chart .front-line { fill: none; stroke: var(--text-3); stroke-width: 1.25; stroke-dasharray: 3 3; }
.chart .pt { fill: var(--bg); stroke: var(--text-3); stroke-width: 1.5; }
.chart .pt.front { fill: var(--text); stroke: var(--text); }
.chart .pt-label { fill: var(--text-3); font-size: 0.9rem; }
.chart .pt-label.front { fill: var(--text); }
/* Reserved width for the billing marker, so it cannot push the digits out of line. */
.mark-slot { display: inline-block; width: 0.62em; text-align: left; }

/* heatmap-like table */
.heat td.v { text-align: center; min-width: 4.6rem; padding: 0.45rem 0.4rem; position: relative; }
.heat td.v span { position: relative; z-index: 1; }
.heat td.v.na { color: var(--text-3); font-style: italic; }
.heat th.v { text-align: center; }
.heat td.lab { white-space: normal; min-width: 12rem; }
.heat tr.group td { padding-top: 1rem; font-family: var(--serif); font-size: 0.9rem; font-variant: normal; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-2); border-bottom: 1px solid var(--rule); text-align: left; }
.legend { display: flex; align-items: center; gap: 0.6rem; margin-top: 0.9rem; font-size: 0.8rem; color: var(--text-2); }
/* six discrete steps of the same alpha scale used in the cells (0.04 .. 0.50); no gradient */
.legend .bar { display: inline-flex; width: 144px; height: 10px; border: 1px solid var(--rule); }
.legend .bar i { flex: 1; }
.legend .bar i:nth-child(1) { background: rgba(var(--heat), 0.04); }
.legend .bar i:nth-child(2) { background: rgba(var(--heat), 0.13); }
.legend .bar i:nth-child(3) { background: rgba(var(--heat), 0.22); }
.legend .bar i:nth-child(4) { background: rgba(var(--heat), 0.32); }
.legend .bar i:nth-child(5) { background: rgba(var(--heat), 0.41); }
.legend .bar i:nth-child(6) { background: rgba(var(--heat), 0.50); }

/* ---------- task gallery ---------- */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 2rem 1.75rem; }
.task {
  border-top: 1px solid var(--rule); padding-top: 0.9rem;
  /* One gap governs every row; .src is pinned to the bottom so the link
     lines up across cards whose titles wrap to different heights. */
  display: flex; flex-direction: column; gap: 0.4rem; height: 100%;
}
.task .thumb {
  aspect-ratio: 1 / 1; width: 100%; background: var(--thumb); display: block;
  object-fit: cover;
}
.task .thumb.placeholder {
  display: flex; align-items: center; justify-content: center;
  font-size: 0.9rem; color: var(--text-3); letter-spacing: 0.06em; text-transform: uppercase;
}
.task h3 { font-size: 1.1rem; margin: 0; }
.task .meta { font-size: 0.9rem; color: var(--text-2); margin: 0; line-height: 1.45; }
.task .meta .dot::before { content: "·"; margin: 0 0.35em; color: var(--text-3); }
.task .diff { font-size: 0.9rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); }
.task .src { font-size: 0.9rem; margin-top: auto; }

/* ---------- get started ---------- */

/* ---------- citation / footer ---------- */
.cite pre { font-size: 0.9rem; position: relative; cursor: pointer; }
.cite pre::after {
  content: "Click to copy"; position: absolute; top: 0.55rem; right: 0.7rem;
  font-family: var(--sans); font-size: 0.9rem; letter-spacing: 0.03em; color: var(--text-3);
  background: var(--bg); padding: 0.05rem 0.4rem; opacity: 0;
  transition: opacity 0.15s ease; pointer-events: none;
}
.cite pre:hover::after, .cite pre:focus-visible::after { opacity: 1; }
.cite pre.copied::after { content: "Copied"; opacity: 1; color: var(--text-2); }
.cite pre.failed::after { content: "Copy failed"; opacity: 1; color: var(--text-2); }
.cite pre:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.site-footer { border-top: 1px solid var(--rule); padding: 2rem 0 3rem; color: var(--text-2); font-size: 1rem; }
.site-footer p { margin-bottom: 0.4rem; }

@media (max-width: 480px) {
  body { font-size: 16px; }
  table { font-size: 0.9rem; }
  th, td { padding: 0.4rem 0.45rem; }
  .gallery { grid-template-columns: 1fr 1fr; gap: 1.5rem 1rem; }
}
@media (max-width: 380px) { .gallery { grid-template-columns: 1fr; } }
@media print { .site-nav, .hero-links { display: none; } }
