/* TensorLynx · High-fidelity reassessment of optimised designs (slug high-fidelity-design-reassessment).
   Page-only drawings and motion. Every selector is scoped under .tx-p-hifi. Default (no JS, reduced motion) = final state;
   motion only runs under html.js once a figure is revealed (.is-in). Transforms, opacity and stroke only. */

.tx-p-hifi { --hifi-ok: var(--tx-green); --hifi-bad: var(--tx-red); --hifi-c: var(--tx-cyan); --hifi-a: var(--tx-amber); }
.tx-p-hifi .tx-h1 { max-width: 21ch; font-size: clamp(2.4rem, 1.7rem + 3.1vw, 4.1rem); }
.tx-p-hifi .hifi-h1-k { display: block; color: var(--tx-cyan); font-size: .56em; letter-spacing: -0.01em; margin-bottom: .35em; }
.tx-p-hifi .hifi-vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- shared SVG text and strokes ---- */
.tx-p-hifi svg text { font-family: var(--font-mono); }
.tx-p-hifi .hifi-cap { font-size: 13px; letter-spacing: .16em; fill: var(--tx-amber); }
.tx-p-hifi .hifi-mini { font-size: 13px; fill: var(--tx-muted); }
.tx-p-hifi .hifi-mono { font-size: 14px; fill: var(--tx-muted); }
.tx-p-hifi .hifi-mono--c { fill: var(--tx-cyan); }
.tx-p-hifi .hifi-mono--a { fill: var(--tx-amber); }
.tx-p-hifi .hifi-sub { font-size: .75em; }
.tx-p-hifi .hifi-t { font-family: var(--font-sans); font-size: 18px; font-weight: 600; fill: var(--tx-ink); }
.tx-p-hifi .hifi-t--m { font-weight: 400; font-size: 16px; fill: var(--tx-muted); }
.tx-p-hifi .hifi-axis { fill: none; stroke: var(--border-strong); stroke-width: 1.5; }

