/* ============================================================
   GBM Gene Network — stylesheet
   Design language: a stained section under the scope.
   Palette is derived from bench reality, not decoration:
     eosin rose   = amplification
     hematoxylin  = deletion
     DAB amber    = mutation
     methyl teal  = epigenetic
   The tick — the oncoprint mark — is the page's structural unit.
   No inline styles anywhere; the page runs under a strict CSP.
   ============================================================ */

/* ---------- 1. fonts ---------- */

@font-face {
  font-family: "Archivo";
  src: url("fonts/archivo-var.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url("fonts/newsreader-var.woff2") format("woff2-variations");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url("fonts/newsreader-var-italic.woff2") format("woff2-variations");
  font-weight: 200 800;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Plex Mono";
  src: url("fonts/plexmono-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Plex Mono";
  src: url("fonts/plexmono-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

/* ---------- 2. tokens ---------- */

:root {
  --ink:      #0b0a12;
  --ink-2:    #131120;
  --ink-3:    #1a1728;
  --rule:     #2a2540;
  --rule-soft:#201c33;

  --bone:     #ede9f5;
  --muted:    #9e97b8;
  --faint:    #6c6689;

  --eosin:    #ff5c8a;
  --hema:     #6e7cff;
  --dab:      #f0a93e;
  --methyl:   #34d8a4;

  --eosin-dim: #4a1f30;
  --hema-dim:  #24284f;
  --dab-dim:   #45341a;
  --methyl-dim:#12402f;

  --display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --body: "Newsreader", Georgia, "Times New Roman", serif;
  --mono: "Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --measure: 34rem;
  --gutter: clamp(1.15rem, 4vw, 3rem);
  --rhythm: clamp(3.5rem, 8vw, 6.5rem);

  --tick-w: 5px;
  --tick-h: 13px;
  --tick-gap: 2px;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ---------- 3. reset & base ---------- */

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--ink);
  color: var(--bone);
  font-family: var(--body);
  font-size: clamp(1.02rem, 0.55vw + 0.92rem, 1.18rem);
  line-height: 1.66;
  font-variation-settings: "opsz" 16, "wght" 380;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* faint scanline field — the section under transmitted light */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(120% 70% at 50% -10%, rgba(110, 124, 255, 0.09), transparent 60%),
    radial-gradient(90% 55% at 85% 8%, rgba(255, 92, 138, 0.05), transparent 65%);
}

img, svg { max-width: 100%; }

a {
  color: inherit;
  text-decoration-color: var(--faint);
  text-underline-offset: 0.22em;
  text-decoration-thickness: 1px;
  transition: color 0.18s var(--ease), text-decoration-color 0.18s var(--ease);
}
a:hover { color: var(--eosin); text-decoration-color: var(--eosin); }

:focus-visible {
  outline: 2px solid var(--methyl);
  outline-offset: 3px;
  border-radius: 2px;
}

::selection { background: var(--eosin); color: var(--ink); }

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--methyl);
  color: var(--ink);
  padding: 0.7em 1.2em;
  font-family: var(--mono);
  font-size: 0.8rem;
}
.skip:focus { left: 0.5rem; top: 0.5rem; }

.vh {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* ---------- 4. layout shell ---------- */

.shell {
  position: relative;
  z-index: 1;
  width: min(100% - calc(var(--gutter) * 2), 78rem);
  margin-inline: auto;
}

.col {
  width: min(100%, var(--measure));
}

.rail {
  position: fixed;
  top: 0; left: 0;
  height: 2px;
  width: 100%;
  z-index: 60;
  background: var(--rule-soft);
}
.rail__fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--hema), var(--eosin) 60%, var(--dab));
  transform-origin: left;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  padding: 0.62rem 0;
  background: rgba(11, 10, 18, 0.9);
  background: color-mix(in srgb, var(--ink) 88%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--rule-soft);
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}
.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.topbar__brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--bone);
  text-decoration: none;
}
.topbar__brand:hover { color: var(--bone); }
.topbar__mark {
  display: inline-grid;
  grid-template-columns: repeat(3, 3px);
  gap: 2px;
}
.topbar__mark i {
  display: block;
  width: 3px; height: 12px;
  background: var(--rule);
}
.topbar__mark i:nth-child(1) { background: var(--eosin); }
.topbar__mark i:nth-child(3) { background: var(--hema); }
.topbar__meta { display: none; }

@media (min-width: 46rem) {
  .topbar__meta { display: block; }
}

