/* The Lab — 3 Oct 2026.
 *
 * Kept in its own file rather than appended to components.css, because
 * components.css is shared with the palette work and a stylesheet nobody has
 * to merge is a stylesheet nobody has to rebase.
 *
 * Two constraints carried over from the CSS audit on the header: every text
 * colour is set together with the background it sits on, and nothing relies on
 * a box being tall enough for its content. The verdict list in particular
 * holds sentences of wildly different length, so the pills are inline-flex
 * with their own padding rather than stretched children of a fixed-height row.
 */
.lab-head { margin-bottom: 1.6rem }
.lab-head h2 { margin: .3rem 0 .7rem; line-height: 1.25 }
.lab-lede { max-width: 68ch; color: var(--ink-mid); line-height: 1.65 }
.lab-lede b { color: var(--ink-high) }

/* The tally line replaces four stat tiles.
 *
 * Tiles were the wrong shape for this content on two counts. They made four
 * equal boxes, and the four things in them are not equal in kind — "4
 * corrected" is a verdict about a claim while "10,301 stations" is a fact
 * about the database, and side by side at the same weight the page blurred a
 * conclusion into a count. And they repeated in miniature what the verdict
 * list below says at full size.
 *
 * What replaces them does a job the tiles never did: it introduces the
 * page's colour grammar once, at the top, using the same three tags the
 * verdict cards use. A reader learns the key from the key, and every card
 * below needs no legend of its own. Form carries the relationship. */
.lab-lede-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .5rem 1.4rem;
  margin-top: 1.3rem;
  padding-top: .9rem;
  border-top: 1px solid var(--rule);
}
.lab-tally {
  display: inline-flex;
  align-items: baseline;
  gap: .45rem;
  font-size: .92rem;
  color: var(--ink);
}
.lab-tally b {
  font-family: var(--font-num);
  font-size: 1.5rem;
  line-height: 1;
  color: var(--ink-high);
}
/* A short rule in the tag's own colour, rather than a filled pill: at this
 * size a fill would out-shout the evidence table directly beneath it. */
.lab-tally::before {
  content: '';
  width: .5rem;
  height: .5rem;
  align-self: center;
  border-radius: var(--r-pill);
  background: var(--tally);
}
.lab-v-ok { --tally: var(--band-normal) }
.lab-v-fix { --tally: var(--band-high) }
.lab-v-no { --tally: var(--ink-low) }
.lab-v-gap { --tally: var(--danger-ink) }
.lab-tally-note {
  flex: 1 1 18rem;
  min-width: 0;
  font-size: .82rem;
  color: var(--ink-low);
  line-height: 1.5;
}

/* Section hierarchy. The evidence and the verdicts ARE the argument; the
 * history and the inventory are reference. Rendering all seven headings
 * identically gave the reader no reason to go to the two that matter, which
 * is a relationship failure rather than a cosmetic one. */
.lab-sec--lead > h3 {
  font-size: 1.12rem;
  color: var(--ink);
  border-bottom-color: var(--accent);
  box-shadow: inset 3px 0 0 var(--accent);
  padding-left: .7rem;
  margin-left: -.7rem;
}
.lab-sec:not(.lab-sec--lead) > h3 { color: var(--ink-mid) }

.lab-sec { margin-top: 2.4rem }
.lab-sec > h3 {
  font-size: 1.05rem;
  color: var(--ink-high);
  margin: 0 0 .5rem;
  padding-bottom: .45rem;
  border-bottom: 1px solid var(--rule);
}
.lab-sec > p { max-width: 72ch; color: var(--ink-mid); line-height: 1.65 }

/* ── tables ─────────────────────────────────────────────────────────────── */
.lab-tablewrap { overflow-x: auto; margin: 1rem 0 }
.lab-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-num);
  font-size: .88rem;
  font-variant-numeric: tabular-nums;
}
.lab-table th, .lab-table td {
  padding: .45rem .6rem;
  text-align: right;
  white-space: nowrap;
  border-bottom: 1px solid var(--line-hair);
}
.lab-table thead th {
  color: var(--ink-low);
  font-weight: 600;
  font-size: .74rem;
  text-align: right;
  border-bottom: 1px solid var(--rule);
}
.lab-table tbody th[scope="row"] {
  text-align: left;
  color: var(--ink-mid);
  font-weight: 500;
  font-family: var(--font-ui);
}
.lab-table td { color: var(--ink) }
.lab-delta th, .lab-delta td {
  border-top: 1px solid var(--rule);
  border-bottom: none;
  font-weight: 600;
}
.lab-delta td.up { color: var(--danger-ink) }
.lab-delta td.dn { color: var(--ink-mid) }
.lab-read {
  border-left: 2px solid var(--accent);
  padding-left: .9rem;
  color: var(--ink-mid);
  line-height: 1.65;
  max-width: 72ch;
}

/* ── official statements ────────────────────────────────────────────────── */
.lab-official { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; gap: .5rem }
.lab-official li {
  background: var(--well);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--official);
  border-radius: var(--r-sm);
  padding: .6rem .8rem;
  color: var(--ink);
  line-height: 1.6;
}
.lab-off-when { color: var(--ink-low); font-size: .8rem; margin-bottom: .25rem }
.lab-off-when b { color: var(--ink-mid) }

