/* ============================================================
   Two-input toehold AND gate — the model page
   ------------------------------------------------------------
   Page-local styles for wiki/pages/and-gate-model.html. Nothing
   here is used by another page, and nothing here redefines a
   site token: every colour resolves through style.css's :root.

   The palette rules this page obeys (style.css states them):
     * tier 1 carries structure — ink, paper, the hairlines
     * --cernal-red marks ONE thing per figure, never a category
     * tier 2 accents index a category as TONE, not mass, so a
       figure's fills are the --acc-*-soft tints over --ink
       hairlines. That is the site's "blueprint" register, which
       is what a schematic wants anyway.

   Prefix: .ag-  (and-gate). The TOC builds itself from h2/h3, so
   h4 is free for headings inside a subsection.
   ============================================================ */

/* ---------- the page's own rhythm ---------- */

.ag h2 {
  margin-top: 2.75rem;
}

.ag h3 {
  margin-top: 2.25rem;
  font-size: 1.3rem;
}

.ag h4 {
  margin-top: 1.75rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink);
}

.ag p,
.ag li {
  color: var(--ink-2);
}

/* Running text reads at a paper measure; figures and tables are
   free to use the full column. */
.ag-prose {
  max-width: 68ch;
}

/* ---------- the section crumb and the status pills ---------- */

.ag-crumb {
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 0.35rem;
}

.ag-crumb .no-caps {
  text-transform: none;
  letter-spacing: 0;
}

.ag-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 1rem 0 1.75rem;
}

.ag-pill {
  display: inline-block;
  border: 1px solid var(--ink);
  border-radius: 999px;
  padding: 0.18rem 0.7rem;
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--ink);
  background: var(--paper);
}

/* A section not yet written says so, rather than looking finished. */
.ag-wip {
  border: 1px dashed var(--ink-3);
  border-radius: 2px;
  padding: 0.7rem 0.9rem;
  background: var(--paper-sink);
  font-size: 0.88rem;
  color: var(--ink-3);
}

.ag-wip strong {
  color: var(--ink-2);
}

/* ---------- figures ---------- */

.ag-fig {
  margin: 1.75rem 0;
  max-width: 100%;
  min-width: 0;
}

.ag-fig svg, .ag-fig img.wiki-webp {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  border: 1px solid var(--paper-edge);
  background: var(--paper);
}

.ag-fig figcaption {
  margin-top: 0.6rem;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--ink-3);
}

.ag-fig figcaption b {
  color: var(--ink-2);
}

/* The domain-map schematic's own ink. Set here so the SVG carries
   no literal colours and follows the site tokens. */
.ag-map-fill-const {
  fill: var(--paper-sink);
}

.ag-map-fill-a {
  fill: var(--acc-gold-soft);
}

.ag-map-fill-b {
  fill: var(--acc-blue-soft);
}

.ag-map-fill-stem {
  fill: var(--acc-teal-soft);
}

.ag-map-fill-shared {
  fill: var(--acc-violet-soft);
}

.ag-map-box {
  stroke: var(--ink);
  stroke-width: 2;
}

/* The one signal in this figure: where the ribosome starts. */
.ag-map-start {
  fill: var(--cernal-red-soft);
  stroke: var(--cernal-red);
  stroke-width: 3;
}

.ag-map-rule {
  stroke: var(--ink-3);
  stroke-width: 2;
  stroke-dasharray: 6 5;
}

.ag-map-label {
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 19px;
  fill: var(--ink);
}

.ag-map-sub {
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 16px;
  fill: var(--ink-3);
}

.ag-map-band {
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 20px;
  letter-spacing: 0.08em;
  fill: var(--ink-2);
}

.ag-map-signal {
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 20px;
  fill: var(--cernal-red-deep);
  font-weight: 700;
}

/* ---------- the four-state cartoon (Figure 3.1) ----------
   Generated by tools/figure_and_gate_states.py in the engine repo -- edit the
   generator and paste the output, don't hand-edit the SVG. Classes are st-*
   (state) so they cannot collide with the domain map's ag-map-*.

   SVG text does not wrap, so every label in that figure is kept short and the
   explanation lives in the figcaption. The figure is shown at its natural size
   inside .ag-scroll and scrolls sideways on a narrow screen rather than
   shrinking, because shrinking puts the labels below legible size. */

.ag-fig--states svg, .ag-fig--states img.wiki-webp {
  min-width: 740px;
  border: 0;
}

.st-bb {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2.5;
  stroke-linecap: round;
}

/* A base pair inside a stem. Hairlines: there are a hundred of them and they are
   texture, not data. */
.st-rung {
  stroke: var(--ink);
  stroke-width: 1;
  opacity: 0.55;
}

/* The one element the architecture leaves permanently free. */
.st-toehold {
  fill: none;
  stroke: var(--acc-blue);
  stroke-width: 7;
  stroke-linecap: round;
  opacity: 0.4;
}

/* Trigger A's site: a bracket while it is paired shut, a highlight once open. */
.st-site {
  fill: none;
  stroke: var(--acc-gold);
  stroke-width: 6;
  stroke-linecap: round;
  opacity: 0.55;
}

.st-open {
  fill: none;
  stroke: var(--acc-violet);
  stroke-width: 7;
  stroke-linecap: round;
  opacity: 0.3;
}

.st-rbs {
  fill: var(--acc-violet);
  stroke: var(--ink);
  stroke-width: 0.75;
}

.st-aug {
  fill: var(--cernal-red);
  stroke: var(--cernal-red-deep);
  stroke-width: 0.75;
}

.st-pill-text {
  fill: #fff;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 12px;
  font-weight: 700;
}

/* The two triggers, as separate molecules below the switch. */
.st-trig {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
}

.st-trig--a {
  stroke: var(--acc-gold);
}

.st-trig--b {
  stroke: var(--acc-blue);
}

.st-duplex {
  stroke: var(--ink);
  stroke-width: 1;
  opacity: 0.5;
}

.st-trig-text {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 13px;
}

.st-trig-text--a {
  fill: var(--acc-kraft);
}

.st-trig-text--b {
  fill: var(--pipe-blue-deep);
}

.st-ribo {
  fill: var(--acc-teal-soft);
  stroke: var(--acc-teal);
  stroke-width: 1.25;
}

/* The three unpaired bases facing the start codon across the main stem. Open
   circles rather than a label: what matters is that they are unpaired and that
   there are as many of them as there are bases in the codon opposite. */
.st-bulge {
  fill: var(--paper);
  stroke: var(--ink);
  stroke-width: 1.25;
}

/* The inhibitory hairpin's loop carries no regulatory element, so it is marked
   with its length rather than a name. */
.st-loop {
  fill: var(--paper-sink);
  stroke: var(--ink-3);
  stroke-width: 0.75;
}

.st-pill-text--loop {
  fill: var(--ink-3);
  font-weight: 400;
}

/* A hairpin's name, above it. */
.st-name {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 13px;
  fill: var(--ink);
}

/* One row of short symbols under the baseline, each with a tick up to what it
   names. Everything longer than a symbol lives in the figure's caption, because
   SVG text does not wrap. */
.st-symbol {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 12px;
  fill: var(--ink-2);
}

