/* fig-pipeline: inputs → start → (flow model) → after the flow → (threshold) → binarized, then the
   reconstructed graph beside the truth, framed as the reference.
   Six steps (pipeline.js): anything not yet reached carries .pipeline-off and is dimmed in place.
   Colours are tokens only. */
.pipeline-wrap { position: relative; outline-offset: 4px; border-radius: var(--radius); }
.pipeline-wrap > svg { position: absolute; left: 0; top: 0; }
.pipeline-head-label {
  position: absolute; display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  text-align: center; line-height: 1.25; padding-bottom: 6px; box-sizing: border-box;
  font-size: var(--fig-text); color: var(--fg); pointer-events: none; white-space: nowrap;
}
.pipeline-head-label.one { flex-direction: row; justify-content: center; align-items: flex-end; gap: 6px; }
.pipeline-word { font-weight: 600; }
.pipeline-sym { color: var(--muted); }
.pipeline-sym .katex { font-size: 1.05em; color: var(--fg); }
.pipeline-note { font-size: 12px; color: var(--muted); }
/* inputs: smaller headings (quieter by size, not by colour) */
.pipeline-head-label.input { font-size: 12.5px; padding-bottom: 5px; gap: 5px; }
/* the reference: regular weight, muted word */
.pipeline-head-label.ref .pipeline-word { font-weight: 500; color: var(--muted); }
.pf-svg .pipeline-op { font-size: 12.5px; fill: var(--muted); }
.pipeline-arrow { fill: none; stroke: var(--c-ref); stroke-width: 1.5; stroke-linejoin: round; }
.pipeline-head { fill: var(--c-ref); stroke: none; }
/* the refinement arrow: the backbone of the figure */
.pipeline-arrow.main { stroke: var(--fg); stroke-width: 2.25; }
.pipeline-head.main { fill: var(--fg); }
.pipeline-compare { stroke: var(--c-ref); stroke-width: 1.5; stroke-dasharray: 4 3; fill: none; }
.pipeline-compare-tick { stroke: var(--c-ref); stroke-width: 1.5; }
.pipeline-frame { fill: none; stroke: var(--c-ref); stroke-width: 1; stroke-dasharray: 3 3; }
.pipeline-readout { margin-top: 12px; }
.pipeline-stage-name { color: var(--fg); font-weight: 600; }
.pipeline-ring { pointer-events: none; }
.pipeline-hi-halo { fill: none; stroke: var(--bg); stroke-width: 4; }
.pipeline-hi-ring { fill: none; stroke: var(--fg); stroke-width: 1.75; }

/* ---------- the flow model and the time bar (step 4) ---------- */
.pipeline-model { fill: var(--bg); stroke: var(--fg); stroke-width: 1.5; }
.pipeline-model-tex {
  position: absolute; display: flex; align-items: center; justify-content: center;
  color: var(--fg); font-size: 15px; pointer-events: none;
}
.pipeline-tbar-track { stroke: var(--c-axis); stroke-width: 1.25; fill: none; }
.pipeline-tbar-prog { stroke: var(--c-flow); stroke-width: 2.5; stroke-linecap: round; fill: none; }
.pipeline-tbar-dot { fill: var(--c-flow); stroke: var(--bg); stroke-width: 1.5; }
.pf-svg .pipeline-tbar-t { fill: var(--fg); font-variant-numeric: tabular-nums; }
.pipeline-tbar-var { font-style: italic; }

/* ---------- the masked-pair mark and the largest changes ----------
   Once a masked pair is filled (Prior, Start, After the flow, Binarized) it keeps a light outline in the
   hatch colour, so the eye follows the region that was hidden (not on a small Prior panel). The pairs the
   flow changes most get a full-strength flow-green ring just outside the cell, on a --bg halo, in After the
   flow at step 4 only (ink is kept for observed entries and the truth). */
.pipeline-mmark { fill: none; stroke: var(--c-hatch); stroke-width: 0.8; stroke-opacity: 0.5; pointer-events: none; }
.pipeline-chg { opacity: 0; pointer-events: none; transition: opacity 0.6s ease-in-out; }
.pipeline-wrap[data-stage="4"] .pipeline-chg { opacity: 1; }
.pipeline-chg-mark { fill: none; stroke: var(--c-flow); stroke-width: 1.4; }
.pipeline-chg-halo { fill: none; stroke: var(--bg); stroke-width: 3; }
.pipeline-fliers { pointer-events: none; }
/* a travelling prior cell keeps the light masked-pair outline, so a low score still shows as a cell in the air */
.pipeline-flier { shape-rendering: crispEdges; stroke: var(--c-hatch); stroke-opacity: 0.6; stroke-width: 0.8; vector-effect: non-scaling-stroke; }

/* ---------- the drawings (step 6) ----------
   Reconstructed: observed edges ink; found = solid green, false = thin dashed green (underneath, light),
   missed = thin dotted red. Truth: observed ink, masked edges strong red dashed (.pf-edge.masked-edge). */
