/* Onchain Execution Lineage — research interface.
 *
 * Two rules govern this sheet:
 *
 * 1. Monospace is the instrument, sans is the analyst. Anything the verifier
 *    produced — headings, labels, identifiers, statuses, numbers — is set in
 *    mono. Prose that interprets those values is set in sans. The typography
 *    carries the product's own boundary: Rust decides, the site explains.
 *
 * 2. Colour is reserved for evidence. Navigation, structure and links are
 *    achromatic. The only saturated hues on the page are the five verification
 *    statuses, and every status also carries a glyph, its literal name, and a
 *    distinct border treatment, so colour is never the only signal.
 */

:root {
  /* Shell — achromatic. */
  --paper: #f6f6f4;
  --surface: #ffffff;
  --sunk: #edecea;
  --ink: #14161a;
  --graphite: #575e66;
  --faint: #888e96;
  --rule: #dcdad4;
  --rule-strong: #bfbdb6;

  /* Evidence — the only hues. */
  --pass: #1b6b45;
  --fail: #a52a1e;
  --candidate: #855307;
  --unknown: #3f4954;
  --na: #888e96;

  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;

  --wide: 1180px;
  --gutter: 78px;
  --num: tabular-nums slashed-zero;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0f1113;
    --surface: #15181b;
    --sunk: #1c2024;
    --ink: #e8e7e4;
    --graphite: #a9afb7;
    --faint: #8a919b;
    --rule: #2b3035;
    --rule-strong: #414850;

    --pass: #74c39c;
    --fail: #e58d82;
    --candidate: #d5a75c;
    --unknown: #9fabbb;
    --na: #8a919b;
  }
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.6 var(--mono);
  font-variant-numeric: var(--num);
  -webkit-font-smoothing: antialiased;
}

/* Prose is the interpretation layer, and it looks like it. */
p,
li,
dd,
.prose,
.lede,
.note,
.ceiling {
  font-family: var(--sans);
}

.mono,
code {
  font-family: var(--mono);
  font-variant-numeric: var(--num);
}

a {
  color: var(--ink);
  text-decoration-color: var(--rule-strong);
  text-underline-offset: 3px;
}

a:hover {
  text-decoration-color: var(--ink);
}

.skip-link {
  position: absolute;
  left: -9999px;
}

.skip-link:focus {
  left: 12px;
  top: 12px;
  z-index: 10;
  background: var(--surface);
  padding: 8px 12px;
  border: 1px solid var(--ink);
}

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}

/* ---- masthead: a status line, not a banner ----------------------------- */

.masthead {
  border-bottom: 1px solid var(--ink);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 5;
}

.bar {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 0 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  min-height: 54px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  color: inherit;
  padding: 9px 0;
}

.brand-mark {
  font-size: 17px;
  line-height: 1;
  color: var(--ink);
  border: 1px solid var(--ink);
  padding: 3px 5px;
}

.brand strong {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.brand-sub {
  display: block;
  font-size: 10.5px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--faint);
}

.nav {
  display: flex;
  gap: 0;
  flex-wrap: wrap;
}

.nav a {
  padding: 7px 12px;
  font-size: 12.5px;
  letter-spacing: 0.04em;
  text-decoration: none;
  color: var(--graphite);
  border-bottom: 2px solid transparent;
}

.nav a:hover {
  color: var(--ink);
}

.nav a[aria-current="page"] {
  color: var(--ink);
  font-weight: 600;
  border-bottom-color: var(--ink);
}

main {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 26px 22px 72px;
}

main:focus {
  outline: none;
}

/* ---- type -------------------------------------------------------------- */

h1 {
  font-size: 25px;
  line-height: 1.18;
  letter-spacing: -0.02em;
  font-weight: 600;
  margin: 0 0 10px;
}

/* Section registers: a rule, a tick, a label. */
h2 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
  margin: 40px 0 12px;
  padding-top: 11px;
  border-top: 1px solid var(--ink);
  display: flex;
  align-items: baseline;
  gap: 9px;
}