/* ---------- 5. type scale ---------- */

h1, h2, h3, h4 {
  font-family: var(--display);
  font-weight: 700;
  line-height: 1.03;
  margin: 0;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2.5rem, 7.4vw, 5.6rem);
  font-variation-settings: "wdth" 108, "wght" 760;
  letter-spacing: -0.024em;
}

h2 {
  font-size: clamp(1.85rem, 3.9vw, 3rem);
  font-variation-settings: "wdth" 104, "wght" 700;
  letter-spacing: -0.018em;
  margin-block: 0 0.85rem;
}

h3 {
  font-family: var(--display);
  font-size: clamp(1.12rem, 1.5vw, 1.3rem);
  font-variation-settings: "wdth" 96, "wght" 640;
  letter-spacing: -0.005em;
  margin-block: 2.1rem 0.55rem;
}

p { margin-block: 0 1.05em; }
p:last-child { margin-bottom: 0; }

strong { font-variation-settings: "opsz" 16, "wght" 620; color: #fbf9ff; }
em { font-style: italic; }

.lede {
  font-size: clamp(1.16rem, 1.35vw, 1.42rem);
  line-height: 1.52;
  color: #d8d2ea;
  font-variation-settings: "opsz" 24, "wght" 340;
}

/* ---------- 6. eyebrow + tick language ---------- */

.eyebrow {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-family: var(--mono);
  font-size: 0.685rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 1.15rem;
}
.eyebrow b {
  font-weight: 600;
  color: var(--eosin);
}
.eyebrow::after {
  content: "";
  flex: 1;
  height: 1px;
  background: repeating-linear-gradient(90deg, var(--rule) 0 4px, transparent 4px 8px);
}

/* the tick: the page's atomic mark */
.tick {
  display: inline-block;
  width: var(--tick-w);
  height: var(--tick-h);
  background: var(--rule);
  vertical-align: -2px;
}
.tick--amp { background: var(--eosin); }
.tick--del { background: var(--hema); }
.tick--mut { background: var(--dab); }
.tick--epi { background: var(--methyl); }

/* ---------- 7. hero ---------- */

.hero {
  position: relative;
  padding-block: clamp(2rem, 5vw, 4rem) clamp(3rem, 7vw, 5.5rem);
  border-bottom: 1px solid var(--rule-soft);
}

.oncoprint {
  position: relative;
  margin-bottom: clamp(2rem, 4.5vw, 3.4rem);
  border: 1px solid var(--rule-soft);
  background: var(--ink-2);
  padding: 0.9rem 0.9rem 0.7rem;
  overflow: hidden;
}

.oncoprint__caption {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.1rem;
  font-family: var(--mono);
  font-size: 0.63rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 0.75rem;
}

.oncoprint__grid {
  display: grid;
  gap: 0.32rem;
}

.opr {
  display: grid;
  grid-template-columns: 5.4rem 1fr 3rem;
  align-items: center;
  gap: 0.55rem;
}
@media (max-width: 34rem) {
  .opr { grid-template-columns: 4.3rem 1fr 2.7rem; gap: 0.4rem; }
}
.opr__val {
  font-family: var(--mono);
  font-size: 0.66rem;
  color: var(--faint);
  text-align: right;
  transition: color 0.2s var(--ease);
}
.opr:hover .opr__val { color: var(--eosin); }
.opr__label {
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--muted);
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.2s var(--ease);
}
.opr__track {
  display: flex;
  gap: var(--tick-gap);
  height: var(--tick-h);
}
.opr__cell {
  flex: 1 1 0;
  min-width: 0;
  background: var(--ink-3);
  transition: background 0.25s var(--ease), transform 0.25s var(--ease);
}
.opr__cell--amp { background: var(--eosin); }
.opr__cell--del { background: var(--hema); }
.opr__cell--mut { background: var(--dab); }

.opr:hover .opr__label,
.opr:focus-within .opr__label { color: var(--bone); }

.oncoprint__sweep {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(90deg, var(--ink-2) 0 42%, rgba(19, 17, 32, 0) 100%);
  animation: sweep 1.5s var(--ease) forwards;
}
@keyframes sweep {
  to { transform: translateX(105%); }
}

.hero__body {
  display: grid;
  gap: clamp(1.6rem, 3vw, 2.6rem);
}
@media (min-width: 58rem) {
  .hero__body {
    grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
    align-items: end;
  }
}