/* ── verdicts ───────────────────────────────────────────────────────────── */
.lab-verdicts { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; gap: .7rem }
.lab-verdict {
  background: var(--well);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  padding: .85rem 1rem;
  /* No fixed height anywhere: the tag, the heading and the paragraph each
   * want their own height and the box grows to fit them. A box that cannot
   * fit its content shrinks instead of overflowing, which is the failure this
   * whole sheet is written to avoid. */
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .4rem;
}
.lab-verdict.is-strong { background: var(--card-wash) }
.lab-v-head { display: flex }
.lab-v-tag {
  display: inline-flex;
  align-items: center;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: .2rem .5rem;
  border-radius: var(--r-pill);
  border: 1px solid currentColor;
  /* colour is set together with the background it sits on, per the audit */
  background: var(--well);
  color: var(--ink);
}
.lab-v-ok .lab-v-tag { color: var(--ink-inv); background: var(--band-normal); border-color: var(--band-normal) }
.lab-v-fix .lab-v-tag { color: var(--ink-inv); background: var(--band-high); border-color: var(--band-high) }
.lab-v-no .lab-v-tag { color: var(--ink); background: var(--well-dim); border-color: var(--rule-strong) }
.lab-v-gap .lab-v-tag { color: var(--ink-inv); background: var(--danger-ink); border-color: var(--danger-ink) }
.lab-verdict h4 { margin: 0; font-size: .98rem; color: var(--ink-high); line-height: 1.4 }
.lab-verdict p { margin: 0; color: var(--ink-mid); line-height: 1.7; max-width: 74ch }

/* ── system layers ──────────────────────────────────────────────────────── */
.lab-layers { margin: 1.2rem 0 0; padding: 0; list-style: none; counter-reset: lab-layer }
.lab-layer {
  position: relative;
  padding: .9rem 0 .9rem 3.2rem;
  border-bottom: 1px solid var(--line-hair);
  counter-increment: lab-layer;
}
.lab-layer::before {
  content: counter(lab-layer);
  position: absolute;
  left: 0;
  top: .9rem;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 50%;
  background: var(--well-dim);
  border: 1px solid var(--rule-strong);
  color: var(--ink-high);
  font-family: var(--font-num);
  font-size: .85rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lab-layer-k {
  font-size: .7rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: .2rem;
}
.lab-layer h4 { margin: 0 0 .35rem; font-size: .95rem; color: var(--ink-high); line-height: 1.45 }
.lab-layer p { margin: 0; color: var(--ink-mid); line-height: 1.7; max-width: 76ch }
.lab-layer cite {
  display: block;
  margin-top: .45rem;
  font-size: .74rem;
  color: var(--ink-low);
  font-style: normal;
  border-left: 2px solid var(--rule);
  padding-left: .6rem;
}

/* ── history ────────────────────────────────────────────────────────────── */
.lab-history { margin: 1.2rem 0 0; padding: 0; list-style: none }
.lab-history li {
  display: grid;
  grid-template-columns: minmax(7.5rem, 10rem) 1fr;
  gap: 1rem;
  padding: .85rem 0;
  border-bottom: 1px solid var(--line-hair);
}
.lab-h-year {
  font-family: var(--font-num);
  font-size: .82rem;
  color: var(--ink-high);
  line-height: 1.4;
}
.lab-h-body p { margin: 0 0 .35rem; color: var(--ink); line-height: 1.7; max-width: 74ch }
.lab-h-note { color: var(--ink-low); font-size: .86rem }

/* ── inventory ──────────────────────────────────────────────────────────── */
.lab-inv th[scope="row"] { text-align: left; white-space: normal; min-width: 16rem }
.lab-inv-name { color: var(--ink-low); font-size: .78rem; line-height: 1.4 }
.lab-inv code { font-family: var(--font-mono); font-size: .82rem; color: var(--ink-high) }
.lab-inv tr.is-unplaced { background: color-mix(in oklab, var(--danger-ink) 9%, transparent) }
.lab-inv tr.is-stale { background: color-mix(in oklab, var(--ink-low) 8%, transparent) }

/* ── gaps ───────────────────────────────────────────────────────────────── */
.lab-sec-end { border-top: 2px solid var(--rule-strong); padding-top: 1.4rem }
.lab-gaps { margin: .8rem 0 0; padding-left: 1.1rem; color: var(--ink-mid); line-height: 1.7 }
.lab-gaps li { margin-bottom: .45rem; max-width: 76ch }
.lab-foot {
  margin-top: 1rem;
  font-size: .8rem;
  color: var(--ink-low);
  line-height: 1.6;
  max-width: 76ch;
}

@media (max-width: 720px) {
  .lab-history li { grid-template-columns: 1fr; gap: .3rem }
  .lab-layer { padding-left: 2.5rem }
  .lab-layer::before { width: 1.6rem; height: 1.6rem; top: .85rem }
  .lab-table { font-size: .8rem }
}