/* A register opening a page needs no rule above it — the subnav or hero
   already drew one. */
h2:first-child,
.hero + h2,
.subnav + h2,
.badges + h2 {
  border-top: 0;
  padding-top: 0;
  margin-top: 14px;
}

h2::before {
  content: "";
  flex: none;
  width: 13px;
  height: 3px;
  background: var(--ink);
  transform: translateY(-3px);
}

h3 {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--faint);
  margin: 24px 0 8px;
}

h4 {
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 6px;
  letter-spacing: 0.01em;
}

p {
  margin: 0 0 11px;
}

.lede {
  font-size: 16px;
  line-height: 1.55;
  color: var(--graphite);
  max-width: 66ch;
}

.prose {
  max-width: 72ch;
  color: var(--graphite);
  font-size: 14.5px;
}

.prose strong {
  color: var(--ink);
  font-weight: 600;
}

.eyebrow {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 9px;
}

.muted {
  color: var(--faint);
}

/* Annotations hang off a rule rather than sitting in a tinted box. */
.note {
  border-left: 2px solid var(--rule-strong);
  padding: 3px 0 3px 14px;
  color: var(--graphite);
  font-size: 13.5px;
  margin: 15px 0;
  max-width: 74ch;
}

.note strong {
  color: var(--ink);
}

.warn {
  border-left-color: var(--candidate);
}

.error {
  border: 1px solid var(--fail);
  border-left-width: 3px;
  padding: 12px 14px;
  color: var(--fail);
  background: var(--surface);
  margin-bottom: 10px;
  font-family: var(--sans);
}

.loading {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 13px;
}

/* ---- hero: header block ------------------------------------------------ */

.hero {
  border-top: 2px solid var(--ink);
  border-bottom: 1px solid var(--rule);
  padding: 16px 0 18px;
  margin-bottom: 26px;
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 18px 0 0;
}

.btn {
  display: inline-block;
  padding: 7px 13px;
  border: 1px solid var(--rule-strong);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.03em;
  cursor: pointer;
}

.btn:hover {
  border-color: var(--ink);
}

.btn-primary {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
  font-weight: 600;
}

/* ---- registers (formerly cards) ---------------------------------------- */

.grid {
  display: grid;
  gap: 0;
  grid-template-columns: repeat(auto-fit, minmax(244px, 1fr));
  margin: 14px 0;
  border-top: 1px solid var(--rule);
  border-left: 1px solid var(--rule);
}