/* A domain name written along a vertical stem arm. The two hairpins stand 34
   units apart -- that gap is the architecture's a = 0, not a drawing choice --
   so an inner arm has no room for a horizontal label and the text is rotated to
   run along the arm instead. Smaller than .st-symbol because there are eleven
   of them in a panel and they sit close to the rungs. */

.st-domain {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 10px;
  fill: var(--ink-2);
  letter-spacing: 0.02em;
}

.st-lead {
  stroke: var(--ink-3);
  stroke-width: 1;
  stroke-dasharray: 2 3;
}

.st-end {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 12px;
  fill: var(--ink-3);
}

/* The state label, the only place a panel is identified. */
.st-state {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 19px;
  font-weight: 700;
  fill: var(--ink);
  letter-spacing: 0.08em;
}

.st-title {
  font-family: var(--font-sans, system-ui, sans-serif);
  font-size: 15px;
  font-weight: 600;
  fill: var(--ink);
}

.st-caption {
  font-family: var(--font-sans, system-ui, sans-serif);
  font-size: 13px;
  fill: var(--ink-2);
}

.st-divider {
  stroke: var(--paper-edge);
  stroke-width: 1;
}

.st-gene {
  stroke-width: 1;
}

.st-gene--off {
  fill: var(--paper-sink);
  stroke: var(--ink-3);
}

.st-gene--on {
  fill: var(--acc-green-soft);
  stroke: var(--acc-green);
}

.st-gene-text {
  font-family: var(--font-sans, system-ui, sans-serif);
  font-size: 13px;
  font-weight: 600;
  fill: var(--ink-2);
}

.st-tick {
  fill: none;
  stroke: var(--acc-green);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.st-cross,
.st-cross-big {
  fill: none;
  stroke: var(--cernal-red);
  stroke-width: 3;
  stroke-linecap: round;
}

.ag-key .k-toehold {
  background: var(--acc-blue);
  opacity: 0.4;
  border-color: var(--acc-blue);
}

.ag-key .k-site {
  background: var(--acc-violet);
  opacity: 0.55;
  border-color: var(--acc-violet);
}

.ag-key .k-rbs {
  background: var(--acc-violet);
  border-color: var(--ink);
}

/* ---------- a figure's legend, as a row of keys ---------- */

.ag-key {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.1rem;
  margin: 0.75rem 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.82rem;
  color: var(--ink-2);
}

.ag-key li {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--ink-2);
}

.ag-key i {
  width: 0.95rem;
  height: 0.95rem;
  border: 1.5px solid var(--ink);
  flex: 0 0 auto;
}

.ag-key .k-const {
  background: var(--paper-sink);
}

.ag-key .k-a {
  background: var(--acc-gold-soft);
}

.ag-key .k-b {
  background: var(--acc-blue-soft);
}

.ag-key .k-stem {
  background: var(--acc-teal-soft);
}

.ag-key .k-shared {
  background: var(--acc-violet-soft);
}

.ag-key .k-start {
  background: var(--cernal-red-soft);
  border-color: var(--cernal-red);
}

/* ---- the funnel, the tubes and the two windows ---- */

.mt-funnel {
  fill: var(--acc-blue-soft);
  stroke: var(--ink);
  stroke-width: 1.25;
}

/* The two rows that involve folding, which is the figure's point. */
.mt-funnel--fold {
  fill: var(--acc-gold-soft);
}

.mt-tube {
  fill: var(--paper-sink);
  stroke: var(--ink);
  stroke-width: 1.5;
}

.mt-tube--leak {
  fill: var(--cernal-red-soft);
  stroke: var(--cernal-red);
}

.mt-tube--on {
  fill: var(--acc-green-soft);
  stroke: var(--acc-green);
}

.mt-state-big {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 22px;
  font-weight: 700;
  fill: var(--ink);
  letter-spacing: 0.06em;
}

.mt-leak-note {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 12px;
  font-weight: 700;
  fill: var(--cernal-red-deep);
}

.mt-tick {
  stroke: var(--ink);
  stroke-width: 1.25;
}

.mt-aug {
  fill: var(--cernal-red);
  stroke: var(--cernal-red-deep);
  stroke-width: 0.75;
}

/* The wide span is the one the published number is measured over; the narrow one
   is what the filter reads. Drawing them in the same family makes the nesting
   the thing you see first. */
.mt-span {
  stroke: var(--ink);
  stroke-width: 1.5;
}

.mt-span--wide {
  fill: var(--acc-teal-soft);
}

.mt-span--narrow {
  fill: var(--acc-gold-soft);
}

/* ---------- displayed equations ----------
   No maths library: the iGEM wiki forbids external CDNs and these are simple
   enough to set in HTML. The point of the class is that an equation gets its own
   line and its own space, the way the source document sets them, instead of
   being more letters inside a paragraph. */

.ag-eq {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1.4rem 0;
  padding: 0.9rem 1rem;
  background: var(--paper-sink);
  border-left: 3px solid var(--ink);
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 1rem;
  color: var(--ink);
  text-align: center;
  line-height: 2;
}

/* The equation itself scrolls inside its own box, so a long one never widens the
   page and never pushes its number off the right edge. */
.ag-eq-body {
  flex: 1;
  min-width: 0;
  overflow-x: auto;
}

/* Flush right, so an equation can be cited by number the way a figure is. */
.ag-eq-no {
  flex: none;
  font-family: var(--font-display, system-ui, sans-serif);
  font-size: 0.85rem;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.ag-eq i {
  font-style: italic;
}

/* Two equations on one line on a wide screen, stacked on a narrow one. */
.ag-eq-gap {
  display: inline-block;
  width: 3.5rem;
}

@media (max-width: 575.98px) {
  .ag-eq-gap {
    display: block;
    width: 0;
    height: 0.4rem;
  }
}

/* A fraction, without a maths engine: numerator over a rule over denominator. */
.ag-frac {
  display: inline-flex;
  flex-direction: column;
  vertical-align: middle;
  text-align: center;
  line-height: 1.3;
}

.ag-frac > span:first-child {
  border-bottom: 1px solid var(--ink);
  padding: 0 0.4rem 0.1rem;
}

.ag-frac > span:last-child {
  padding: 0.1rem 0.4rem 0;
}

.ag-fig--methods svg,
.ag-fig--methods img.wiki-webp,
.ag-fig--check svg,
.ag-fig--check img.wiki-webp,
.ag-fig--brief svg,
.ag-fig--brief img.wiki-webp {
  min-width: 900px;
  border: 0;
}

.ag-fig > svg,
.ag-fig > img.wiki-webp {
  min-width: 0;
}

.ag-reading-route {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1.25rem 0 2rem;
}

.ag-reading-route a {
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--paper-edge);
  border-radius: 3px;
  background: var(--paper-sink);
  color: var(--ink);
  font-size: 0.9rem;
}

.ag-reading-route a:hover,
.ag-reading-route a:focus-visible {
  border-color: var(--cernal-red);
}