#fig-pipeline .pf-edge.pipeline-e-found { stroke-width: 2.4; }
#fig-pipeline .pf-edge.pipeline-e-false { stroke-width: 1.1; stroke-dasharray: 3 3; stroke-opacity: 0.85; }
#fig-pipeline .pf-edge.pipeline-e-missed { stroke-width: 1.6; stroke-dasharray: 1.5 3; }
#fig-pipeline .pipeline-labelled .pf-node-label { font-size: 12px; }
#fig-pipeline .pipeline-labelled.small .pf-node-label { font-size: 10.5px; }
/* the legend changes with the step and keeps the height of the tallest one: rows stay at the top */
#fig-pipeline .fig-legend { align-content: flex-start; }
#fig-pipeline .pipeline-hitline { stroke: transparent; stroke-width: 12; stroke-linecap: round; cursor: crosshair; }
#fig-pipeline .pipeline-ghi-line { stroke: var(--fg); stroke-opacity: 0.16; stroke-width: 10; stroke-linecap: round; fill: none; }
#fig-pipeline .pf-node.pipeline-node-hi { stroke: var(--fg); stroke-width: 3; }
/* legend keys that match the drawing marks */
#fig-pipeline .fig-legend .pipeline-key-obs { stroke-width: 1.6; }
#fig-pipeline .fig-legend .pipeline-key-found { stroke-width: 2.4; }
#fig-pipeline .fig-legend .pipeline-key-false { stroke-width: 1.1; stroke-dasharray: 3 3; }
#fig-pipeline .fig-legend .pipeline-key-missed { stroke-width: 1.6; stroke-dasharray: 1.5 3; }

/* ---------- steps ----------
   A panel not yet reached keeps its place: a dashed placeholder with a faint heading.
   Its content and its ring are hidden; the arrows and labels of its step are all but hidden. */
.pipeline-ph { fill: none; stroke: var(--c-axis); stroke-width: 1; stroke-dasharray: 4 4; opacity: 0; }
.pipeline-cells, .pipeline-ring, .pipeline-ph, .pipeline-staged { transition: opacity 0.9s ease-in-out; }
.pipeline-panel.pipeline-off .pipeline-ph { opacity: 1; }
.pipeline-panel.pipeline-off .pipeline-cells { opacity: 0; pointer-events: none; }
.pipeline-panel.pipeline-off .pipeline-ring { opacity: 0; }
.pipeline-head-label.pipeline-off { opacity: 0.24; }
.pipeline-model-tex.pipeline-off { opacity: 0.16; }
.pipeline-ops .pipeline-off { opacity: 0.16; }
/* phone: the drawings, their headings and the compare mark are not reserved before step 6 (the figure grows) */
.pipeline-wrap.pipeline-grow .pipeline-late.pipeline-off { visibility: hidden; }
/* the Truth's reference frame waits for step 6, so before it the Truth placeholder is one dashed box like the others */
.pipeline-ops .pipeline-off .pipeline-frame { opacity: 0; }
/* durations match pipeline.js: the prior's scores fade in over 1 s (step 2, T_PRIOR); After the flow and
   Binarized arrive in 0.8 s (steps 4 and 5, T_FADE) before the script moves their cells; the drawings in
   0.9 s (step 6, T_SHOW). Start's cells (step 3) are under script control while the Combine beats run. */
.pipeline-wrap[data-stage="2"] .pipeline-cells { transition-duration: 1s; }
.pipeline-wrap[data-stage="3"] .pipeline-cells, .pipeline-wrap[data-stage="4"] .pipeline-cells,
.pipeline-wrap[data-stage="5"] .pipeline-cells { transition-duration: 0.8s; }

/* ---------- the Combine beats (step 3; data-beat on the wrap, set by pipeline.js) ----------
   The bracket is swapped for its two arms so each can be dimmed; for the beat on show, the source panel and
   its arm lead and the other input and its arm are dimmed (not hidden). In beat 1 a --fg line runs from
   Observed along its arm into Start; in beat 2 the prior's cells themselves travel. */
.pipeline-beats { visibility: hidden; }
.pipeline-wrap[data-beat] .pipeline-beats { visibility: visible; }
.pipeline-wrap[data-beat] .pipeline-bracket { visibility: hidden; }
.pipeline-panel, .pipeline-arm, .pipeline-sweep { transition: opacity 0.6s ease-in-out; }
.pipeline-wrap[data-beat] .pipeline-head-label { transition-duration: 0.6s; }
.pipeline-sweep { opacity: 0; }
.pipeline-wrap[data-beat="obs"] .pipeline-sweep.obs { opacity: 1; }
.pipeline-sweep-line { fill: none; stroke: var(--fg); stroke-width: 2; stroke-linejoin: round; }
.pipeline-sweep-head { fill: var(--fg); stroke: none; }
.pipeline-wrap[data-beat="obs"] .pipeline-arm.prior,
.pipeline-wrap[data-beat="obs"] .pipeline-panel.pipeline-p1,
.pipeline-wrap[data-beat="obs"] .pipeline-head-label.pipeline-p1,
.pipeline-wrap[data-beat="prior"] .pipeline-arm.obs,
.pipeline-wrap[data-beat="prior"] .pipeline-panel.pipeline-p0,
.pipeline-wrap[data-beat="prior"] .pipeline-head-label.pipeline-p0 { opacity: 0.3; }
/* a jump (not a step forward by one) and reduced motion: switch at once */
.pipeline-wrap.pipeline-instant *, .pipeline-wrap.pipeline-instant { transition: none !important; }
@media (prefers-reduced-motion: reduce) {
  .pipeline-wrap * { transition: none !important; }
}

/* ---------- controls ---------- */
/* the Graph selector on a row of its own, the steps and Play under it */
#fig-pipeline .fig-controls .pipeline-graph-ctl { flex-basis: 100%; align-items: flex-start; }
/* touch targets at least 32 px high; on a phone the step selector shows the numbers 1 to 6 */
#fig-pipeline .fig-controls .seg button, #fig-pipeline .fig-controls .btn { min-height: 32px; }
#fig-pipeline .fig-controls.pipeline-narrow .pipeline-seg .seg button { min-width: 40px; padding-inline: 8px; font-variant-numeric: tabular-nums; }
#fig-pipeline .fig-controls.pipeline-narrow { gap: 12px 16px; }
