/* registry: Platform A, first block. Gene and rule registry: a GRCh38 chromosome map built from the published site sets,
   one hashed rule-table button per gene, a zoom into the selected gene's sites, and the control column.
   Shared components (figbox, ctl, readout, opts, key, tags) are used as they are; this file lays out the map and marks only.
   v5 (the films' look): warm-grey chromosome cells, ink pins with hairline leaders to the rule-table labels (Figtree caps, the films'
   labels), the selected table framed in orange like the films' "32 bytes" box, site marks with a fine ink outline. */

.rg-box { margin: 32px 0 0; }

/* ---------- Figure top row ---------- */
.rg-top { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 8px 16px; padding-bottom: 14px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.rg-top > * { margin: 0; }

/* ---------- Chromosome map: one row per chromosome, 10 Mb cells, gene pins, leaders to the rule-table buttons ---------- */
.rg-map { --lw: 22px; --gap: 12px; --bw: 168px; --cell: 10px; --cg: 2px; position: relative; overflow-anchor: none; }
.rg-map > .small { margin: 0; }
.rg-row { display: grid; grid-template-columns: var(--lw) minmax(0, 1fr) var(--bw); column-gap: var(--gap); align-items: end; height: var(--h); }
.rg-chr { font-family: var(--mono); font-size: 10px; line-height: 10px; color: var(--muted); text-align: right; padding-bottom: 2px; transition: color var(--t2); }
.rg-row.on .rg-chr { color: var(--ink); }
.rg-lane { position: relative; height: 100%; min-width: 0; }
.rg-bar { position: absolute; left: 0; bottom: 4px; height: 6px; width: calc(var(--n) * var(--cell));
  background: linear-gradient(90deg, var(--c) calc(100% - var(--cg)), transparent 0) 0 0 / var(--cell) 100% repeat-x; }
.rg-row.o { --c: var(--g3); }
.rg-row.e { --c: var(--g1); }
.rg-pins { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.rg-pin { pointer-events: auto; cursor: pointer; }
.rg-stem { fill: none; stroke: var(--ink); stroke-width: 1.25px; transform-box: fill-box; transform-origin: 50% 100%; transition: stroke var(--t2); }
.rg-sq { fill: var(--ink); transition: fill var(--t2); }
.rg-lead { fill: none; stroke: var(--g3); stroke-width: 1px; transition: stroke var(--t2); }
.rg-pin.sel .rg-stem { stroke: var(--ink); stroke-width: 1.5px; }
.rg-pin.sel .rg-sq { fill: var(--ink); }
.rg-pin.sel .rg-lead { stroke: var(--ink); }

/* Rule-table buttons: gene name (a label, Figtree) and the first hex digits of the table's SHA-256 (data, mono) */
.rg-blks { display: flex; flex-direction: column; min-width: 0; }
.rg-blk { display: flex; align-items: center; justify-content: space-between; gap: 6px; height: calc(var(--sh) - 6px); margin: 3px 0; padding: 0 8px; min-width: 0;
  border: 1px solid var(--line-2); border-radius: 0; background: var(--white); color: var(--ink); cursor: pointer; font-family: var(--mono); font-size: 11px; line-height: 1; letter-spacing: .02em;
  transition: border-color var(--t2) var(--ease), box-shadow var(--t2) var(--ease), background var(--t2) var(--ease); }
.rg-blk b { font-family: var(--font); font-weight: 500; font-size: 10.5px; letter-spacing: .08em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rg-blk code { font-family: var(--mono); font-size: 11px; color: var(--muted); white-space: nowrap; }
.rg-blk code.cmp { color: var(--tone); }
.rg-blk:hover { border-color: var(--ink); }
.rg-blk[aria-pressed="true"] { border-color: var(--signal); box-shadow: inset 0 0 0 .5px var(--signal); background: var(--white); }
.rg-blk[aria-pressed="true"] code { color: var(--ink); }

/* Before the build plays (registry.js adds .rg-wait only when motion is allowed) */
.rg-box.rg-wait .rg-bar, .rg-box.rg-wait .rg-chr, .rg-box.rg-wait .rg-pin, .rg-box.rg-wait .rg-blk, .rg-box.rg-wait .rg-stick { opacity: 0; }

/* ---------- Zoom: the selected gene's sites at base-pair scale, opened under its chromosome ---------- */
.rg-zm { display: grid; grid-template-rows: 0fr; transition: grid-template-rows var(--t3) var(--ease); }
.rg-zm.open { grid-template-rows: 1fr; }
.rg-zi { min-height: 0; overflow: hidden; }
.rg-zc { padding: 2px 0 18px; }
.rg-trk { display: block; overflow: visible; }
.rg-wd { fill: var(--sel); stroke: var(--line-2); stroke-width: 1px; }
.rg-bl { fill: none; stroke: var(--ink); stroke-width: 1.5px; }
.rg-tk { fill: none; stroke: var(--ink); stroke-width: 1px; }
.rg-trk text { font-family: var(--mono); font-size: 10.5px; fill: var(--muted); }
.rg-trk .rg-al { font-size: 11px; fill: var(--ink); transition: fill var(--t2); }
.rg-s .rg-ss { fill: none; stroke: var(--ink); stroke-width: 1.5px; transform-box: fill-box; transform-origin: 50% 100%; transition: stroke var(--t2); }
.rg-s .rg-sk { fill: var(--f, var(--ink)); stroke: rgba(17, 17, 17, .5); stroke-width: 1px; transition: fill var(--t2), stroke var(--t2), stroke-width var(--t2); }
.rg-s.px .rg-ss { stroke: var(--dash); stroke-dasharray: 3 2; }
.rg-s.un .rg-sk { fill: var(--white); stroke: var(--line-2); stroke-width: 1.5px; }
.rg-s.un .rg-ss { stroke: var(--line-2); }
.rg-s.un .rg-al { fill: var(--muted); }
.rg-s .rg-hl { fill: none; stroke: var(--ink); stroke-width: 1.5px; opacity: 0; transition: opacity var(--t1); }
.rg-s.hl .rg-hl { opacity: 1; }

/* Sites table under the track */
.rg-tbl { width: 100%; border-collapse: separate; border-spacing: 0; margin: 6px 0 0; font-family: var(--mono); font-size: 12px; line-height: 1.3; }
.rg-tbl caption { text-align: left; }
.rg-tbl th { text-align: left; padding: 0 12px 6px 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
.rg-tbl td { padding: 6px 12px 6px 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
.rg-tbl th:last-child, .rg-tbl td:last-child { padding-right: 0; }
.rg-tbl tbody tr { transition: background var(--t1), color var(--t2); }
.rg-tbl tbody tr.hl { background: var(--sel); }
.rg-tbl tbody tr.un { color: var(--muted); }
.rg-tbl .rg-sw { display: inline-block; width: 8px; height: 8px; margin-right: 8px; vertical-align: 0; background: var(--f, var(--ink)); box-shadow: inset 0 0 0 1px rgba(17, 17, 17, .5); transition: background var(--t2), box-shadow var(--t2); }
.rg-tbl tr.un .rg-sw { background: none; box-shadow: inset 0 0 0 1.5px var(--line-2); }
.rg-tbl .rg-px { margin-left: 6px; font-family: var(--font); font-weight: 500; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.rg-tbl .rg-px.b { display: block; margin: 2px 0 0 16px; }
.rg-tbl .rg-fn { font-family: var(--font); font-size: 13px; color: var(--muted); }
.rg-tbl .rg-37 { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; }

/* ---------- Control column ---------- */
.rg-stick { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.rg-gh > * { margin: 0; }
.rg-gn { margin: 6px 0 2px; }
.rg-gm { color: var(--muted); }
.rg-vo .opt { flex-direction: column; align-items: flex-start; gap: 2px; }
.rg-rt .rd-cell > .rg-by { margin: 10px 0 0; line-height: 0; }
.rg-by canvas { display: block; max-width: 100%; height: auto; image-rendering: pixelated; }
.rg-rt .rd-cell > .rg-hx { margin: 10px 0 8px; overflow-wrap: anywhere; }
.rg-hx > span { display: block; }
.rg-ok { white-space: normal; }
.rg-same { margin: 0; }
.rg-gl ul { margin: 8px 0 0; padding: 0; list-style: none; font-size: 14px; line-height: 1.35; }
.rg-gl li { padding: 7px 0; border-top: 1px solid var(--line); }
.rg-gl li:last-child { border-bottom: 1px solid var(--line); }

/* Wide screens: the control column stays in view while the map scrolls under the sticky page bar */
@media (min-width: 1001px) {
  .rg-stick { position: sticky; top: 80px; }
}
@media (max-width: 760px) {
  .rg-chr { font-size: 9.5px; }
  .rg-blk { padding: 0 6px; font-size: 10.5px; }
  .rg-blk b { font-size: 10px; letter-spacing: .06em; }
  .rg-blk code { font-size: 10.5px; }
  .rg-tbl { font-size: 11.5px; }
}