.hero__dek {
  font-size: clamp(1.1rem, 1.25vw, 1.32rem);
  color: #d5cfe9;
  line-height: 1.55;
  font-variation-settings: "opsz" 22, "wght" 340;
  margin-top: 1.3rem;
}

.byline {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
  margin-top: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
}

.legend {
  display: grid;
  gap: 0.5rem;
  border-left: 1px solid var(--rule);
  padding-left: 1.1rem;
}
.legend__row {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: baseline;
  gap: 0.7rem;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.03em;
  color: var(--muted);
}

/* ---------- 8. verdict panel ---------- */

.verdict {
  border: 1px solid var(--rule);
  border-left: 3px solid var(--eosin);
  background: linear-gradient(180deg, var(--ink-2), var(--ink));
  padding: clamp(1.4rem, 3vw, 2.3rem);
  margin-block: var(--rhythm) 0;
}
.verdict h2 {
  font-size: clamp(1.35rem, 2.2vw, 1.8rem);
  margin-bottom: 0.9rem;
}
.verdict p { max-width: 46rem; }

/* ---------- 9. sections ---------- */

.section {
  padding-block: var(--rhythm) 0;
  scroll-margin-top: 4.5rem;
}
.section > .col > p,
.section > .col > ul,
.section > .col > ol { max-width: var(--measure); }

.section--wide > .col { width: 100%; }

/* ---------- 10. table of contents ---------- */

.toc {
  padding-block: var(--rhythm) 0;
}
.toc__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0;
  border-top: 1px solid var(--rule-soft);
}
.toc__item a {
  display: grid;
  grid-template-columns: 2.4rem 1fr auto;
  align-items: baseline;
  gap: 0.9rem;
  padding: 0.72rem 0.3rem;
  border-bottom: 1px solid var(--rule-soft);
  text-decoration: none;
  font-family: var(--display);
  font-variation-settings: "wdth" 98, "wght" 500;
  font-size: 1.02rem;
  color: var(--muted);
  transition: color 0.18s var(--ease), background 0.18s var(--ease), padding-left 0.18s var(--ease);
}
.toc__item a:hover,
.toc__item a:focus-visible {
  color: var(--bone);
  background: var(--ink-2);
  padding-left: 0.8rem;
}
.toc__n {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--faint);
  letter-spacing: 0.05em;
}
.toc__tag {
  font-family: var(--mono);
  font-size: 0.63rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
}
.toc__item a[aria-current="true"] { color: var(--eosin); }
.toc__item a[aria-current="true"] .toc__n { color: var(--eosin); }

/* ---------- 11. epistemic chips ---------- */

.chip {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.59rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.16em 0.5em;
  margin-left: 0.35em;
  border: 1px solid currentColor;
  vertical-align: 0.16em;
  white-space: nowrap;
  user-select: none;
}
.chip--fact { color: var(--methyl); }
.chip--inf { color: var(--hema); }
.chip--con { color: var(--dab); }

.chipkey {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.3rem;
  font-family: var(--mono);
  font-size: 0.66rem;
  color: var(--faint);
  letter-spacing: 0.04em;
  margin-top: 1.4rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--rule-soft);
}

/* ---------- 12. gene cards ---------- */

.genes {
  display: grid;
  gap: 1px;
  background: var(--rule-soft);
  border: 1px solid var(--rule-soft);
  margin-top: 2rem;
}
@media (min-width: 44rem) { .genes { grid-template-columns: 1fr 1fr; } }
@media (min-width: 72rem) { .genes { grid-template-columns: repeat(3, 1fr); } }

.gene {
  background: var(--ink-2);
  padding: 1.35rem 1.3rem 1.45rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  transition: background 0.22s var(--ease);
}
.gene:hover { background: var(--ink-3); }

.gene__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem;
}
.gene__sym {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 1.02rem;
  letter-spacing: 0.01em;
  color: var(--bone);
}
.gene__freq {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--eosin);
}
.gene__prot {
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--faint);
}
.gene__prot b { color: var(--muted); font-weight: 400; }
.gene__txt {
  font-size: 0.95rem;
  line-height: 1.58;
  color: #cec8e2;
  margin: 0;
}
.gene__mode {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: auto;
  padding-top: 0.7rem;
}
.mode {
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  padding: 0.2em 0.5em;
  border: 1px solid var(--rule);
  color: var(--muted);
}
.mode--amp { border-color: var(--eosin-dim); color: var(--eosin); }
.mode--del { border-color: var(--hema-dim); color: var(--hema); }
.mode--mut { border-color: var(--dab-dim); color: var(--dab); }
.mode--epi { border-color: var(--methyl-dim); color: var(--methyl); }

