/* =========================================================================
   Project page (MotiFlow). Builds on the tokens in custom.css.
   Figures, widgets and section rules use the full 1120 px column; running text
   sits in a narrower column centred on the same axis.
   ========================================================================= */

body:has(.pj) { --main-width: 1168px; --main-padding: 24px; }   /* 1120px column */

.pj {
  --measure: 44rem;                 /* text column: ~75 characters of Literata at 17px */
  --inset: max(0px, calc((100% - var(--measure)) / 2));
  --r: 20px; --r-sm: 12px; --pad: 24px; --gap: 20px;
  /* renderer tokens (read by mf3d.js) */
  --mf-bg: var(--surface); --mf-paper: var(--surface); --mf-ink: var(--ink); --mf-ink-3: var(--ink-3); --mf-accent: var(--accent);
  --mf-mute: light-dark(#a7b0ba, #56606b);
  --bar: light-dark(#c3ccd6, #3d4651);
}
.pj .sc { font-variant: small-caps; letter-spacing: .02em; }
.pj :is(p, li, dd, .k, .meta) { text-wrap: pretty; }
.pj :is(h1, h2, h3, h4) { text-wrap: balance; }
.pj .nw { white-space: nowrap; }
.pj :is(.kpi, .rt, .res-notes, .ex-table, .seg) .sc { font-variant: normal; letter-spacing: 0; }   /* no synthetic small caps in the sans UI */
.pj .lbl { display: block; font-family: var(--font-label); font-size: 11px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.pj .vm i { font-family: KaTeX_Caligraphic, "Literata", serif; font-style: normal; font-size: 1.12em; }
.pj .vm sub { font-size: .75em; text-transform: none; }
.pj .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.pj a.ref { text-decoration: none; color: var(--accent); font-family: var(--font-label); font-size: .82em; }
.pj .ex-note { font-size: 14px; line-height: 1.6; color: var(--ink-3); margin: 14px 0 0; }
.pj .mf-view { position: relative; }
.pj .mf-layer { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.pj .mf-failed .mf-host::after { content: "3D view unavailable"; position: absolute; inset: 0; display: grid; place-items: center; font: 12px var(--font-label); color: var(--ink-3); }

/* ---------- controls shared by the widgets ---------- */
.seg { display: inline-flex; flex-wrap: wrap; padding: 3px; border-radius: 99px; background: var(--surface-2); }
.seg button { font-family: var(--font-sans); font-size: 13px; font-weight: 500; line-height: 1; border: 0; background: transparent; color: var(--ink-3);
  padding: 8px 13px; border-radius: 99px; cursor: pointer; transition: background .15s ease, color .15s ease; white-space: nowrap; }
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--paper); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .1); }
.icon-btn { position: relative; flex: none; width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; padding: 0; border-radius: 99px;
  border: 1px solid var(--rule); background: var(--paper); color: var(--ink-2); cursor: pointer; transition: color .15s ease, border-color .15s ease, background .15s ease; }
.icon-btn:hover { color: var(--accent); border-color: var(--accent); }
.icon-btn[aria-pressed="true"] { color: var(--accent-ink); background: var(--accent-soft); border-color: transparent; }
.icon-btn svg { width: 16px; height: 16px; }
.pick select { -webkit-appearance: none; appearance: none; font-family: var(--font-sans); font-size: 13px; font-weight: 500; color: var(--ink); cursor: pointer;
  border: 1px solid var(--rule); border-radius: 99px; padding: 8px 32px 8px 14px; height: 34px;
  background: var(--paper) linear-gradient(45deg, transparent 50%, currentColor 50%) no-repeat calc(100% - 17px) 14px / 5px 5px,
              linear-gradient(135deg, currentColor 50%, transparent 50%) no-repeat calc(100% - 12px) 14px / 5px 5px; }
.pick select:hover { border-color: var(--accent); }
.pj-range { -webkit-appearance: none; appearance: none; width: 100%; height: 22px; background: transparent; margin: 0; cursor: pointer; }
.pj-range::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(var(--accent), var(--accent)) 0 / var(--fill, 0%) 100% no-repeat, var(--rule); }
.pj-range::-moz-range-track { height: 4px; border-radius: 4px; background: var(--rule); }
.pj-range::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--accent); }
.pj-range::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; margin-top: -6px; border-radius: 50%; background: var(--paper); border: 2px solid var(--accent); box-shadow: 0 1px 3px rgba(0, 0, 0, .18); }
.pj-range::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--paper); border: 2px solid var(--accent); }
.readout { font-family: var(--font-label); font-size: 13px; color: var(--ink-2); text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pj :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pj-eq { display: flex; flex-direction: column; gap: 6px; align-items: center; justify-content: center; color: var(--ink); font-size: 15px;
  min-height: 84px; background: var(--paper); border-radius: 14px; padding: 12px 16px; overflow-x: auto; }

/* ---------- hero ---------- */
.pj-hero { padding: 4px 0 40px; text-align: center; }
.pj-kicker { display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap; margin-bottom: 20px; }
.pj-pill { font-family: var(--font-label); font-size: 12px; font-weight: 500; letter-spacing: .07em; text-transform: uppercase; line-height: 1;
  color: var(--accent-ink); background: var(--accent-soft); padding: 7px 11px; border-radius: 99px; }
.pj-meta { font-family: var(--font-label); font-size: 12.5px; color: var(--ink-3); letter-spacing: .02em; }
.pj-title .katex { font-size: 1em; }
.pj-title { font-size: 44px !important; line-height: 1.13 !important; letter-spacing: -0.015em; margin: 0 auto 20px !important; max-width: 960px; text-wrap: balance; }
.pj-authors { font-size: 17px; color: var(--ink); margin: 0; line-height: 1.6; display: flex; flex-wrap: wrap; justify-content: center; column-gap: 20px; max-width: none !important; }
.pj-authors span { white-space: nowrap; }
.pj-authors a { color: var(--ink); text-decoration-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.pj-authors a:hover { color: var(--accent); text-decoration-color: var(--accent); }
.pj-authors sup, .pj-affil sup { font-family: var(--font-label); font-size: 10px; color: var(--ink-3); margin-left: 1px; }
.pj-affil { font-size: 14px; color: var(--ink-3); margin: 4px 0 0; line-height: 1.6; display: flex; flex-wrap: wrap; justify-content: center; column-gap: 16px; max-width: none !important; }
.pj-affil span { white-space: nowrap; }
.pj-tldr { font-size: 18px; line-height: 1.6; color: var(--ink); max-width: var(--measure); margin: 26px auto 0; }
.pj-tldr { font-size: 19px; }
.pj-tldr .tag { display: inline-block; margin-right: 10px; padding: 4px 10px; border-radius: 8px; vertical-align: 2px; line-height: 1.3;
  font-family: var(--font-label); font-size: 13.5px; font-weight: 500; letter-spacing: .06em; color: var(--paper); background: var(--accent-ink); }
.pj-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 26px; }

/* ---------- hero viewer ---------- */
.pj-viewer { background: var(--surface); border-radius: var(--r); overflow: hidden; }
.pj-vbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 16px var(--pad) 0; }
.pj-tools { display: flex; align-items: center; gap: 8px; }
.pj-hint { font-family: var(--font-label); font-size: 11px; letter-spacing: .04em; color: var(--ink-3); margin-right: 6px; }
.pj-stage { position: relative; aspect-ratio: 16 / 7; }
.pj-stage .mf-view { position: absolute; inset: 0; }
.pj-viewer[data-mode="gen"] .ctrl-rep, .pj-viewer[data-mode="rep"] .ctrl-gen { display: none; }
.pj-viewer[data-mode="rep"] .gen-only { visibility: hidden; }
.pj-ctrl { min-height: 64px; padding: 0 var(--pad); }
.ctrl-gen { display: grid; grid-template-columns: 34px minmax(0, 1fr) 76px; grid-template-rows: auto auto; align-items: center; column-gap: 14px; align-content: center; }
.ctrl-gen .pj-ticks { grid-column: 2; }
#mf-play .i-pause, #mf-play.playing .i-play { display: none; }
#mf-play.playing .i-pause { display: block; }
.pj-ticks { display: flex; justify-content: space-between; font-family: var(--font-label); font-size: 11px; color: var(--ink-3); padding: 0 1px; margin-top: 2px; }
/* representation: three stops on a line */
.ctrl-rep { display: flex; align-items: center; }
.stops { position: relative; flex: 1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stops::before, .stops::after { content: ""; position: absolute; top: 14px; left: 16.667%; height: 2px; border-radius: 2px; }
.stops::before { right: 16.667%; background: var(--rule); }
.stops::after { width: calc(66.667% * var(--rep, .5)); background: var(--accent); }
.stop { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 8px 0 4px; border: 0; background: none; cursor: pointer;
  font-family: var(--font-sans); font-size: 13px; font-weight: 500; color: var(--ink-3); transition: color .15s ease; }
.stop i { width: 14px; height: 14px; border-radius: 50%; background: var(--surface); border: 2px solid var(--rule); transition: background .2s ease, border-color .2s ease, box-shadow .2s ease; }
.stop.past i { border-color: var(--accent); }
.stop.on i { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.stop:hover, .stop.on { color: var(--ink); }
/* captions */
.pj-caps { display: grid; }
.pj-caps > .pj-cap { grid-area: 1 / 1; visibility: hidden; opacity: 0; transition: opacity .25s ease; }
.pj-caps > .pj-cap.on { visibility: visible; opacity: 1; }
.pj-caps { margin: 10px var(--pad) 0; border-top: 1px solid var(--rule); }
.pj-cap { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 28px; align-items: center; padding: 18px 0 var(--pad); }
.pj-cap p { margin: 0; font-size: 16px; line-height: 1.6; color: var(--ink-2); }
.pj-cap p strong { color: var(--ink); }
.pj-note { font-size: 13.5px !important; line-height: 1.55; color: var(--ink-3) !important; max-width: var(--measure); margin: 12px auto 0 !important; }

/* ---------- sections ---------- */
.pj-sec { margin-top: 84px; }
.pj .pj-sec > h2 { display: flex; align-items: baseline; gap: 14px; font-size: 26px !important; line-height: 1.25; margin: 0 0 22px !important; padding: 0 0 12px var(--inset) !important;
  border-bottom: 1px solid var(--rule) !important; }
.pj h2 .num { flex: none; font-family: var(--font-label); font-size: 13px; font-weight: 500; letter-spacing: .06em; color: var(--accent); position: relative; top: -2px; }
.pj-sec > p { max-width: var(--measure); margin: 0 auto 1em; }
.pj-sec > p:last-of-type { margin-bottom: 0; }

/* ---------- 01 why rigid motifs: cards widen on hover / tap ---------- */
.pj-why { display: flex; gap: 16px; margin-top: 32px; align-items: stretch; }
.wcard { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; overflow: hidden; background: var(--surface); border-radius: 18px; padding: 10px 10px 14px; cursor: pointer;
  transition: flex-grow .6s cubic-bezier(.22, .8, .25, 1), background-color .2s ease, box-shadow .2s ease; -webkit-tap-highlight-color: transparent; }
.wcard.open { flex-grow: 1.6; }                   /* keep in sync with GROW in page-more.js */
.wcard:not(.open):hover { box-shadow: inset 0 0 0 1px var(--rule); }
.wcard .fig { position: relative; height: 176px; border-radius: 12px; background: var(--paper); overflow: hidden; --mf-bg: var(--paper); --mf-paper: var(--paper); }
.wcard .fig .mf-host, .wcard .fig .mf-view { position: absolute; inset: 0; }
.wcard .fig-2d { display: flex; align-items: center; justify-content: center; }
/* heading and text sit under the figure; the method list is a footer pinned to the bottom of each card */
.wcard .hd { display: contents; }
.wcard h4 { order: 1; font-family: var(--font-sans); font-size: 15.5px !important; font-weight: 600; line-height: 1.3; margin: 14px 8px 0 !important; color: var(--ink); }
.wcard p { order: 2; font-size: 14.5px; line-height: 1.55; margin: 8px 8px 0; color: var(--ink-2); }
/* in the row (set by page-more.js): fixed text widths, so nothing reflows while a card widens or narrows */
.pj-why[style*="--wc"] .wcard h4, .pj-why[style*="--wc"] .wcard .meta { width: var(--wc); flex: none; }
.pj-why[style*="--wc"] .wcard p { width: var(--wo); flex: none; opacity: 0; transition: opacity .2s ease; }
.pj-why[style*="--wc"] .wcard.open p { opacity: 1; transition: opacity .35s ease .25s; }
.wcard .meta { order: 3; display: block; margin: auto 8px 0; padding-top: 14px; font-family: var(--font-label); font-size: 10.5px; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); line-height: 1.5; }
.wcard.ours { background: var(--accent-soft); }
.wcard.ours h4, .wcard.ours .meta { color: var(--accent); }
.wcard.ours p strong { color: var(--accent-ink); }
/* 2D fragment graph */
.mf2d { width: 90%; max-height: 88%; height: auto; display: block; }
.mf2d-hl { opacity: .22; }
.mf2d-bonds { stroke: var(--ink-2); }
.mf2d-labels { font-family: var(--font-sans); font-weight: 500; }
.mf2d-C { fill: var(--ink-2); }
.mf2d-O { fill: light-dark(#C73A2F, #F06A5F); } .mf2d-N { fill: light-dark(#2A63A3, #5B9BE0); } .mf2d-S { fill: light-dark(#8A7000, #E2C23A); }
.mf2d-F, .mf2d-Cl { fill: light-dark(#5E7A20, #A5C24A); }

/* ---------- 02 fragmentation explorer ---------- */
.pj-explorer { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr); gap: 32px; margin-top: 32px; align-items: start; }
.ex-view { background: var(--surface); border-radius: var(--r); padding: 16px; }
.ex-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.ex-stage { position: relative; aspect-ratio: 4 / 3; margin-top: 6px; }
.ex-stage .mf-view { position: absolute; inset: 0; }
.ex-count { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; padding: 2px 6px 2px; font-family: var(--font-sans); font-size: 14px; color: var(--ink-2); }
.ex-count b { font-weight: 600; color: var(--ink); font-size: 16px; font-variant-numeric: tabular-nums; }
.ex-count > span { color: var(--ink-3); }
.ex-count em { margin-left: auto; font-style: normal; font-family: var(--font-label); font-size: 12px; color: var(--ink-3); }
.ex-side { padding-top: 6px; }
.ex-side .lbl { margin-bottom: 10px; }
.ex-table { font-family: var(--font-sans); font-size: 14px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.ex-table .row { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) 44px minmax(0, 1.65fr) 56px; column-gap: 12px; align-items: center;
  min-height: 34px; padding: 0 10px; border-top: 1px solid var(--rule); cursor: pointer; transition: background .15s ease; }
.ex-table .row.second { border-top-color: transparent; }
.ex-table .row.head { cursor: default; min-height: 0; padding-bottom: 8px; border-top: 0; align-items: end;
  font-family: var(--font-label); font-size: 10.5px; font-weight: 500; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); }
.ex-table .row:not(.head):hover { background: var(--surface); }
.ex-table .row.on { background: var(--accent-soft) !important; }
.ex-table .row.on:not(.second) { border-radius: 10px 10px 0 0; border-top-color: transparent; }
.ex-table .row.on.second { border-radius: 0 0 10px 10px; }
.ex-table .row.on + .row:not(.second) { border-top-color: transparent; }
.ex-table .nm { color: var(--ink); font-weight: 500; white-space: nowrap; }
.ex-table .nm .al { font-style: normal; font-weight: 400; color: var(--ink-3); }
.ex-table .row.on .nm .al { color: var(--accent-ink); }
.ex-table .ds { color: var(--ink-3); white-space: nowrap; }
.ex-table .r { text-align: right; }
.ex-table .cell { display: flex; align-items: center; gap: 10px; }
.ex-table .mb { flex: 1; height: 6px; border-radius: 3px; background: linear-gradient(var(--bar), var(--bar)) 0 / var(--w) 100% no-repeat, var(--rule); }
.ex-table .row.on .mb { background: linear-gradient(var(--accent), var(--accent)) 0 / var(--w) 100% no-repeat, color-mix(in srgb, var(--accent) 18%, transparent); }
.ex-table .cell em { font-style: normal; width: 32px; text-align: right; }
.ex-table .row.on .nm, .ex-table .row.on em { color: var(--accent-ink); }
.pj-compress { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; align-items: center; margin-top: 24px; padding: 22px 24px; background: var(--surface); border-radius: var(--r); }
.cp-text p { margin: 8px 0 0; font-size: 16px; line-height: 1.6; }
.cp-bars { display: flex; flex-direction: column; gap: 8px; }
.cp-row { display: grid; grid-template-columns: 100px minmax(0, 1fr) 36px; gap: 14px; align-items: center; font-family: var(--font-sans); font-size: 14px; color: var(--ink-2); }
.cp-track { height: 12px; }
.cp-track i { display: block; height: 100%; width: var(--w); border-radius: 4px; background: var(--bar); }
.cp-row b { text-align: right; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.cp-row.us span, .cp-row.us b { color: var(--accent); }
.cp-row.us i { background: var(--accent); }

/* ---------- 03 symmetries ---------- */
.pj-sym { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr); gap: 32px; margin-top: 32px; align-items: start; }
.sym-view { position: relative; aspect-ratio: 4 / 3; background: var(--surface); border-radius: var(--r); overflow: hidden; }
.sym-view .mf-view { position: absolute; inset: 0; }
.sym-side { padding-top: 6px; }
.sym-side > * + * { margin-top: 16px; }
.sym-seg .f { margin-left: 4px; color: var(--ink-3); font-weight: 400; }
.sym-eq { min-height: 0; padding: 14px 16px; background: var(--surface); }
.sym-head { display: flex; justify-content: space-between; padding: 0 10px 8px; font-family: var(--font-label); font-size: 10.5px; font-weight: 500; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); border-bottom: 1px solid var(--rule); }
.sym-head sub { text-transform: none; }
.sym-row { display: grid; grid-template-columns: 128px minmax(0, 1fr) 40px; gap: 14px; align-items: center; width: 100%; margin-top: 4px; padding: 8px 10px; border: 0; border-radius: 10px;
  background: none; text-align: left; font-family: var(--font-sans); font-size: 14px; color: var(--ink-2); cursor: default; transition: background .15s ease; }
.sym-row:hover { background: var(--surface); }
.sym-row .nm b { font-weight: 600; color: var(--ink); margin-right: 8px; }
.sym-row .nm em { font-style: normal; color: var(--ink-3); font-size: 13px; }
.sym-row .bar { height: 6px; border-radius: 3px; background: var(--rule); overflow: hidden; }
.sym-row .bar i { display: block; height: 100%; width: var(--w); background: var(--mf-mute); border-radius: 3px; }
.sym-row .val { text-align: right; font-variant-numeric: tabular-nums; }
.sym-row.best { background: var(--accent-soft); }
.sym-row.best .bar i { background: var(--accent); }
.sym-row.best b, .sym-row.best .val { color: var(--accent); }
.sym-side .ex-note { margin-top: 18px; }

/* ---------- 04 two flows ---------- */
.pj-eq-wide { margin-top: 30px; min-height: 0; padding: 18px 20px; background: var(--surface); font-size: 17px; }
.pj-flow { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 20px; margin-top: 20px; }
.fl-card { display: flex; flex-direction: column; min-width: 0; background: var(--surface); border-radius: var(--r); padding: 22px 24px 24px; }
.fl-card p { font-size: 15px; line-height: 1.6; margin: 8px 0 0; }
.fl-tokens { margin-top: auto; padding-top: 20px; }
/* discrete flow: one lane per motif, ordered by reveal time; token on the left, 0..1 track on the right */
.lanes { --cw: 70px; --g: 12px; position: relative; display: flex; flex-direction: column; gap: 3px; }
.lane { display: grid; grid-template-columns: var(--cw) minmax(0, 1fr); column-gap: var(--g); align-items: center; height: 24px; border-radius: 8px; }
.lane.focus { background: var(--paper); box-shadow: 0 0 0 1px var(--rule); }
.lane .tok { position: relative; display: flex; align-items: center; justify-content: center; height: 20px; margin-left: 2px; border-radius: 6px;
  border: 1.2px dashed color-mix(in srgb, var(--accent) 55%, transparent); background: var(--paper); transition: background-color .25s ease, border-color .25s ease; }
.lane .tok b { font-family: var(--font-sans); font-size: 12px; font-weight: 600; color: var(--ink); opacity: 0; transition: opacity .25s ease; }
.lane .tok em { position: absolute; font-style: normal; font-family: var(--font-label); font-size: 9.5px; font-weight: 500; letter-spacing: .08em; color: var(--accent); transition: opacity .2s ease; }
.lane.on .tok { border-style: solid; border-color: var(--h); background: color-mix(in srgb, var(--h) 15%, var(--paper)); }
.lane.on .tok b { opacity: 1; } .lane.on .tok em { opacity: 0; }
.lane .trk { position: relative; height: 100%; margin-right: 8px; }
.lane .trk::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 1.5px dashed var(--rule); }
.lane .post { position: absolute; left: var(--x); top: 50%; width: var(--w, 0%); height: 3px; margin-top: -1.25px; border-radius: 2px; background: var(--h); }
.lane .tau { position: absolute; left: var(--x); top: 50%; width: 9px; height: 9px; border-radius: 50%; transform: translate(-50%, -50%); background: var(--paper); border: 1.5px solid var(--h); }
.lane.on .tau { background: var(--h); }
.lane.focus .tok { box-shadow: 0 0 0 2px var(--paper), 0 0 0 3.5px var(--h); }
.lane.axis { height: auto; margin-top: 4px; }
.lane.axis .ends { display: flex; justify-content: space-between; margin-right: 8px; font-family: var(--font-label); font-size: 11px; color: var(--ink-3); }
.lane.axis .cnt { color: var(--ink-2); }
.lanes .cur { position: absolute; top: 0; bottom: 22px; width: 2px; margin-left: -1px; border-radius: 1px; background: var(--accent);
  left: calc(var(--cw) + var(--g) + (100% - var(--cw) - var(--g) - 8px) * var(--t, 0)); }
.fl-view { position: relative; flex: 1; min-height: 240px; margin-top: 16px; border-radius: 14px; background: var(--paper); --mf-bg: var(--paper); --mf-paper: var(--paper); }
.fl-view .mf-view { position: absolute; inset: 0; }
.fl-ctrl { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) 76px; gap: 14px; align-items: center; padding: 0 2px; }
.pj-arch { margin-top: 36px; }
.arch { display: grid; grid-template-columns: minmax(0, 1fr) 26px minmax(0, 1fr) 26px minmax(0, 1.2fr) 26px minmax(0, 1fr); align-items: stretch; margin-top: 12px; }
.ab { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; background: var(--surface); border-radius: 14px; padding: 14px 16px 15px; font-family: var(--font-sans); font-size: 14px; line-height: 1.45; color: var(--ink-2); }
.ab b { font-size: 14.5px; font-weight: 600; color: var(--ink); margin-bottom: 4px; }
.ar { align-self: center; justify-self: center; width: 9px; height: 9px; margin-left: -4px; border-top: 1.5px solid var(--ink-3); border-right: 1.5px solid var(--ink-3); transform: rotate(45deg); }
.pj-arch > .ex-note { max-width: var(--measure); margin: 14px auto 0; }