.grid > * {
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

.card {
  background: var(--surface);
  border: 1px solid var(--rule);
  padding: 14px 16px;
  margin-bottom: 12px;
}

.grid .card {
  border: 0;
  margin: 0;
}

.card p {
  font-size: 13.5px;
  color: var(--graphite);
  margin: 0;
}

.card ul {
  margin: 8px 0 0;
  padding-left: 17px;
  font-size: 13.5px;
  color: var(--graphite);
}

.card li {
  margin-bottom: 3px;
}

.card-head {
  display: flex;
  gap: 12px;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 9px;
  margin-bottom: 4px;
}

.card-id {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

/* ---- use-case registers ------------------------------------------------ */

.case-card {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--ink);
  padding: 16px 18px;
  margin-bottom: 12px;
}

.case-card:hover {
  border-color: var(--rule-strong);
  border-left-color: var(--ink);
  background: var(--sunk);
}

.case-head {
  display: flex;
  gap: 10px;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
}

.case-title {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.case-question {
  font-family: var(--sans);
  font-size: 14.5px;
  color: var(--ink);
  margin: 9px 0;
  max-width: 72ch;
}

.badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 8px 0;
}

.badge {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.05em;
  padding: 2px 7px;
  border: 1px solid var(--rule-strong);
  color: var(--graphite);
}

.badge-type {
  border-color: var(--ink);
  color: var(--ink);
  font-weight: 600;
}

.metrics {
  display: flex;
  gap: 0;
  flex-wrap: wrap;
  margin-top: 14px;
  border-top: 1px solid var(--rule);
}

.metrics > div {
  padding: 10px 22px 2px 0;
  margin-right: 22px;
  border-right: 1px solid var(--rule);
}

.metrics > div:last-child {
  border-right: 0;
}

.metric-value {
  display: block;
  font-family: var(--mono);
  font-variant-numeric: var(--num);
  font-size: 21px;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.metric-label {
  display: block;
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
  margin-top: 3px;
}

/* ---- stage chain ------------------------------------------------------- */

.flow {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  /* Top margin reserves room for the boundary label that sits above the strip. */
  margin: 30px 0 10px;
  border-left: 1px solid var(--rule);
}

.flow-stage {
  flex: 1 1 172px;
  min-width: 158px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-left: 0;
  border-bottom-width: 3px;
  padding: 11px 13px 10px;
  position: relative;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.flow-stage[aria-pressed="true"] {
  background: var(--sunk);
  border-bottom-color: var(--ink);
}

.flow-stage:hover {
  background: var(--sunk);
}

/* Observation state, encoded in the bottom rule as well as the badge. */
.stage-observed {
  border-bottom-style: solid;
}
.stage-candidate {
  border-bottom-style: dashed;
}
.stage-unknown {
  border-bottom-style: dotted;
}
.stage-not_applicable {
  border-bottom-style: solid;
  border-bottom-color: var(--rule);
  color: var(--faint);
}

/* The observation boundary: a hard limit drawn into the chain itself. */
.flow-boundary {
  flex: 0 0 0;
  width: 0;
  border-left: 2px dashed var(--ink);
  margin: 0 13px 0 0;
  position: relative;
}

.flow-boundary-label {
  position: absolute;
  bottom: 100%;
  left: 0;
  transform: translate(-50%, -6px);
  white-space: nowrap;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--faint);
  background: var(--paper);
  padding: 0 6px;
}

.flow-name {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.11em;
  color: var(--faint);
  margin-bottom: 6px;
}

.flow-headline {
  display: block;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.45;
  margin-bottom: 8px;
  word-break: break-word;
}

/* ---- status vocabulary ------------------------------------------------- */

.status {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  padding: 2px 7px;
  white-space: nowrap;
}

.status .glyph {
  font-size: 11px;
}

.status-pass {
  border: 1px solid currentColor;
  color: var(--pass);
}

.status-fail {
  border: 3px double currentColor;
  color: var(--fail);
  font-weight: 700;
}

.status-candidate {
  border: 2px dashed currentColor;
  color: var(--candidate);
  font-style: italic;
}

.status-unknown {
  border: 1px dotted currentColor;
  color: var(--unknown);
}

.status-not_applicable {
  border: 1px solid transparent;
  color: var(--na);
  background: color-mix(in srgb, currentColor 10%, transparent);
}

.summary-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 6px 0 20px;
  align-items: center;
}

.summary-row .mono {
  font-size: 13px;
  font-weight: 600;
}

/* ---- tables ------------------------------------------------------------ */

.scroll-x {
  overflow-x: auto;
  max-width: 100%;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--rule);
  background:
    linear-gradient(to right, var(--surface) 30%, transparent),
    linear-gradient(to left, var(--surface) 30%, transparent) 100% 0,
    radial-gradient(farthest-side at 0 50%, rgba(0, 0, 0, 0.09), transparent),
    radial-gradient(farthest-side at 100% 50%, rgba(0, 0, 0, 0.09), transparent)
      100% 0;
  background-repeat: no-repeat;
  background-size: 34px 100%, 34px 100%, 12px 100%, 12px 100%;
  background-attachment: local, local, scroll, scroll;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--mono);
  font-variant-numeric: var(--num);
  font-size: 12.5px;
  background: var(--surface);
}

