/* DNA Synthesis Screening Tracker
 *
 * Design intent: a reference instrument, not an article with a table in it.
 * The table is the product, so it gets the full width and the strongest
 * contrast; prose is support and stays out of its way.
 *
 * The hardest constraint is that most cells currently read "Unverified". If
 * every state is styled with equal weight, 11 grey rows dominate the page and
 * the thing looks broken rather than in-progress. So verified states carry the
 * colour and weight, and unverified recedes almost to the background — present,
 * honest, but not shouting.
 */

:root {
  --bg: #ffffff;
  --bg-sunk: #f7f7f5;
  --surface: #ffffff;
  --line: #e6e5e0;
  --line-strong: #d2d1ca;
  --ink: #16160f;
  --ink-2: #55544c;
  --ink-3: #8f8e85;
  --ink-4: #b5b4ab;

  --accent: #0f5c46;
  --accent-ink: #ffffff;
  --accent-wash: #eaf3ef;

  --pos: #14603f;
  --pos-bg: #e3f1e9;
  --neg: #8a3421;
  --neg-bg: #fbe9e4;
  --warn: #7a5410;
  --warn-bg: #fcf0da;

  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Helvetica, Arial, sans-serif;
  --r: 4px;
  --shell: 1440px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e0f0c;
    --bg-sunk: #141610;
    --surface: #16180f;
    --line: #2a2d22;
    --line-strong: #3b3f31;
    --ink: #eeeee2;
    --ink-2: #a7a698;
    --ink-3: #75746a;
    --ink-4: #55554d;
    --accent: #58c79b;
    --accent-ink: #0b0d08;
    --accent-wash: #14251d;
    --pos: #6fd3a5;
    --pos-bg: #16301f;
    --neg: #e29b88;
    --neg-bg: #331c16;
    --warn: #dcb670;
    --warn-bg: #2d2513;
  }
}