/* ---------- 05 results ---------- */
.pj-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-top: 30px; }
.kpi { display: flex; flex-direction: column; gap: 8px; text-align: left; padding: 16px 16px 15px; border: 1px solid var(--rule); border-radius: 16px; background: transparent; cursor: pointer;
  font-family: var(--font-sans); color: var(--ink-2); transition: border-color .15s ease, background-color .15s ease; }
.kpi:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--rule)); }
.kpi .big { font-size: 32px; font-weight: 600; line-height: 1.05; letter-spacing: -0.02em; color: var(--ink); font-variant-numeric: tabular-nums; }
.kpi .big small { font-size: .56em; font-weight: 500; letter-spacing: 0; margin-left: 2px; color: var(--ink-3); }
.kpi .k { font-size: 13px; line-height: 1.4; color: var(--ink-3); }
.kpi[aria-selected="true"] { background: var(--accent-soft); border-color: transparent; }
.kpi[aria-selected="true"] .big, .kpi[aria-selected="true"] .big small { color: var(--accent); }
.kpi[aria-selected="true"] .k { color: var(--accent-ink); }
.pj-res { margin-top: 12px; padding: 22px 24px 22px; background: var(--surface); border-radius: var(--r); }
.res-hd h4 { font-size: 18px !important; line-height: 1.35; margin: 0 !important; color: var(--ink); }
.res-hd p { margin: 4px 0 0; font-size: 14px; color: var(--ink-3); }
.rt-scroll { margin-top: 14px; overflow-x: auto; }
.pj .rt { display: table; margin: 0; border: 0; border-radius: 0; line-height: 1.4; }
.rt th { background: none; }
.rt tbody tr { border-top: 0; }
.rt { table-layout: fixed; width: 100%; border-collapse: collapse; font-family: var(--font-sans); font-size: 14px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.rt th, .rt td { height: 36px; padding: 0 12px; border-bottom: 1px solid var(--rule); text-align: left; white-space: nowrap; font-weight: 400; }
.rt tr > :first-child { padding-left: 10px; }
.rt thead th { height: auto; padding-top: 0; padding-bottom: 8px; vertical-align: bottom; font-family: var(--font-label); font-size: 10.5px; font-weight: 500; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); }
.rt thead .up { color: var(--accent); font-family: var(--font-sans); }
.rt .n { text-align: right; }
.rt thead th.key { text-align: right; }
.rt tbody th { font-weight: 500; color: var(--ink); }
.rt thead th:first-child { width: 23%; }
.rt thead th.key { width: 38%; }
.rt thead th { white-space: normal; }
.rt .kc { display: flex; align-items: center; gap: 12px; }
.rt .cellbar { flex: 1; height: 8px; border-radius: 4px; background: color-mix(in srgb, var(--rule) 70%, transparent); overflow: hidden; }
.rt .cellbar i { display: block; height: 100%; width: 0; border-radius: 4px; background: var(--bar); transition: width .7s cubic-bezier(.2, .7, .2, 1); }
.pj-res.in .cellbar i { width: var(--w); }
.rt .v { min-width: 76px; text-align: right; }
.rt small { font-size: 11px; color: var(--ink-3); margin-left: 3px; }
.rt sup { font-size: 10px; color: var(--ink-3); margin-left: 1px; }
.rt td.top .v { font-weight: 700; color: var(--ink); }
.rt tr.us th, .rt tr.us td { color: var(--accent); font-weight: 600; background: color-mix(in srgb, var(--accent-soft) 75%, transparent); }
.rt tr.us .cellbar i { background: var(--accent); }
.rt tr.us td.top .v { color: var(--accent); }
.rt tr.ref th, .rt tr.ref td { color: var(--ink-3); font-style: italic; }
.rt tbody tr:last-child > * { border-bottom: 0; }
.res-notes { list-style: none; padding: 0; margin: 16px 0 0; }
.res-notes li { position: relative; padding-left: 16px; margin: 6px 0 0; font-size: 14px; line-height: 1.55; color: var(--ink-3); }
.res-notes li::before { content: "–"; position: absolute; left: 0; }
.res-notes li:first-child { color: var(--ink-2); }