.ag-flow {
  display: grid;
  gap: 1.6rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ag-flow > li {
  position: relative;
  padding: 0.8rem 1rem;
  border: 1px solid var(--paper-edge);
  border-left: 3px solid var(--ink);
  border-radius: 3px;
  background: var(--paper-sink);
}

.ag-flow > li:last-child {
  border-left-color: var(--cernal-red);
}

.ag-flow b,
.ag-flow span {
  display: block;
}

.ag-flow b {
  margin-bottom: 0.2rem;
  font-family: var(--font-display, system-ui, sans-serif);
  color: var(--ink);
}

.ag-flow > li:not(:last-child)::after {
  content: "\2193";
  position: absolute;
  left: 50%;
  bottom: -1.55rem;
  line-height: 1.5rem;
  color: var(--ink-3);
}

.ag-algo-reading { padding: 0.8rem 1rem; margin: 0; font-size: 0.9rem; }
.ag-walkthrough { width: 100%; table-layout: fixed; border-collapse: collapse; }
.ag-walkthrough th, .ag-walkthrough td {
  padding: 0.85rem 1rem;
  vertical-align: top;
  border-top: 1px solid var(--paper-edge);
  text-align: left;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.ag-walkthrough th:first-child { width: 37%; }
.ag-walkthrough td:last-child { background: var(--paper); font-size: 0.94rem; }
.ag-walkthrough code { color: var(--ink); font-size: 0.89rem; white-space: normal; }
.ag-walkthrough .ag-loop td { background: var(--paper-sink); font-size: 0.95rem; }
.ag-walkthrough .ag-indent { padding-left: 1.7rem; }
.ag-step { display: block; color: var(--ink-3); font-size: 0.8rem; margin-bottom: 0.2rem; }

.ag-overview-findings { padding-left: 1.25rem; margin: 1.1rem 0; }
.ag-overview-findings li { margin: 0.75rem 0; padding-left: 0.2rem; }
.ag-walkthrough ul { margin: 0; padding-left: 1.05rem; }
.ag-walkthrough li + li { margin-top: 0.5rem; }
.ag-walkthrough code { line-height: 1.75; }
.ag-quick-key p + p { margin-top: 0.65rem; }
.ag-secondary-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: start;
  gap: 1.25rem;
  margin: 1.8rem 0;
}
.ag-secondary-layout > * { min-width: 0; margin: 0; }
.ag-secondary-example { padding: 0.55rem; background: var(--paper-sink); }
.ag-secondary-example figcaption { font-size: 0.88rem; }
.ag .ag-pseudocode { margin: 0; padding: 0.65rem 1.25rem 1rem 2.5rem; }
.ag-pseudocode li { padding: 0.7rem 0 0.7rem 0.25rem; }
.ag-pseudocode li + li { border-top: 1px solid var(--paper-edge); }
.ag-pseudocode code { display: block; font-size: 0.88rem; line-height: 1.65; color: var(--ink); }
.ag-pseudocode p { margin: 0.35rem 0 0; font-size: 0.93rem; line-height: 1.6; }
.ag-grid-cell { stroke: var(--paper-edge); stroke-width: 1.5; }
.ag-grid-selected { fill: #e5f1ec; stroke: #427761; stroke-width: 2; }
.ag-grid-muted { fill: var(--paper-sink); }
.ag-grid-pick { fill: #235c49; stroke: white; stroke-width: 2; }
.ag-toy-card { fill: var(--paper); stroke: var(--paper-edge); stroke-width: 1.5; }
.ag-toy-base, .ag-toy-conflict {
  font-family: var(--font-mono, monospace); font-size: 24px; font-weight: 650; fill: var(--ink);
}
.ag-toy-conflict { fill: #a02b43; }
.ag-toy-bond { stroke: #35745e; stroke-width: 2.5; }
.ag-toy-backbone { stroke: var(--ink-3); stroke-width: 1.8; fill: none; }
.ag-toy-loop { stroke: var(--ink-3); stroke-width: 1.8; fill: none; stroke-dasharray: 3 4; }
.ag-toy-base-bg { fill: var(--paper); }
.ag-lever-card { fill: var(--paper-sink); stroke: var(--paper-edge); stroke-width: 1.2; }
.ag-lever-base { fill: var(--ink); font: 600 26px var(--font-mono, monospace); }
.ag-lever-edited { fill: var(--cernal-red); }
.ag-toy-missing { fill: none; stroke: #a02b43; stroke-width: 2; }
.ag-secondary-example .mt-note { font-size: 17px; }
.ag-secondary-example .mt-dom { font-size: 19px; }
.ag-secondary-example .mt-title { font-size: 22px; }
.ag-toy-domains { fill: var(--acc-teal, #285b66); font-size: 15px; font-family: var(--font-mono, monospace); }
.ag-toy-footnote { fill: var(--ink-2); font-size: 14px; font-family: var(--font-mono, monospace); }
.ag-energy-selected { background: #e5f1ec; }
.ag-workflow-mobile { display: none; }

@media (max-width: 980px) {
  .ag-secondary-layout { grid-template-columns: minmax(0, 1fr); }
  .ag-secondary-example { max-width: 680px; margin-inline: auto; }
}
@media (max-width: 640px) {
  .ag-walkthrough, .ag-walkthrough tbody, .ag-walkthrough tr, .ag-walkthrough td { display: block; width: auto; }
  .ag-walkthrough thead { display: none; }
  .ag-walkthrough td { padding: 0.8rem; }
  .ag-walkthrough .ag-indent { padding-left: 0.8rem; }
  .ag-walkthrough td + td { border-top: 0; }
  .ag-workflow-desktop { display: none; }
  .ag-workflow-mobile { display: grid; gap: 0.8rem; list-style: none; padding: 0; margin: 0; }
  .ag-workflow-mobile li { padding: 0.8rem; border: 1px solid var(--paper-edge); border-radius: 5px; background: var(--paper); }
  .ag-workflow-mobile p { margin: 0.4rem 0; line-height: 1.5; }
  .ag-workflow-mobile .ag-workflow-record { color: var(--ink-3); font-size: 0.85rem; }
  .ag-workflow-mobile svg { margin: 0.5rem 0; }
}
@media print {
  .ag-secondary-layout { display: block; }
  .ag-pseudocode li { break-inside: avoid; }
  .ag-workflow-mobile { display: none !important; }
  .ag-workflow-desktop { display: block !important; }
  .ag-energy-selected, .ag-grid-selected { print-color-adjust: exact; }
}

.ag-fold-legend {
  display: flex; flex-wrap: wrap; gap: 0.55rem 1.25rem;
  padding: 1rem; margin: 0; list-style: none;
  border: 1px solid var(--paper-edge); background: var(--paper-sink);
}
.ag-fold-legend li { display: flex; align-items: center; gap: 0.45rem; font-size: 0.85rem; }
.ag-fold-legend i { width: 0.85rem; height: 0.85rem; border: 1.5px solid; border-radius: 50%; flex: none; }
.ag-fold-pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; }
.ag-fold-panel { min-width: 0; padding: 0.75rem; border: 1px solid var(--paper-edge); background: var(--paper); }
.ag-fold-title { margin: 0 0 0.5rem; font-size: 0.9rem; }
.ag-fold-panel svg { border: 0; }
.ag-fold-toolbar button {
  padding: 0.35rem 0.7rem; border: 1px solid var(--ink-3); border-radius: 3px;
  background: var(--paper); color: var(--ink); cursor: pointer; font: inherit;
}
.ag-fold-backbone { stroke: var(--ink-3); stroke-width: 1.6; }
.ag-fold-bond { stroke: var(--ink-3); stroke-width: 1.1; stroke-dasharray: 2.5 2.5; opacity: 0.65; }
.ag-fold-base circle { stroke-width: 1.3; }
.ag-fold-base text { text-anchor: middle; font-size: 10px; font-family: monospace; font-weight: 600; }
.ag-fold-end { fill: var(--ink); font-family: sans-serif; font-size: 11px; text-anchor: middle; }
.ag-fold-enhanced > .ag-fold-state, .ag-fold-enhanced > .ag-fold-legend { display: none; }
.ag-fold-interactive { border: 1px solid var(--paper-edge); padding: 1rem; background: var(--paper); }
.ag-fold-choices { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 0.75rem; }
.ag-fold-choices fieldset { display: flex; flex-wrap: wrap; gap: 0.4rem; padding: 0; margin: 0; border: 0; }
.ag-fold-choices legend { float: none; width: auto; margin: 0 0 0.3rem; font-size: 0.85rem; font-weight: 600; }
.ag-fold-choices label {
  display: inline-flex; align-items: center; gap: 0.3rem; border: 1px solid var(--paper-edge);
  padding: 0.35rem 0.5rem; color: var(--ink); font-size: 0.85rem; cursor: pointer;
}
.ag-fold-choices label:has(input:checked) { background: var(--paper-sink); border-color: var(--ink); }
.ag-fold-choices label.ag-three-invite {
  border-color: #27879a; background: linear-gradient(115deg, #e8f8fb, #edf1ff);
  box-shadow: 0 0 0 2px #27879a12, 0 0 16px #4aa4d92b; color: #173d54;
}
.ag-fold-choices label.ag-three-invite:has(input:checked) { border-color: #15526d; box-shadow: 0 0 0 2px #27879a55; }
.ag-three-badge { border-radius: 1rem; padding: 0.16rem 0.45rem; background: #174d66; color: white; font-size: 0.67rem; font-weight: 700; letter-spacing: 0.02em; }
.ag-fold-choices input { accent-color: var(--ink); }
.ag-fold-toolbar { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.ag-fold-toolbar button { font-size: 0.85rem; }
.ag-fold-zoom { margin-left: auto; color: var(--ink-3); font-size: 0.85rem; }
.ag-fold-readout { font-family: var(--font-mono, monospace); font-size: 0.83rem; margin: 0.8rem 0 0.5rem; }
.ag-fold-viewport { width: 100%; height: clamp(300px, 58svh, 620px); border: 1px solid var(--paper-edge); overflow: hidden; }
.ag-fold-viewport > svg { width: 100%; height: 100%; border: 0; touch-action: none; cursor: grab; user-select: none; }
.ag-fold-viewport > svg.is-dragging { cursor: grabbing; }
.ag-fold-base[data-initiation] circle { stroke-width: 2.8; }
.ag-fold-three, .ag-fold-three > canvas { width: 100%; height: 100%; }
.ag-fold-viewport [hidden], .ag-fig [hidden] { display: none !important; }
.ag-mechanism-three { padding: 0.8rem; }
.ag-mechanism-three canvas { height: clamp(320px, 60svh, 620px); }
.ag-notation { padding: 1rem 1.2rem; margin: 1rem 0; border-left: 4px solid var(--cernal-red); background: var(--paper-sink); }
.ag-notation dl { display: grid; grid-template-columns: minmax(8rem, 1fr) 3fr; gap: 0.45rem 1rem; margin: 0; }
.ag-notation dt, .ag-notation dd { margin: 0; font-size: 0.88rem; }
@media (max-width: 500px) { .ag-notation dl { grid-template-columns: 1fr; } .ag-notation dd { margin-bottom: 0.6rem; } }
.ag-fold-help { font-size: 0.8rem; margin: 0.65rem 0; color: var(--ink-3); }
.ag-fold-view-key summary { cursor: pointer; font-size: 0.85rem; }
.ag-fold-view-key .ag-fold-legend { margin-top: 0.5rem; }
.ag-fold-interactive:fullscreen { display: flex; flex-direction: column; padding: 1rem; overflow: auto; background: var(--paper); }
.ag-fold-interactive:fullscreen .ag-fold-viewport { flex: 1; min-height: 100px; height: auto; }
@media (max-width: 700px) {
  .ag-walkthrough thead { display: none; }
  .ag-walkthrough, .ag-walkthrough tbody, .ag-walkthrough tr, .ag-walkthrough td { display: block; width: auto; }
  .ag-walkthrough td:last-child { border-top: 0; }
  .ag-walkthrough .ag-indent { padding-left: 1rem; }
  .ag-fold-pair { grid-template-columns: minmax(0, 1fr); }
}
@media print {
  .ag-walkthrough tr { break-inside: avoid; }
  .ag-fold-pair { display: block; }
  .ag-fold-panel { break-inside: avoid; margin-bottom: 1rem; }
  .ag-fold-panel svg { max-height: 210mm; }
  .ag-fold-interactive { display: none !important; }
  .ag-mechanism-choices, .ag-mechanism-three { display: none !important; }
  .ag-mechanism-flat[hidden] { display: block !important; }
  .ag-fold-enhanced > .ag-fold-state { display: block; }
  .ag-fold-enhanced > .ag-fold-legend { display: flex; }
}

/* ---------- the Methods figures (mt-*) ----------
   Generated by tools/figure_methods.py in the engine repo. Same rules as the
   state cartoon: short labels only, the sentences live in the figcaption, and
   fills are the site's tier-2 soft tints over ink hairlines. */

.mt-title {
  font-family: var(--font-display, system-ui, sans-serif);
  font-size: 17px;
  font-weight: 600;
  fill: var(--ink);
}

.mt-caption,
.mt-row {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 13px;
  fill: var(--ink-2);
}

.mt-note,
.mt-side,
/* Numeric ticks on the Pareto scatter: small, monospaced so the digits line up, and
   recessive, because the marks are the subject and the scale is the reference. */

.mt-tickmark {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 10px;
  fill: var(--ink-3);
}

.mt-axis,
.mt-legend,
.mt-marker-text,
.mt-lever-where,
.mt-lever-domain {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 12px;
  fill: var(--ink-3);
}

.mt-dom {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 12px;
  fill: var(--ink);
}

.mt-seq,
.mt-end,
.mt-share {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11px;
  fill: var(--ink-3);
}

.mt-box {
  stroke: var(--ink);
  stroke-width: 1.5;
}

.mt-fill-a,
.mt-lev-lower {
  fill: var(--acc-gold-soft);
}

.mt-fill-b {
  fill: var(--acc-blue-soft);
}

.mt-fill-shared {
  fill: var(--acc-violet-soft);
}

.mt-fill-stem,
.mt-lev-upper {
  fill: var(--acc-teal-soft);
}

.mt-fill-const,
.mt-lev-plain {
  fill: var(--paper-sink);
}

.mt-fill-start,
.mt-lev-start {
  fill: var(--cernal-red-soft);
}

.mt-lev-closure {
  fill: var(--acc-kraft-soft);
}

/* The gene the switch controls. Green because it is the output, and not one of the
   parts a trigger binds or a lever rewrites. */
.mt-fill-out {
  fill: var(--acc-green-soft);
}

/* A trigger window is cut out of a transcript that keeps going past it on both sides,
   and a strip that simply stops reads as though it did not. Dashed, because how much
   more there is is not being claimed. */
.mt-mrna {
  stroke: var(--ink-3);
  stroke-width: 1.5;
  stroke-dasharray: 3 4;
  fill: none;
}

/* A tie line runs from a trigger's domain to the switch domain it pairs with. */
.mt-tie {
  fill: none;
  stroke-width: 1.5;
  stroke-dasharray: 4 3;
}

.mt-tie--a {
  stroke: var(--acc-kraft);
}

.mt-tie--b {
  stroke: var(--pipe-blue);
}

.mt-tie--shared {
  stroke: var(--acc-violet);
}

/* ---- the overlap histogram ---- */

.mt-bar {
  fill: var(--acc-blue-soft);
  stroke: var(--ink);
  stroke-width: 1.5;
}

.mt-value {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 13px;
  font-weight: 700;
  fill: var(--ink);
}

.mt-axis-line {
  stroke: var(--ink);
  stroke-width: 1.5;
}

/* The transcript a trigger window is cut out of. Thin and pale for the whole
   messenger RNA, solid for the window we take -- the point of the pair is the
   ratio between them: a few dozen nucleotides chosen out of a thousand. */

/* The one red mark in this figure: the length the published work relied on. */
.mt-marker {
  stroke: var(--cernal-red);
  stroke-width: 2;
  stroke-dasharray: 5 4;
}

/* ---- the conflict grid ---- */

.mt-cell {
  fill: var(--paper-sink);
  stroke: var(--ink-3);
  stroke-width: 1;
}

.mt-cell--clash {
  fill: var(--acc-gold-soft);
  stroke: var(--ink);
  stroke-width: 1.75;
}

.mt-base {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 15px;
  fill: var(--ink);
}

.mt-clash-mark {
  font-size: 15px;
  fill: var(--cernal-red);
}

/* A build that survives but is dominated, and one on the front. */
.mt-dominated {
  fill: var(--paper);
  stroke: var(--ink-3);
  stroke-width: 1.25;
}

.mt-front {
  fill: var(--cernal-red);
  stroke: var(--cernal-red-deep);
  stroke-width: 1;
}

/* ---- the non-dominated explainer (methods-front.svg) ----
   Three more marks than the figure above it needs. A build the two rules
   reject is drawn as a cross rather than left out, because the reader is
   meant to be able to count all 27. The shaded box is the region one named
   build dominates. And one point is on the front only once the third axis
   is counted, so it cannot wear either of the two marks above. */

.mt-rejected {
  stroke: var(--ink-3);
  stroke-width: 1.5;
  fill: none;
}

.mt-third-axis {
  fill: var(--acc-teal-soft);
  stroke: var(--acc-teal);
  stroke-width: 2;
}

.mt-dom-box {
  fill: var(--paper-sink);
  stroke: var(--paper-edge);
  stroke-width: 1;
}

.mt-point-name {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11px;
  fill: var(--ink-2);
}

/* ---- the lever rows ---- */

.mt-lev-row {
  stroke: var(--ink);
  stroke-width: 1.25;
  fill: var(--paper-sink);
}

.mt-lev-row.mt-lev-closure {
  fill: var(--acc-kraft-soft);
}

.mt-lev-row.mt-lev-upper3 {
  fill: var(--acc-teal-soft);
}

.mt-lev-row.mt-lev-lower3 {
  fill: var(--acc-gold-soft);
}

.mt-lever-name {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 14px;
  font-weight: 700;
  fill: var(--ink);
}

.mt-seq-before {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 13px;
  fill: var(--ink-3);
  text-decoration: line-through;
}

.mt-seq-after {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 13px;
  font-weight: 700;
  fill: var(--ink);
}

/* The symbol list under a displayed equation. Last year's model page sets these
   as a short paragraph rather than a table, and it reads better: the symbols are
   being named, not tabulated. */
.ag-where {
  margin: 1rem 0 0.8rem;
  padding: 0.8rem 1rem;
  border-left: 3px solid #27879a;
  background: var(--paper-sink);
  font-size: 0.9rem;
  color: var(--ink-2);
}
.ag-definition-guide { margin: 1rem 0; color: var(--ink-2); font-size: 0.88rem; }
.ag-lexicon { margin: 0; padding: 1rem; }
.ag-lexicon > div { display: grid; grid-template-columns: minmax(9rem, 1fr) 3fr; gap: 1rem; padding: 0.7rem 0; border-bottom: 1px solid var(--paper-edge); }
.ag-lexicon dt, .ag-lexicon dd { margin: 0; font-size: 0.86rem; }
.ag-term { white-space: nowrap; }
.ag-term-info, .ag-info-sample {
  display: inline-flex; align-items: center; justify-content: center; vertical-align: 0.08em;
  box-sizing: border-box; width: 16px; height: 16px; margin: 0 0.15em 0 0.22em;
  padding: 0; border: 1px solid #57727c; border-radius: 50%; background: #f0f8fa; color: #375c6a;
  font: 600 11px/1 Georgia, serif; font-style: normal; text-decoration: none;
}
.ag-term-info { position: relative; cursor: help; }
.ag-term-info::after { content: ''; position: absolute; inset: -4px; }
.ag-term-info:hover, .ag-term-info[aria-expanded=true] { background: #245d72; color: white; border-color: #245d72; }
.ag-term-info:focus-visible { outline: 2px solid #245d72; outline-offset: 3px; }
.ag-eq { position: relative; }
.ag-eq > .ag-term-info { flex: none; margin-left: 0.65rem; }
.ag-figure-definitions { display: inline-block; margin-left: 0.6rem; white-space: nowrap; font-size: 0.8rem; color: var(--ink-2); }
.ag-term-popover {
  position: fixed; z-index: 1600; box-sizing: border-box; width: min(370px, calc(100vw - 24px));
  max-height: min(390px, calc(100svh - 24px)); overflow-y: auto; padding: 1rem 2rem 1rem 1rem;
  border: 1px solid #9abac6; border-top: 3px solid #27879a; border-radius: 8px;
  background: #fff; color: #182831; box-shadow: 0 10px 36px #152c3e30;
  font: 0.86rem/1.55 system-ui, sans-serif; text-align: left;
}
.ag-term-popover[hidden] { display: none; }
.ag-term-popover dl, .ag-term-popover p { margin: 0; }
.ag-term-popover dt { font-weight: 700; margin: 0 0 0.35rem; }
.ag-term-popover dd { margin: 0 0 0.85rem; }
.ag-term-popover dd:last-child { margin-bottom: 0; }
.ag-term-popover a { color: #17546b; text-decoration: underline; white-space: nowrap; }
.ag-term-close { position: absolute; right: 5px; top: 5px; width: 28px; height: 28px; border: 0; border-radius: 4px; color: #375c6a; background: #f0f8fa; font-size: 1.2rem; cursor: pointer; }
@media (max-width: 600px) { .ag-lexicon > div { grid-template-columns: 1fr; gap: 0.35rem; } }
@media print { .ag-term-info, .ag-term-popover, .ag-three-badge, .ag-figure-definitions { display: none !important; } .ag-term { white-space: normal; } }

/* ---------- citations and the reference list ----------
   A superscript number in the text, and a numbered list in section 10 that the
   layout's own script folds into an accordion. The numbers are hand-kept, which
   is a maintenance cost paid deliberately: a generated scheme would mean the
   reference list could not be read on its own. */

.ag-cite {
  font-size: 0.68em;
  vertical-align: super;
  line-height: 0;
  padding: 0 0.1em;
  font-weight: 600;
  text-decoration: none;
}

.ag-cite::before {
  content: "[";
}

.ag-cite::after {
  content: "]";
}

.ag-refs {
  margin: 0;
  padding-left: 1.6rem;
  font-size: 0.88rem;
}

.ag-refs li {
  margin-bottom: 0.6rem;
  color: var(--ink-2);
}

/* The anchor a citation jumps to clears the fixed navbar. */
.ag-refs li:target {
  background: var(--acc-gold-soft);
  scroll-margin-top: 90px;
}

/* ---------- tables of numbers ---------- */

.ag-table {
  width: 100%;
  margin: 1.25rem 0;
  font-size: 0.88rem;
  border-collapse: collapse;
}

/* The evidence map: three columns of running prose rather than numbers, so it needs
   column widths and a readable line length instead of the numeric table's alignment. */

.ag-table--evidence {
  font-size: 0.86rem;
}

.ag-table--evidence td:first-child {
  width: 22%;
  min-width: 11rem;
}

.ag-table--evidence td:last-child {
  width: 14%;
  min-width: 8rem;
  white-space: nowrap;
}

.ag-table--evidence td {
  vertical-align: top;
  line-height: 1.5;
}

/* Section 8.5 contains prose in all three columns. Keep this override scoped:
   numeric evidence tables elsewhere still need their compact final column. */
.ag-table--decisions {
  table-layout: fixed;
}

.ag-table--decisions th:first-child,
.ag-table--decisions td:first-child {
  width: 24%;
}

.ag-table--decisions th:last-child,
.ag-table--decisions td:last-child {
  width: 42%;
}

.ag-table.ag-table--decisions th,
.ag-table.ag-table--decisions td {
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
}

@media (max-width: 600px) {
  .ag-scroll:has(.ag-table--decisions) {
    overflow-x: auto;
  }

  .ag-table--decisions {
    min-width: 38rem;
  }
}

.ag-table caption {
  caption-side: top;
  text-align: left;
  font-size: 0.8rem;
  color: var(--ink-3);
  padding-bottom: 0.45rem;
}

.ag-table th,
.ag-table td {
  border-bottom: 1px solid var(--paper-edge);
  padding: 0.38rem 0.6rem;
  vertical-align: top;
}

.ag-table thead th {
  border-bottom: 2px solid var(--ink);
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}

.ag-table td.num,
.ag-table th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  white-space: nowrap;
}

.ag-table tbody tr:last-child td {
  border-bottom: 2px solid var(--ink);
}

/* Any table wide enough to overflow scrolls in its own box, so the
   page body never scrolls sideways. */
.ag-scroll {
  overflow-x: auto;
}

/* ---------- a code path, inline ---------- */

.ag code,
.ag .ag-path {
  font-size: 0.86em;
}

.ag-path {
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  background: var(--paper-sink);
  border: 1px solid var(--paper-edge);
  border-radius: 2px;
  padding: 0.05rem 0.3rem;
  white-space: nowrap;
}

/* ---------- the source pointer under a section's opening ---------- */

.ag-src {
  font-size: 0.82rem;
  color: var(--ink-3);
  border-top: 1px solid var(--paper-edge);
  padding-top: 0.5rem;
}

/* ---------- a stated algorithm ----------
   Numbered lines, so a step can be cited, and three indents, so the loop structure is
   visible without drawing a flow chart. The caption carries the input and the output,
   which is the part a reader needs before the first line makes sense. */

.ag-algo {
  margin: 1.5rem 0;
  padding: 0;
  border: 1px solid var(--paper-edge);
  border-left: 3px solid var(--ink);
  background: var(--paper-sink);
}

.ag-algo > figcaption {
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--paper-edge);
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--ink-2);
}

.ag-algo-lines {
  margin: 0;
  padding: 0.8rem 1rem 0.9rem 3.2rem;
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 0.86rem;
  line-height: 1.75;
  color: var(--ink);
}

.ag-algo-lines > li {
  margin: 0.15rem 0;
  padding-left: 0.3rem;
}

.ag-algo-lines > li::marker {
  color: var(--ink-3);
  font-size: 0.8em;
}

/* Depth inside the loops. A rule on the left of an indented run shows how far the
   block it belongs to reaches. */
.ag-algo-lines > li.l2 {
  margin-left: 1.3rem;
  border-left: 1px solid var(--paper-edge);
  padding-left: 0.7rem;
}

.ag-algo-lines > li.l3 {
  margin-left: 2.6rem;
  border-left: 1px solid var(--paper-edge);
  padding-left: 0.7rem;
}

@media (max-width: 575.98px) {
  .ag-algo-lines {
    padding-left: 2.4rem;
  }

  .ag-algo-lines > li.l2 {
    margin-left: 0.5rem;
  }

  .ag-algo-lines > li.l3 {
    margin-left: 1rem;
  }
}

/* ---------- implementation detail, folded away by default ----------
   The reader of this page is a person. Anything a person would not
   read -- module paths, which test enforces what -- goes in here, so
   it is available without being in the way. */

/* These hold the equations, the full domain table and the unabridged methods, so a
   reader who wants them has to be able to see that they are there. Shut, the row
   reads as a control and not as a caption: a teal spine down its left edge, a
   chevron that turns when it opens, and the word OPEN at the right saying what
   clicking does. */

.ag-details {
  margin: 1.25rem 0;
  border: 1px solid var(--paper-edge);
  border-left: 3px solid var(--acc-teal);
  border-radius: 2px;
  background: var(--card-tint);
}

.ag-details > summary {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  cursor: pointer;
  padding: 0.62rem 0.85rem;
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink);
  list-style: none;
}

/* The native triangle sits outside the flex row and cannot be aligned with it. */
.ag-details > summary::-webkit-details-marker {
  display: none;
}

.ag-details > summary::before {
  content: "\25B8";
  flex: none;
  color: var(--acc-teal);
  font-size: 0.9rem;
  line-height: 1;
  transition: transform 0.15s ease;
}

.ag-details[open] > summary::before {
  transform: rotate(90deg);
}

/* The affordance in words, for anyone who does not read a chevron as a button. */
.ag-details > summary::after {
  content: "open";
  margin-left: auto;
  flex: none;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: var(--ink-3);
}

.ag-details[open] > summary::after {
  content: "close";
}

.ag-details > summary:hover,
.ag-details > summary:focus-visible {
  background: var(--paper-sink);
}

.ag-details > summary:focus-visible {
  outline: 2px solid var(--acc-teal);
  outline-offset: -2px;
}

.ag-details[open] > summary {
  border-bottom: 1px solid var(--paper-edge);
}

.ag-details > div {
  padding: 0.85rem;
}

.ag-details p:last-child {
  margin-bottom: 0;
}

/* ---------- a declared setting, as a definition row ---------- */

.ag-settings {
  margin: 1.25rem 0;
  border-left: 3px solid var(--acc-teal);
  padding-left: 1rem;
}

.ag-settings dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.3rem 1rem;
  margin: 0;
  font-size: 0.88rem;
}

.ag-settings dt {
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  color: var(--ink);
  font-weight: 400;
}

.ag-settings dd {
  margin: 0;
  color: var(--ink-2);
}

@media (max-width: 575.98px) {
  .ag-settings dl {
    grid-template-columns: 1fr;
    gap: 0.1rem;
  }

  .ag-settings dd {
    margin-bottom: 0.45rem;
  }
}


/* ---------- the method flow (methods-flow.svg) ----------
   One row per step: a number, a short title, one line of plain text, and a small
   schematic of what that step does. The drawings carry no sequence and are not to
   scale; Figures 3.1 and 3.2 hold the real geometry. Every drawing is bounded inside
   its row by the generator, which refuses to write a figure that overflows. */

.fl-title {
  font-family: var(--font-display, system-ui, sans-serif);
  font-size: 18px;
  font-weight: 600;
  fill: var(--ink);
}

.fl-caption,
.fl-note {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11px;
  fill: var(--ink-3);
}

.fl-step {
  font-family: var(--font-display, system-ui, sans-serif);
  font-size: 15px;
  font-weight: 600;
  fill: var(--ink);
}

.fl-line {
  font-family: var(--font-sans, system-ui, sans-serif);
  font-size: 13px;
  fill: var(--ink-2);
}

/* The count a step leaves behind. Monospaced so the figures line up down the column,
   and recessive, because the step is the subject and the count is its size. */

.fl-count {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11px;
  fill: var(--ink-3);
}

.fl-row {
  fill: var(--card-tint);
  stroke: var(--paper-edge);
  stroke-width: 1;
}

.fl-num {
  fill: var(--cernal-red-soft);
  stroke: var(--cernal-red);
  stroke-width: 1.25;
}

.fl-num-text {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 13px;
  font-weight: 600;
  fill: var(--cernal-red-deep);
}

/* A whole transcript, drawn as a bar so that a window can sit on it without the two
   reading as the same kind of thing. */

.fl-genebar {
  fill: var(--paper-sink);
  stroke: var(--paper-edge);
  stroke-width: 1;
}

.fl-win {
  fill: var(--acc-blue-soft);
  stroke: var(--acc-blue);
  stroke-width: 1;
}

.fl-win--hit {
  fill: var(--acc-gold-soft);
  stroke: var(--acc-gold);
  stroke-width: 1.5;
}

.fl-link {
  stroke: var(--cernal-red);
  stroke-width: 2;
  stroke-dasharray: 3 3;
  fill: none;
}

/* A loose strand: dashed, because what is drawn is schematic and the rest of the
   molecule continues past the edge of the panel. */

.fl-gene {
  stroke: var(--ink-3);
  stroke-width: 1.5;
  stroke-dasharray: 3 4;
  fill: none;
}

.fl-lead {
  stroke: var(--ink-4, var(--ink-3));
  stroke-width: 1;
  stroke-dasharray: 2 3;
  fill: none;
}

.fl-stem {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2.25;
  stroke-linecap: round;
}

.fl-stem--small {
  stroke-width: 1.75;
}

/* One base pair inside a stem. A full rung pairs; a broken one is the position the
   two triggers disagree about; a lever one is a position a design may rewrite. */

.fl-rung {
  stroke: var(--ink-3);
  stroke-width: 1.5;
  fill: none;
}

.fl-rung--clash {
  stroke: var(--cernal-red);
  stroke-width: 2;
}

.fl-rung--lever {
  stroke: var(--acc-violet, var(--cernal-red));
  stroke-width: 2.5;
}

.fl-aug {
  fill: var(--acc-gold-soft);
  stroke: var(--acc-gold);
  stroke-width: 1.75;
}

.fl-funnel {
  fill: var(--acc-teal-soft);
  stroke: var(--acc-teal);
  stroke-width: 1;
}

.fl-tube {
  fill: var(--paper-sink);
  stroke: var(--ink-3);
  stroke-width: 1.25;
}

.fl-tube--on {
  fill: var(--acc-green-soft);
  stroke: var(--acc-green);
  stroke-width: 1.75;
}

/* The open strand in the one tube that should translate. */

.fl-open {
  fill: none;
  stroke: var(--acc-green);
  stroke-width: 2.25;
  stroke-linecap: round;
}

.fl-state {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 14px;
  font-weight: 600;
  fill: var(--ink);
}


/* ---------- the closure trade-off (closure-tradeoff.svg) ----------
   Left panel diverges about a line: violet is a cell the closed bulge wins, red one the
   open loop wins. The same pair as Figure 5.1 and the same meaning, already checked at
   14.5 Delta E apart under protanopia. Right panel is a single magnitude against a
   track, so it needs no second hue. */

.cl-title {
  font-family: var(--font-display, system-ui, sans-serif);
  font-size: 15px;
  font-weight: 600;
  fill: var(--ink);
}

.cl-caption,
.cl-note,
.cl-legend {
  font-family: var(--font-sans, system-ui, sans-serif);
  font-size: 11.5px;
  fill: var(--ink-3);
}

.cl-panel {
  font-family: var(--font-sans, system-ui, sans-serif);
  font-size: 12.5px;
  font-weight: 600;
  fill: var(--ink);
}

.cl-closure,
.cl-level {
  font-family: var(--font-sans, system-ui, sans-serif);
  font-size: 12.5px;
  font-weight: 600;
  fill: var(--ink);
}

.cl-measure {
  font-family: var(--font-sans, system-ui, sans-serif);
  font-size: 11.5px;
  fill: var(--ink-2);
}

.cl-sub,
.cl-count,
.cl-axis {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 10.5px;
  fill: var(--ink-3);
}

.cl-pct {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11.5px;
  font-weight: 600;
  fill: var(--ink-2);
}

.cl-bar--won {
  fill: var(--acc-violet);
}

.cl-bar--lost {
  fill: var(--cernal-red);
}

.cl-bar--open {
  fill: var(--acc-gold);
}

.cl-bar--closed {
  fill: var(--acc-gold);
  fill-opacity: 0.5;
}

.cl-track {
  fill: var(--paper-sink);
}

.cl-zero {
  stroke: var(--ink-3);
  stroke-width: 1.5;
}

/* ---------- the two readings of state 10 (kinetic-vs-equilibrium.svg) ----------
   One series, so no legend: the panel titles name what is plotted. 306 marks in a
   384-pixel panel overlap heavily, so each carries a surface-coloured ring, which is
   what keeps a dense cluster reading as many marks rather than one shape. */

.kx-title {
  font-family: var(--font-display, system-ui, sans-serif);
  font-size: 15px;
  font-weight: 600;
  fill: var(--ink);
}

.kx-caption,
.kx-foot {
  font-family: var(--font-sans, system-ui, sans-serif);
  font-size: 11.5px;
  fill: var(--ink-3);
}

.kx-panel {
  font-family: var(--font-sans, system-ui, sans-serif);
  font-size: 12.5px;
  font-weight: 600;
  fill: var(--ink);
}

.kx-note,
.kx-axis {
  font-family: var(--font-sans, system-ui, sans-serif);
  font-size: 11px;
  fill: var(--ink-3);
}

.kx-tick {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 10px;
  fill: var(--ink-3);
}

.kx-frame {
  fill: var(--card-tint);
  stroke: var(--paper-edge);
  stroke-width: 1;
}

.kx-grid {
  stroke: var(--paper-edge);
  stroke-width: 1;
}

.kx-dot {
  fill: var(--acc-violet);
  fill-opacity: 0.55;
  stroke: var(--paper);
  stroke-width: 1;
}

/* ---------- the variance split (variance-split.svg) ----------
   One hundred-percent stacked bar per quantity: gold is the share of its variance that
   lies between trigger pairs, violet the share that lies within one pair. The pair was
   checked with tools/validate_palette.py rather than chosen by eye -- 25.2 Delta E
   apart under protanopia, and both clear the chroma floor that teal, blue and kraft
   miss. Every segment carries its percentage, so nothing rests on hue. */

.vs-title {
  font-family: var(--font-display, system-ui, sans-serif);
  font-size: 15px;
  font-weight: 600;
  fill: var(--ink);
}

.vs-caption,
.vs-legend {
  font-family: var(--font-sans, system-ui, sans-serif);
  font-size: 11.5px;
  fill: var(--ink-3);
}

.vs-name {
  font-family: var(--font-sans, system-ui, sans-serif);
  font-size: 12.5px;
  fill: var(--ink);
}

.vs-n,
.vs-divider {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 10.5px;
  fill: var(--ink-3);
}

.vs-pct {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11px;
  font-weight: 600;
}

/* Narrow pair shares are labelled inside the adjacent design bar. */
.vs-pct--in,
.vs-pct--pair {
  fill: #fff;
}

.vs-seg--pair {
  fill: var(--acc-gold);
}

.vs-seg--design {
  fill: var(--acc-violet);
}

.vs-rule {
  stroke: var(--paper-edge);
  stroke-width: 1;
  stroke-dasharray: 4 3;
}

/* ---------- the external check (external-check.svg) ----------
   Diverging bars about a zero line, because the job of this data is polarity: a
   measure that ranks a published library the way the bench did is positive, one that
   does not is negative. Violet and red are the diverging pair, picked by running
   tools/validate_palette.py rather than by eye -- green against this red separates by
   4.1 Delta E under deuteranopia, under the floor of 6.0, while violet reaches 14.5.
   Every bar also carries its value and its library as text, so nothing rests on hue. */

.xc-head {
  font-family: var(--font-display, system-ui, sans-serif);
  font-size: 15px;
  font-weight: 600;
  fill: var(--ink);
}

.xc-sub {
  font-family: var(--font-sans, system-ui, sans-serif);
  font-size: 11.5px;
  fill: var(--ink-3);
}

.xc-measure {
  font-family: var(--font-sans, system-ui, sans-serif);
  font-size: 13px;
  font-weight: 600;
  fill: var(--ink);
}

.xc-window,
.xc-term,
.xc-legend {
  font-family: var(--font-sans, system-ui, sans-serif);
  font-size: 11.5px;
  fill: var(--ink-3);
}

.xc-series {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 10.5px;
  fill: var(--ink-3);
}

.xc-tick {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 10.5px;
  fill: var(--ink-3);
}

/* The value is ink, never the series colour: the bar beside it carries the sign. */

.xc-value {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11.5px;
  font-weight: 600;
  fill: var(--ink-2);
}

.xc-bar {
  stroke-width: 1;
}

.xc-bar--pos {
  fill: var(--acc-violet);
  stroke: var(--acc-violet);
}

.xc-bar--neg {
  fill: var(--cernal-red);
  stroke: var(--cernal-red);
}

/* The second library of each pair, drawn lighter so a group reads as one measure.
   Which library a bar belongs to is written on the bar, not left to this. */

.xc-bar--soft {
  fill-opacity: 0.42;
}

.xc-grid {
  stroke: var(--paper-edge);
  stroke-width: 1;
}

.xc-grid--zero {
  stroke: var(--ink-3);
  stroke-width: 1.5;
}

/* The transcript a trigger is a window of, under the bound strand in Figure 3.1.
   Dashed for the whole messenger RNA, solid for the window: the ratio between
   them is the point, and without it the drawing says the trigger IS the gene. */

.st-transcript {
  stroke: var(--ink-3);
  stroke-width: 1.5;
  stroke-dasharray: 3 4;
  fill: none;
}

.st-transcript-cut {
  stroke: var(--cernal-red);
  stroke-width: 4.5;
  stroke-linecap: round;
  fill: none;
  opacity: 0.75;
}

.ag-lever-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.ag-lever-card {
  padding: 1.1rem;
  border: 1px solid var(--paper-edge);
  border-top: 4px solid #176c47;
  border-radius: 0.5rem;
  background: var(--paper);
}

.ag-lever-card--unfavorable {
  border-top-color: #b32630;
}

.ag-lever-card p {
  margin: 0 0 0.65rem;
  line-height: 1.5;
}

.ag-lever-card h5 {
  margin: 0 0 0.8rem;
  font-size: 1rem;
  line-height: 1.45;
  color: var(--ink);
}

.ag-lever-state,
.ag-lever-unit,
.ag-lever-sample {
  font-size: 0.8rem;
  color: var(--ink-2);
}

.ag-lever-state,
.ag-lever-direction {
  font-weight: 650;
}

.ag-lever-card .ag-lever-change {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 1.65rem;
  font-weight: 700;
  color: #176c47;
}

.ag-lever-card--unfavorable .ag-lever-change {
  color: #b32630;
}

@media screen and (max-width: 760px) {
  .ag-lever-cards {
    grid-template-columns: 1fr;
  }
}

/* ---------- print and PDF export ----------
   On screen a wide figure or table scrolls inside .ag-scroll, which is what keeps the
   page body from scrolling sideways. On paper there is nothing to scroll, so anything
   past the container's edge is cropped -- and .ag-fig svg carries min-width: 900px,
   which guarantees there is something past it. That is why the exported PDF cut the
   right-hand side off Figures 3.1 and 3.2 and several Methods tables.

   These rules let a wide block scale to the sheet rather than lose its edge. */

@media print {
  .ag-scroll {
    overflow: visible;
  }

  /* The min-width is what forces the overflow, so it has to go before width can
     have any effect. */
  .ag-fig svg,
  .ag-fig--methods svg,
  .ag-fig--states svg,
  .ag-fig--check svg,
  .ag-fig--brief svg {
    min-width: 0;
    width: 100%;
    height: auto;
  }

  .ag-table {
    width: 100%;
    font-size: 0.74rem;
  }

  /* A figure split over a page break loses the thing a reader needs it for, which is
     seeing all of it at once; a caption on its own sheet is worse still. */
  .ag-fig,
  figure {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .ag-table tr,
  .ag-settings dl > dt,
  .ag-settings dl > dd {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .ag h2,
  .ag h3,
  .ag h4 {
    break-after: avoid;
    page-break-after: avoid;
  }

  /* On paper there is nothing to click, so a shut panel is content that silently did
     not print -- including the algorithm's second half and its parameter table. Open
     every one and drop the affordance that only makes sense on screen. */
  .ag-details > div,
  .ag-details > .ag-scroll,
  .ag-details > details,
  .ag-details > figure,
  .ag-details > table {
    display: block !important;
  }

  .ag-details::details-content {
    display: block !important;
    content-visibility: visible !important;
  }

  .ag .judging .accordion-collapse {
    display: block !important;
  }

  .ag-flow > li {
    break-inside: avoid;
  }

  .ag-details > summary::before,
  .ag-details > summary::after {
    content: none;
  }

  .ag-details > summary {
    border-bottom: 1px solid var(--paper-edge);
  }

  .ag-algo-lines > li {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  /* Review scaffolding never belongs in an export. */
  .ag-new {
    background: none;
  }
}