:root[data-theme="dark"] {
  --bg: #0e0f0c;
  --bg-sunk: #141610;
  --surface: #16180f;
  --line: #2a2d22;
  --line-strong: #3b3f31;
  --ink: #eeeee2;
  --ink-2: #a7a698;
  --ink-3: #75746a;
  --ink-4: #55554d;
  --accent: #58c79b;
  --accent-ink: #0b0d08;
  --accent-wash: #14251d;
  --pos: #6fd3a5;
  --pos-bg: #16301f;
  --neg: #e29b88;
  --neg-bg: #331c16;
  --warn: #dcb670;
  --warn-bg: #2d2513;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-underline-offset: 2px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip { position: absolute; left: -9999px; }
.skip:focus { left: .5rem; top: .5rem; z-index: 20; background: var(--accent); color: var(--accent-ink); padding: .6rem 1rem; }

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

/* ------------------------------------------------------------- masthead */

.top {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  position: sticky; top: 0; z-index: 5;
}
.top .wrap {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; height: 52px;
}
.brand {
  font-family: var(--mono);
  font-size: .78rem; font-weight: 600;
  letter-spacing: .09em; text-transform: uppercase;
  color: var(--ink); text-decoration: none;
  display: inline-flex; align-items: center; gap: .5rem;
}
.brand b { color: var(--accent); font-weight: 700; }
.top nav { display: flex; gap: 1.4rem; font-family: var(--mono); font-size: .72rem; letter-spacing: .05em; text-transform: uppercase; }
.top nav a { color: var(--ink-2); text-decoration: none; }
.top nav a:hover { color: var(--accent); }

/* ----------------------------------------------------------------- hero */

.hero { padding: clamp(2.5rem, 6vw, 4.5rem) 0 2rem; border-bottom: 1px solid var(--line); }
.hero .wrap { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: clamp(2rem, 5vw, 5rem); align-items: start; }
@media (max-width: 900px) { .hero .wrap { grid-template-columns: 1fr; gap: 2rem; } }

.eyebrow {
  font-family: var(--mono); font-size: .68rem; letter-spacing: .14em;
  text-transform: uppercase; color: var(--ink-3); margin: 0 0 1.1rem;
}

/* The finding is a number, so the number is the headline. */
.claim { margin: 0; font-size: clamp(1.55rem, 1rem + 2vw, 2.35rem); line-height: 1.18; letter-spacing: -0.02em; font-weight: 600; }
.claim .big {
  display: block;
  font-family: var(--mono);
  font-size: clamp(3.4rem, 2rem + 7vw, 6rem);
  line-height: .9;
  letter-spacing: -0.05em;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: .35rem;
  font-variant-numeric: tabular-nums;
}
.claim .of { color: var(--ink-3); font-weight: 500; }

.lede { color: var(--ink-2); margin: 0 0 1.25rem; font-size: .96rem; }
.lede strong { color: var(--ink); font-weight: 600; }
.hero h1 { font-size: 1.05rem; font-weight: 600; letter-spacing: -0.01em; margin: 0 0 .85rem; }

/* ------------------------------------------------------------ stat strip */

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.tile { padding: .8rem .9rem; border-right: 1px solid var(--line); background: var(--surface); }
.tile:last-child { border-right: 0; }
.tile .n { display: block; font-family: var(--mono); font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.tile .l { display: block; margin-top: .2rem; font-size: .72rem; line-height: 1.35; color: var(--ink-3); }
.tile--flag .n { color: var(--accent); }

/* ------------------------------------------------------------- controls */

.bar { border-bottom: 1px solid var(--line); background: var(--bg-sunk); position: sticky; top: 52px; z-index: 4; }
.bar .wrap { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; min-height: 52px; padding-top: .5rem; padding-bottom: .5rem; }
.bar { display: none; }
body.js .bar { display: block; }

.bar input[type="search"], .bar select {
  font: inherit; font-size: .82rem; padding: .35rem .55rem;
  border: 1px solid var(--line-strong); border-radius: var(--r);
  background: var(--surface); color: var(--ink); min-width: 0;
}
.bar input[type="search"] { flex: 0 1 260px; }
.bar button {
  font: inherit; font-size: .82rem; padding: .35rem .6rem; cursor: pointer;
  border: 1px solid var(--line-strong); border-radius: var(--r);
  background: var(--surface); color: var(--ink-2);
}
.bar button:hover { border-color: var(--accent); color: var(--accent); }
.bar button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.count { margin-left: auto; font-family: var(--mono); font-size: .72rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* Verification progress reads as an instrument gauge, not an apology box. */
.gauge { display: flex; align-items: center; gap: .5rem; font-family: var(--mono); font-size: .7rem; color: var(--ink-3); }
.gauge .track { width: 74px; height: 5px; border-radius: 3px; background: var(--line); overflow: hidden; }
.gauge .fill { display: block; height: 100%; background: var(--accent); }

/* ---------------------------------------------------------------- table */

/* `overflow-x: auto` makes this element the containing block for sticky
 * descendants, so a sticky thead offsets from the WRAPPER rather than the
 * viewport — which parks the header 104px down, on top of the third row.
 * The scroll container is only needed when the table is too wide, so it is
 * switched off above the width where all eight columns fit and the header can
 * stick to the viewport properly. */
.tablewrap { overflow-x: auto; }
@media (min-width: 1120px) { .tablewrap { overflow-x: visible; } }

table { border-collapse: collapse; width: 100%; }
caption { text-align: left; }

thead th {
  position: sticky; top: 104px; z-index: 3;
  background: var(--bg);
  text-align: left; white-space: nowrap;
  font-family: var(--mono); font-size: .64rem; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3);
  padding: .85rem .7rem;
  border-bottom: 1px solid var(--line-strong);
}
thead th:first-child { padding-left: 0; }
body.js thead th[data-sort] { cursor: pointer; user-select: none; }
body.js thead th[data-sort]:hover { color: var(--accent); }
thead th[aria-sort="ascending"]::after { content: "↑"; margin-left: .35em; color: var(--accent); }
thead th[aria-sort="descending"]::after { content: "↓"; margin-left: .35em; color: var(--accent); }

tbody tr { border-bottom: 1px solid var(--line); }
tbody tr:hover { background: var(--bg-sunk); }
tbody tr[hidden] { display: none; }

/* Unverified rows sit back so the substantiated ones carry the page. */
tbody tr[data-verified="0"] { color: var(--ink-3); }
tbody tr[data-verified="0"] .name { font-weight: 450; }

td, tbody th { padding: .62rem .7rem; vertical-align: baseline; font-size: .84rem; }
tbody th.name { text-align: left; font-weight: 600; padding-left: 0; white-space: nowrap; }
tbody th.name a { color: inherit; text-decoration: none; border-bottom: 1px solid var(--line-strong); }
tbody th.name a:hover { color: var(--accent); border-color: var(--accent); }
.geo { color: var(--ink-3); white-space: nowrap; font-size: .8rem; }
.date { font-family: var(--mono); font-size: .74rem; color: var(--ink-3); white-space: nowrap; }

.src {
  margin-left: .45rem; font-family: var(--mono); font-size: .6rem;
  letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-4); cursor: help; border-bottom: 1px dotted var(--ink-4);
}

/* Status cells: monospace so columns align optically and read as data. */
.c span {
  display: inline-block; font-family: var(--mono);
  font-size: .69rem; letter-spacing: .02em; white-space: nowrap;
  padding: .16rem .45rem; border-radius: 3px; font-weight: 600;
}
.c--yes span     { background: var(--pos-bg); color: var(--pos); }
.c--no span      { background: var(--neg-bg); color: var(--neg); }
.c--partial span { background: var(--warn-bg); color: var(--warn); }

/* "Not stated" is a finding, but not an accusation — outlined, never red. */
.c--no-claim span { background: transparent; color: var(--ink-2); border: 1px solid var(--line-strong); font-weight: 500; }

/* "Unverified" is the absence of a finding, so it is nearly silent. */
.c--unknown span { background: transparent; color: var(--ink-4); font-weight: 400; padding-left: 0; }
.c--unknown span::before { content: "—"; }
.c--unknown span { font-size: 0; }
.c--unknown span::before { font-size: .8rem; }

/* ----------------------------------------------------------------- prose */

.below { padding: 3rem 0 1rem; border-top: 1px solid var(--line); margin-top: 2rem; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 2.5rem; }
.below h2 { font-size: .72rem; font-family: var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 .9rem; font-weight: 600; }
.below p { margin: 0 0 .9rem; color: var(--ink-2); font-size: .875rem; max-width: 62ch; }
.below strong { color: var(--ink); }
code { font-family: var(--mono); font-size: .82em; background: var(--bg-sunk); padding: .1em .3em; border-radius: 3px; }

.faq details { border-top: 1px solid var(--line); }
.faq details:last-of-type { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; list-style: none; padding: .7rem 0; display: flex; gap: .6rem; align-items: baseline; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before { content: "+"; font-family: var(--mono); color: var(--accent); }
.faq details[open] summary::before { content: "−"; }
.faq summary h3 { display: inline; margin: 0; font-size: .875rem; font-weight: 600; }
.faq details p { margin: 0 0 .9rem 1.2rem; font-size: .85rem; }

dl dt { font-family: var(--mono); font-size: .74rem; font-weight: 600; margin-top: .8rem; color: var(--ink); }
dl dd { margin: .15rem 0 0; color: var(--ink-2); font-size: .85rem; max-width: 62ch; }
.below ul, .below ol { color: var(--ink-2); font-size: .875rem; max-width: 62ch; padding-left: 1.1rem; }
.below li { margin: .35rem 0; }

/* Methodology page reads as a document, so it gets a measure. */
.doc .wrap { max-width: 760px; }
.doc h1 { font-size: 1.9rem; letter-spacing: -0.02em; margin: 2.5rem 0 1rem; }
.doc h2 { font-size: .72rem; font-family: var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); margin: 2.5rem 0 .8rem; font-weight: 600; }
.doc p, .doc li { color: var(--ink-2); font-size: .93rem; }
.doc p { max-width: 68ch; }
.doc .lede { font-size: 1.05rem; color: var(--ink-2); }

.foot { border-top: 1px solid var(--line); margin-top: 3rem; padding: 1.5rem 0 3rem; font-size: .76rem; color: var(--ink-3); }
.foot p { margin: .25rem 0; }
.foot .wrap { display: flex; flex-wrap: wrap; gap: .5rem 2rem; justify-content: space-between; }

@media (max-width: 700px) {
  thead th { top: 0; }
  .bar { position: static; }
  .top { position: static; }
}