th,
td {
  text-align: left;
  padding: 7px 12px;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface);
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--faint);
  font-weight: 600;
  border-bottom: 1px solid var(--rule-strong);
}

/* Numeric columns line up on the decimal, always. */
th.num,
td.num {
  text-align: right;
  font-variant-numeric: var(--num);
}

td .status,
td .rel {
  white-space: nowrap;
}

tbody tr:hover {
  background: var(--sunk);
}

tbody tr:last-child td {
  border-bottom: 0;
}

/* Prose inside a data cell drops back to sans and may wrap. */
td.text {
  font-family: var(--sans);
  white-space: normal;
  color: var(--graphite);
  min-width: 22ch;
}

/* ---- identifiers ------------------------------------------------------- */

/* One click selects the whole key — hashes are copied, not read. */
.addr,
.hash,
.fp {
  font-family: var(--mono);
  font-variant-numeric: var(--num);
  user-select: all;
  word-break: break-all;
}

.addr {
  font-size: 12px;
  letter-spacing: -0.01em;
}

.hash {
  font-size: 11.5px;
  color: var(--graphite);
  letter-spacing: -0.01em;
}

/* Route fingerprints are short and compared by eye: give them room. */
.fp {
  font-size: 12px;
  letter-spacing: 0.09em;
  color: var(--graphite);
}

/* A venue is a label, never a verdict — so it never takes a status colour. */
.venue {
  display: inline-block;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.02em;
  color: var(--ink);
  border-bottom: 2px solid var(--rule-strong);
  padding-bottom: 1px;
}

/* ---- key/value registers ----------------------------------------------- */

.kv {
  display: grid;
  grid-template-columns: minmax(140px, 224px) minmax(0, 1fr);
  gap: 0;
  margin: 12px 0 0;
  font-size: 13px;
  border-top: 1px solid var(--rule);
}

.kv dt {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--faint);
  padding: 7px 14px 7px 0;
  border-bottom: 1px solid var(--rule);
}

.kv dd {
  margin: 0;
  padding: 7px 0;
  word-break: break-word;
  border-bottom: 1px solid var(--rule);
  font-family: var(--mono);
  font-variant-numeric: var(--num);
  font-size: 12.5px;
}

/* ---- the ceiling line — signature -------------------------------------- */

/* A claim is never shown without its limit. The rule is hard, the label sits
   in the gutter, and the ceiling text hangs beneath the value it bounds. */
.ceiling {
  display: grid;
  grid-template-columns: var(--gutter) minmax(0, 1fr);
  gap: 0 14px;
  border-top: 1px solid var(--ink);
  margin: 16px 0 0;
  padding-top: 7px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--graphite);
  max-width: 82ch;
}

.ceiling::before {
  content: "CEILING";
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  color: var(--faint);
  text-align: right;
  padding-top: 2px;
}

/* ---- chips, code ------------------------------------------------------- */

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 7px;
}

.chip {
  font-family: var(--mono);
  font-variant-numeric: var(--num);
  font-size: 11px;
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 2px 7px;
  color: var(--graphite);
}

pre {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-left: 2px solid var(--rule-strong);
  padding: 12px 14px;
  overflow-x: auto;
  font-family: var(--mono);
  font-variant-numeric: var(--num);
  font-size: 12px;
  line-height: 1.55;
  max-height: 460px;
}

.ascii {
  color: var(--graphite);
  font-size: 11.5px;
  line-height: 1.4;
  border-left-color: var(--rule);
}

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

.controls {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  margin: 14px 0;
}

.control {
  font-family: var(--mono);
  font-variant-numeric: var(--num);
  font-size: 12px;
  letter-spacing: 0.03em;
  padding: 5px 10px;
  border: 1px solid var(--rule-strong);
  border-radius: 2px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
}

.control:hover {
  border-color: var(--ink);
}

.control[aria-pressed="true"],
.control[aria-current="page"] {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
  font-weight: 600;
}

