/* The sections, in page order. Moving parts use transform / opacity only. */

/* ---------- hero ---------- */
#hero { height: 170vh; }
#hero .pin { display: grid; place-items: center; text-align: center; padding: 70px 16px 30px; }
.hero-in { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.mark-scroll { transform-origin: 49.4% 41.7%; }
.mark { width: min(500px, 80vw); height: auto; display: block; overflow: visible; }
.mark .frame { fill: none; stroke: var(--ink); stroke-width: 7; stroke-dasharray: 102 102; stroke-dashoffset: 102; animation: draw 1s .1s cubic-bezier(.6, .1, .3, 1) forwards; }
.mark .base { fill: var(--ink); opacity: 0; transform: translateY(16px); animation: up .65s .5s cubic-bezier(.2, .8, .2, 1) forwards; }
.mark .code { fill: none; stroke: var(--accent); stroke-width: 5.5; stroke-linecap: round; stroke-linejoin: round; }
.mark .code > * { stroke-dasharray: 102 102; stroke-dashoffset: 102; animation: draw .45s cubic-bezier(.5, 0, .3, 1) forwards; }
.mark .code > :nth-child(1) { animation-delay: .8s; }
.mark .code > :nth-child(2) { animation-delay: 1s; }
.mark .code > :nth-child(3) { animation-delay: 1.15s; }
.mark .gear-in { opacity: 0; transform: scale(.35) rotate(-200deg); animation: gearin .85s .95s cubic-bezier(.2, .8, .25, 1) forwards; }
.mark .gear { fill: var(--accent); }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes up { to { opacity: 1; transform: none; } }
@keyframes gearin { to { opacity: 1; transform: none; } }
@keyframes fade { to { opacity: 1; } }
.hero-text { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.sub-mark { margin-top: 2px; color: var(--muted); font-weight: 700; font-size: clamp(11px, 1.5vw, 14px); letter-spacing: 3.2px; }
.hero-title { font-size: clamp(2.4rem, 8vw, 5.6rem); font-weight: 800; letter-spacing: -1.5px; }
.hero-title .hw { display: inline-block; transform: translateY(.25em); animation: rise .7s cubic-bezier(.2, .8, .2, 1) forwards; }
@keyframes rise { to { transform: none; } }
.hero-title .eng { color: var(--accent-ink); }
.hero-title .hw:nth-child(1) { animation-delay: 1.4s; }
.hero-title .hw:nth-child(2) { animation-delay: 1.6s; }
.hero-tag { font-size: clamp(1.05rem, 2.4vw, 1.5rem); color: var(--muted); margin: 6px 0 14px; }
.hero-text .pill { font-size: 14px; padding: 7px 16px; }
.scroll-hint { position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%); color: var(--muted); font-size: 13px; display: flex; flex-direction: column; align-items: center; gap: 6px; opacity: 0; animation: fade 1s 2.8s forwards; }
.scroll-hint span { width: 22px; height: 34px; border: 2px solid var(--muted); border-radius: 12px; position: relative; }
.scroll-hint span::after { content: ""; position: absolute; left: 50%; top: 6px; width: 4px; height: 7px; margin-left: -2px; border-radius: 2px; background: var(--accent); animation: wheel 1.6s 3s ease-in-out 3; }
@keyframes wheel { 60% { transform: translateY(10px); opacity: 0; } }

/* ---------- design ---------- */
#design { height: 300vh; }
.steps { list-style: none; padding: 0; margin: 26px 0 0; display: grid; gap: 12px; }
.steps li { display: grid; grid-template-columns: 32px 1fr; gap: 12px; align-items: start; color: var(--muted); transition: color .4s; }
.steps li b { display: block; color: var(--muted); transition: color .4s; }
.steps li.on, .steps li.on b { color: var(--ink); }
.steps .n { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 14px; border: 1px solid var(--line); background: var(--surface); }
.steps li.on .n { border-color: var(--accent); color: var(--accent-ink); }
.designer { display: grid; grid-template-columns: 52px 1fr; }
.palette { border-right: 1px solid var(--line); padding: 10px 0; display: flex; flex-direction: column; align-items: center; gap: 8px; background: var(--bg2); }
.palette img { width: 26px; height: 26px; padding: 4px; border-radius: 8px; }
.palette img.hot { background: color-mix(in srgb, var(--accent) 16%, transparent); }
.canvas {
  position: relative; padding: 14px; display: grid; gap: 12px;
  grid-template-columns: 1.25fr 1fr; grid-template-areas: "g s" "g t" "c c" "l b";
  background-image: radial-gradient(color-mix(in srgb, var(--steel) 20%, transparent) 1px, transparent 1.2px);
  background-size: 16px 16px;
}
.w { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px; position: relative; transform-origin: 0 0; }
.w .nm { position: absolute; top: -9px; left: 8px; font-size: 11px; padding: 0 5px; border-radius: 4px; background: var(--surface); color: var(--muted); line-height: 16px; }
.w-gauge { grid-area: g; display: grid; place-items: center; cursor: crosshair; touch-action: none; }
.w-gauge svg { width: 100%; max-width: 260px; height: auto; display: block; }
.w-slider { grid-area: s; display: flex; flex-direction: column; justify-content: center; gap: 6px; }
.w-toggle { grid-area: t; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.w-trend { grid-area: c; padding: 8px 10px; }
.w-trend svg { width: 100%; height: 86px; display: block; }
.w-label { grid-area: l; display: flex; align-items: center; font-weight: 600; font-size: clamp(14px, 1.6vw, 17px); min-height: 48px; }
.w-button { grid-area: b; display: flex; align-items: center; justify-content: center; }
.g-track { fill: none; stroke: var(--line); stroke-width: 12; stroke-linecap: round; }
.g-val { fill: none; stroke: var(--accent); stroke-width: 12; stroke-linecap: round; }
.g-tick { stroke: var(--steel); stroke-width: 2; stroke-linecap: round; }
.g-needle { fill: var(--ink); }
.g-num { fill: var(--ink); font: 700 26px system-ui, "DejaVu Sans", sans-serif; text-anchor: middle; }
.g-unit { fill: var(--muted); font: 12px system-ui, "DejaVu Sans", sans-serif; text-anchor: middle; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; background: transparent; cursor: pointer; margin: 0; }
input[type=range]::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--accent) var(--fill, 40%), var(--line) var(--fill, 40%)); }
input[type=range]::-moz-range-track { height: 6px; border-radius: 3px; background: var(--line); }
input[type=range]::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--accent); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -8px; border-radius: 50%; background: var(--accent); border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--accent); }
input[type=range]::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--accent); border: 3px solid var(--surface); }
.sl-row { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }
.sw { position: relative; width: 58px; height: 32px; border-radius: 16px; border: 1px solid var(--line); background: var(--led-off); cursor: pointer; flex: none; transition: background .25s; padding: 0; }
.sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: var(--ink); transition: transform .25s cubic-bezier(.3, 1.4, .5, 1); }
.sw[aria-checked="true"] { background: var(--accent); }
.sw[aria-checked="true"]::after { transform: translateX(26px); background: #fff; }
.led { position: relative; width: 26px; height: 26px; flex: none; }
.led i, .led b { position: absolute; inset: 0; border-radius: 50%; }
.led i { background: var(--led-off); border: 1px solid var(--line); }
.led b { background: radial-gradient(circle at 35% 35%, #bbf7d0, var(--ok) 55%); box-shadow: 0 0 14px var(--ok); opacity: 0; transition: opacity .25s; }
.led.on b { opacity: 1; }
.tg-txt { font-size: 13px; color: var(--muted); }
.evt { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line); background: var(--bg2); font-size: 13px; color: var(--muted); min-height: 50px; }

/* ---------- code ---------- */
#code { height: 280vh; }
.codewin { font-size: clamp(11.5px, 1.4vw, 15px); }
.codebody { padding: 14px 0; background: var(--code-bg); line-height: 1.75; overflow: hidden; }
.cl { position: relative; display: block; padding: 0 16px 0 40px; white-space: pre; overflow: hidden; }
.cl.frame { color: var(--frame-ink); opacity: 0; transition: opacity .3s; }
.cl.frame.on { opacity: 1; }
.cl .cover { position: absolute; top: 0; bottom: 0; left: 40px; right: -100vw; background: var(--code-bg); border-left: 2px solid transparent; }
.cl.typing .cover { border-left-color: var(--accent); }
.cl .bad { text-decoration: underline wavy var(--bad); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
.errnote { display: block; margin: 6px 16px 0 40px; padding: 6px 10px; border-left: 3px solid var(--bad); background: color-mix(in srgb, var(--bad) 10%, var(--code-bg)); color: var(--ink); font-size: .92em; opacity: 0; transition: opacity .3s; white-space: normal; }
.errnote.on { opacity: 1; }
.t-k { color: #c084fc; } .t-s { color: #86efac; } .t-n { color: #fbbf24; } .t-f { color: var(--accent-ink); }
:root[data-theme="light"] .t-k { color: #7e22ce; } :root[data-theme="light"] .t-s { color: #15803d; } :root[data-theme="light"] .t-n { color: #a16207; }
.notes { display: grid; gap: 14px; margin-top: 24px; }
.notes div { display: grid; grid-template-columns: 26px 1fr; gap: 10px; color: var(--muted); }
.notes img { width: 22px; height: 22px; margin-top: 2px; }
.notes b { color: var(--ink); font-weight: 600; }

/* ---------- tools ---------- */
.tools { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-top: 36px; }
.tool { display: flex; flex-direction: column; gap: 6px; }
.tool img { width: 30px; height: 30px; margin-bottom: 4px; }
.tool p { margin: 0; }
.tool .chip { margin-top: auto; align-self: flex-start; font-size: 12.5px; }

/* ---------- EtherCAT ---------- */
#bus { height: 300vh; }
.chain { position: relative; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }
.chain::before { content: ""; position: absolute; left: 6%; right: 6%; top: 50%; height: 3px; margin-top: -1.5px; background: var(--line); border-radius: 2px; }
.chain .wire { position: absolute; left: 6%; right: 6%; top: 50%; height: 3px; margin-top: -1.5px; background: var(--accent); border-radius: 2px; transform-origin: 0 50%; transform: scaleX(0); }
.dev {
  position: relative; z-index: 1; border-radius: 12px; border: 1px solid var(--line); background: var(--surface);
  padding: 12px 8px 10px; text-align: center; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0;
  transition: border-color .3s;
}
.dev[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.dev svg { width: 100%; max-width: 64px; height: 64px; }
.dev .dn { font-weight: 700; font-size: 13px; }
.dev .dk { font-size: 11.5px; color: var(--muted); line-height: 1.25; }
.dev .st { font: 600 10.5px ui-monospace, "DejaVu Sans Mono", monospace; padding: 2px 6px; min-width: 9ch; text-align: center; border-radius: 5px; background: var(--bg2); color: var(--muted); }
.dev.op .st { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ink); }
.dev .lamp { position: absolute; top: 8px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--led-off); }
.dev .lamp b { position: absolute; inset: 0; border-radius: 50%; background: var(--ok); opacity: 0; transition: opacity .3s; }
.dev.lit .lamp b { opacity: 1; }
.dev.master { background: color-mix(in srgb, var(--accent) 10%, var(--surface)); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.packet { position: absolute; left: 0; top: 0; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: #fff; box-shadow: 0 0 10px var(--accent); z-index: 0; pointer-events: none; opacity: 0; }
.bus-foot { display: flex; flex-wrap: wrap; gap: 12px 28px; margin-top: 22px; align-items: center; }
.bus-foot .hint { color: var(--muted); font-size: 14px; }
.bus-head { margin-bottom: 26px; }
.bus-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 40px; }

/* ---------- motion ---------- */
.motion-grid { display: grid; grid-template-columns: 1fr 1fr 0.8fr; gap: 20px; margin-top: 36px; }
.gears { display: flex; justify-content: center; align-items: center; }
.gears svg { width: 50%; max-width: 190px; height: auto; touch-action: none; }
.gears .gm { cursor: grab; }
.gear-fill { fill: var(--accent); }
.gear-fill.f { fill: var(--steel); }
.gear-mark { fill: var(--bg); }
.rail { position: relative; height: 92px; margin: 10px 30px 6px; }
.rail .bar { position: absolute; left: 0; right: 0; bottom: 18px; height: 6px; border-radius: 3px; background: var(--line); }
.rail .ticks { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }
.rail .mover { position: absolute; left: 0; right: 0; bottom: 24px; height: 52px; pointer-events: none; }
.rail .carr { position: absolute; left: -26px; bottom: 0; width: 52px; height: 46px; border-radius: 9px; background: var(--accent); display: grid; place-items: center; color: #04121f; font: 700 12px ui-monospace, "DejaVu Sans Mono", monospace; }
.rail .tgt { position: absolute; bottom: 14px; width: 2px; height: 16px; background: var(--ink); margin-left: -1px; }
.codeline { margin-top: 6px; display: grid; gap: 6px; }
.kinds { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 14px; }
.kinds span { font-size: 13px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink); }

/* ---------- connectors ---------- */
.hub-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; align-items: center; }
.hub { position: relative; width: min(460px, 100%); aspect-ratio: 1; margin: 0 auto; }
.hub > svg.lines { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.hub .ln { stroke: var(--line); stroke-width: .6; }
.hub .ln.on { stroke: color-mix(in srgb, var(--accent) 70%, transparent); }
.hub .core { position: absolute; left: 50%; top: 50%; width: 28%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; background: var(--surface); border: 1px solid var(--line); display: grid; place-items: center; }
.hub .core svg { width: 70%; height: 70%; }
.node {
  position: absolute; width: 22%; aspect-ratio: 1; margin: -11% 0 0 -11%; border-radius: 18px; border: 1px solid var(--line); background: var(--surface);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; cursor: pointer; padding: 4px; transition: border-color .2s;
}
.node img { width: 42%; height: 42%; }
.node span { font-size: clamp(11px, 1.4vw, 13px); font-weight: 600; }
.node[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.pulse { position: absolute; left: 50%; top: 50%; width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px; border-radius: 50%; background: var(--accent); opacity: 0; }
.hub.live .pulse { animation: travel 1.6s linear 2 both; }
@keyframes travel { 0% { transform: translate(var(--x0), var(--y0)); opacity: 0; } 15%, 85% { opacity: 1; } 100% { transform: translate(0, 0); opacity: 0; } }
.link-code { margin-top: 18px; min-height: 40px; }
.proto { font-size: clamp(1.15rem, 2.6vw, 1.7rem); font-weight: 700; color: var(--ink); margin-top: 10px; }
.proto em { font-style: normal; color: var(--accent-ink); padding: 0 .2em; }

/* ---------- project ---------- */
.proj { display: grid; grid-template-columns: 1fr 1fr; gap: 36px; align-items: center; }
.folder { padding: 0; overflow: hidden; }
.folder .fhead { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); background: var(--bg2); font-weight: 600; }
.folder .fhead svg { width: 22px; height: 22px; }
.frow { display: grid; grid-template-columns: 34px 1fr; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); align-items: center; }
.frow:last-child { border-bottom: 0; }
.frow svg { width: 30px; height: 30px; }
.frow code { font-size: 14px; font-weight: 600; }
.frow span { display: block; color: var(--muted); font-size: 14px; }

/* ---------- embedded ---------- */
#os { height: 280vh; }
.monitor { width: min(540px, 100%); margin: 0 auto; }
.monitor .scr { position: relative; aspect-ratio: 16 / 10; border-radius: 14px; border: 10px solid #1b2a3c; background: #000; overflow: hidden; }
.monitor .stand { width: 26%; height: 18px; margin: 0 auto; background: #15222f; clip-path: polygon(12% 0, 88% 0, 100% 100%, 0 100%); }
.scr .layer { position: absolute; inset: 0; display: grid; place-items: center; opacity: 0; }
.scr .l-splash { background: radial-gradient(circle at 50% 45%, #0e2236, #02060b 70%); }
.scr .l-splash svg { width: 46%; }
.scr .l-app { background: #0b1522; padding: 6%; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); gap: 6%; place-items: stretch; }
.scr .l-app .tile { background: #13233a; border: 1px solid #22374f; border-radius: 8px; display: grid; place-items: center; min-height: 0; min-width: 0; }
.scr .l-app img { width: 46%; height: 60%; }
.scr .pwr { position: absolute; right: 12px; bottom: 10px; width: 6px; height: 6px; border-radius: 50%; background: #22c55e; }
.phases { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 18px; font-size: 13px; color: var(--muted); }
.phases div { position: relative; padding-top: 10px; }
.phases div::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px; border-radius: 2px; background: var(--line); }
.phases i { position: absolute; top: 0; left: 0; right: 0; height: 4px; border-radius: 2px; background: var(--accent); transform-origin: 0 50%; transform: scaleX(0); }
.phases div.on { color: var(--ink); }

/* ---------- counters ---------- */
.counters { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.counter { padding: 22px 18px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); }
.counter .big { font-size: clamp(2.4rem, 5vw, 3.6rem); font-weight: 800; color: var(--accent-ink); line-height: 1; font-variant-numeric: tabular-nums; }
.counter .what { margin-top: 8px; color: var(--muted); font-size: 15px; }
.counter .what b { color: var(--ink); }

/* ---------- run ---------- */
#run { text-align: center; }
.run-stage { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: clamp(12px, 3vw, 40px); margin: 40px auto 0; max-width: 900px; }
.run-side { border: 1px solid var(--line); background: var(--surface); border-radius: 14px; padding: 16px; min-height: 160px; display: grid; place-items: center; gap: 8px; color: var(--muted); font-size: 14px; }
.run-side img { width: 60px; height: 60px; }
.runbtn { justify-self: center; margin-bottom: 30px; position: relative; width: clamp(120px, 18vw, 170px); aspect-ratio: 1; border-radius: 50%; border: 0; background: transparent; cursor: pointer; padding: 0; }
.runbtn svg.ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.runbtn .rt { fill: none; stroke: var(--line); stroke-width: 5; }
.runbtn .rp { fill: none; stroke: var(--accent); stroke-width: 5; stroke-linecap: round; stroke-dasharray: 100 100; stroke-dashoffset: 100; }
.runbtn .face { position: absolute; inset: 12%; border-radius: 50%; background: color-mix(in srgb, var(--accent) 14%, var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent); display: grid; place-items: center; }
.runbtn .face img { width: 38%; height: 38%; }
.runbtn .pct { position: absolute; left: 0; right: 0; bottom: -34px; font: 700 15px ui-monospace, "DejaVu Sans Mono", monospace; color: var(--accent-ink); }
.app-live img { opacity: .35; transition: opacity .4s; }
.app-live.on img { opacity: 1; }
.app-live.on { border-color: var(--accent); }

/* ---------- soon ---------- */
#soon { padding: clamp(90px, 16vh, 180px) 0 40px; text-align: center; }
#soon .reallogo { display: block; width: clamp(140px, 28vh, 256px); height: auto; aspect-ratio: 1; margin: 0 auto 6px; }
@supports (width: round(down, 10.5px, 1px)) { #soon .reallogo { width: round(down, clamp(140px, 28vh, 256px), 2px); } }
/* Each part starts hidden only once scripts run; .go plays the entrance once and every
   keyframe ends at "none / 1", which is the part's own drawn state - the real logo. */
.js #realLogo .lp { opacity: 0; }
#realLogo .lp { transform-box: fill-box; transform-origin: center; }
#realLogo.go .lp { animation: lp-in .7s cubic-bezier(.2, .8, .2, 1) forwards; }
#realLogo.go .lp-frame { animation-name: lp-scale; animation-delay: 0s; }
#realLogo.go .lp-base { animation-name: lp-up; animation-delay: .25s; }
#realLogo.go .lp-code { animation-name: lp-left; animation-delay: .45s; }
#realLogo.go .lp-gear { animation-name: lp-gear; animation-duration: .9s; animation-delay: .6s; }
#realLogo.go .lp-sub { animation-delay: 1s; }
#realLogo.go .lp-name { animation-name: lp-up; animation-delay: 1.15s; }
#realLogo.done .lp { animation: none; opacity: 1; }
@keyframes lp-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes lp-scale { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: none; } }
@keyframes lp-up { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@keyframes lp-left { from { opacity: 0; transform: translateX(-40px); } to { opacity: 1; transform: none; } }
@keyframes lp-gear { from { opacity: 0; transform: translateX(50px) rotate(240deg) scale(.4); } to { opacity: 1; transform: none; } }
.hero-list { list-style: none; padding: 0; margin: 0 0 16px; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 10px; max-width: 760px; }
.hero-list li { font-size: clamp(13px, 1.5vw, 15px); color: var(--muted); padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px; background: color-mix(in srgb, var(--surface) 70%, transparent); }
.hero-list b { color: var(--accent-ink); font-weight: 700; }
@media (max-width: 520px) { .hero-list li:not(:nth-child(2)) { display: none; } }
#soon h2 { font-size: clamp(2rem, 6vw, 4.2rem); }
#soon .lead { margin: 14px auto 0; }
footer a { color: var(--accent-ink); }
footer .contact { margin: 0 0 6px; }

/* ---------- small screens ---------- */
@media (max-width: 1000px) {
  .tools { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .motion-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 860px) {
  .hub-wrap, .motion-grid, .proj, .bus-cols { grid-template-columns: minmax(0, 1fr); }
  .steps { margin-top: 14px; gap: 6px; }
  .steps { grid-template-areas: "one"; }
  .steps li { grid-area: one; visibility: hidden; }
  .steps li.on { visibility: visible; }
  .canvas { padding: 12px 10px; gap: 10px; }
  .w-gauge svg { max-width: 190px; }
  .w-trend svg { height: 62px; }
  .designer { grid-template-columns: 40px 1fr; }
  .palette img { width: 22px; height: 22px; padding: 3px; }
  .notes { display: none; }
  .chain { grid-template-columns: repeat(4, minmax(0, 1fr)); row-gap: 14px; }
  .chain::before, .chain .wire, .packet { display: none; }
  .dev svg { height: 40px; }
  .dev { padding: 9px 4px 8px; gap: 3px; }
  .bus-cols, .bus-foot .hint { display: none; }
  .bus-head { margin-bottom: 16px; }
  .counters { grid-template-columns: 1fr 1fr; }
  .run-stage { grid-template-columns: 1fr; }
  .run-side { min-height: 0; }
  .os-copy .points { font-size: 14px; gap: 4px; margin-top: 10px; }
}
@media (max-width: 560px) { .tools { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 860px) and (max-height: 760px) { .os-copy .points { display: none; } }

@media (prefers-reduced-motion: reduce) {
  .mark .frame, .mark .code > * { stroke-dashoffset: 0; }
  .mark .base, .mark .gear-in, .hero-list, .sub-mark, .hero-title .hw, .hero-tag, .hero-text .pill, .scroll-hint { opacity: 1; transform: none; }
  .scroll-hint { transform: translateX(-50%); }
  .steps li { display: grid !important; visibility: visible !important; grid-area: auto !important; }
  .steps li b { color: var(--ink); }
  .packet, .pulse { display: none; }
  .js #realLogo .lp { opacity: 1; }
}

/* ================= added 2026-10-11: EC-Ai, Logic, Drawing, cam, documents ================= */

/* ---------- EC-Ai ---------- */
.aiwin { transition: box-shadow .4s, border-color .4s; }
.aiwin.working { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent), var(--shadow); }
.ai-work { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--accent-ink); opacity: 0; transition: opacity .3s; white-space: nowrap; }
.aiwin.working .ai-work { opacity: 1; }
.ai-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); }
.ai-page {
  position: relative; min-height: 270px; padding: 22px 14px; display: grid; gap: 22px; align-content: center; justify-items: center;
  border-right: 1px solid var(--line);
  background-image: radial-gradient(color-mix(in srgb, var(--steel) 20%, transparent) 1px, transparent 1.2px); background-size: 16px 16px;
}
.ai-el { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px; opacity: 0; transform: scale(.88); transition: opacity .35s, transform .35s cubic-bezier(.2, .8, .2, 1), box-shadow .35s, border-color .35s; }
.ai-el.on { opacity: 1; transform: none; }
.ai-el.touch { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 28%, transparent); }
.ai-el .nm { position: absolute; top: -9px; left: 8px; font-size: 11px; padding: 0 5px; border-radius: 4px; background: var(--surface); color: var(--muted); line-height: 16px; }
.ai-el > img { width: 76px; height: 76px; }
.ai-el .btn { cursor: default; }
.ai-panel { display: flex; flex-direction: column; min-width: 0; }
.ai-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); font-weight: 700; }
.ai-head img { width: 22px; height: 22px; }
.ai-log { flex: 1; min-height: 196px; padding: 12px 14px; display: grid; gap: 9px; align-content: start; font-size: 14px; }
.ai-log p { margin: 0; }
.ai-me { justify-self: end; max-width: 94%; min-height: 2.5em; padding: 7px 12px; border-radius: 12px 12px 3px 12px; background: color-mix(in srgb, var(--accent) 14%, var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); }
.ai-step, .ai-done, .ai-ask, .ai-said { opacity: 0; visibility: hidden; transform: translateY(6px); transition: opacity .3s, transform .3s, visibility .3s; }
.ai-step.on, .ai-done.on, .ai-ask.on, .ai-said.on { opacity: 1; visibility: visible; transform: none; }
.ai-step { position: relative; padding-left: 20px; color: var(--muted); }
.ai-step::before { content: ""; position: absolute; left: 2px; top: .5em; width: 9px; height: 9px; border-radius: 2px; background: var(--accent); transform: rotate(45deg) scale(.7); }
.ai-done { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-weight: 600; }
.ai-done .btn, .ai-ask .btn { padding: 4px 12px; font-size: 13px; }
.ai-done .gone { display: none; }
.ai-ask { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg2); }
.ai-ask span { flex: 1 1 100%; }
.ai-ask .ready { background: var(--accent); color: #04121f; border-color: var(--accent); }
.ai-said { color: var(--muted); }
.ai-log[data-kind="scan"] .ai-step, .ai-log[data-kind="scan"] .ai-done { display: none; }
.ai-log[data-kind="add"] .ai-ask, .ai-log[data-kind="add"] .ai-said { display: none; }
.aiwin .seg { margin: 0; padding: 10px 14px; border-top: 1px solid var(--line); background: var(--bg2); }
.aiwin .seg .btn { font-size: 13px; padding: 6px 10px; font-weight: 500; }
.nb { white-space: nowrap; }
.ai-note { color: var(--muted); font-size: 14px; max-width: 36em; margin: 16px 0 0; }

/* ---------- logic ---------- */
#logic { height: 340vh; }
.ladwin { transition: border-color .4s; }
.ladwin.live { border-color: var(--ok); }
.lad-mon { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.ladwin.live .lad-mon { color: var(--ink); }
.lad-body { display: grid; grid-template-columns: minmax(0, 1fr) 206px; align-items: center; background: var(--code-bg); }
.lad { display: block; width: 100%; height: auto; }
.lad .rail { fill: none; stroke: var(--steel); stroke-width: 2.5; stroke-linecap: round; }
.lad .lw, .lad .lc { fill: none; stroke: var(--steel); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: stroke .2s; }
.lad .lc { stroke: var(--ink); stroke-width: 2.4; }
.lad .lb { fill: var(--surface); stroke: var(--steel); stroke-width: 2; transition: stroke .2s; }
.lad .hot { stroke: var(--ok); }
.lad text { font: 11.5px system-ui, "DejaVu Sans", sans-serif; fill: var(--muted); text-anchor: middle; }
.lad .ln { fill: var(--frame-ink); font-size: 10.5px; }
.lad .lv { fill: var(--accent-ink); font-weight: 600; }
.lad .st { opacity: 0; transition: opacity .25s; }
.lad .st.on { opacity: 1; }
.il { align-self: stretch; border-left: 1px solid var(--line); padding: 10px 0 10px 12px; font-size: 10.5px; line-height: 1.5; color: var(--ink); overflow: hidden; }
.il span { display: block; white-space: pre; opacity: 0; transition: opacity .25s; }
.il span.on { opacity: 1; }
.il .c { color: var(--frame-ink); }
.lad-bar { min-height: 52px; }
.lad-bar #ladEntry { min-width: 9ch; min-height: 2.2em; border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.lad-hint { color: var(--muted); font-size: 12.5px; }
.lad-live { display: none; flex-wrap: wrap; align-items: center; gap: 8px; }
.ladwin.live .lad-live { display: flex; }
.ladwin.live .lad-type { display: none; }
.lad-type { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.lad-tag { font-weight: 700; font-size: 12px; letter-spacing: 1px; color: var(--ink); padding: 2px 8px; border-radius: 5px; background: color-mix(in srgb, var(--ok) 22%, transparent); }
.lad-live .btn { padding: 5px 12px; font-size: 13px; }
.lad-live .btn.held { background: var(--ok); border-color: var(--ok); color: #04121f; }
.logic-kinds { margin: 18px 0 0; }

/* ---------- drawing ---------- */
#drawing { height: 340vh; }
.dstage { background-image: radial-gradient(color-mix(in srgb, var(--steel) 20%, transparent) 1px, transparent 1.2px); background-size: 16px 16px; padding: 6px 8px 0; }
.dsvg { display: block; width: 100%; height: auto; overflow: visible; }
.dsvg .dp { opacity: 0; }
.d-body { fill: var(--surface2); stroke: var(--steel); stroke-width: 2; }
.d-glass { fill: var(--bg); stroke: var(--line); stroke-width: 1.5; }
.d-liquid { fill: var(--accent); transform-box: fill-box; transform-origin: 50% 100%; transform: scaleY(0); }
.d-pipe { fill: none; stroke: var(--steel); stroke-width: 8; stroke-linejoin: round; opacity: 0; }
.d-shut { fill: var(--bad); stroke: var(--steel); stroke-width: 1.5; stroke-linejoin: round; }
.d-open { fill: var(--ok); stroke: var(--steel); stroke-width: 1.5; stroke-linejoin: round; opacity: 0; }
.d-handle { fill: var(--ink); }
.d-imp { fill: none; stroke: var(--accent); stroke-width: 4; stroke-linecap: round; }
.d-box { fill: var(--accent); }
.d-box.b { fill: var(--steel); }
.d-roll { fill: var(--steel); }
.dsvg text { font: 10.5px system-ui, "DejaVu Sans", sans-serif; fill: var(--muted); text-anchor: middle; }
.dsvg .d-val { font: 700 15px system-ui, "DejaVu Sans", sans-serif; fill: var(--ink); paint-order: stroke; stroke: var(--bg); stroke-width: 3px; }
.tl { border-top: 1px solid var(--line); background: var(--bg2); padding: 8px 12px 10px; }
.tl .seg { margin: 0 0 8px; gap: 6px; }
.tl .seg .btn { padding: 3px 9px; font: 600 11.5px ui-monospace, "DejaVu Sans Mono", monospace; border-radius: 7px; }
.tl-row { display: grid; grid-template-columns: 124px minmax(0, 1fr) 34px; gap: 10px; align-items: center; font-size: 11.5px; color: var(--muted); }
.tl-name { white-space: nowrap; overflow: hidden; }
.tl-len { text-align: right; white-space: nowrap; }
.tl-track { position: relative; height: 22px; margin: 0 7px; border-radius: 4px; background:
  repeating-linear-gradient(90deg, var(--line) 0 1px, transparent 1px 12.5%), var(--surface); border: 1px solid var(--line); border-left: 0; }
.tl-track .key { position: absolute; top: 50%; width: 10px; height: 10px; margin: -5px 0 0 -5px; background: var(--ink); transform: rotate(45deg) scale(0); transition: transform .25s cubic-bezier(.3, 1.4, .5, 1); }
.tl-track .key.on { transform: rotate(45deg) scale(1); }
.tl-track .key.k1 { left: 100%; }
.ph-mover { position: absolute; inset: 0; pointer-events: none; }
.ph-mover b { position: absolute; left: -1px; top: -5px; bottom: -5px; width: 2px; background: var(--bad); }
.ph-mover b::before { content: ""; position: absolute; left: -4px; top: -2px; width: 10px; height: 6px; border-radius: 2px; background: var(--bad); }
.draw-evt label { color: var(--muted); }
.draw-evt input[type=range] { flex: 0 1 150px; width: auto; min-width: 90px; }

/* ---------- cam ---------- */
.cam svg { display: block; width: 100%; max-width: 330px; height: auto; margin: 0 auto; overflow: visible; }
.cam .ax { fill: none; stroke: var(--line); stroke-width: 1.5; stroke-linecap: round; }
.cam .cam-line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.cam .cam-dot { fill: var(--ink); stroke: var(--surface); stroke-width: 2; }
.cam .cam-fol { fill: var(--accent); }
.cam text { font: 10px system-ui, "DejaVu Sans", sans-serif; fill: var(--muted); }
.cam-note { font-size: 13px !important; margin: 8px 0 0 !important; }
.motion-grid { grid-template-columns: 1fr 1fr; }

/* ---------- documents and the machine ---------- */
#docs .tools { margin-top: 36px; }
.frow.lockrow span { color: var(--muted); }

/* ---------- small screens ---------- */
@media (max-width: 860px) {
  .ai-body { grid-template-columns: minmax(0, 1fr); }
  .ai-page { min-height: 0; padding: 20px 12px 14px; grid-template-columns: auto auto; justify-content: space-evenly; align-items: center; border-right: 0; border-bottom: 1px solid var(--line); }
  .ai-el > img { width: 56px; height: 56px; }
  .ai-log { min-height: 170px; }
  .lad-body { grid-template-columns: minmax(0, 1fr); }
  .il, .lad-hint, .logic-kinds { display: none; }
  .lad text { font-size: 14px; }
  .lad .ln { font-size: 12px; }
  .lad-bar { min-height: 46px; }
  .dsvg text { font-size: 12.5px; }
  .tl { padding: 6px 10px 8px; }
  .tl-row { grid-template-columns: 104px minmax(0, 1fr) 30px; gap: 6px; }
  .draw-evt .chip { font-size: 11px; }
  .motion-grid { grid-template-columns: minmax(0, 1fr); }
}
/* a short phone: the scene keeps its window whole and gives up words instead */
@media (max-width: 860px) and (max-height: 700px) {
  .tl .seg .btn[data-clip="belt"], #logic .lead, #drawing .lead, #logic .kicker, #drawing .kicker, #drawing .steps .more { display: none; }
  .dsvg { max-height: 112px; }
  .draw-evt { padding: 5px 10px; min-height: 0; gap: 4px 8px; }
  .tl .seg { margin-bottom: 5px; }
}

@media (prefers-reduced-motion: reduce) {
  .dsvg .dp, .d-pipe { opacity: 1; }
  .lad .st, .il span { opacity: 1; }
}

.homelink { color: var(--muted); font-size: 14px; text-decoration: none; white-space: nowrap; }
.homelink:hover { color: var(--ink); text-decoration: underline; }
@media (max-width: 380px) { .homelink { display: none; } }
