/* bias-audit.css — /research/ai-bias-audit/ ONLY.
   Loaded by layouts/research/bias-audit.html; every rule is scoped under
   .audit-page so nothing here reaches another page. Tokens come from
   main.css :root. Presentation only: the study's words and numbers are
   gated elsewhere and this file never generates either.

   The motif is the ruler. The study is about floors — what an instrument
   reads when nothing political has changed — so the page's structural
   device is a tick strip: under the hero, under every section heading,
   along the top of every figure plate. */

.audit-page {
  --ab-bench: 57rem;                 /* the measurement bench: container inner width at 960 */
  --ab-plate: linear-gradient(180deg, #17171c 0%, #111116 100%);
  --ab-plate-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.045), 0 2px 14px rgba(0, 0, 0, 0.45);
  --ab-tick: #5a5a6a;
  --ab-tick-strong: #8e8ea0;
}

/* ── Hero plate ─────────────────────────────────────────── */
.audit-page .ab-hero {
  max-width: 46rem;
  margin: 0.5rem auto 2.4rem;
  position: relative;
}
.audit-page .ab-title {
  font-size: clamp(2.5rem, 7.2vw, 4.9rem);
  font-weight: 900;
  line-height: 0.98;
  letter-spacing: -0.045em;
  margin: 0 0 1.4rem;
  text-wrap: balance;
  /* brushed chrome, the same plate the site's other instrument titles are cut from */
  background: linear-gradient(165deg, #f4f4fa 0%, #c2c2cf 34%, #7c7c8a 52%, #dcdce6 70%, #a0a0ae 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: #d8d8e2;
}
.audit-page .ab-title .ab-t { display: block; }
.audit-page .ab-lede {
  font-size: 1.16rem;
  line-height: 1.6;
  color: var(--text-bright);
  margin: 0 0 1.2rem;
  max-width: 44rem;
}
.audit-page .ab-lede b {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.94em;
  color: #fff;
  padding: 0 0.12em;
  background: rgba(204, 0, 0, 0.16);
  border-bottom: 1px solid rgba(204, 0, 0, 0.55);
  border-radius: 2px;
  font-variant-numeric: tabular-nums;
}
.audit-page .ab-meta { margin-bottom: 1.1rem; }
/* the ruler: fine ticks every 8px, a taller one every 40px, the origin marked in red */
.audit-page .ab-ruler {
  height: 14px;
  position: relative;
  border-bottom: 1px solid var(--chrome);
  background:
    repeating-linear-gradient(90deg, var(--ab-tick-strong) 0 1px, transparent 1px 40px) left bottom / 100% 12px no-repeat,
    repeating-linear-gradient(90deg, var(--ab-tick) 0 1px, transparent 1px 8px) left bottom / 100% 5px no-repeat;
}
.audit-page .ab-ruler::after {
  content: '';
  position: absolute;
  left: 0; bottom: -1px;
  width: 60px; height: 2px;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(204, 0, 0, 0.55);
}

/* ── Contents: open, two columns on a wide screen ───────── */
.audit-page .ab-toc summary { letter-spacing: 0.22em; }
/* #TableOfContents is a <nav>, so main.css's top-bar rules (flex ul, centered on phones)
   leak into it; the shared layout hides that behind a closed <details>. Reset here. */
.audit-page .ab-toc #TableOfContents ul { display: block; text-align: left; gap: 0; }
.audit-page .ab-toc #TableOfContents > ul { column-gap: 2.2rem; }
.audit-page .ab-toc li { break-inside: avoid; }
.audit-page .ab-toc a { color: var(--text); }
.audit-page .ab-toc a:hover { color: var(--text-bright); }

/* ── Body copy ──────────────────────────────────────────── */
.audit-page .ab-prose { font-size: 1.04rem; line-height: 1.72; }
.audit-page .ab-prose > p { margin-bottom: 1.35rem; }
.audit-page .ab-prose strong { color: var(--text-bright); }
.audit-page .ab-prose code {
  font-size: 0.84em;
  color: var(--text-bright);
  background: #121217;
}
.audit-page .ab-prose a code { color: #ff5a5a; }
.audit-page .ab-prose em { color: var(--text-bright); }

/* Section headings: no underline, a short ruler beneath instead */
.audit-page .ab-prose h2 {
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin: 3.6rem 0 1.1rem;
  padding: 0 0 0.9rem;
  border-bottom: none;
  position: relative;
  scroll-margin-top: 4.5rem;
}
.audit-page .ab-prose h2::after {
  content: '';
  position: absolute;
  left: 0; bottom: 0;
  width: 161px; height: 11px;
  background:
    repeating-linear-gradient(90deg, var(--ab-tick-strong) 0 1px, transparent 1px 40px) left bottom / 100% 11px no-repeat,
    repeating-linear-gradient(90deg, var(--ab-tick) 0 1px, transparent 1px 8px) left bottom / 100% 5px no-repeat,
    linear-gradient(var(--accent), var(--accent)) left bottom / 40px 2px no-repeat;
  box-shadow: none;
}
.audit-page .ab-prose h2:first-child { margin-top: 0.5rem; }

/* ── The bench: objects that run wider than the reading column ── */
.audit-page .ab-fig,
.audit-page .ab-tablewrap { width: 100%; }
@media (min-width: 62rem) {
  .audit-page .ab-fig,
  .audit-page .ab-tablewrap {
    width: var(--ab-bench);
    margin-left: calc(50% - var(--ab-bench) / 2);
  }
}

/* Figure plates — the four charts */
.audit-page .ab-prose { counter-reset: abfig; }
.audit-page .ab-fig {
  counter-increment: abfig;
  margin: 2.2rem 0 2.6rem;
  padding: 0;
  background: var(--ab-plate);
  border: 1px solid var(--border-chrome);
  border-radius: 6px;
  box-shadow: var(--ab-plate-shadow);
  overflow: hidden;
  position: relative;
}
/* label strip: FIG 01 at left, tick ruler across the top edge */
.audit-page .ab-fig::before {
  content: 'fig. ' counter(abfig, decimal-leading-zero);
  display: block;
  padding: 0.55rem 1rem 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent-text);
  border-bottom: 1px solid var(--border-chrome);
  background:
    repeating-linear-gradient(90deg, var(--ab-tick) 0 1px, transparent 1px 8px) left top / 100% 4px no-repeat,
    linear-gradient(180deg, #1c1c22, #16161a);
}
.audit-page .ab-fig-link {
  display: block;
  padding: 0.9rem 1rem 0.5rem;
  background:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px) 0 0 / 100% 48px,
    #0f0f13;
}
.audit-page .ab-fig-link:hover { text-shadow: none; }
.audit-page .ab-fig-link:focus-visible { outline: 2px solid var(--link-hover); outline-offset: -4px; }
.audit-page .ab-fig img {
  display: block;
  width: 100%;
  height: auto;
  margin: 0;
  border-radius: 3px;
}
.audit-page .ab-fig figcaption {
  padding: 0.75rem 1rem 0.9rem;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  line-height: 1.6;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}
.audit-page .ab-fig figcaption::before {
  content: '';
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent);
  margin: 0 0.6em 0.1em 0;
  vertical-align: middle;
}