.subnav {
  display: flex;
  gap: 0;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--ink);
  margin: 16px 0 22px;
}

.subnav a {
  padding: 8px 13px;
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.03em;
  text-decoration: none;
  color: var(--graphite);
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
}

.subnav a:hover {
  color: var(--ink);
}

.subnav a[aria-current="page"] {
  color: var(--ink);
  font-weight: 600;
  border-bottom-color: var(--ink);
}

/* ---- bracket selector -------------------------------------------------- */

.batches {
  display: flex;
  gap: 0;
  flex-wrap: wrap;
  margin: 14px 0 6px;
  border-left: 1px solid var(--rule);
}

.batch {
  font-family: var(--mono);
  font-variant-numeric: var(--num);
  font-size: 13px;
  min-width: 58px;
  padding: 7px 9px 6px;
  border: 1px solid var(--rule);
  border-left: 0;
  border-bottom-width: 3px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  line-height: 1.25;
}

.batch small {
  display: block;
  font-size: 10px;
  letter-spacing: 0.04em;
  margin-top: 2px;
}

.batch:hover {
  background: var(--sunk);
}

.batch[aria-current="page"] {
  background: var(--sunk);
  font-weight: 700;
}

.batch-eligible {
  color: var(--pass);
  border-bottom-color: var(--pass);
  border-bottom-style: solid;
}

.batch-rejected {
  color: var(--graphite);
  border-bottom-color: var(--rule-strong);
  border-bottom-style: dotted;
}

/* ---- bracket strip ----------------------------------------------------- */

.bracket {
  display: flex;
  align-items: stretch;
  gap: 0;
  flex-wrap: wrap;
  margin: 16px 0;
  border-left: 1px solid var(--rule);
}

.leg {
  flex: 1 1 198px;
  border: 1px solid var(--rule);
  border-left: 0;
  background: var(--surface);
  padding: 12px 14px;
  position: relative;
}

.leg::after {
  content: "→";
  position: absolute;
  right: -8px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--faint);
  background: var(--surface);
  z-index: 1;
  font-size: 12px;
  line-height: 1;
  padding: 3px 1px;
}

.leg:last-child::after {
  content: "";
}

.leg-role {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--faint);
}

/* The treatment leg is the one that moved; mark it structurally. */
.leg-anchor {
  border-top: 3px solid var(--rule-strong);
}

.leg-treatment {
  border-top: 3px solid var(--ink);
}

.leg-venue {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 6px 0 3px;
}

.leg-fp {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.09em;
  color: var(--graphite);
  user-select: all;
}

/* ---- relationship map -------------------------------------------------- */

.relmap {
  display: grid;
  grid-template-columns: minmax(158px, 1fr) minmax(190px, 1.3fr) minmax(178px, 1fr);
  gap: 0;
  align-items: stretch;
  border: 1px solid var(--rule);
  border-top: 0;
  background: var(--surface);
  margin: 0;
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.relmap:first-of-type {
  border-top: 1px solid var(--ink);
}

.relmap:hover {
  background: var(--sunk);
}

.relmap[aria-pressed="true"] {
  background: var(--sunk);
  box-shadow: inset 3px 0 0 var(--ink);
}

.relmap > div {
  padding: 12px 14px;
}

.relmap-mid {
  border-left: 1px solid var(--rule);
  border-right: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  text-align: center;
}

.rel-line {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  color: var(--faint);
}

.rel {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.05em;
  padding: 2px 7px;
  border: 1px solid currentColor;
  white-space: nowrap;
}

.rel-same_value {
  color: var(--pass);
}

.rel-value_mismatch {
  color: var(--fail);
  border-width: 3px;
  border-style: double;
}

.rel-candidate_byte_match,
.rel-candidate {
  color: var(--candidate);
  border-style: dashed;
  border-width: 2px;
  font-style: italic;
}

.rel-not_recoverable,
.rel-no_match {
  color: var(--unknown);
  border-style: dotted;
}

.quantity {
  font-family: var(--mono);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* A byte site is a coordinate pair, not a name: the label stays attached to
   the number so an offset can never be read as a field. */
.site-pair {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-bottom: 4px;
}

.site-key {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--faint);
}

.site-val {
  font-family: var(--mono);
  font-variant-numeric: var(--num);
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}

.quantity-sub {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--faint);
  line-height: 1.5;
}