/* ---------- 13. circuit map ---------- */

.circuit {
  margin-top: 2.2rem;
  border: 1px solid var(--rule-soft);
  background: var(--ink-2);
}
.circuit__tabs {
  display: flex;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--rule-soft);
}
.ctab {
  appearance: none;
  background: transparent;
  border: 0;
  border-right: 1px solid var(--rule-soft);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  padding: 0.85rem 1.1rem;
  cursor: pointer;
  transition: color 0.18s var(--ease), background 0.18s var(--ease);
}
.ctab:hover { color: var(--bone); background: var(--ink-3); }
.ctab[aria-selected="true"] {
  color: var(--ink);
  background: var(--bone);
}
.circuit__stage {
  padding: clamp(1rem, 2.5vw, 1.8rem);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.circuit__svg { width: 100%; min-width: 660px; height: auto; display: block; }
.circuit__hint {
  display: none;
  margin: 0;
  padding: 0.55rem clamp(1rem, 2.5vw, 1.8rem) 0;
  font-family: var(--mono);
  font-size: 0.63rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
}
@media (max-width: 46rem) { .circuit__hint { display: block; } }

.cnode rect { fill: var(--ink-3); stroke: var(--rule); stroke-width: 1; }
.cnode text {
  font-family: var(--mono);
  font-size: 11px;
  fill: var(--muted);
  letter-spacing: 0.04em;
}
.cedge { stroke: var(--rule); stroke-width: 1.4; fill: none; }
.cedge--inhibit { stroke-dasharray: 3 3; }

.cnode, .cedge { transition: opacity 0.3s var(--ease); }
.circuit[data-focus="growth"] :not([data-circuit~="growth"]).cnode,
.circuit[data-focus="growth"] :not([data-circuit~="growth"]).cedge,
.circuit[data-focus="p53"] :not([data-circuit~="p53"]).cnode,
.circuit[data-focus="p53"] :not([data-circuit~="p53"]).cedge,
.circuit[data-focus="rb"] :not([data-circuit~="rb"]).cnode,
.circuit[data-focus="rb"] :not([data-circuit~="rb"]).cedge { opacity: 0.16; }

.cnode--growth rect { stroke: var(--eosin-dim); }
.cnode--growth text { fill: var(--eosin); }
.cnode--p53 rect { stroke: var(--dab-dim); }
.cnode--p53 text { fill: var(--dab); }
.cnode--rb rect { stroke: var(--hema-dim); }
.cnode--rb text { fill: var(--hema); }
.cnode--out rect { fill: transparent; stroke-dasharray: 3 3; }

.circuit__note {
  padding: 0 clamp(1rem, 2.5vw, 1.8rem) 1.4rem;
  font-family: var(--mono);
  font-size: 0.7rem;
  line-height: 1.6;
  color: var(--muted);
  max-width: 44rem;
}

/* ---------- 14. diagnosis path ---------- */

.dx {
  margin-top: 2.2rem;
  border: 1px solid var(--rule-soft);
  background: var(--ink-2);
  display: grid;
}
@media (min-width: 52rem) { .dx { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }

.dx__controls {
  padding: clamp(1.1rem, 2.5vw, 1.7rem);
  border-bottom: 1px solid var(--rule-soft);
  display: grid;
  gap: 0.55rem;
  align-content: start;
}
@media (min-width: 52rem) {
  .dx__controls { border-bottom: 0; border-right: 1px solid var(--rule-soft); }
}

.dx__legend {
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 0.5rem;
}

.sw {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.15rem;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.76rem;
  color: var(--muted);
  border-bottom: 1px solid var(--rule-soft);
  transition: color 0.18s var(--ease);
}
.sw:last-of-type { border-bottom: 0; }
.sw:hover { color: var(--bone); }
.sw input {
  appearance: none;
  width: 30px; height: 15px;
  border: 1px solid var(--rule);
  background: var(--ink);
  position: relative;
  cursor: pointer;
  margin: 0;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}
.sw input::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 9px; height: 9px;
  background: var(--faint);
  transition: transform 0.2s var(--ease), background 0.2s var(--ease);
}
.sw input:checked { border-color: var(--methyl); }
.sw input:checked::after { transform: translateX(15px); background: var(--methyl); }
.sw input:disabled { opacity: 0.35; cursor: not-allowed; }
.sw input:disabled + span { opacity: 0.4; }

.dx__out {
  padding: clamp(1.1rem, 2.5vw, 1.7rem);
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  justify-content: center;
}
.dx__name {
  font-family: var(--display);
  font-variation-settings: "wdth" 100, "wght" 700;
  font-size: clamp(1.2rem, 2.2vw, 1.6rem);
  line-height: 1.12;
  color: var(--bone);
}
.dx__grade {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--eosin);
}
.dx__why {
  font-size: 0.95rem;
  color: #cbc5e0;
  margin: 0;
  line-height: 1.55;
}
.dx__disclaimer {
  font-family: var(--mono);
  font-size: 0.62rem;
  line-height: 1.6;
  color: var(--faint);
  letter-spacing: 0.02em;
  border-top: 1px solid var(--rule-soft);
  padding-top: 0.7rem;
}

