/* Interactive science models (models.js, models2.js). Moved out of styles.css in v4. Uses the compat variable names from tokens.css. */
/* ---------- Hablox interactive models (v1 classes; models2.css adds more) ---------- */
.mbox:empty { display: none; }
.model { border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px; margin: 8px 0; background: var(--bg); }
.msvg { width: 100%; max-height: 260px; display: block; margin: 4px auto 8px; }
.msvg.short { max-height: 140px; }
.msvg .axis { stroke: var(--muted); stroke-width: 1.5; }
.msvg .tick { fill: var(--muted); font-size: 11px; }
.msvg .trail { stroke: var(--brand); stroke-width: 2; stroke-dasharray: 4 4; }
.msvg .ground { stroke: var(--text); stroke-width: 2; }
.msvg .ball { fill: var(--brand); }
.msvg .wire { stroke: var(--text); stroke-width: 2; }
.msvg .res { fill: var(--brand-soft); stroke: var(--brand); stroke-width: 2; }
.msvg .rlabel { fill: var(--text); font-size: 12px; font-weight: 700; }
.mlabel { display: flex; flex-direction: column; gap: 4px; margin: 8px 0; font-size: 15px; }
.mlabel input[type="range"] { width: 100%; accent-color: var(--brand); min-height: 32px; }
.mnums { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 15px; }
.mnums b { font-variant-numeric: tabular-nums; }
.seg { display: inline-flex; border: 2px solid var(--ink-line); border-radius: var(--r-md); overflow: hidden; margin: 4px 0 8px; }
.seg button { border: 0; background: var(--surface); color: var(--text); padding: 8px 14px; font-size: 15px; font-weight: 600; cursor: pointer; min-height: 44px; }
.seg button + button { border-left: 1px solid var(--ink-line); }
.seg button.on { background: var(--text-strong); color: var(--text-on-ink); }
.pgroup { margin: 4px 0; }
.pgrid { border-collapse: collapse; margin: 8px 0; font-size: 18px; }
.pgrid th, .pgrid td { width: 56px; height: 44px; text-align: center; border: 1px solid var(--line); }
.pgrid th { color: var(--muted); }
.pgrid td.dominant { background: var(--brand-soft); }
.pgrid td.recessive { background: var(--part-soft); color: var(--part); font-weight: 700; }

/* ---------- Hablox interactive models, part 2 (models2.js: lens, gas, shells, ph, dna, pyramid) ----------
   Only theme variables and currentColor are used, so light and dark mode both work. */
.mlabel input[type="range"] { min-height: 44px; } /* 44 px touch height (v1 had 32 px; this also helps the v1 models) */
.mnums .mwide { flex-basis: 100%; }
.mnums.col { flex-direction: column; gap: 2px; }
.mnote { margin: 8px 0 0; }
.seg.full { display: flex; }
.seg.full button { flex: 1 1 0; padding: 8px 4px; font-size: 17px; font-style: italic; font-synthesis: style; } /* T, p, V as in formulas */
.seg.nums button { min-width: 48px; }
.seg button:focus-visible { outline-offset: -3px; } /* .seg clips overflow, so draw the focus ring inside */
/* v1 fix: the resistors toggle "Пайдарпай | Параллелӣ" is 224 px wide, wider than a model on a 320 px phone (200 px) */
.model .seg { max-width: 100%; }
.model .seg:not(.full) { flex-wrap: wrap; }
@media (max-width: 360px) { .model .seg:not(.full) button { padding-left: 8px; padding-right: 8px; min-width: 44px; } }
/* a halo in the model's background colour keeps small labels readable where they cross a line */
.msvg .halo { paint-order: stroke; stroke: var(--bg); stroke-width: 3px; stroke-linejoin: round; }

/* lens */
.msvg .ray { stroke: var(--part); stroke-width: 1.6; }
.msvg .ray.b { stroke: var(--phys); }
.msvg .ray.x { stroke-width: 1.2; stroke-dasharray: 4 3; }
.msvg .img { stroke: var(--brand); stroke-width: 2.5; }
/* gas */
.msvg .gas { fill: var(--bad); }
.msvg .dot { fill: var(--text); }
/* shells */
.msvg .ball.val { fill: var(--part); }
/* pyramid */
.msvg .lvl { fill: var(--bio-soft); stroke: var(--bio); stroke-width: 1.5; }

/* ph: indicator list and example buttons */
.mlist { list-style: none; padding: 0; margin: 8px 0; }
.mlist li { display: flex; align-items: center; gap: 8px; margin: 4px 0; }
.mlist svg { flex: 0 0 22px; }
.mchips { display: flex; flex-wrap: wrap; gap: 0 8px; }

/* dna: input and codon rows. Each codon is a fixed-width cell, so the four rows line up. */
.dnain {
  width: 100%; min-height: 44px; padding: 8px 10px; border: 2px solid var(--line-strong); border-radius: var(--r-md);
  background: var(--surface); color: var(--text); font: 600 17px var(--mono); letter-spacing: .08em; text-transform: uppercase;
}
.dna { margin: 4px 0 8px; }
.dna .dl { margin: 8px 0 0; font-size: 13px; color: var(--muted); }
.dna .dseq { margin: 0; font: 600 14px/1.7 var(--mono); white-space: nowrap; }
.dna .cd { display: inline-block; width: 2.7em; text-align: center; border-radius: var(--r-xs); }
/* start: plain text on green (var(--ok) text on --ok-soft is only 4.4:1); stop: red text on red-soft (5.7:1) */
.dna .cd.st { background: var(--ok-soft); color: var(--text); box-shadow: inset 0 0 0 1.5px var(--ok); }
.dna .cd.sp { background: var(--bad-soft); color: var(--bad); box-shadow: inset 0 0 0 1.5px var(--bad); }
.dna .cd.off { color: var(--muted); font-weight: 400; }