.link-row {
  cursor: pointer;
}

.link-row[aria-selected="true"] {
  box-shadow: inset 3px 0 0 var(--ink);
  background: var(--sunk);
}

/* ---- identification graph ---------------------------------------------- */

.dag-wrap {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-top: 1px solid var(--ink);
  padding: 10px;
  overflow-x: auto;
}

.dag {
  display: block;
  min-width: 680px;
  width: 100%;
  height: auto;
}

.dag-node rect {
  fill: var(--surface);
  stroke: var(--rule-strong);
  stroke-width: 1.5;
  transition:
    stroke 0.45s ease,
    fill 0.45s ease;
}

.dag-node {
  transition: opacity 0.45s ease;
}

.dag-node.is-emphasized rect {
  stroke: var(--ink);
  stroke-width: 2.5;
}

.dag-node.is-dim {
  opacity: 0.3;
}

.dag-node text {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  fill: var(--ink);
}

.dag-node .dag-sub {
  font-size: 9.5px;
  font-weight: 400;
  letter-spacing: -0.01em;
  fill: var(--faint);
}

.dag-node.selectable {
  cursor: pointer;
}

.dag-edge {
  fill: none;
  stroke: var(--graphite);
  stroke-width: 1.5;
  /* Mode changes mutate classes in place; these transitions ARE the
     animation. The global reduced-motion rule disables them. */
  transition:
    opacity 0.45s ease,
    stroke-width 0.45s ease,
    stroke 0.45s ease;
}

/* Arrowheads are filled marks, not stroked outlines. */
.dag-arrow {
  fill: var(--graphite);
  stroke: none;
}

.dag-arrow.is-emphasized {
  fill: var(--ink);
}

.dag-edge.is-emphasized {
  stroke: var(--ink);
  stroke-width: 2.6;
}

.dag-edge.is-dim {
  opacity: 0.2;
}

/* Edge style encodes evidence class; the legend states each one. */
.edge-hypothesized {
  stroke-dasharray: 5 4;
}
.edge-candidate {
  stroke-dasharray: 2 4;
  stroke: var(--candidate);
}
.edge-unobserved {
  stroke-dasharray: 1 5;
  opacity: 0.55;
}
.edge-observed_covariation {
  stroke-dasharray: none;
}
.edge-intervention_supported {
  stroke-dasharray: none;
  stroke-width: 2.6;
  stroke: var(--ink);
}

/* A dot travelling along an emphasized edge: influence flows this way. */
.dag-pulse {
  fill: var(--ink);
  stroke: var(--paper);
  stroke-width: 1;
  pointer-events: none;
}

/* The collider's shared child while a mode selects on it: conditioned-on,
   which is exactly not the same treatment as an intervened node. */
.dag-node.is-conditioned rect {
  stroke: var(--ink);
  stroke-width: 2.5;
  stroke-dasharray: 6 3;
  fill: var(--sunk);
}

/* Induced association between the collider's parents. Arrowless, dashed,
   candidate-coloured and labelled: visibly not a causal edge. */
.dag-induced-group {
  opacity: 1;
  transition: opacity 0.5s ease;
}

.dag-induced-group.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.dag-induced {
  fill: none;
  stroke: var(--candidate);
  stroke-width: 2;
  stroke-dasharray: 2 6;
  stroke-linecap: round;
}

/* Halo so the label stays readable where it crosses its own arc. */
.dag-induced-label,
.dag-do {
  paint-order: stroke;
  stroke: var(--surface);
  stroke-width: 4;
  stroke-linejoin: round;
}