/* ---- Hero: the gate line ---- */
.tx-p-hifi .hifi-hero { aspect-ratio: auto; min-height: 0; }
.tx-p-hifi .hifi-tilt svg { height: auto; }
.tx-p-hifi .hifi-hero { border: 0; background: none; }
.tx-p-hifi .hifi-hero figcaption { display: flex; flex-wrap: wrap; gap: .5rem 1rem; justify-content: space-between; font-size: var(--step-xs); color: var(--tx-muted); margin-top: .4rem; }
.tx-p-hifi .hifi-box { fill: var(--surface-1); stroke: var(--border-strong); }
.tx-p-hifi .hifi-lane { stroke: var(--tx-cyan); stroke-width: 2; stroke-dasharray: 3 7; opacity: .55; }
.tx-p-hifi .hifi-lane--b { stroke: var(--tx-amber); }
.tx-p-hifi .hifi-gates rect { fill: rgba(57, 208, 224, .05); stroke: var(--accent-border); stroke-width: 1.5; }
.tx-p-hifi .hifi-gates text { font-size: 13px; letter-spacing: .08em; fill: var(--tx-ink); }
.tx-p-hifi .hifi-tick circle { fill: var(--surface-0); stroke: var(--hifi-ok); stroke-width: 2; }
.tx-p-hifi .hifi-tick path, .tx-p-hifi .hifi-cross path { fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.tx-p-hifi .hifi-tick path { stroke: var(--hifi-ok); }
.tx-p-hifi .hifi-cross circle { fill: var(--surface-0); stroke: var(--hifi-bad); stroke-width: 2; }
.tx-p-hifi .hifi-cross path { stroke: var(--hifi-bad); }
.tx-p-hifi .hifi-tick, .tx-p-hifi .hifi-cross { transform-box: fill-box; transform-origin: center; }
.tx-p-hifi .hifi-back { fill: none; stroke: var(--hifi-bad); stroke-width: 2; stroke-dasharray: 1; stroke-dashoffset: 0; }
.tx-p-hifi .hifi-back-t { font-size: 13px; fill: var(--hifi-bad); }
.tx-p-hifi .hifi-lab { font-size: 16px; font-weight: 600; fill: var(--tx-ink); }
.tx-p-hifi .hifi-tok { opacity: 0; }
.tx-p-hifi .hifi-tok--a { fill: var(--tx-cyan); filter: drop-shadow(0 0 6px rgba(57, 208, 224, .9)); }
.tx-p-hifi .hifi-tok--b { fill: var(--tx-amber); }
.tx-p-hifi .hifi-seal { transform-box: fill-box; transform-origin: center; transform: rotate(-6deg); }
.tx-p-hifi .hifi-seal-o { fill: none; stroke: var(--hifi-ok); stroke-width: 3; }
.tx-p-hifi .hifi-seal-i { fill: rgba(79, 209, 139, .1); stroke: var(--hifi-ok); stroke-width: 1.2; stroke-dasharray: 2 3; }
.tx-p-hifi .hifi-seal-ring { animation-duration: 40s; }
.tx-p-hifi .hifi-seal-ring text { font-size: 8.6px; letter-spacing: .07em; fill: var(--hifi-ok); }
.tx-p-hifi .hifi-seal-tick { fill: none; stroke: var(--hifi-ok); stroke-width: 3.4; stroke-linecap: round; stroke-linejoin: round; }
.tx-p-hifi .hifi-seal-t { font-size: 10px; font-weight: 700; letter-spacing: .08em; fill: var(--hifi-ok); }
.tx-p-hifi .hifi-readout rect { fill: var(--surface-1); stroke: var(--tx-line); }
.tx-p-hifi .hifi-readout text { font-size: 14px; fill: var(--tx-ink); }

.js .tx-p-hifi .hifi-hero.is-in .hifi-tok--a { animation: hifi-a 4.4s linear .3s both; }
.js .tx-p-hifi .hifi-hero.is-in .hifi-tok--b { animation: hifi-b 2.2s linear .1s both; }
.js .tx-p-hifi .hifi-hero.is-in :is(.hifi-tick, .hifi-cross) { animation: hifi-pop .5s var(--ease-out) var(--d, 0s) both; }
.js .tx-p-hifi .hifi-hero.is-in .hifi-back { animation: hifi-draw 1.1s var(--ease-out) 1.55s both; }
.js .tx-p-hifi .hifi-hero.is-in .hifi-back-t { animation: hifi-fade .6s var(--ease-out) 2.3s both; }
.js .tx-p-hifi .hifi-hero.is-in .hifi-seal { animation: hifi-stamp .75s cubic-bezier(.2, 1.5, .4, 1) 4.1s both; }
@keyframes hifi-a { 0% { opacity: 1; transform: none; } 88% { opacity: 1; transform: translateX(479px); } 100% { opacity: 0; transform: translateX(479px); } }
@keyframes hifi-b { 0% { opacity: 1; transform: none; } 55%, 72% { opacity: 1; transform: translateX(149px); } 100% { opacity: 0; transform: translateX(149px); } }
@keyframes hifi-pop { from { opacity: 0; transform: scale(.3); } to { opacity: 1; transform: none; } }
@keyframes hifi-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes hifi-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes hifi-stamp { 0% { opacity: 0; transform: scale(1.6) rotate(-16deg); } 100% { opacity: 1; transform: rotate(-6deg); } }

/* ---- Problem: the winner is the model's largest error ---- */
.tx-p-hifi .hifi-curse svg { padding: .6rem; }
.tx-p-hifi .hifi-nodata { fill: rgba(242, 163, 58, .06); stroke: rgba(242, 163, 58, .3); stroke-dasharray: 4 5; }
.tx-p-hifi .hifi-truth { fill: none; stroke: var(--tx-ink); stroke-width: 2.4; }
.tx-p-hifi .hifi-surr { fill: none; stroke: var(--tx-cyan); stroke-width: 2.4; }
.tx-p-hifi .hifi-legend text { font-size: 13px; fill: var(--tx-muted); }
.tx-p-hifi .hifi-samples circle { fill: var(--surface-0); stroke: var(--tx-ink); stroke-width: 2; }
.tx-p-hifi .hifi-gap { fill: none; stroke: var(--hifi-bad); stroke-width: 2.4; }
.tx-p-hifi .hifi-pred { fill: var(--surface-0); stroke: var(--tx-cyan); stroke-width: 2.6; }
.tx-p-hifi .hifi-solved { fill: var(--hifi-bad); }
.tx-p-hifi .hifi-true { fill: var(--hifi-ok); }
.tx-p-hifi .hifi-lbl { font-size: 14px; fill: var(--tx-ink); }
.tx-p-hifi .hifi-lbl--c { fill: var(--tx-cyan); }
.tx-p-hifi .hifi-lbl--r { fill: var(--hifi-bad); }
.tx-p-hifi .hifi-stat strong { color: var(--tx-ink); font-size: 1.15em; }
.tx-p-hifi .tx-callout { margin-top: 1.4rem; }

/* ---- How: the reassessment bench (states via [data-active]) ---- */
.tx-p-hifi .hifi-stage .hifi-panel { fill: rgba(255, 255, 255, .015); stroke: var(--tx-line); }
.tx-p-hifi .hifi-dots circle { fill: var(--surface-2); stroke: var(--border-strong); transition: fill .4s var(--ease-out), stroke .4s; }
.tx-p-hifi .hifi-h { font-family: var(--font-sans); font-size: 20px; font-weight: 600; fill: var(--tx-ink); opacity: 0; transition: opacity .45s var(--ease-out); }
.tx-p-hifi .hifi-contours ellipse { fill: none; stroke: rgba(57, 208, 224, .14); }
.tx-p-hifi .hifi-tr { fill: rgba(57, 208, 224, .05); stroke: var(--tx-cyan); stroke-dasharray: 6 5; transform-box: fill-box; transform-origin: center; transition: transform .9s var(--ease-out); }
.tx-p-hifi .hifi-doe circle { fill: var(--border-strong); }
.tx-p-hifi .hifi-c circle { fill: var(--surface-1); stroke: var(--tx-cyan); stroke-width: 2.4; transition: fill .5s var(--ease-out), stroke .5s; }
.tx-p-hifi .hifi-c text { font-size: 16px; fill: var(--tx-ink); }
.tx-p-hifi .hifi-c .hifi-halo { fill: none; stroke: var(--hifi-ok); stroke-width: 2; stroke-dasharray: 3 3; }
.tx-p-hifi .hifi-strike { stroke: var(--hifi-bad); stroke-width: 2.6; stroke-linecap: round; }
.tx-p-hifi .hifi-step { fill: none; stroke: var(--tx-amber); stroke-width: 2; stroke-dasharray: 4 4; }
.tx-p-hifi .hifi-c--b circle { stroke: var(--hifi-bad); fill: var(--surface-1); }
.tx-p-hifi .hifi-ret { fill: none; stroke: var(--hifi-bad); stroke-width: 2.4; }
.tx-p-hifi .hifi-vmark circle { fill: none; stroke: var(--hifi-ok); stroke-width: 2.4; }
.tx-p-hifi .hifi-vmark path { fill: none; stroke: var(--surface-0); stroke-width: 3; stroke-linecap: round; }
.tx-p-hifi :is(.hifi-doe, .hifi-strike, .hifi-halo, .hifi-c--b, .hifi-ret, .hifi-vmark, .hifi-ev) { opacity: 0; transition: opacity .5s var(--ease-out); }
.tx-p-hifi .hifi-ghost { fill: none; stroke: var(--tx-cyan); stroke-width: 2.4; stroke-dasharray: 7 6; }
.tx-p-hifi .hifi-chip { fill: var(--accent-soft); stroke: var(--accent-border); }
.tx-p-hifi .hifi-chip--ok { fill: rgba(79, 209, 139, .12); stroke: rgba(79, 209, 139, .5); }
.tx-p-hifi .hifi-chip--bad { fill: rgba(255, 90, 78, .12); stroke: rgba(255, 90, 78, .5); }
.tx-p-hifi .hifi-chip-t { font-size: 13px; letter-spacing: .1em; fill: var(--tx-ink); }
.tx-p-hifi .hifi-band { fill: rgba(57, 208, 224, .16); stroke: var(--accent-border); }
.tx-p-hifi .hifi-mu { stroke: var(--tx-cyan); stroke-width: 2; }
.tx-p-hifi .hifi-js { fill: var(--hifi-ok); stroke: var(--surface-0); stroke-width: 2; }
.tx-p-hifi .hifi-js--bad { fill: var(--hifi-bad); }
.tx-p-hifi .hifi-miss { stroke: var(--hifi-bad); stroke-width: 2; stroke-dasharray: 3 3; }
.tx-p-hifi .hifi-bar { fill: rgba(57, 208, 224, .22); stroke: var(--tx-cyan); }
.tx-p-hifi .hifi-bar--re { fill: rgba(79, 209, 139, .22); stroke: var(--hifi-ok); }
.tx-p-hifi .hifi-eq { stroke: var(--tx-ink); stroke-width: 1.5; stroke-dasharray: 4 3; }
.tx-p-hifi .hifi-mseal circle { fill: rgba(79, 209, 139, .1); stroke: var(--hifi-ok); stroke-width: 3; }
.tx-p-hifi .hifi-mseal .hifi-mseal-i { stroke-width: 1.2; stroke-dasharray: 2 3; fill: none; }
.tx-p-hifi .hifi-mseal path { fill: none; stroke: var(--hifi-ok); stroke-width: 3.4; stroke-linecap: round; stroke-linejoin: round; }
.tx-p-hifi .hifi-sheet { fill: var(--surface-2); stroke: var(--border-strong); }
.tx-p-hifi .hifi-lines { stroke: var(--border-strong); stroke-width: 6; stroke-linecap: round; }

.tx-p-hifi [data-active="1"] .hifi-h1, .tx-p-hifi [data-active="2"] .hifi-h2, .tx-p-hifi [data-active="3"] .hifi-h3,
.tx-p-hifi [data-active="4"] .hifi-h4, .tx-p-hifi [data-active="5"] .hifi-h5, .tx-p-hifi [data-active="6"] .hifi-h6,
.tx-p-hifi [data-active="1"] .hifi-ev1, .tx-p-hifi [data-active="2"] .hifi-ev2, .tx-p-hifi [data-active="3"] .hifi-ev3,
.tx-p-hifi [data-active="4"] .hifi-ev4, .tx-p-hifi [data-active="5"] .hifi-ev5, .tx-p-hifi [data-active="6"] .hifi-ev6 { opacity: 1; }
.tx-p-hifi [data-active="1"] .hifi-dots circle:nth-child(-n+1), .tx-p-hifi [data-active="2"] .hifi-dots circle:nth-child(-n+2),
.tx-p-hifi [data-active="3"] .hifi-dots circle:nth-child(-n+3), .tx-p-hifi [data-active="4"] .hifi-dots circle:nth-child(-n+4),
.tx-p-hifi [data-active="5"] .hifi-dots circle:nth-child(-n+5), .tx-p-hifi [data-active="6"] .hifi-dots circle { fill: var(--tx-cyan); stroke: var(--tx-cyan); }
/* from step 2: evaluated by the solver */
.tx-p-hifi .tx-steps:not([data-active="1"]) :is(.hifi-doe, .hifi-strike, .hifi-halo) { opacity: 1; }
.tx-p-hifi .tx-steps:not([data-active="1"]) :is(.hifi-c--x, .hifi-c--a) circle:not(.hifi-halo) { fill: var(--tx-cyan); }
.tx-p-hifi .tx-steps:not([data-active="1"]) .hifi-c--c circle { stroke: var(--hifi-bad); }
/* step 4: rejected step, centre kept, region shrinks (and stays shrunk) */
.tx-p-hifi [data-active="4"] :is(.hifi-c--b, .hifi-ret) { opacity: 1; }
.tx-p-hifi :is([data-active="4"], [data-active="5"], [data-active="6"]) .hifi-tr { transform: scale(.62); }
/* from step 5: verified */
.tx-p-hifi :is([data-active="5"], [data-active="6"]) .hifi-vmark { opacity: 1; }
.tx-p-hifi .tx-steps:is([data-active="5"], [data-active="6"]) .hifi-c--a circle:not(.hifi-halo) { fill: var(--hifi-ok); stroke: var(--hifi-ok); }

/* ---- Depth: tabs and the solver-agreement explorer ---- */
.tx-p-hifi .hifi-tabs { margin-top: 2.2rem; }
.tx-p-hifi .hifi-pan { padding: clamp(1.2rem, 1rem + 1vw, 2rem); border: 1px solid var(--tx-line); border-radius: var(--radius-lg); background: var(--surface-1); }
.tx-p-hifi .hifi-pan + .hifi-pan { margin-top: 1rem; }
.js .tx-p-hifi .hifi-pan + .hifi-pan { margin-top: 0; }
.tx-p-hifi .hifi-eqn { font-family: var(--font-mono); font-size: var(--step-md); color: var(--tx-ink); padding: .7rem 1rem; border-left: 3px solid var(--tx-cyan); background: var(--accent-soft); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.tx-p-hifi .hifi-zones rect { stroke: var(--surface-1); stroke-width: 2; transition: opacity var(--dur-base); }
.tx-p-hifi .hifi-zones rect:hover, .tx-p-hifi .hifi-zones rect:focus-visible { opacity: .8; outline: none; }
.tx-p-hifi .hifi-z--p { fill: rgba(79, 209, 139, .22); }
.tx-p-hifi .hifi-z--c { fill: rgba(242, 163, 58, .2); }
.tx-p-hifi .hifi-z--f { fill: rgba(255, 90, 78, .16); }
.tx-p-hifi .hifi-zones text { font-size: 12px; letter-spacing: .08em; fill: var(--tx-ink); pointer-events: none; }
.tx-p-hifi .hifi-svband { fill: rgba(57, 208, 224, .22); stroke: var(--tx-cyan); transition: x .2s, width .2s; }
.tx-p-hifi .hifi-ticksx path { stroke: var(--border-strong); }
.tx-p-hifi .hifi-ticksx text { font-size: 13px; fill: var(--tx-muted); }
.tx-p-hifi .hifi-svm { transition: transform .2s var(--ease-out); }
.tx-p-hifi .hifi-svm path { stroke: var(--tx-ink); stroke-width: 2; }
.tx-p-hifi .hifi-svm circle { fill: var(--tx-ink); }
.tx-p-hifi .hifi-verdict { font-size: 16px; fill: var(--tx-ink); }
.tx-p-hifi .hifi-controls { display: grid; gap: .9rem; padding: 1rem 1.1rem 0; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.tx-p-hifi .hifi-controls label { display: grid; grid-template-columns: 1fr auto; gap: .35rem; font-size: var(--step-sm); color: var(--tx-muted); }
.tx-p-hifi .hifi-controls output { font-family: var(--font-mono); color: var(--tx-ink); }
.tx-p-hifi .hifi-controls input { grid-column: 1 / -1; width: 100%; accent-color: var(--tx-cyan); }
.tx-p-hifi .hifi-controls input:focus-visible { outline: 2px solid var(--tx-amber); outline-offset: 3px; }

/* ---- Proof: predicted bands against solver values ---- */
.tx-p-hifi .hifi-proof { margin-top: 2.4rem; }
.tx-p-hifi .hifi-bands svg { padding: .4rem .2rem; }
.tx-p-hifi .hifi-key text { font-size: 13px; fill: var(--tx-muted); }
.tx-p-hifi .hifi-rt { font-family: var(--font-sans); font-size: 17px; font-weight: 600; fill: var(--tx-ink); }
.tx-p-hifi .hifi-rv { font-size: 14px; letter-spacing: .04em; }
.tx-p-hifi .hifi-ok { fill: var(--hifi-ok); }
.tx-p-hifi .hifi-bad { fill: var(--hifi-bad); }
.tx-p-hifi .hifi-edge { stroke: var(--border-strong); stroke-dasharray: 2 5; }
.tx-p-hifi .hifi-grow, .tx-p-hifi .hifi-drop { transform-box: fill-box; }
.tx-p-hifi .hifi-grow { transform-origin: left center; }
.js .tx-p-hifi .hifi-bands .hifi-grow { transform: scaleX(0); transition: transform 1s var(--ease-out) calc(var(--i, 0) * 180ms + .2s); }
.js .tx-p-hifi .hifi-bands .hifi-drop { opacity: 0; transform: translateY(-26px); transition: opacity .5s var(--ease-out) calc(var(--i, 0) * 180ms + 1s), transform .8s cubic-bezier(.3, 1.5, .5, 1) calc(var(--i, 0) * 180ms + 1s); }
.js .tx-p-hifi .hifi-bands.is-in :is(.hifi-grow, .hifi-drop) { transform: none; opacity: 1; }
.tx-p-hifi .hifi-row { --i: 0; }
.tx-p-hifi .hifi-cases { display: grid; gap: 1rem; }
.tx-p-hifi .hifi-cases .tx-card p { font-size: var(--step-sm); }
.tx-p-hifi .hifi-cases .tx-badge { margin-left: .3rem; vertical-align: middle; }
.tx-p-hifi .hifi-kpis { margin-top: 2rem; }
.tx-p-hifi .tx-kpi-l .tx-badge { margin-top: .5rem; }

/* ---- Value ---- */
.tx-p-hifi .hifi-roles { margin-top: 2.2rem; }
.tx-p-hifi .hifi-apps { margin: 2.2rem 0; }
.tx-p-hifi .hifi-apps p { color: var(--tx-muted); font-size: var(--step-sm); margin: .7rem 0 0; }
.tx-p-hifi .hifi-more { margin-top: 1.6rem; color: var(--tx-muted); max-width: 70ch; }

/* ---- Reduced motion: final states ---- */
.tx-reduced .tx-p-hifi :is(.hifi-grow, .hifi-drop) { opacity: 1 !important; transform: none !important; transition: none !important; }
.tx-reduced .tx-p-hifi :is(.hifi-tr, .hifi-svm, .hifi-svband, .hifi-h, .hifi-ev) { transition: none !important; }
@media (prefers-reduced-motion: reduce) {
  .js .tx-p-hifi .hifi-bands :is(.hifi-grow, .hifi-drop) { opacity: 1; transform: none; }
}
