/* Self-hosted Latin subsets of the five typefaces, so the page asks no other site for anything. All are SIL Open Font License 1.1: see vendor/fonts. */
@font-face { font-family: 'Archivo Black'; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/archivo-black-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-style: normal; font-weight: 600; font-display: swap; src: url(fonts/barlow-condensed-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/ibm-plex-mono-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 500; font-display: swap; src: url(fonts/ibm-plex-mono-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: 'Public Sans'; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/public-sans-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'Public Sans'; font-style: normal; font-weight: 600; font-display: swap; src: url(fonts/public-sans-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'Space Grotesk'; font-style: normal; font-weight: 500; font-display: swap; src: url(fonts/space-grotesk-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: 'Space Grotesk'; font-style: normal; font-weight: 700; font-display: swap; src: url(fonts/space-grotesk-latin-700-normal.woff2) format('woff2'); }

/* ISTRAT-H1 simulator.
   Layout: the studio with the robot takes the width, with a telemetry strip underneath; the controls and the parts list sit in a column on the right. The controls are two panels, the teleop pendant and the routine library, behind a switch; on a very wide screen there is room to show both side by side. On a phone or tablet everything stacks and the studio sticks to the top so the robot stays in view while the controls scroll under it. */
:root {
  --bg: #edf2ee;
  --panel: #f7faf8;
  --ink: #0a1410;
  --mute: #4a5a51;
  --line: #c6d2ca;
  --accent-ink: #0b7438;
  /* the studio, the robot and the pendant are objects: these stay the same in both themes */
  --studio: #0a1410;
  --studio-2: #0f1c17;
  --studio-3: #15261f;
  --studio-line: #223a2e;
  --green: #3ef07a;
  --off: #eaf2ec;
  --off-mute: #a3b8ab;
  --red: #ff4d3a;
  --amber: #ffb23e;
  --display: 'Space Grotesk', 'Trebuchet MS', Arial, sans-serif;
  --body: 'Public Sans', 'Segoe UI', Arial, sans-serif;
  --mono: 'IBM Plex Mono', 'Courier New', monospace;
  --mark: 'Archivo Black', 'Arial Black', Impact, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #0a1410; --panel: #0e1b16; --ink: #eaf2ec; --mute: #a3b8ab; --line: #1f3329; --accent-ink: #3ef07a; color-scheme: dark; }
}
:root[data-theme="dark"] { --bg: #0a1410; --panel: #0e1b16; --ink: #eaf2ec; --mute: #a3b8ab; --line: #1f3329; --accent-ink: #3ef07a; color-scheme: dark; }

html, body { min-height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 15px; line-height: 1.5; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, summary:focus-visible, .well:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

.app { display: flex; flex-direction: column; gap: 14px; padding: 16px; max-width: 1800px; margin-inline: auto; }
.main, .side { display: contents; }
.head { order: 1; } .stage { order: 2; } .ctl, .pendant, .rout { order: 3; } .telem { order: 4; } .info { order: 5; }
.head, .info { width: 100%; max-width: 720px; margin-inline: auto; }

/* ---------- studio ---------- */
.stage { position: sticky; top: 0; z-index: 5; height: 48vh; min-height: 270px; max-height: 470px; border: 1px solid var(--studio-line); border-radius: 14px; overflow: hidden; background: var(--studio); box-shadow: 0 12px 28px rgba(0, 0, 0, .28); }
.stage canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; outline: none; }
.stage canvas:active { cursor: grabbing; }
.stage canvas:focus-visible { box-shadow: inset 0 0 0 2px var(--green); }
.status { position: absolute; left: 10px; top: 10px; margin: 0; max-width: calc(100% - 20px); padding: 6px 12px 6px 10px; border: 1px solid var(--studio-line); border-radius: 999px; background: rgba(10, 20, 16, .82); color: var(--off); font-family: var(--mono); font-weight: 500; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; pointer-events: none; }
.status::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); vertical-align: 0; }
.status[data-state="stop"]::before { background: var(--red); box-shadow: 0 0 8px var(--red); }
.status[data-state="warn"]::before { background: var(--amber); box-shadow: 0 0 8px var(--amber); }
.hint { position: absolute; left: 14px; bottom: 9px; margin: 0; color: var(--off-mute); font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; pointer-events: none; opacity: .75; }
.fallback { position: absolute; inset: 0; margin: 0; padding: 24px; display: grid; place-items: center; text-align: center; color: var(--off-mute); }
.camframe { position: absolute; right: 10px; bottom: 10px; width: 30%; max-width: 280px; min-width: 120px; aspect-ratio: 16 / 10; border: 1px solid var(--green); border-radius: 6px; pointer-events: none; box-shadow: 0 0 0 1px rgba(0, 0, 0, .6); }
.camframe span { position: absolute; left: 6px; top: 4px; font-family: var(--mono); font-size: 9.5px; letter-spacing: .14em; color: var(--green); text-shadow: 0 0 4px #000; }
.tags { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.tags i { position: absolute; left: 0; top: 0; width: 22px; height: 22px; margin: -11px 0 0 -11px; display: grid; place-items: center; border: 1px solid var(--off); border-radius: 50%; background: rgba(10, 20, 16, .7); color: var(--off); font: 500 10px/1 var(--mono); font-style: normal; opacity: 0; will-change: transform; }
.tags i.hot { border-color: var(--green); color: var(--green); box-shadow: 0 0 10px rgba(62, 240, 122, .6); }

/* ---------- heading ---------- */
.eyebrow { margin: 0; color: var(--accent-ink); font-family: var(--mono); font-size: 12px; font-weight: 500; letter-spacing: .16em; text-transform: uppercase; }
h1 { margin: 4px 0 8px; font-family: var(--display); font-weight: 700; font-size: 40px; line-height: 1; letter-spacing: -.01em; }
.lede { margin: 0; color: var(--mute); max-width: 54ch; }

/* ---------- teleop pendant ---------- */
.pendant, .rout { position: relative; width: 100%; max-width: 420px; margin-inline: auto; padding: 14px 14px 16px; border-radius: 22px; background: linear-gradient(180deg, var(--studio-3), var(--studio-2) 30%, var(--studio)); border: 1px solid var(--studio-line); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 14px 30px rgba(0, 0, 0, .35); color: var(--off); font-family: var(--mono); user-select: none; -webkit-user-select: none; display: grid; gap: 12px; }
.pendant::before, .rout::before { content: ""; position: absolute; left: 22px; right: 22px; top: 0; height: 2px; border-radius: 2px; background: var(--green); opacity: .9; }
.ptop { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.pmark { font-family: var(--mark); font-size: 20px; letter-spacing: .01em; line-height: 1; color: var(--off); }
.pmark small { display: block; margin-top: 5px; font-family: var(--mono); font-weight: 500; font-size: 10px; letter-spacing: .2em; color: var(--off-mute); }
.estop { width: 68px; height: 68px; border-radius: 50%; border: 5px solid #f2c230; background: radial-gradient(circle at 38% 30%, #ff8a7a, var(--red) 45%, #a8190b); color: #fff; font: 500 10px/1.15 var(--mono); letter-spacing: .08em; cursor: pointer; box-shadow: 0 5px 0 #6d0f06, 0 8px 14px rgba(0, 0, 0, .5); transition: transform .08s, box-shadow .08s; }
.estop[aria-pressed="true"] { transform: translateY(4px); box-shadow: 0 1px 0 #6d0f06, 0 0 22px rgba(255, 77, 58, .8); }
.lab { font-size: 9.5px; font-weight: 500; letter-spacing: .16em; text-transform: uppercase; color: var(--off-mute); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 0; border: 1px solid var(--studio-line); border-radius: 999px; padding: 3px; background: rgba(0, 0, 0, .25); }
.seg button { min-height: 44px; padding: 0 6px; border: 0; border-radius: 999px; background: transparent; color: var(--off-mute); font: 500 12px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; cursor: pointer; transition: background .15s, color .15s; }
.seg button[aria-pressed="true"] { background: var(--green); color: #04210f; }
.sticks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.stick { display: grid; justify-items: center; gap: 7px; min-width: 0; }
.well { position: relative; width: 100%; max-width: 150px; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle at 50% 50%, #050908 0 30%, #0c1512 31% 58%, #15261f 59% 100%); border: 1px solid var(--studio-line); box-shadow: inset 0 4px 10px rgba(0, 0, 0, .7), 0 0 0 4px rgba(0, 0, 0, .25); touch-action: none; cursor: grab; outline: none; }
.well::before { content: ""; position: absolute; inset: 9%; border-radius: 50%; border: 1px dashed rgba(62, 240, 122, .28); }
.well:active { cursor: grabbing; }
.knob { position: absolute; left: 50%; top: 50%; width: 44%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle at 38% 30%, #3b4a43, #1b2722 55%, #0b1210); border: 2px solid var(--green); box-shadow: 0 6px 10px rgba(0, 0, 0, .6), inset 0 1px 0 rgba(255, 255, 255, .15); transform: translate(-50%, -50%); pointer-events: none; will-change: transform; }
.cap { margin: 0; text-align: center; font-size: 10px; letter-spacing: .08em; line-height: 1.5; color: var(--off-mute); text-transform: uppercase; min-height: 3em; }
.cap b { display: block; font-weight: 500; color: var(--off); letter-spacing: .14em; }
.row { display: grid; gap: 8px; }
.row.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.row.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.row.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.pb { min-height: 46px; padding: 4px 6px; border: 1px solid var(--studio-line); border-radius: 999px; background: rgba(255, 255, 255, .03); color: var(--off); font: 500 11px/1.15 var(--mono); letter-spacing: .1em; text-transform: uppercase; cursor: pointer; touch-action: manipulation; transition: border-color .12s, background .12s, transform .06s; }
.pb:hover { border-color: var(--green); }
.pb:active, .pb.is-down { transform: translateY(1px); background: rgba(62, 240, 122, .16); border-color: var(--green); }
.pb[aria-pressed="true"] { background: rgba(62, 240, 122, .16); border-color: var(--green); color: var(--green); }
.pb.hold { touch-action: none; }
.pb.grip { border-color: var(--green); color: var(--green); }
.pb small { display: block; margin-top: 3px; font-size: 8.5px; letter-spacing: .1em; color: var(--off-mute); }
.slide { display: grid; grid-template-columns: auto minmax(0, 1fr) 3.2em; align-items: center; gap: 10px; }
.slide input { width: 100%; height: 44px; margin: 0; background: transparent; accent-color: var(--green); cursor: pointer; }
.slide output { font-size: 11px; text-align: right; color: var(--green); }
.group { display: grid; gap: 6px; }

/* ---------- which panel ---------- */
.ctl { width: 100%; max-width: 420px; margin-inline: auto; background: var(--studio-2); font-family: var(--mono); }
.ctl button b { font-weight: 500; opacity: .7; margin-left: 4px; }
.app[data-tab="teleop"] .rout, .app[data-tab="rout"] .pendant { display: none; }

/* ---------- routine library ---------- */
.rout { align-content: start; }
.rout[data-compose="1"] { border-color: var(--green); }
.rtop { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.pb.stop { min-width: 84px; border-color: var(--red); color: #ffb3a9; }
.pb.stop:hover { border-color: var(--red); background: rgba(255, 77, 58, .14); }
.rnow { margin: 0; min-height: 34px; padding: 8px 12px; border: 1px solid var(--studio-line); border-radius: 10px; background: rgba(0, 0, 0, .28); font-size: 11px; font-weight: 500; letter-spacing: .08em; line-height: 1.5; text-transform: uppercase; color: var(--off-mute); }
.rnow::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 8px; border-radius: 50%; background: var(--studio-line); }
.rout[data-run="1"] .rnow { color: var(--off); border-color: rgba(62, 240, 122, .45); }
.rout[data-run="1"] .rnow::before { background: var(--green); box-shadow: 0 0 8px var(--green); animation: beat 1s ease-in-out infinite; }
@keyframes beat { 50% { opacity: .35; } }
.rtabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.rtabs button { min-height: 44px; padding: 2px 4px; border: 1px solid var(--studio-line); border-radius: 10px; background: transparent; color: var(--off-mute); font: 500 10.5px/1.2 var(--mono); letter-spacing: .1em; text-transform: uppercase; cursor: pointer; transition: background .15s, color .15s, border-color .15s; }
.rtabs button:hover { border-color: var(--green); }
.rtabs button[aria-pressed="true"] { background: var(--green); border-color: var(--green); color: #04210f; }
.rtabs button i { font-style: normal; opacity: .65; margin-left: 5px; }
.rgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; align-content: start; min-height: 150px; }
.rb { position: relative; min-height: 46px; padding: 5px 10px; border: 1px solid var(--studio-line); border-radius: 999px; background: rgba(255, 255, 255, .03); color: var(--off); font: 500 11px/1.2 var(--mono); letter-spacing: .08em; text-transform: uppercase; text-align: center; cursor: pointer; touch-action: manipulation; transition: border-color .12s, background .12s, transform .06s; overflow: hidden; }
.rb:hover { border-color: var(--green); }
.rb:active { transform: translateY(1px); background: rgba(62, 240, 122, .16); border-color: var(--green); }
.rb.now { border-color: var(--green); color: var(--green); background: rgba(62, 240, 122, .12); }
.rout[data-compose="1"] .rgrid .rb::before { content: "+ "; color: var(--green); }
.rb i { position: absolute; right: 6px; top: 50%; width: 20px; height: 20px; margin-top: -10px; display: grid; place-items: center; border: 1px solid var(--studio-line); border-radius: 50%; font: 500 9.5px/1 var(--mono); font-style: normal; letter-spacing: 0; color: var(--green); background: rgba(0, 0, 0, .3); }
.rb:has(i) { padding-right: 30px; padding-left: 14px; }
.rside { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; align-items: center; }
.rside .lab small { display: block; margin-top: 3px; font-size: 8.5px; letter-spacing: .08em; opacity: .8; }
.rb small { display: block; margin-top: 3px; font-size: 9px; letter-spacing: .04em; text-transform: none; color: var(--off-mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mine { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 6px; }
.mine .rb { border-radius: 14px; text-align: left; padding: 7px 14px; }
.rx { min-width: 46px; min-height: 46px; padding: 0 12px; border: 1px solid var(--studio-line); border-radius: 14px; background: transparent; color: var(--off-mute); font: 500 11px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; cursor: pointer; transition: border-color .12s, color .12s; }
.rx:hover, .rx.sure { border-color: var(--red); color: #ffb3a9; }
.rempty { grid-column: 1 / -1; margin: 0; padding: 14px 4px; font-size: 11.5px; line-height: 1.6; letter-spacing: .02em; color: var(--off-mute); }
.composer { display: grid; gap: 8px; padding-top: 12px; border-top: 1px solid var(--studio-line); }
.composer[data-on="0"] .cbody { display: none; }
.cbody { display: grid; gap: 8px; }
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; counter-reset: step; }
.chips li { counter-increment: step; }
.chip { min-height: 44px; padding: 4px 12px 4px 10px; border: 1px solid rgba(62, 240, 122, .5); border-radius: 999px; background: rgba(62, 240, 122, .08); color: var(--off); font: 500 10.5px/1.2 var(--mono); letter-spacing: .06em; text-transform: uppercase; cursor: pointer; transition: background .12s, border-color .12s; }
.chip::before { content: counter(step); margin-right: 7px; color: var(--green); }
.chip:hover { border-color: var(--green); }
.chip[aria-pressed="true"] { background: var(--green); border-color: var(--green); color: #04210f; }
.chip[aria-pressed="true"]::before { color: #04210f; }
.pb:disabled { opacity: .35; cursor: default; }
#eDel { border-color: var(--red); color: #ffb3a9; }
.cnote { margin: 0; font-size: 10.5px; letter-spacing: .04em; line-height: 1.5; color: var(--off-mute); }
.cname { width: 100%; min-height: 46px; padding: 0 16px; border: 1px solid var(--studio-line); border-radius: 999px; background: rgba(0, 0, 0, .3); color: var(--off); font: 500 13px/1 var(--mono); letter-spacing: .04em; user-select: text; -webkit-user-select: text; }
.cname::placeholder { color: var(--off-mute); opacity: .8; }
.cname:focus { border-color: var(--green); outline: none; }
.pb.go { border-color: var(--green); color: var(--green); }

/* ---------- telemetry ---------- */
.telem { padding: 12px 14px 14px; border: 1px solid var(--studio-line); border-radius: 14px; background: var(--studio-2); color: var(--off); font-family: var(--mono); display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px 20px; align-items: start; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 12px; margin: 0; }
.stats div { min-width: 0; }
.stats dt { font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--off-mute); }
.stats dd { margin: 2px 0 0; font-size: 17px; font-weight: 500; white-space: nowrap; font-variant-numeric: tabular-nums; }
.stats dd small { font-size: 10px; color: var(--off-mute); margin-left: 3px; }
.jm { min-width: 0; }
.jm p { margin: 0 0 6px; font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--off-mute); }
#joints { display: block; width: 100%; height: 86px; }
.jm .hands { margin: 6px 0 0; font-size: 10px; letter-spacing: .08em; color: var(--off-mute); }

/* ---------- notes ---------- */
.info { display: flex; flex-direction: column; gap: 14px; }
h2 { margin: 0; font-family: var(--mono); font-size: 12px; font-weight: 500; letter-spacing: .16em; text-transform: uppercase; color: var(--mute); }
.parts { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 10px; }
.parts button { width: 100%; min-height: 44px; padding: 2px 6px; border: 0; border-radius: 6px; background: transparent; text-align: left; font: 400 12px/1.2 var(--mono); letter-spacing: .02em; color: var(--ink); cursor: pointer; display: grid; grid-template-columns: 2.2em minmax(0, 1fr); align-items: center; }
.parts button b { font-weight: 500; color: var(--accent-ink); }
.parts button:hover, .parts button:focus-visible, .parts button.hot { background: color-mix(in srgb, var(--accent-ink) 14%, transparent); }
.steps { margin: 0; padding-left: 1.2em; display: grid; gap: 6px; }
.steps b { font-weight: 600; }
.key { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.key th, .key td { text-align: left; padding: 6px 8px 6px 0; border-top: 1px solid var(--line); vertical-align: top; }
.key th { font-weight: 400; color: var(--mute); }
kbd { display: inline-block; min-width: 1.7em; text-align: center; font-family: var(--mono); font-size: 11.5px; font-weight: 500; padding: 1px 5px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; }
details { border-top: 1px solid var(--line); padding-top: 10px; }
summary { cursor: pointer; font-family: var(--mono); font-weight: 500; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; min-height: 32px; }
details ul { margin: 8px 0 0; padding-left: 1.2em; color: var(--mute); font-size: 13.5px; display: grid; gap: 5px; }

@media (min-width: 1240px) {
  .app { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 18px; align-items: start; }
  .main { display: flex; flex-direction: column; gap: 12px; min-width: 0; position: sticky; top: 16px; height: calc(100vh - 32px); height: calc(100dvh - 32px); min-height: 600px; }
  .side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
  .stage { position: relative; top: auto; flex: 1 1 0; height: auto; min-height: 240px; max-height: none; }
  .telem { flex: 0 0 auto; }
  .head, .info { max-width: none; }
}
@media (min-width: 1680px) {
  .app { grid-template-columns: minmax(0, 1fr) 852px; }
  .side { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 12px; align-items: start; }
  .head, .info { grid-column: 1 / -1; }
  .ctl { display: none; }
  .app[data-tab] .pendant, .app[data-tab] .rout { display: grid; }
}
@media (max-width: 640px) { .hint { display: none; } }
@media (max-width: 380px) { h1 { font-size: 34px; } .pb { font-size: 10px; letter-spacing: .06em; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

.noscript { margin: 24px 16px; font-family: var(--body); color: var(--ink); }