/* ---------- 06 scope, citation ---------- */
.pj-scope { display: grid; grid-template-columns: 132px minmax(0, 1fr); max-width: var(--measure); margin: 0 auto; }
.pj-scope dt, .pj-scope dd { margin: 0; padding: 14px 0; border-top: 1px solid var(--rule); }
.pj-scope dt { font-family: var(--font-label); font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); padding-top: 18px; }
.pj-scope dd { color: var(--ink-2); line-height: 1.65; }
.pj-scope dt:first-of-type, .pj-scope dd:first-of-type { border-top: 0; padding-top: 4px; }
.pj-scope dt:first-of-type { padding-top: 8px; }
.pj-bib { max-width: var(--measure); margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; background: var(--surface); border-radius: 16px; padding: 10px 10px 0 20px; }
.pj-bib::before { content: "BibTeX"; grid-area: 1 / 1; font-family: var(--font-label); font-size: 11px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.pj-bib .icon-btn { grid-area: 1 / 2; }
.pj-bib code { grid-area: 2 / 1 / 3 / 3; display: block; overflow-x: auto; margin-top: 6px; padding: 0 10px 18px 0; font-family: var(--font-label); font-size: 11.5px; line-height: 1.8; color: var(--ink-2); white-space: pre; background: none; }
#mf-copy .i-ok { display: none; }
#mf-copy.done { color: var(--accent); border-color: var(--accent); }
#mf-copy.done svg:first-child { display: none; }
#mf-copy.done .i-ok { display: block; }
#mf-copy .copied { position: absolute; right: calc(100% + 8px); top: 50%; transform: translateY(-50%); font-family: var(--font-label); font-size: 11px; color: var(--accent); white-space: nowrap; pointer-events: none; }
.pj h3.pj-refs-h { max-width: var(--measure); margin: 44px auto 18px !important; }
.pj-refs { list-style: none; padding: 0; margin: 0 auto; max-width: var(--measure); counter-reset: r; }
.pj-refs li { counter-increment: r; display: grid; grid-template-columns: 36px minmax(0, 1fr); margin: 0 0 6px; font-size: 14px; line-height: 1.55; color: var(--ink-3); }
.pj-refs li::before { content: "[" counter(r) "]"; font-family: var(--font-label); font-size: 12px; padding-top: 2px; }
.pj-refs li:target { color: var(--ink); }

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
  .pj-why { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wcard.open { box-shadow: inset 0 0 0 1px var(--rule); }
  .pj-cap { grid-template-columns: 1fr; gap: 14px; }
  .pj-kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .kpi { grid-column: span 2; }
  .kpi:nth-child(4), .kpi:nth-child(5) { grid-column: span 3; }
}
@media (max-width: 860px) {
  .pj-explorer, .pj-sym, .pj-compress, .pj-flow { grid-template-columns: minmax(0, 1fr); }
  .pj-explorer, .pj-sym { gap: 22px; }
  .sym-view, .ex-stage { aspect-ratio: 16 / 10; }
  /* narrow screens: the four stages stacked, centred, with downward chevrons between them */
  .arch { display: flex; flex-direction: column; align-items: stretch; }
  .ar { align-self: center; margin: 9px 0 13px; transform: rotate(135deg); }
  .ab { padding: 12px 16px 13px; }
}
@media (max-width: 640px) {
  body:has(.pj) { --main-padding: 16px; }
  .pj { --pad: 14px; --r: 16px; }
  .pj-hero { padding-bottom: 28px; }
  .pj-title { font-size: 30px !important; }
  .pj-authors { font-size: 16px; column-gap: 14px; }
  .pj-affil { font-size: 13px; column-gap: 12px; }
  .pj-tldr { font-size: 16.5px; }
  .pj-hint { display: none; }
  .pj-vbar { padding-top: 12px; }
  .pj-stage { aspect-ratio: 1 / 1; }
  .pj-cap { padding-top: 14px; }
  .pj-cap p { font-size: 15px; }
  .pj-eq { font-size: 13.5px; padding: 10px 12px; }
  .pj-ticks span:nth-child(2) { display: none; }
  .ctrl-gen { grid-template-columns: 34px minmax(0, 1fr) 62px; column-gap: 10px; }
  .pj-sec { margin-top: 64px; }
  .pj .pj-sec > h2 { font-size: 22px !important; gap: 10px; }
  .pj-why { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .wcard { display: grid; grid-template-columns: 124px minmax(0, 1fr); grid-template-rows: auto auto 1fr; column-gap: 14px; padding: 10px; }
  .wcard .fig { grid-column: 1; grid-row: 1 / span 3; height: auto; min-height: 120px; }
  .wcard h4, .wcard p, .wcard .meta { grid-column: 2; margin-left: 0; margin-right: 0; }
  .wcard h4 { margin: 4px 0 0 !important; }
  .wcard p { margin-top: 6px; font-size: 14px; }
  .wcard .meta { align-self: end; padding-top: 10px; }
  .wcard.open { box-shadow: none; }
  .ex-view { padding: 10px; }
  .ex-stage { aspect-ratio: 4 / 3; }
  .ex-top .seg button { padding: 8px 10px; font-size: 12.5px; }
  .ex-table { font-size: 13px; }
  .ex-table .row { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) 36px minmax(0, 1.2fr) 36px; column-gap: 8px; padding: 0 6px; }
  .ex-table .row.head { font-size: 9.5px; }
  .ex-table .nm { white-space: normal; line-height: 1.25; padding: 6px 0; }
  .ex-table .cell em { width: 28px; }
  .ex-table .mb { display: none; }
  .ex-table .cell { justify-content: flex-end; }
  .pj-compress { padding: 18px 16px; gap: 18px; }
  .cp-row { grid-template-columns: 92px minmax(0, 1fr) 32px; gap: 10px; }
  .sym-row { grid-template-columns: 112px minmax(0, 1fr) 36px; gap: 10px; }
  .sym-seg .f { display: none; }
  .fl-card { padding: 16px; }
  .pj-flow > .fl-card:first-child { order: 0; } .pj-flow > .fl-ctrl { order: 1; } .pj-flow > .fl-card:nth-child(2) { order: 2; }
  .fl-view { min-height: 230px; }
  .pj-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .kpi, .kpi:nth-child(4), .kpi:nth-child(5) { grid-column: auto; }
  .kpi:first-child { grid-column: 1 / -1; }
  .kpi { padding: 13px 14px 12px; gap: 6px; }
  .kpi .big { font-size: 26px; }
  .pj-res { padding: 16px 14px 14px; }
  /* small screens: values only (no bars, no ±), so the key metric stays in view */
  .rt { font-size: 13px; table-layout: auto; }
  .rt thead th:first-child, .rt thead th.key { width: auto; }
  .rt th, .rt td { padding: 6px 6px; height: 34px; white-space: normal; line-height: 1.3; }
  .rt thead th { font-size: 9.5px; letter-spacing: .03em; }
  .rt .cellbar, .rt small { display: none; }
  .rt .v { min-width: 0; }
  .rt .kc { justify-content: flex-end; }
  .pj-scope { grid-template-columns: minmax(0, 1fr); }
  .pj-scope dt { padding: 16px 0 0 !important; }
  .pj-scope dd { border-top: 0; padding: 4px 0 14px !important; }
  .pj-bib { padding: 8px 8px 0 14px; }
  .pj-bib code { font-size: 11.5px; }
}
@media (prefers-reduced-motion: reduce) {
  .wcard, .rt .cellbar i, .lane .tok, .lane .tok b, .pj-caps > .pj-cap { transition: none !important; }
}