/* ---------- 15. ladder ---------- */

.ladder {
  margin-top: 2.2rem;
  display: grid;
  gap: 1px;
  background: var(--rule-soft);
  border: 1px solid var(--rule-soft);
}
@media (min-width: 56rem) { .ladder { grid-template-columns: 15rem 1fr; } }

.ladder__rungs { display: grid; gap: 1px; background: var(--rule-soft); align-content: start; }
.rung {
  appearance: none;
  border: 0;
  background: var(--ink-2);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-align: left;
  padding: 0.75rem 1rem;
  cursor: pointer;
  display: grid;
  grid-template-columns: 1.5rem 1fr;
  gap: 0.6rem;
  align-items: center;
  transition: background 0.18s var(--ease), color 0.18s var(--ease);
}
.rung:hover { background: var(--ink-3); color: var(--bone); }
.rung b { color: var(--faint); font-weight: 400; }
.rung[aria-selected="true"] { background: var(--bone); color: var(--ink); }
.rung[aria-selected="true"] b { color: var(--ink); }

.ladder__panel {
  background: var(--ink-2);
  padding: clamp(1.2rem, 2.6vw, 1.9rem);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  min-height: 15rem;
}
.ladder__title {
  font-family: var(--display);
  font-variation-settings: "wdth" 100, "wght" 680;
  font-size: 1.28rem;
  color: var(--bone);
}
.ladder__assay {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--methyl);
}
.ladder__can, .ladder__cant { margin: 0; font-size: 0.97rem; line-height: 1.58; }
.ladder__cant { color: var(--muted); border-left: 2px solid var(--dab); padding-left: 0.85rem; }

/* ---------- 16. frequency chart ---------- */

.freq {
  margin-top: 2.2rem;
  display: grid;
  gap: 0.62rem;
}
.fbar {
  display: grid;
  grid-template-columns: 9.5rem 1fr 3.2rem;
  align-items: center;
  gap: 0.75rem;
}
@media (max-width: 34rem) {
  .fbar { grid-template-columns: 7rem 1fr 2.9rem; gap: 0.5rem; }
}
.fbar__name {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fbar__track {
  height: 11px;
  background: var(--ink-3);
  position: relative;
  overflow: hidden;
}
.fbar__fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: var(--eosin);
  transition: width 1s var(--ease);
}
.fbar[data-kind="del"] .fbar__fill { background: var(--hema); }
.fbar[data-kind="mut"] .fbar__fill { background: var(--dab); }
.fbar[data-kind="epi"] .fbar__fill { background: var(--methyl); }
.fbar__val {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--bone);
  text-align: right;
}

/* ---------- 17. states grid ---------- */

.states {
  margin-top: 2rem;
  display: grid;
  gap: 1px;
  background: var(--rule-soft);
  border: 1px solid var(--rule-soft);
}
@media (min-width: 40rem) { .states { grid-template-columns: 1fr 1fr; } }

