/* Scroll-led introduction. Without script, or with reduced motion, it reads as a plain opening:
   the heading, a plan of the laboratory, and the five steps as a list. */
.machine-intro {
  --mi-bg:#f4f4ea; --mi-ink:#1d2637; --mi-line:#2b3a4e; --mi-mute:#566274; --mi-accent:#0b4fb3; --mi-paper:#fdfdf9; --mi-rule:#c7cdd6;
  background:var(--mi-bg); color:var(--mi-ink); position:relative;
}
.mi-stage {position:relative; display:flex; flex-direction:column; padding:clamp(2.2rem,5vw,4.5rem) 5vw clamp(2rem,4vw,3.5rem)}
.mi-hero {max-width:38rem; order:-1}
.mi-over {margin:0 0 1.1rem; font:500 .82rem/1.4 ui-monospace,"SFMono-Regular",Menlo,Consolas,monospace; letter-spacing:.14em; text-transform:uppercase; color:var(--mi-accent)}
.mi-hero h1 {font-size:clamp(2.1rem,3.55vw,3.5rem); line-height:1.28; color:var(--mi-ink)}
:lang(en) .mi-hero h1 {font-size:clamp(2.1rem,3.3vw,3.25rem); line-height:1.12}
.mi-lead {margin:1.4rem 0 0; color:var(--mi-mute); line-height:1.95; max-width:33em}
.mi-actions {display:flex; flex-wrap:wrap; align-items:center; gap:1.4rem; margin:1.9rem 0 0}
.mi-actions .btn {background:var(--mi-ink); border-color:var(--mi-ink); border-radius:2px}
.mi-actions .btn:hover {background:#111a28}
.mi-link {font-weight:600; text-underline-offset:.3em}
.mi-scene {display:block; width:100%; height:auto; margin-top:clamp(1.8rem,4vw,3rem); overflow:hidden}
.mi-machine {display:none}
.mi-rail {margin-top:1.5rem; border-top:1px solid var(--mi-rule)}
.mi-steps {list-style:none; margin:0; padding:0; counter-reset:mi}
.mi-steps li {counter-increment:mi; padding:1.15rem 0; border-bottom:1px solid var(--mi-rule); display:grid; grid-template-columns:3.2rem minmax(0,1fr); column-gap:.4rem}
.mi-steps li::before {content:counter(mi, decimal-leading-zero); font:500 .82rem/2.1 ui-monospace,Menlo,Consolas,monospace; color:var(--mi-accent); grid-row:1 / span 2}
.mi-steps h2 {font-size:clamp(1.15rem,1.7vw,1.5rem); line-height:1.5; letter-spacing:-.02em}
.mi-steps p {margin:.35rem 0 0; color:var(--mi-mute); font-size:.95rem; line-height:1.85; grid-column:2}
.mi-count,.mi-hint,.mi-progress {display:none}

/* Drawing */
.mi-scene * {vector-effect:non-scaling-stroke}
.mi-scene path,.mi-scene rect,.mi-scene polyline,.mi-scene circle {fill:none; stroke:var(--mi-line); stroke-width:1.15}
.mi-scene text {fill:var(--mi-mute); stroke:none}
.mi-mono {font:500 13px/1 ui-monospace,"SFMono-Regular",Menlo,Consolas,monospace; letter-spacing:.06em}
.mi-sans {font:500 13px/1 Inter,"Hiragino Kaku Gothic ProN","Noto Sans CJK JP",system-ui,sans-serif}
.mi-serif {font:500 38px/1 Georgia,"Yu Mincho","Hiragino Mincho ProN","Noto Serif CJK JP",serif; letter-spacing:-.02em}
.mi-scene text.mi-serif,.mi-scene text.mi-strong,.mi-scene text.mi-figure {fill:var(--mi-ink)}
.mi-scene text.mi-accent {fill:var(--mi-accent)}
.mi-scene text.mi-item {font-size:17.5px; fill:var(--mi-ink)}
.mi-scene text.mi-note {font-size:14px}
.mi-scene text.mi-ask {font-size:30px}
.mi-scene text.mi-title {font-size:34px}
.mi-figure {font:500 46px/1 Georgia,"Yu Mincho","Hiragino Mincho ProN",serif; letter-spacing:-.03em}
#mi-perf circle {fill:var(--mi-line); stroke:none; opacity:.5}
.mi-scene .mi-chassis {fill:#ecece0; stroke-width:1.5}
.mi-scene .mi-bezel {stroke:var(--mi-rule)}
.mi-scene .mi-grille {stroke:var(--mi-line); fill:url(#mi-perf)}
.mi-scene .mi-sweep {stroke:none; fill:#fdfdf9; opacity:.5}
.mi-scene .mi-led {fill:var(--mi-accent); stroke:none}
.mi-scene .mi-foot {fill:var(--mi-line); stroke:none}
.mi-scene .mi-aperture {fill:var(--mi-bg); stroke:var(--mi-accent); stroke-width:1.5}
.mi-scene .mi-leader,.mi-scene .mi-dim {stroke:var(--mi-accent)}
.mi-scene .mi-ground,.mi-scene .mi-rule,.mi-scene .mi-vents,.mi-scene .mi-panel {stroke:var(--mi-rule)}
.mi-scene .mi-floor {fill:var(--mi-paper); stroke:none}
.mi-scene .mi-wall {stroke-width:2.4; stroke:var(--mi-ink); stroke-linecap:square}
.mi-scene .mi-room-fill {stroke:none; fill:var(--mi-accent); opacity:0; transition:opacity .5s}
.mi-scene .mi-room.is-active .mi-room-fill {opacity:.055}
.mi-scene .mi-src rect {fill:var(--mi-line); stroke:none}
.mi-scene .mi-tick {stroke:var(--mi-accent); stroke-width:2}
.mi-scene .mi-ridge {stroke:var(--mi-accent); stroke-width:1.6; stroke-linejoin:round}
.mi-scene .mi-sheet-icon {fill:var(--mi-bg)}
.mi-scene .mi-paper {fill:var(--mi-paper); stroke:var(--mi-ink); stroke-width:1.4}
.mi-scene .mi-bar {fill:var(--mi-accent); stroke:none}
.mi-scene .mi-bar-base {fill:#bcc2cc}
.mi-scene .mi-route {stroke:var(--mi-accent); stroke-width:1.8; stroke-dasharray:1; stroke-dashoffset:0}
.mi-scene .mi-bench-frame {fill:var(--mi-paper); stroke-width:1.5}
.mi-scene .mi-read {fill:var(--mi-accent); stroke:none}
.mi-scene .mi-read.is-base {fill:#bcc2cc}
.mi-scene .mi-pipe {stroke:var(--mi-accent); stroke-width:1.5; stroke-linejoin:round}
.mi-scene .mi-doc {opacity:0}
.mi-scene text.mi-flow {font-size:26px; fill:var(--mi-ink)}
.mi-scene .mi-plate {stroke:var(--mi-rule)}
.mi-scene .mi-well {stroke:var(--mi-rule)}
.mi-scene .mi-well.is-on {stroke:var(--mi-accent); fill:var(--mi-accent); fill-opacity:.16}
.mi-scene .mi-return {stroke:var(--mi-accent); stroke-width:1.8; stroke-dasharray:1; stroke-dashoffset:0}
.mi-scene .mi-return-head {stroke:var(--mi-accent); stroke-width:1.8; stroke-linejoin:round}
.mi-scene text.mi-loop {font-size:46px}
.mi-scene .mi-agent {display:none}
.mi-scene .mi-agent .mi-tag {fill:var(--mi-paper); stroke:var(--mi-accent); stroke-width:1}
.mi-scene .mi-agent circle {fill:var(--mi-accent); stroke:var(--mi-paper); stroke-width:3}

/* Live mode: the stage stays in view while the page scrolls through the scenes. */
.mi-live.machine-intro {height:calc(100svh - var(--masthead,71px) + 480svh)}
.mi-live .mi-stage {position:sticky; top:var(--masthead,71px); height:calc(100svh - var(--masthead,71px)); padding:0; overflow:hidden}
.mi-live .mi-scene {position:absolute; inset:0; width:100%; height:100%; margin:0}
.mi-live .mi-machine {display:block}
.mi-live .mi-agent {display:block}
.mi-live .mi-hero {position:absolute; left:5vw; top:47%; transform:translateY(-50%); width:min(40vw,37rem); z-index:2}
.mi-live .mi-rail {position:absolute; left:0; right:0; bottom:0; height:23%; margin:0; padding:0 5vw; background:var(--mi-paper); border-top:1px solid var(--mi-rule); z-index:2; transition:transform .5s cubic-bezier(.2,.7,.2,1)}
.mi-live .mi-rail.is-rest {transform:translateY(calc(100% - 3.4rem))}
.mi-live .mi-steps li {position:absolute; left:5vw; right:16vw; top:50%; transform:translateY(-46%); border:0; padding:0; opacity:0; transition:opacity .45s; grid-template-columns:4rem minmax(0,1fr); max-width:60rem}
.mi-live .mi-steps li.is-current {opacity:1}
.mi-live .mi-steps h2 {font-size:clamp(1.3rem,2.05vw,1.95rem)}
.mi-live .mi-steps p {font-size:clamp(.9rem,1.05vw,1rem); max-width:46em}
.mi-live .mi-count {display:block; position:absolute; right:5vw; top:50%; transform:translateY(-50%); margin:0; font:500 .82rem/1 ui-monospace,Menlo,Consolas,monospace; letter-spacing:.1em; color:var(--mi-mute); transition:opacity .4s}
.mi-live .mi-count b {color:var(--mi-ink); font-weight:600}
.mi-live .mi-hint {display:block; position:absolute; left:5vw; top:1.05rem; margin:0; font:500 .8rem/1.3 ui-monospace,Menlo,Consolas,monospace; letter-spacing:.1em; color:var(--mi-mute); transition:opacity .4s}
.mi-live .mi-rail:not(.is-rest) .mi-hint,.mi-live .mi-rail.is-rest .mi-count {opacity:0}
.mi-live .mi-progress {display:block; position:absolute; left:0; top:-1px; height:2px; width:100%; background:var(--mi-accent); transform-origin:0 50%; transform:scaleX(var(--mi-p,0))}
.mi-live .mi-src {opacity:.3; transition:opacity .35s calc(var(--i) * 45ms)}
.mi-live .mi-room-body.is-active .mi-src {opacity:1}
.mi-live .mi-ridge {stroke-dasharray:1; stroke-dashoffset:1; transition:stroke-dashoffset 1.1s calc(.25s + var(--i) * .16s) ease-out}
.mi-live .mi-room-body.is-active .mi-ridge {stroke-dashoffset:0}
.mi-live .mi-led {animation:mi-pulse 2.4s ease-in-out infinite}
.mi-live .mi-sweep {animation:mi-sweep 5.5s cubic-bezier(.4,0,.6,1) infinite; transform-box:fill-box}
/* One cycle in the opening view: the design goes down to the bench, the wells are read, the measurements come back. */
.mi-live .mi-doc-out {animation:mi-out 14s linear infinite}
.mi-live .mi-doc-back {animation:mi-back 14s linear infinite}
.mi-live .mi-bench .mi-well.is-on {animation:mi-assay 14s linear infinite; animation-delay:calc(var(--c) * .3s)}
.mi-live .mi-read:not(.is-base) {transform-box:fill-box; transform-origin:50% 100%; animation:mi-read 14s linear infinite; animation-delay:calc(var(--c) * .25s)}
.mi-live .mi-aperture {animation:mi-think 14s linear infinite}
@keyframes mi-out {
  0%,9% {transform:translate(1466px,410px); opacity:0} 12% {transform:translate(1482px,410px); opacity:1}
  16% {transform:translate(1520px,410px); opacity:1} 34% {transform:translate(1520px,710px); opacity:1}
  38% {transform:translate(1488px,710px); opacity:1} 41%,100% {transform:translate(1468px,710px); opacity:0}
}
@keyframes mi-back {
  0%,57% {transform:translate(894px,710px); opacity:0} 60% {transform:translate(878px,710px); opacity:1}
  64% {transform:translate(840px,710px); opacity:1} 82% {transform:translate(840px,410px); opacity:1}
  86% {transform:translate(872px,410px); opacity:1} 89%,100% {transform:translate(892px,410px); opacity:0}
}
@keyframes mi-assay {0%,40% {fill-opacity:.1} 47%,91% {fill-opacity:.9} 98%,100% {fill-opacity:.1}}
@keyframes mi-read {0%,47% {transform:scaleY(0)} 56%,91% {transform:scaleY(1)} 98%,100% {transform:scaleY(0)}}
@keyframes mi-think {0%,6% {stroke-width:3.4px} 12%,86% {stroke-width:1.5px} 90%,100% {stroke-width:3.4px}}
@keyframes mi-pulse {0%,100% {opacity:.35} 50% {opacity:1}}
@keyframes mi-sweep {0% {transform:translateX(0); opacity:0} 12% {opacity:.55} 88% {opacity:.55} 100% {transform:translateX(380px); opacity:0}}

@media (max-width:760px) {
  .mi-scene .mi-cycle-note {display:none}
  .mi-live .mi-hero {left:6vw; right:6vw; top:5.5%; transform:none; width:auto}
  .mi-hero h1 {font-size:clamp(1.75rem,7.4vw,2.3rem)}
  .mi-lead {font-size:.92rem; line-height:1.8; margin-top:.9rem}
  .mi-actions {margin-top:1.1rem; gap:.9rem}
  .mi-actions .btn {padding:.7em 1.1em}
  .mi-live .mi-rail {height:33%}
  .mi-live .mi-steps li {left:6vw; right:6vw; grid-template-columns:2.4rem minmax(0,1fr); top:54%}
  .mi-live .mi-steps h2 {font-size:1.12rem}
  .mi-live .mi-steps p {font-size:.84rem; line-height:1.7}
  .mi-live .mi-count {top:1.25rem; right:6vw; transform:none}
  .mi-live .mi-hint {left:6vw}
}
@media (prefers-reduced-motion:reduce) {
  .mi-led,.mi-sweep,.mi-doc,.mi-well,.mi-read,.mi-aperture {animation:none !important}
}