.dag-induced-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.05em;
  fill: var(--candidate);
}

/* The permanent tag on the one assigned quantity. */
.dag-do {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  fill: var(--faint);
}

.control-play {
  font-weight: 600;
}

.dag-boundary {
  stroke: var(--rule-strong);
  stroke-dasharray: 3 5;
}

.dag-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  fill: var(--faint);
}

.legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 10px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--graphite);
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend svg {
  flex: none;
}

/* ---- file loading ------------------------------------------------------ */

.dropzone {
  border: 1px dashed var(--rule-strong);
  padding: 30px 20px;
  text-align: center;
  color: var(--graphite);
  background: var(--surface);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 13px;
}

.dropzone.dragging {
  border-color: var(--ink);
  border-style: solid;
  color: var(--ink);
  background: var(--sunk);
}

.local-badge {
  display: inline-block;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  border: 1px solid var(--rule-strong);
  padding: 3px 8px;
  color: var(--graphite);
  margin-bottom: 12px;
}

/* ---- footer ------------------------------------------------------------ */

.footer {
  border-top: 1px solid var(--ink);
  background: var(--surface);
}

.footer-inner {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 18px 22px 34px;
  font-family: var(--sans);
  font-size: 12.5px;
  color: var(--graphite);
}

.footer-inner p {
  max-width: 86ch;
}

.footer-inner strong {
  color: var(--ink);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.02em;
}

/* ---- home: lighter than the detail views on purpose --------------------
 *
 * Primary action > secondary information > technical detail. The registers
 * used inside a use case (hairline boxes, ruled h2s) read as a terminal panel
 * — appropriate once someone has chosen to go deep, wrong for a first screen.
 * Home uses more whitespace and fewer boxes than everywhere else.
 */

.hero-home {
  border-top: 0;
  border-bottom: 0;
  padding: 28px 0 8px;
  margin-bottom: 8px;
}

.hero-home h1 {
  font-size: 30px;
}

.hero-home .lede {
  font-size: 18px;
  max-width: 58ch;
}

/* ---- minimal execution path (home only) --------------------------------- */

.mini-flow {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  margin: 18px 0 4px;
}

.mini-flow-stop {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.04em;
  padding: 7px 12px;
  border: 1px solid var(--rule);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.mini-flow-stop:hover {
  border-color: var(--rule-strong);
}

.mini-flow-stop[aria-pressed="true"] {
  border-color: var(--ink);
  background: var(--sunk);
  font-weight: 600;
}

.mini-flow-arrow {
  color: var(--faint);
  font-size: 12px;
  padding-left: 16px;
}

.mini-flow-sentence {
  color: var(--graphite);
  font-size: 13.5px;
  max-width: 56ch;
  margin: 8px 0 0;
}

/* ---- explore: a plain grid of cards -------------------------------------- */

.case-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 16px 0;
}

.case-card-plain {
  border-left-width: 3px;
  padding: 14px 16px;
}

.cta-text {
  display: inline-block;
  margin-top: 10px;
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
}

/* ---- docs -------------------------------------------------------------- */

.doc-grid {
  display: grid;
  gap: 0;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin: 12px 0;
  border-top: 1px solid var(--rule);
  border-left: 1px solid var(--rule);
}

.doc-grid > * {
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

.doc-card {
  padding: 13px 15px;
  background: var(--surface);
}

.doc-card h4 {
  margin: 0 0 5px;
}

.doc-card p {
  font-size: 13.5px;
  color: var(--graphite);
  margin: 0;
}

.doc-card ul {
  margin: 0;
  padding-left: 16px;
  font-size: 13px;
  color: var(--graphite);
}

.doc-card li {
  margin-bottom: 3px;
}

.doc-card-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.doc-card-link:hover {
  background: var(--sunk);
}

/* ---- disclosure --------------------------------------------------------
 *
 * Supporting detail hides behind these: full per-request tables, source
 * listings, extended reasoning. The evidence-bearing summary stays visible;
 * the record opens on demand.
 */

.disclosure {
  margin: 14px 0 16px;
}

.disclosure summary {
  cursor: pointer;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--graphite);
  padding: 2px 0;
}