.state {
  background: var(--ink-2);
  padding: 1.3rem;
  display: grid;
  gap: 0.4rem;
}
.state__n {
  font-family: var(--display);
  font-variation-settings: "wdth" 100, "wght" 700;
  font-size: 1.1rem;
  color: var(--bone);
}
.state__g {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--eosin);
  letter-spacing: 0.05em;
}
.state__d { font-size: 0.94rem; color: #c9c3de; margin: 0; line-height: 1.55; }

/* ---------- 18. timeline ---------- */

.timeline {
  margin-top: 2rem;
  border-top: 1px solid var(--rule-soft);
}
.tev {
  display: grid;
  grid-template-columns: 4.2rem 1fr;
  gap: 1rem;
  padding: 1rem 0.2rem;
  border-bottom: 1px solid var(--rule-soft);
}
@media (min-width: 46rem) {
  .tev { grid-template-columns: 5rem 1fr 12rem; }
}
.tev__y {
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--eosin);
  letter-spacing: 0.02em;
}
.tev__t { margin: 0; font-size: 0.98rem; line-height: 1.55; }
.tev__s {
  font-family: var(--mono);
  font-size: 0.65rem;
  color: var(--faint);
  letter-spacing: 0.04em;
  align-self: center;
}

/* ---------- 19. tables ---------- */

.tbl-wrap { overflow-x: auto; margin-top: 1.9rem; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.94rem;
}
th, td {
  text-align: left;
  padding: 0.66rem 0.85rem 0.66rem 0;
  border-bottom: 1px solid var(--rule-soft);
  vertical-align: top;
}
th {
  font-family: var(--mono);
  font-size: 0.64rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 400;
  border-bottom-color: var(--rule);
}
td code, p code, li code {
  font-family: var(--mono);
  font-size: 0.86em;
  color: var(--eosin);
  background: var(--ink-2);
  padding: 0.1em 0.35em;
}

/* ---------- 20. code blocks ---------- */

pre {
  font-family: var(--mono);
  font-size: 0.76rem;
  line-height: 1.65;
  background: var(--ink-2);
  border: 1px solid var(--rule-soft);
  border-left: 2px solid var(--hema);
  padding: 1.05rem 1.2rem;
  overflow-x: auto;
  color: #c6c0dc;
  margin-block: 1.6rem;
}

/* ---------- 21. lists ---------- */

.section ul, .section ol { padding-left: 1.15rem; margin-block: 0 1.15em; }
.section li { margin-bottom: 0.45em; }
.section li::marker { color: var(--faint); }

.pull {
  border-left: 2px solid var(--eosin);
  padding-left: 1.15rem;
  margin-block: 1.8rem;
  font-size: 1.1rem;
  line-height: 1.55;
  color: #ded8f0;
  font-variation-settings: "opsz" 22, "wght" 350;
  max-width: 42rem;
}

/* ---------- 22. sources ---------- */
/* Each <li> holds mixed inline content (title, <br>, <a>, <em>). It must NOT
   be a grid container — otherwise every child node becomes its own grid item
   and the URL falls into the narrow counter column. Block + absolute counter. */

.sources { counter-reset: src; list-style: none; padding: 0; margin-top: 1.8rem; }
.sources li {
  counter-increment: src;
  position: relative;
  padding: 0.72rem 0 0.72rem 2.8rem;
  border-bottom: 1px solid var(--rule-soft);
  font-size: 0.93rem;
  line-height: 1.5;
}
.sources li::before {
  content: counter(src);
  position: absolute;
  left: 0;
  top: 0.72rem;
  width: 2rem;
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--faint);
  padding-top: 0.28em;
}
.sources a {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
  overflow-wrap: anywhere;
  word-break: normal;
  display: inline-block;
  max-width: 100%;
  margin-top: 0.2rem;
}

/* ---------- 23. footer ---------- */

.foot {
  margin-top: var(--rhythm);
  border-top: 1px solid var(--rule);
  padding-block: 2.4rem 3.4rem;
  font-family: var(--mono);
  font-size: 0.7rem;
  line-height: 1.75;
  color: var(--faint);
  letter-spacing: 0.03em;
  display: grid;
  gap: 1.1rem;
}
.foot p { max-width: 46rem; margin: 0; }
.foot__share { display: flex; flex-wrap: wrap; gap: 0.35rem 1rem; align-items: baseline; }
.foot__share a { color: var(--muted); text-decoration-color: var(--rule); }
.foot__share a:hover { color: var(--eosin); }
.foot strong { color: var(--muted); font-weight: 400; }

/* ---------- 24. motion & print ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .oncoprint__sweep { display: none; }
}

@media print {
  body { background: #fff; color: #000; }
  body::before, .rail, .topbar, .oncoprint__sweep { display: none; }
  .oncoprint, .verdict, .gene, .circuit, .dx, .ladder { border-color: #999; background: #fff; }
  a { color: #000; }
}