/* Table plates — mono numerics, right-aligned, bars under p90/max (set by the page script) */
.audit-page .ab-tablewrap {
  margin: 1.8rem 0 2.2rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--ab-plate);
  border: 1px solid var(--border-chrome);
  border-radius: 6px;
  box-shadow: var(--ab-plate-shadow);
}
.audit-page .ab-prose .ab-tablewrap table {
  display: table;
  width: 100%;
  min-width: 34rem;
  max-width: none;
  margin: 0;
  border-collapse: collapse;
  overflow: visible;
  font-size: 0.92rem;
}
.audit-page .ab-tablewrap th {
  background: linear-gradient(180deg, #1e1e24, #17171c);
  border: none;
  border-bottom: 1px solid var(--border-chrome);
  padding: 0.7rem 0.9rem;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #a8a8b4;
  white-space: nowrap;
}
.audit-page .ab-tablewrap th + th { border-left: 1px solid #24242c; }
.audit-page .ab-tablewrap td {
  border: none;
  border-bottom: 1px solid #1e1e24;
  padding: 0.62rem 0.9rem;
  line-height: 1.5;
  color: var(--text);
  vertical-align: top;
  position: relative;
}
.audit-page .ab-tablewrap td + td {
  border-left: 1px solid rgba(36, 36, 44, 0.7);
  font-family: var(--font-mono);
  font-size: 0.86rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.audit-page .ab-tablewrap td:last-child { color: var(--text-bright); }
.audit-page .ab-tablewrap tbody tr:last-child td { border-bottom: none; }
.audit-page .ab-tablewrap tr:hover td { background: rgba(255, 255, 255, 0.02); }
.audit-page .ab-tablewrap td strong { color: #fff; }
/* an emphasised row (the whole first cell bold) carries a red tick at its left edge */
.audit-page .ab-tablewrap td:first-child > strong:only-child::before,
.audit-page .ab-tablewrap td:first-child > em:only-child::before {
  content: '';
  position: absolute;
  left: 0; top: 0.55rem; bottom: 0.55rem;
  width: 2px;
  background: var(--accent);
}
.audit-page .ab-tablewrap td:first-child > em:only-child::before { background: var(--chrome-light); }
.audit-page .ab-tablewrap td.ab-bar { padding-bottom: 0.95rem; min-width: 5.5rem; }
.audit-page .ab-tablewrap td.ab-bar::after {
  content: '';
  position: absolute;
  left: 0.9rem; right: 0.9rem; bottom: 0.42rem;
  height: 3px;
  border-radius: 1px;
  background: linear-gradient(90deg, var(--chrome-light), var(--accent) 100%);
  width: var(--w, 0%);
  max-width: calc(100% - 1.8rem);
}
/* right-aligned numeric columns keep their bar anchored left of the number cell */
.audit-page .ab-tablewrap td[style*="right"] { text-align: right; }

/* ── Entries: study dossiers and the red-team takeaways ─── */
.audit-page .ab-prose p.ab-entry {
  padding-left: 1.15rem;
  border-left: 2px solid var(--accent-dim);
}
.audit-page .ab-prose p.ab-entry > strong:first-child { color: #fff; }
/* the five takeaways read as plates */
.audit-page .ab-prose #what-this-is-worth-to-somebody-red-teaming-a-model ~ p.ab-entry {
  padding: 0.85rem 1.1rem 0.9rem 1.15rem;
  margin-bottom: 0.75rem;
  background: var(--ab-plate);
  border: 1px solid var(--border-chrome);
  border-left: 3px solid var(--accent);
  border-radius: 0 5px 5px 0;
  box-shadow: var(--ab-plate-shadow);
  font-size: 0.98rem;
  line-height: 1.6;
}

/* ── Lists ──────────────────────────────────────────────── */
/* the methods-section lines are a sequence; numbered on plates */
.audit-page .ab-prose ol {
  list-style: none;
  counter-reset: abstep;
  margin: 1.4rem 0 1.6rem;
  padding: 0;
}
.audit-page .ab-prose ol > li {
  counter-increment: abstep;
  position: relative;
  margin: 0 0 0.6rem;
  padding: 0.8rem 1.1rem 0.8rem 3.6rem;
  background: var(--ab-plate);
  border: 1px solid var(--border-chrome);
  border-radius: 5px;
  box-shadow: var(--ab-plate-shadow);
  line-height: 1.6;
}
.audit-page .ab-prose ol > li::before {
  content: counter(abstep, decimal-leading-zero);
  position: absolute;
  left: 1.05rem; top: 0.9rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent-text);
}
.audit-page .ab-prose ul { padding-left: 0; list-style: none; margin: 1.2rem 0 1.6rem; }
.audit-page .ab-prose ul > li {
  position: relative;
  padding-left: 1.35rem;
  margin: 0 0 0.7rem;
  line-height: 1.62;
}
.audit-page .ab-prose ul > li::before {
  content: '';
  position: absolute;
  left: 0; top: 0.72em;
  width: 8px; height: 2px;
  background: var(--accent);
}

/* ── Mobile ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .audit-page .ab-title { font-size: clamp(2.3rem, 11.5vw, 3rem); }
  .audit-page .ab-lede { font-size: 1.06rem; }
  .audit-page .ab-prose { font-size: 1rem; }
  .audit-page .ab-prose h2 { font-size: 1.45rem; margin-top: 2.8rem; }
  .audit-page .ab-fig { margin: 1.6rem 0 2rem; border-radius: 4px; }
  .audit-page .ab-fig-link { padding: 0.6rem 0.5rem 0.3rem; }
  .audit-page .ab-fig figcaption { padding: 0.6rem 0.75rem 0.75rem; font-size: 0.7rem; }
  .audit-page .ab-prose .ab-tablewrap table { min-width: 0; font-size: 0.86rem; }
  .audit-page .ab-tablewrap th, .audit-page .ab-tablewrap td { padding: 0.55rem 0.6rem; }
  .audit-page .ab-tablewrap td + td { font-size: 0.8rem; }
  /* the plate scrolls sideways on a phone; the bars under p90/max are a desktop reading */
  .audit-page .ab-tablewrap td.ab-bar { padding-bottom: 0.55rem; min-width: 0; }
  .audit-page .ab-tablewrap td.ab-bar::after { display: none; }
  .audit-page .ab-tablewrap td:first-child { min-width: 13rem; }
  .audit-page .ab-prose ol > li { padding-left: 3rem; }
  .audit-page .ab-prose ol > li::before { left: 0.85rem; }
}
@media (min-width: 769px) {
  .audit-page .ab-toc #TableOfContents > ul { columns: 2; }
}

/* ── Quality floor ──────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .audit-page * { transition: none !important; }
}