.disclosure summary:hover {
  color: var(--ink);
}

.disclosure[open] > summary {
  color: var(--ink);
  font-weight: 600;
}

.disclosure pre,
.disclosure > .scroll-x,
.disclosure > .controls,
.disclosure > .prose,
.disclosure > .badges,
.disclosure > .note {
  margin-top: 10px;
}

/* ---- identification notation --------------------------------------------
 *
 * The identification argument in symbols rather than paragraphs. It gets the
 * ink treatment because it is the view's central claim, not an aside.
 */

.notation {
  font-size: 13.5px;
  line-height: 1.75;
  color: var(--ink);
  border-left: 2px solid var(--ink);
  max-height: none;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  margin: 0;
}

.notation-walk {
  margin: 12px 0 18px;
  outline: none;
}

.notation-walk:focus-visible {
  box-shadow: inset 0 0 0 2px var(--ink);
}

.notation-status {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--faint);
  margin: 0 0 8px;
}

.notation-controls {
  margin-bottom: 10px;
}

.notation-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.notation-step {
  opacity: 0.55;
}

.notation-step.is-current {
  opacity: 1;
}

.notation-block + .notation-block {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--rule);
}

.notation-role {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--faint);
  margin: 4px 0 0;
}

@media (max-width: 640px) {
  .notation {
    font-size: 12.5px;
  }
}

/* ---- stage checklist (Inspect result header) ----------------------------- */

.checklist {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  list-style: none;
  margin: 12px 0 16px;
  padding: 0;
  font-family: var(--mono);
  font-size: 13px;
}

.checklist li {
  display: flex;
  align-items: center;
}

.checklist-observed {
  color: var(--pass);
}

.checklist-not_applicable {
  color: var(--na);
}

.checklist-unknown {
  color: var(--unknown);
}

.checklist-candidate {
  color: var(--candidate);
}

/* ---- narrow ------------------------------------------------------------ */

@media (max-width: 720px) {
  main {
    padding: 20px 16px 56px;
  }

  /* A wrapped nav would pin three rows to the top of a short viewport. */
  .masthead {
    position: static;
  }

  .bar {
    padding: 0 16px 7px;
    min-height: 0;
    gap: 8px;
  }

  .nav {
    width: 100%;
  }

  .nav a {
    padding: 6px 9px;
    font-size: 12px;
  }

  h1 {
    font-size: 21px;
  }

  .lede {
    font-size: 15px;
  }

  .flow,
  .bracket,
  .batches {
    border-left: 0;
  }

  .flow-boundary {
    flex: 1 1 100%;
    width: auto;
    height: 0;
    border-left: 0;
    border-top: 2px dashed var(--ink);
    margin: 16px 0 22px;
  }

  .flow-boundary-label {
    left: 0;
    bottom: 100%;
    transform: translate(0, -5px);
  }

  .flow-stage,
  .leg {
    flex-basis: 100%;
    border-left: 1px solid var(--rule);
  }

  .leg::after {
    content: "↓";
    right: 50%;
    top: auto;
    bottom: -9px;
    transform: translateX(50%);
  }

  .kv {
    grid-template-columns: 1fr;
  }

  .kv dt {
    border-bottom: 0;
    padding-bottom: 0;
  }

  .relmap {
    grid-template-columns: 1fr;
  }

  .relmap-mid {
    border-left: 0;
    border-right: 0;
    border-top: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
    align-items: flex-start;
    text-align: left;
  }

  .ceiling {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .ceiling::before {
    text-align: left;
  }

  .metrics > div {
    padding-right: 16px;
    margin-right: 16px;
  }

  th,
  td {
    padding: 6px 9px;
  }
}
