/* =====================================================================
   Robotics Atlas — design system "atelier"
   Light mode = light grey. Dark mode = dark grey. One accent: electric blue (--accent).
   The robots themselves stay orange (--hl) inside the drawings and 3D models,
   because the page texts talk about "the orange line".
   3D views and diagrams sit on a dark-grey panel in both modes.
   ===================================================================== */
:root {
  --bg: #1f1f1f;  --bg-2: #181818;  --surface: #292929;  --surface-2: #333333;  --border: #444444;
  --text: #ececec;  --muted: #9b9b9b;
  --accent: #6b97ff;                   /* electric blue: links, buttons, active items */
  --btn: #2f6bff;  --btn-hover: #4f84ff;  --btn-ink: #ffffff;
  --hl: #ff9f43;
  --ax: #ff6b6b;  --ay: #4ed17f;  --az: #5aa9ff;
  --good: #4ade80;  --bad: #fb7185;
  --panel: #262626;
  --line: rgba(255, 255, 255, 0.16);
  --radius: 4px;  --pad: 2rem;  --maxw: 1180px;
  --display: 'Archivo', 'Arial Narrow', 'Helvetica Neue', Arial, sans-serif;
  --font: 'IBM Plex Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'Cascadia Code', Menlo, Consolas, monospace;
  color-scheme: dark;
}
:root[data-theme='light'] {
  --bg: #e4e4e4;  --bg-2: #d8d8d8;  --surface: #efefef;  --surface-2: #dcdcdc;  --border: #bdbdbd;
  --text: #171717;  --muted: #595959;
  --accent: #1f55e0;
  --btn: #1f55e0;  --btn-hover: #1744b8;  --btn-ink: #ffffff;
  --hl: #c2570a;
  --ax: #d63a3a;  --ay: #1f9a4f;  --az: #1f6fe0;
  --good: #15803d;  --bad: #be123c;
  --line: rgba(0, 0, 0, 0.18);
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme='dark']) {
    --bg: #e4e4e4;  --bg-2: #d8d8d8;  --surface: #efefef;  --surface-2: #dcdcdc;  --border: #bdbdbd;
    --text: #171717;  --muted: #595959;
    --accent: #1f55e0;
    --btn: #1f55e0;  --btn-hover: #1744b8;  --btn-ink: #ffffff;
    --hl: #c2570a;
    --ax: #d63a3a;  --ay: #1f9a4f;  --az: #1f6fe0;
    --good: #15803d;  --bad: #be123c;
    --line: rgba(0, 0, 0, 0.18);
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font); background: var(--bg); color: var(--text);
  margin: 0; padding: 0 var(--pad) 2rem; line-height: 1.65; font-size: 1rem;
  -webkit-font-smoothing: antialiased;
}
body > :not(.site-nav):not(.site-foot):not(svg):not(.to-top):not(script):not(style):not(.wide) { max-width: var(--maxw); margin-left: auto; margin-right: auto; }
body > svg { max-width: 100%; }
::selection { background: var(--btn); color: #fff; }

h1, h2, h3 { font-family: var(--display); font-stretch: 85%; line-height: 1.08; letter-spacing: -0.005em; scroll-margin-top: 5rem; }
h1 { text-wrap: balance; font-size: clamp(2.2rem, 5vw, 3.4rem); font-weight: 800; margin: 1.6rem 0 0.6rem; }
h2 { font-size: 1.7rem; font-weight: 750; margin: 2.6rem 0 0.7rem; }
h3 { font-size: 1.2rem; font-weight: 700; margin: 1.4rem 0 0.4rem; }
p, li { max-width: 74ch; }
a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
a[style*='ff9f43'] { color: var(--accent) !important; }
span[style*='ff9f43'] { color: var(--hl) !important; }
strong { font-weight: 600; }
code { font-family: var(--mono); font-size: 0.88em; background: var(--surface-2); padding: 0.08rem 0.35rem; border-radius: 3px; }
ul, ol { padding-left: 1.3rem; }
li { margin: 0.25rem 0; }
hr { border: 0; border-top: 1px solid var(--border); margin: 2rem 0; }

/* ---- content blocks ---- */
.robot { background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: var(--radius); padding: 1rem 1.5rem; margin: 1.1rem auto; }
.robot h2, .robot h3:first-child { margin-top: 0.2rem; }
.robot svg { background: var(--panel); border-radius: 3px; padding: 0.4rem; }

/* ---- controls ---- */
.ctl { display: flex; align-items: center; gap: 0.7rem; margin: 0.45rem 0; flex-wrap: wrap; }
.ctl-name { width: 15rem; font-weight: 500; }
.ctl input[type='range'] { width: 260px; max-width: 100%; accent-color: var(--btn); }
html body input[type='number'], html body input[type='text'], html body select {
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 0.35rem 0.6rem; font: inherit; font-size: 0.95rem; min-height: 2.2rem;
}
html body .ctl input[type='number'], html body .ik-box input[type='number'], html body .xyz input { width: 6rem; font-family: var(--mono); font-size: 0.9rem; }
html body input[type='number']:focus, html body select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
input[type='checkbox'], input[type='radio'] { accent-color: var(--btn); }
.ctl-unit { color: var(--muted); width: 2.5rem; font-family: var(--mono); font-size: 0.9rem; }
.toolbar { display: flex; gap: 0.7rem 1.3rem; align-items: center; flex-wrap: wrap; margin: 0.9rem auto; }
.toolbar label { display: inline-flex; align-items: center; gap: 0.4rem; }

button {
  font: inherit; font-weight: 600; font-size: 0.95rem; cursor: pointer; color: var(--btn-ink);
  background: var(--btn); border: 0; border-radius: var(--radius); padding: 0.5rem 1rem; min-height: 2.3rem;
  transition: background 0.12s, transform 0.1s;
}
button:hover { background: var(--btn-hover); }
button:active { transform: translateY(1px); }
button:disabled, input:disabled { opacity: 0.45; cursor: not-allowed; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- 3D view and diagrams (always dark grey) ---- */
#view { width: 100%; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); background: var(--panel); }
svg#schema, svg#zoom, svg#arena, svg#sim { border-radius: var(--radius); border: 1px solid var(--border); }

/* ---- tables ---- */
table.dh { border-collapse: separate; border-spacing: 0; margin: 0.6rem 0 1.2rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; font-size: 0.95rem; }
table.dh th, table.dh td { border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); padding: 0.5rem 0.95rem; text-align: center; }
table.dh tr > :last-child { border-right: 0; }
table.dh tr:last-child > td { border-bottom: 0; }
table.dh th { background: var(--surface-2); font-weight: 600; }
table.dh td small { display: block; color: var(--hl); font-weight: 500; font-family: var(--mono); }
table.dh td.left, table.dh th.left { text-align: left; }
pre.matrix { background: var(--surface); border: 1px solid var(--border); padding: 1rem 1.2rem; border-radius: var(--radius); overflow-x: auto; font-family: var(--mono); font-size: 0.86rem; line-height: 1.55; }
.legend-x { color: var(--ax); font-weight: 600; } .legend-y { color: var(--ay); font-weight: 600; } .legend-z { color: var(--az); font-weight: 600; }

/* ---- wheels page (its own markup) ---- */
html body .cards .card { background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: var(--radius); padding: 1rem 1.2rem; }
html body .cards .card h3 { color: var(--text); }
html body .cards .card svg { background: var(--panel); }
html body .tag { background: var(--surface-2); color: var(--muted); border: 0; }
html body .pro { color: var(--good); } html body .con { color: var(--bad); }
html body table.dh td.left, html body table.dh th.left { text-align: left; }

/* ---- navigation bar: a floating glass pill, links on both sides of the mark ---- */
body { padding-top: 5.6rem; }
.site-nav {
  position: fixed; top: 0.8rem; left: 50%; transform: translateX(-50%); z-index: 70; width: min(1120px, calc(100% - 1.6rem)); margin: 0;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1rem; padding: 0.45rem 0.6rem 0.45rem 1.2rem;
  background: color-mix(in srgb, var(--bg) 62%, transparent); border: 1px solid var(--border); border-radius: 999px;
  backdrop-filter: blur(16px) saturate(1.3); -webkit-backdrop-filter: blur(16px) saturate(1.3); box-shadow: 0 10px 40px -18px rgba(0, 0, 0, 0.6);
}
.brand { display: inline-flex; align-items: center; gap: 0.5rem; color: var(--text); font-family: var(--display); font-stretch: 85%; font-weight: 800; font-size: 1.15rem; text-decoration: none; justify-self: center; }
.nav-l, .nav-r { display: flex; align-items: center; gap: 0.15rem; }
.nav-r { justify-content: flex-end; gap: 0.35rem; }
.nav-l > a, .dd-link, .dd-btn { color: var(--muted); text-decoration: none; padding: 0.42rem 0.85rem; border-radius: 999px; background: none; border: 0; font: inherit; font-weight: 500; font-size: 0.92rem; cursor: pointer; min-height: 0; transition: color 0.15s, background 0.15s; white-space: nowrap; }
.nav-l > a:hover, .dd-link:hover, .dd-btn:hover, .dd.open .dd-btn { background: color-mix(in srgb, var(--text) 10%, transparent); color: var(--text); text-decoration: none; }
.nav-l a[aria-current], .dd-link[aria-current] { color: var(--text); background: color-mix(in srgb, var(--accent) 20%, transparent); }
.mob-only { display: none; }
.dd { position: relative; display: flex; align-items: center; }
.dd-link { padding-right: 0.4rem; border-radius: 999px 0 0 999px; }
.dd-btn { padding: 0.42rem 0.6rem 0.42rem 0.2rem; border-radius: 0 999px 999px 0; font-size: 0.8rem; }
.dd-menu { display: none; position: absolute; right: 0; top: calc(100% + 0.9rem); min-width: 20rem; padding: 0.4rem; background: color-mix(in srgb, var(--bg) 88%, transparent); border: 1px solid var(--border); border-radius: 18px; backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); box-shadow: 0 18px 50px -20px rgba(0, 0, 0, 0.7); }
.dd.open .dd-menu { display: block; }
.dd-menu a { display: flex; justify-content: space-between; gap: 1rem; padding: 0.5rem 0.8rem; border-radius: 12px; color: var(--text); text-decoration: none; font-size: 0.93rem; }
.dd-menu a:hover { background: color-mix(in srgb, var(--text) 10%, transparent); }
.dd-menu a[aria-current='page'] { font-weight: 600; }
.dd-menu small { color: var(--muted); font-family: var(--mono); font-size: 0.76rem; align-self: center; }
.nav-tools { display: flex; align-items: center; gap: 0.4rem; }
.seg { display: inline-flex; gap: 0.1rem; padding: 0.15rem; border-radius: 999px; background: color-mix(in srgb, var(--text) 8%, transparent); }
.seg button { background: none; color: var(--muted); padding: 0.22rem 0.6rem; min-height: 0; font-size: 0.8rem; font-weight: 500; border-radius: 999px; font-family: var(--mono); }
.seg button:hover { color: var(--text); background: none; }
.seg button[aria-pressed='true'] { color: #fff; background: var(--btn); }
.icon-btn { background: none; color: var(--text); border: 1px solid var(--border); width: 2.2rem; min-height: 2.2rem; padding: 0; display: grid; place-items: center; border-radius: 50%; }
.icon-btn:hover { background: color-mix(in srgb, var(--text) 10%, transparent); }
.icon-btn svg { width: 17px; height: 17px; }
.nav-toggle { display: none; }

/* ---- footer, pager, back to top ---- */
.site-foot { margin: 4rem calc(-1 * var(--pad)) -2rem; padding: 2rem var(--pad); border-top: 1px solid var(--border); background: var(--bg-2); color: var(--muted); font-size: 0.92rem; text-align: center; }
.site-foot p { margin: 0.3rem auto; max-width: none; }
.pager { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; max-width: var(--maxw); margin: 0 auto 1.5rem; }
.pager a { border: 1px solid var(--border); padding: 0.65rem 1.1rem; border-radius: var(--radius); text-decoration: none; color: var(--text); font-weight: 500; }
.pager a:hover { border-color: var(--accent); }
.to-top { position: fixed; right: 1rem; bottom: 1rem; width: 2.6rem; height: 2.6rem; padding: 0; border-radius: 50%; font-size: 1.1rem; opacity: 0; pointer-events: none; transition: opacity 0.2s; z-index: 40; }
.to-top.show { opacity: 0.95; pointer-events: auto; }

/* =====================================================================
   HOME PAGE: a full-screen 3D robot behind the page. Sections scroll over it,
   the camera flies around the robot while you read.
   ===================================================================== */
#gl { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; transition: opacity 0.6s; }
body.home { background: radial-gradient(120% 90% at 70% 40%, var(--surface) 0%, var(--bg) 62%); background-attachment: fixed; }
body.home { padding-top: 0; }
html.scrolling { scroll-snap-type: none !important; scroll-behavior: auto !important; }
.scene-sec { position: relative; z-index: 1; min-height: 100svh; display: flex; align-items: center; margin: 0 calc(-1 * var(--pad)); padding: 5.6rem var(--pad) 2.5rem; }
.scene-sec.hero { align-items: flex-end; padding-bottom: 3.4rem; }
.scene-sec.end { background: var(--bg); min-height: 0; padding-top: 5rem; align-items: flex-start; }
.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; }
.cta { display: flex; gap: 0.7rem; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; background: var(--btn); color: var(--btn-ink); padding: 0.7rem 1.3rem; border-radius: var(--radius); font-weight: 600; text-decoration: none; transition: background 0.12s; }
.btn:hover { background: var(--btn-hover); text-decoration: none; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--text); }
.btn.ghost:hover { background: var(--text); color: var(--bg); }
.scroll-cue { position: absolute; right: var(--pad); bottom: 2rem; font-family: var(--mono); font-size: 0.82rem; color: var(--muted); }
.scroll-cue::after { content: ''; display: block; width: 1px; height: 46px; margin: 0.5rem auto 0; background: linear-gradient(var(--accent), transparent); animation: cue 1.8s ease-in-out infinite; transform-origin: top; }
@keyframes cue { 0% { transform: scaleY(0); } 60% { transform: scaleY(1); } 100% { transform: scaleY(1); opacity: 0; } }

.panel { max-width: 31rem; padding: 1.6rem 1.7rem; background: color-mix(in srgb, var(--bg) 84%, transparent); border: 1px solid var(--border); border-radius: var(--radius); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.panel .step { font-family: var(--mono); font-size: 0.82rem; color: var(--accent); margin: 0 0 0.5rem; }
.panel h2 { margin: 0 0 0.7rem; font-size: clamp(1.7rem, 3.2vw, 2.4rem); font-stretch: 78%; }
.panel p { margin: 0 0 0.8rem; max-width: 46ch; }
.panel .read { font-family: var(--mono); font-size: 0.85rem; color: var(--muted); line-height: 1.7; margin-top: 0.6rem; border-top: 1px solid var(--border); padding-top: 0.7rem; white-space: pre; overflow-x: auto; }
.panel .read b { color: var(--accent); font-weight: 500; }
.panel table.dh { margin: 0.6rem 0 0; font-family: var(--mono); font-size: 0.8rem; }
.panel table.dh th, .panel table.dh td { padding: 0.25rem 0.6rem; }
.jtag { position: fixed; z-index: 2; left: 0; top: 0; pointer-events: none; font-family: var(--mono); font-size: 0.8rem; background: var(--bg); color: var(--text); border: 1px solid var(--accent); padding: 0.1rem 0.45rem; border-radius: 3px; opacity: 0; transition: opacity 0.3s; white-space: nowrap; }
.jtag b { color: var(--accent); font-weight: 500; }
.jtag.on { opacity: 1; }
.jtag.hl { background: var(--accent); color: #fff; }
.jtag.hl b { color: #fff; }

.panel .rtag { color: var(--muted); margin: 0 0 0.8rem; }
.panel .notation { margin-right: 0.6rem; }
.panel dl { margin: 0.4rem 0 1.1rem; }
.panel dt { color: var(--muted); font-size: 0.85rem; margin-top: 0.6rem; }
.panel dd { margin: 0.1rem 0 0; }
.panel .btn { margin-top: 0.2rem; }

.path { list-style: none; padding: 0; margin: 0; max-width: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 3rem; counter-reset: step; border-top: 1px solid var(--border); }
.path li { counter-increment: step; display: block; margin: 0; padding: 0.9rem 0 0.9rem 2.6rem; border-bottom: 1px solid var(--border); position: relative; color: var(--muted); max-width: none; }
.path li::before { content: counter(step); position: absolute; left: 0; top: 0.9rem; font-family: var(--mono); color: var(--accent); font-weight: 500; }
.path a { font-weight: 600; }
.cmp-wrap { overflow-x: auto; }
.cmp-wrap table.dh { min-width: 780px; width: 100%; }
.cmp-wrap td:first-child { text-align: left; font-weight: 600; }


/* ---- immersive home: three screens (hero, tour that fades 01 to 04, robot slider) ---- */
.scene-sec.tour { align-items: center; }
.fader, .gal-cards { display: grid; }
.fader > .panel, .gal-cards > .card { grid-area: 1 / 1; opacity: 0; visibility: hidden; transform: translateY(12px); transition: opacity 0.55s ease, transform 0.55s ease, visibility 0s linear 0.55s; }
.fader > .panel.on, .gal-cards > .card.on { opacity: 1; visibility: visible; transform: none; transition: opacity 0.55s ease 0.12s, transform 0.55s ease 0.12s, visibility 0s; }
.stepper { display: flex; align-items: center; gap: 0.35rem; margin-top: 1rem; }
.stepper button, .gal-dots button, .gal-arrow { font-family: var(--mono); font-size: 0.85rem; cursor: pointer; color: var(--muted); background: color-mix(in srgb, var(--bg) 70%, transparent); border: 1px solid var(--border); border-radius: 999px; min-width: 2.5rem; height: 2.5rem; padding: 0 0.7rem; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); transition: color 0.2s, border-color 0.2s, background 0.2s, transform 0.2s; }
.stepper button:hover, .gal-dots button:hover, .gal-arrow:hover { color: var(--text); border-color: var(--accent); }
.stepper button[aria-current='true'], .gal-dots button[aria-current='true'] { color: #fff; background: var(--btn); border-color: var(--btn); }
.stepper button:focus-visible, .gal-dots button:focus-visible, .gal-arrow:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.scene-sec.gal { flex-direction: column; justify-content: space-between; align-items: stretch; padding-top: 5.8rem; padding-bottom: 1.4rem; }
.scene-sec.gal > .wrap { flex: 1; display: flex; flex-direction: column; justify-content: space-between; position: relative; }
.gal-head { max-width: 30rem; }
.gal-head h2 { margin: 0 0 0.4rem; font-size: clamp(1.9rem, 3.4vw, 2.8rem); font-stretch: 78%; }
.gal-head p { margin: 0; color: var(--muted); font-size: 0.95rem; }
.gal-arrow { position: absolute; top: 42%; z-index: 3; width: 3.2rem; height: 3.2rem; font-size: 1.2rem; padding: 0; }
.gal-arrow.prev { left: 0; } .gal-arrow.next { right: 0; }
.gal-foot { display: flex; flex-direction: column; align-items: center; gap: 0.8rem; }
.gal-dots { display: flex; gap: 0.4rem; flex-wrap: wrap; justify-content: center; }
.gal-dots button { min-width: 2.2rem; height: 2.2rem; padding: 0; }
.gal-cards { width: 100%; max-width: 62rem; }
.gal-cards .card { max-width: none; width: 100%; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); grid-template-areas: 'step dl' 'title dl' 'tag dl' 'text btn'; column-gap: 2.4rem; align-items: start; padding: 1.1rem 1.6rem; }
.gal-cards .card .step { grid-area: step; margin: 0 0 0.2rem; }
.gal-cards .card h2 { grid-area: title; margin: 0 0 0.2rem; font-size: clamp(1.5rem, 2.6vw, 2.1rem); }
.gal-cards .card .rtag { grid-area: tag; margin: 0 0 0.5rem; }
.gal-cards .card > p:not(.step):not(.rtag) { grid-area: text; margin: 0; max-width: none; }
.gal-cards .card dl { grid-area: dl; margin: 0; font-size: 0.92rem; }
.gal-cards .card dt:first-child { margin-top: 0; }
.gal-cards .card .btn { grid-area: btn; justify-self: start; margin-top: 0.8rem; }
@media (max-width: 900px) {
  .scene-sec.gal { padding-top: 5.2rem; }
  .gal-head p { display: none; }
  .gal-arrow { top: 26%; width: 2.6rem; height: 2.6rem; }
  .gal-cards .card { display: block; padding: 0.9rem 1.1rem; }
  .gal-cards .card dl { display: none; }
  .gal-cards .card .btn { width: 100%; text-align: center; }
  .fader > .panel:not(.on), .gal-cards > .card:not(.on) { display: none; }
  .fader > .panel.on, .gal-cards > .card.on { animation: rise 0.5s ease both; }
  .jtag { display: none; }
  .gal-dots button { min-width: 1.9rem; height: 1.9rem; font-size: 0.75rem; }
}

/* ---- atmosphere behind every page: blueprint dots, two blue glows, a slow scan line ---- */
body::before { content: ''; position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(60rem 36rem at 85% -8%, color-mix(in srgb, var(--btn) 16%, transparent), transparent 70%),
    radial-gradient(46rem 30rem at -6% 108%, color-mix(in srgb, var(--btn) 11%, transparent), transparent 70%),
    radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--text) 13%, transparent) 1px, transparent 1.4px) 0 0 / 28px 28px; }
body::after { content: ''; position: fixed; left: 0; right: 0; top: 0; height: 160px; z-index: -1; pointer-events: none;
  background: linear-gradient(to bottom, transparent, color-mix(in srgb, var(--btn) 7%, transparent), transparent); animation: scan 14s linear infinite; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes scan { from { transform: translateY(-160px); } to { transform: translateY(100vh); } }
@media (prefers-reduced-motion: reduce) { body::after { display: none; } }

/* ---- small screens ---- */
@media (max-width: 900px) {
  :root { --pad: 1rem; }
  .scene-sec { align-items: flex-end; padding: 3rem var(--pad) 2rem; }
  .panel { max-width: none; padding: 1.1rem 1.2rem; }
  .scroll-cue { display: none; }
  .path { grid-template-columns: 1fr; }
  .site-nav { grid-template-columns: auto 1fr; padding: 0.4rem 0.5rem 0.4rem 1rem; border-radius: 26px; }
  .brand { justify-self: start; }
  .nav-toggle { display: grid; }
  .nav-r .dd { display: none; }
  .nav-l { display: none; grid-column: 1 / -1; grid-row: 2; flex-direction: column; align-items: stretch; padding: 0.3rem 0 0.4rem; }
  .site-nav.open .nav-l { display: flex; }
  .nav-l > a { padding: 0.65rem 0.9rem; }
  .mob-only { display: block; }
  #view { height: 340px !important; }
  #view canvas { width: 100% !important; height: 100% !important; }
  .ctl-name { width: 100%; }
  .ctl input[type='range'] { flex: 1; width: auto; min-width: 140px; }
  table.dh { display: block; max-width: 100%; overflow-x: auto; }
  .cmp-wrap table.dh { display: table; }
  .pager a { flex: 1 1 100%; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
  .hero-title .ch { transform: none; }
}

/* ---- robot pages ---- */
.crumbs { font-size: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0 auto 0.4rem; }
.crumbs a { text-decoration: none; font-size: 0.88rem; line-height: 1.5; padding: 0.25rem 0.8rem; border: 1px solid var(--border); border-radius: 999px; background: color-mix(in srgb, var(--surface) 80%, transparent); }
.crumbs a:hover { border-color: var(--accent); }
.toc { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.4rem auto 1.4rem; }
.toc a { font-family: var(--mono); font-size: 0.78rem; text-decoration: none; color: var(--muted); padding: 0.2rem 0.65rem; border-radius: 999px; background: color-mix(in srgb, var(--text) 7%, transparent); }
.toc a:hover { color: var(--text); background: color-mix(in srgb, var(--accent) 22%, transparent); }
.stage { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 0 2rem; align-items: start; margin-top: 0.6rem; }
.stage-main > :first-child { margin-top: 0; }
.stage-side h2 { margin-top: 0; font-size: 1.35rem; }
.stage-side .ctl { gap: 0.2rem 0.7rem; }
.stage-side .ctl-name { width: 100%; font-size: 0.92rem; }
.stage-side .ctl input[type='range'] { flex: 1; width: auto; min-width: 120px; }
#view { box-shadow: 0 0 0 1px var(--border), 0 18px 50px -20px rgba(0, 0, 0, 0.55); }
body > svg#schema, body > svg#zoom, body > svg#arena { display: block; margin: 1rem auto; width: 100%; max-width: 880px !important; box-shadow: 0 0 0 1px var(--border); }
@media (max-width: 1000px) { .stage { grid-template-columns: 1fr; } }

/* ---- home: end screen in two columns, hero details, fade-in ---- */
#gl { opacity: 0; transition: opacity 1.4s ease 0.2s; }
html.loaded #gl { opacity: 1; }
.scene-sec.end { min-height: 100svh; align-items: center; padding-top: 3rem; padding-bottom: 3rem; }
.scene-sec.end .wrap { max-width: 1360px; }
.end-grid { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.25fr); gap: 3rem; align-items: start; }
.end-col > h2:first-child { margin-top: 0; }
.end-col > p { margin: 0 0 0.8rem; color: var(--muted); }
.end-grid .path { grid-template-columns: 1fr; }
.end-grid .path li { padding-top: 0.6rem; padding-bottom: 0.6rem; }
.end-grid .path li::before { top: 0.6rem; }
.end-grid .cmp-wrap table.dh { min-width: 0; font-size: 0.8rem; }
.end-grid .cmp-wrap th, .end-grid .cmp-wrap td { padding: 0.45rem 0.55rem; }
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 0.45rem; margin: 1.4rem 0 0; padding: 0; max-width: 44rem; }
.chips li { margin: 0; font-family: var(--mono); font-size: 0.74rem; color: var(--muted); padding: 0.28rem 0.7rem; border: 1px solid var(--border); border-radius: 999px; background: color-mix(in srgb, var(--bg) 60%, transparent); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.chips li::before { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin-right: 0.5rem; vertical-align: 1px; }
.ticker { position: absolute; left: 0; right: 0; bottom: 0; overflow: hidden; border-top: 1px solid var(--border); background: color-mix(in srgb, var(--bg) 70%, transparent); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.ticker .track { display: flex; width: max-content; animation: tick 38s linear infinite; }
.ticker span { font-family: var(--mono); font-size: 0.74rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); padding: 0.55rem 1.6rem; white-space: nowrap; }
.ticker span::after { content: '+'; color: var(--accent); margin-left: 3.2rem; }
@keyframes tick { to { transform: translateX(-50%); } }
.scene-sec.hero { padding-bottom: 5.4rem; }
.scroll-cue { bottom: 4.2rem; }
.stepper { position: relative; padding-bottom: 0.5rem; }
.stepper .bar { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--accent); transform-origin: left; transform: scaleX(0); opacity: 0; }
.stepper .bar.run { opacity: 0.8; animation: fill 8.5s linear forwards; }
@keyframes fill { to { transform: scaleX(1); } }
@media (max-width: 1100px) { .end-grid { grid-template-columns: 1fr; } .scene-sec.end { min-height: 0; } }
@media (prefers-reduced-motion: reduce) { .ticker .track { animation: none; } #gl { transition: none; } }

/* ---- hero: a giant word behind a centred 3D robot, the text in front ---- */
.scene-sec.hero { z-index: auto; justify-content: center; text-align: center; }
#spot { position: fixed; inset: 0; z-index: -1; pointer-events: none; background: radial-gradient(560px circle at var(--mx, 70%) var(--my, 40%), color-mix(in srgb, var(--btn) 15%, transparent), transparent 65%); }
.hero-title { position: absolute; left: 0; right: 0; top: 47%; transform: translateY(-62%); z-index: -1; margin: 0; text-align: center; pointer-events: none; user-select: none; font-family: var(--display); font-weight: 800; text-transform: uppercase; }
.hero-title .row { display: block; overflow: hidden; }
.hero-title .row.big { white-space: nowrap; font-size: 20vw; font-stretch: 64%; line-height: 0.82; letter-spacing: -0.01em; color: color-mix(in srgb, var(--text) 94%, transparent); }
.hero-title .row.small { font-size: clamp(1rem, 3vw, 3rem); font-stretch: 100%; letter-spacing: 0.8em; text-align: right; padding-right: 5vw; margin-top: 0.8rem; color: transparent; -webkit-text-stroke: 1.4px var(--accent); }
.hero-title .ch { display: inline-block; transform: translateY(108%); }
.loaded .hero-title .ch { transform: none; transition: transform 1.1s cubic-bezier(0.2, 0.8, 0.2, 1); transition-delay: calc(var(--i) * 55ms); }
.hero-front { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; }
.hero-front p { margin: 0 auto 1.1rem; max-width: 40rem; font-size: 1.08rem; color: var(--text); text-shadow: 0 1px 14px var(--bg); }
.hero-front .cta { justify-content: center; }
.hero-front .chips { justify-content: center; margin-top: 1.1rem; }
.ticker, .scroll-cue { z-index: 1; }
.scroll-cue { display: none; }

/* ---- signature ---- */
.sign { position: relative; z-index: 1; margin: 0 calc(-1 * var(--pad)); padding: 5rem var(--pad) 4rem; text-align: center; background: linear-gradient(var(--bg), var(--bg-2)); border-top: 1px solid var(--border); overflow: hidden; }
.sign::before { content: ''; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(40rem 18rem at 50% 38%, color-mix(in srgb, var(--btn) 14%, transparent), transparent 70%); }
.sign .wrap { position: relative; }
.sign-kicker { margin: 0 auto; font-family: var(--mono); font-size: 0.8rem; letter-spacing: 0.22em; text-transform: uppercase; color: var(--muted); }
.sign-svg { display: block; width: min(900px, 100%); margin: 0.2rem auto 0; overflow: visible; }
.sign-text { font-family: 'Mrs Saint Delafield', 'Snell Roundhand', 'Segoe Script', cursive; font-size: 190px; fill: transparent; stroke: var(--accent); stroke-width: 1.6; stroke-linejoin: round; stroke-dasharray: 2600; stroke-dashoffset: 2600; }
.sign-line { fill: none; stroke: var(--hl); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 700; stroke-dashoffset: 700; }
.sign.in .sign-text { animation: write 3.2s cubic-bezier(0.5, 0, 0.2, 1) forwards, fillin 1.2s ease 2.6s forwards; }
.sign.in .sign-line { animation: write 1.2s ease 2.4s forwards; }
@keyframes write { to { stroke-dashoffset: 0; } }
@keyframes fillin { to { fill: var(--text); stroke-width: 0.6; } }
.sign-row { display: flex; align-items: center; justify-content: center; gap: 1.2rem 2rem; flex-wrap: wrap; margin-top: 1.4rem; color: var(--text); }
.sign-row p { margin: 0; max-width: 30rem; text-align: left; color: var(--muted); font-size: 0.95rem; }
.sign-mark { width: 64px; height: 64px; }
.sign-mark .a1 { transform-origin: 30px 92px; animation: sw1 5s ease-in-out infinite; }
.sign-mark .a2 { transform-origin: 66px 50px; animation: sw2 3.4s ease-in-out infinite; }
@keyframes sw1 { 0%, 100% { transform: rotate(-8deg); } 50% { transform: rotate(10deg); } }
@keyframes sw2 { 0%, 100% { transform: rotate(14deg); } 50% { transform: rotate(-22deg); } }
.site-foot .by { color: var(--text); }
@media (max-width: 900px) { .hero-front p { font-size: 0.98rem; } .sign-text { font-size: 170px; } .scene-sec.hero { padding-bottom: 4.6rem; } }
@media (prefers-reduced-motion: reduce) { .sign-text, .sign-line { stroke-dashoffset: 0 !important; animation: none !important; fill: var(--text); } .sign-mark * { animation: none !important; } }
body.home::after { display: none; }
@media (max-width: 520px) { .brand span { display: none; } }
@media (max-width: 900px) { .hero-title .row.small { text-align: center; padding-right: 0; padding-left: 0.8em; } }

/* ---- the robot gallery, full screen: a giant outlined name behind the robot, the text in the corners, small dots ---- */
.scene-sec.gal { z-index: auto; padding: 6.4rem var(--pad) 1.4rem; }
.gal-names { position: absolute; left: 0; right: 0; top: 41%; transform: translateY(-50%); z-index: -1; pointer-events: none; user-select: none; }
.gname { position: absolute; left: 0; right: 0; top: 50%; padding: 0 3vw; transform: translateY(-50%) scale(0.96); text-align: center; text-transform: uppercase; font-family: var(--display); font-weight: 800; font-stretch: 64%; font-size: clamp(3.2rem, 11.5vw, 12.5rem); line-height: 0.84; letter-spacing: -0.005em; color: color-mix(in srgb, var(--text) 5%, transparent); -webkit-text-stroke: 1.5px color-mix(in srgb, var(--text) 30%, transparent); opacity: 0; transition: opacity 0.6s ease, transform 0.8s cubic-bezier(0.2, 0.8, 0.2, 1); }
.gname.on { opacity: 1; transform: translateY(-50%) scale(1); }
.gal-head { max-width: 24rem; position: relative; z-index: 1; }
.gal-head h2 { font-size: 0.85rem; font-family: var(--mono); font-stretch: 100%; font-weight: 500; letter-spacing: 0.2em; text-transform: uppercase; color: var(--accent); margin: 0 0 0.3rem; }
.gal-head p { font-size: 0.88rem; }
.gal-foot { width: 100%; gap: 0.9rem; position: relative; }
.gal-foot::before { content: ''; position: absolute; left: calc(-1 * var(--pad)); right: calc(-1 * var(--pad)); bottom: -1.4rem; top: -4rem; z-index: -1; pointer-events: none; background: linear-gradient(transparent, color-mix(in srgb, var(--bg) 88%, transparent) 62%); }
.gal-cards { max-width: none; }
.gal-cards .card { background: none; border: 0; border-radius: 0; backdrop-filter: none; -webkit-backdrop-filter: none; padding: 0; max-width: none; width: 100%;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.15fr) minmax(0, 0.9fr); column-gap: 3rem; align-items: end;
  grid-template-areas: 'step text dl' 'title text dl' 'tag btn dl'; }
.gal-cards .card .step { font-size: 1.15rem; letter-spacing: 0.12em; margin: 0; }
.gal-cards .card h2 { font-size: clamp(1.4rem, 2.2vw, 2rem); font-stretch: 80%; margin: 0.1rem 0 0.35rem; }
.gal-cards .card .rtag { margin: 0; font-size: 0.9rem; }
.gal-cards .card > p:not(.step):not(.rtag) { font-size: 1rem; color: var(--text); }
.gal-cards .card dl { font-size: 0.9rem; border-left: 1px solid var(--border); padding-left: 1.2rem; }
.gal-cards .card dt { text-transform: uppercase; letter-spacing: 0.14em; font-family: var(--mono); font-size: 0.68rem; margin-top: 0.7rem; }
.gal-cards .card dt:first-child { margin-top: 0; }
.gal-cards .card .btn { margin-top: 0.8rem; }
.gal-dots { gap: 0.6rem; flex-wrap: nowrap; align-items: center; padding-top: 0.2rem; }
.gal-dots button { position: relative; width: 8px; height: 8px; min-height: 0; min-width: 0; padding: 0; border-radius: 99px; background: color-mix(in srgb, var(--text) 30%, transparent); border: 0; backdrop-filter: none; transition: width 0.35s ease, background 0.25s ease; }
.gal-dots button::after { content: ''; position: absolute; inset: -10px -5px; }
.gal-dots button:hover { background: color-mix(in srgb, var(--text) 60%, transparent); }
.gal-dots button[aria-current='true'] { width: 30px; background: var(--btn); }
.gal-arrow { top: 40%; }
@media (max-width: 900px) {
  .scene-sec.gal { padding-top: 5rem; }
  .gname { font-size: clamp(2.6rem, 15vw, 6rem); }
  .gal-cards .card { display: block; }
  .gal-cards .card .step { font-size: 0.95rem; }
  .gal-cards .card h2 { font-size: 1.5rem; }
  .gal-cards .card dl { display: none; }
  .gal-foot::before { top: -3rem; }
}

/* ---- "I finished this page" bar at the end of every robot page ---- */
.done-bar { max-width: var(--maxw); margin: 0 auto 1.6rem; display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; padding: 1rem 1.3rem; border: 1px dashed var(--border); border-radius: 14px; background: color-mix(in srgb, var(--surface) 70%, transparent); }
.done-toggle { display: inline-flex; align-items: center; gap: 0.8rem; cursor: pointer; font-weight: 600; color: var(--text); }
.done-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.done-toggle .box { width: 1.7rem; height: 1.7rem; border-radius: 8px; border: 2px solid var(--muted); display: grid; place-items: center; transition: background 0.2s, border-color 0.2s, transform 0.2s; }
.done-toggle .box::after { content: ''; width: 0.55rem; height: 0.9rem; border: solid #fff; border-width: 0 3px 3px 0; transform: rotate(45deg) scale(0); margin-top: -0.15rem; transition: transform 0.2s; }
.done-toggle.on .box { background: var(--good); border-color: var(--good); }
.done-toggle.on .box::after { transform: rotate(45deg) scale(1); }
.done-toggle:hover .box { transform: scale(1.06); }
.done-toggle input:focus-visible + .box { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ---- the roadmap (Where to start?) ---- */
.scene-sec.end { min-height: 0; align-items: flex-start; padding: 6.5rem var(--pad) 4rem; background: var(--bg); }
.scene-sec.end .wrap { max-width: 1180px; }
.rm-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 2rem 3rem; flex-wrap: wrap; margin-bottom: 2.6rem; }
.rm-head h2 { margin: 0 0 0.4rem; font-size: clamp(2rem, 4vw, 3rem); font-stretch: 78%; }
.rm-head p { margin: 0; color: var(--muted); max-width: 34rem; }
.rm-prog { min-width: min(24rem, 100%); flex: 1 1 22rem; max-width: 30rem; }
.rm-count { font-family: var(--mono); font-size: 1.1rem; margin-bottom: 0.5rem; } .rm-count b { color: var(--accent); font-size: 1.6rem; } .rm-count span { color: var(--muted); font-size: 0.85rem; margin-left: 0.4rem; }
.rm-bar { height: 8px; border-radius: 99px; background: color-mix(in srgb, var(--text) 12%, transparent); overflow: hidden; }
.rm-bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--btn), var(--good)); transition: width 0.5s ease; }
.rm-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 0.9rem; align-items: center; }
.rm-win { color: var(--good); font-weight: 600; }
.roadmap { position: relative; display: grid; row-gap: 1.1rem; padding: 0.5rem 0 1rem; }
.roadmap::before { content: ''; position: absolute; left: 50%; top: 0; bottom: 0; width: 0; border-left: 2px dashed color-mix(in srgb, var(--accent) 60%, transparent); transform: translateX(-1px); }
.rm-phase { position: relative; display: flex; justify-content: center; margin: 0.8rem 0 0.2rem; }
.rm-phase span { font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.14em; text-transform: uppercase; padding: 0.4rem 1rem; border-radius: 99px; background: var(--btn); color: #fff; box-shadow: 0 0 0 6px var(--bg); }
.rm-row { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 22rem) minmax(0, 1fr); column-gap: 3.2rem; align-items: center; }
.rm-side { display: flex; } .rm-side.l { justify-content: flex-end; } .rm-side.r { justify-content: flex-start; }
.rm-node { position: relative; width: 100%; max-width: 22rem; padding: 1rem 1.2rem 0.9rem; border-radius: 14px; background: var(--surface); border: 1.5px solid var(--border); box-shadow: 0 10px 30px -18px rgba(0, 0, 0, 0.6); transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s, background 0.2s; }
.rm-node:hover { transform: translateY(-2px); border-color: var(--accent); }
.rm-node.main { border-color: color-mix(in srgb, var(--accent) 70%, var(--border)); }
.rm-node.side { max-width: 20rem; border-style: dashed; }
.rm-node.side::after { content: ''; position: absolute; top: 50%; width: 3.2rem; border-top: 2px dashed color-mix(in srgb, var(--accent) 60%, transparent); }
.rm-side.l .rm-node::after { left: 100%; } .rm-side.r .rm-node::after { right: 100%; }
.rm-top { display: flex; justify-content: space-between; gap: 0.6rem; align-items: center; margin-bottom: 0.5rem; }
.rm-tag { font-family: var(--mono); font-size: 0.72rem; padding: 0.15rem 0.55rem; border-radius: 99px; background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }
.rm-meta { font-family: var(--mono); font-size: 0.7rem; color: var(--muted); display: inline-flex; align-items: center; gap: 0.35rem; }
.lv { display: inline-flex; gap: 2px; } .lv b { width: 5px; height: 10px; border-radius: 2px; background: color-mix(in srgb, var(--text) 22%, transparent); }
.lv.l1 b:nth-child(-n+1), .lv.l2 b:nth-child(-n+2), .lv.l3 b { background: var(--hl); }
.rm-node h3 { margin: 0 0 0.25rem; font-size: 1.25rem; font-stretch: 85%; } .rm-node h3 a { color: var(--text); text-decoration: none; } .rm-node h3 a:hover { color: var(--accent); }
.rm-node p { margin: 0 0 0.8rem; font-size: 0.9rem; color: var(--muted); line-height: 1.45; }
.rm-bot { display: flex; justify-content: space-between; align-items: center; gap: 0.6rem; }
.rm-go { font-size: 0.85rem; font-weight: 600; text-decoration: none; }
.rm-check { display: inline-flex; align-items: center; gap: 0.5rem; cursor: pointer; font-size: 0.85rem; color: var(--muted); }
.rm-check input { position: absolute; opacity: 0; pointer-events: none; }
.rm-check .box { width: 1.35rem; height: 1.35rem; border-radius: 7px; border: 2px solid var(--muted); display: grid; place-items: center; transition: background 0.2s, border-color 0.2s; }
.rm-check .box::after { content: ''; width: 0.4rem; height: 0.72rem; border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg) scale(0); margin-top: -0.12rem; transition: transform 0.2s; }
.rm-check input:checked + .box { background: var(--good); border-color: var(--good); } .rm-check input:checked + .box::after { transform: rotate(45deg) scale(1); }
.rm-check input:focus-visible + .box { outline: 2px solid var(--accent); outline-offset: 2px; }
.rm-node.done { border-color: var(--good); background: color-mix(in srgb, var(--good) 8%, var(--surface)); }
.rm-node.done h3 a { text-decoration: line-through; text-decoration-thickness: 2px; text-decoration-color: color-mix(in srgb, var(--good) 70%, transparent); } .rm-node.done .rm-check { color: var(--good); }
.rm-node.next { border-color: var(--btn); box-shadow: 0 0 0 4px color-mix(in srgb, var(--btn) 22%, transparent), 0 14px 40px -16px color-mix(in srgb, var(--btn) 70%, transparent); }
.rm-node.next::before { content: 'NEXT'; position: absolute; top: -0.7rem; right: 1rem; font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.14em; padding: 0.15rem 0.6rem; border-radius: 99px; background: var(--btn); color: #fff; }
:root[lang='fr'] .rm-node.next::before { content: 'SUIVANT'; }
details.cmp { margin-top: 3.2rem; border: 1px solid var(--border); border-radius: 14px; background: color-mix(in srgb, var(--surface) 60%, transparent); }
details.cmp summary { cursor: pointer; padding: 1rem 1.3rem; font-family: var(--display); font-stretch: 85%; font-weight: 750; font-size: 1.25rem; list-style: none; display: flex; justify-content: space-between; }
details.cmp summary::after { content: '+'; color: var(--accent); font-size: 1.4rem; line-height: 1; } details.cmp[open] summary::after { content: '–'; }
details.cmp .cmp-wrap { padding: 0 1rem 1rem; }
details.cmp table.dh { min-width: 0; width: 100%; font-size: 0.85rem; }
@media (max-width: 900px) {
  .scene-sec.end { padding-top: 5.5rem; }
  .roadmap::before { left: 1.1rem; }
  .rm-phase { justify-content: flex-start; padding-left: 0; } .rm-phase span { margin-left: 0; }
  .rm-row { grid-template-columns: 1fr; row-gap: 0.9rem; padding-left: 2.6rem; }
  .rm-row::before { content: ''; position: absolute; left: 0.75rem; top: 1.6rem; width: 0.8rem; height: 0.8rem; border-radius: 50%; background: var(--btn); box-shadow: 0 0 0 4px var(--bg); }
  .rm-side.l, .rm-side.r { justify-content: flex-start; } .rm-side:empty { display: none; }
  .rm-node, .rm-node.side { max-width: none; } .rm-node.side::after { display: none; }
  .rm-side .rm-node { margin-left: 1.2rem; }
  .rm-row > .rm-side.l { order: 2; } .rm-row > .rm-main { order: 1; } .rm-row > .rm-side.r { order: 3; }
}

/* ---- section rail on the right of the home page ---- */
.rail { position: fixed; right: 1rem; top: 50%; transform: translateY(-50%); z-index: 45; display: flex; flex-direction: column; gap: 0.2rem; }
.rail button { position: relative; width: 22px; height: 22px; padding: 0; background: none; border: 0; cursor: pointer; display: grid; place-items: center; min-height: 0; }
.rail button::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: color-mix(in srgb, var(--text) 35%, transparent); transition: transform 0.25s, background 0.25s; }
.rail button:hover::before { background: var(--text); transform: scale(1.3); }
.rail button.on::before { background: var(--btn); transform: scale(1.6); }
.rail button span { position: absolute; right: 150%; top: 50%; transform: translate(6px, -50%); opacity: 0; pointer-events: none; white-space: nowrap; font-family: var(--mono); font-size: 0.72rem; padding: 0.2rem 0.6rem; border-radius: 99px; background: var(--bg); border: 1px solid var(--border); color: var(--text); transition: opacity 0.2s, transform 0.2s; }
.rail button:hover span, .rail button:focus-visible span { opacity: 1; transform: translate(0, -50%); }
@media (max-width: 900px) { .rail { display: none; } }

/* ---- learn page: lessons with a checklist ---- */
.lead { font-size: 1.12rem; color: var(--muted); max-width: 46rem; }
.how { margin: 1.4rem auto 2.2rem; padding: 1.2rem 1.5rem; border-radius: 16px; background: linear-gradient(135deg, color-mix(in srgb, var(--btn) 14%, var(--surface)), var(--surface)); border: 1px solid var(--border); }
.how h2 { margin: 0 0 0.7rem; font-size: 1.3rem; }
.how ol { counter-reset: s; list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.how li { counter-increment: s; position: relative; padding-left: 2.6rem; margin: 0; max-width: none; }
.how li::before { content: counter(s); position: absolute; left: 0; top: -0.1rem; width: 1.9rem; height: 1.9rem; border-radius: 50%; background: var(--btn); color: #fff; display: grid; place-items: center; font-family: var(--mono); font-size: 0.85rem; }
.learn-layout { display: grid; grid-template-columns: 17rem minmax(0, 1fr); gap: 2.4rem; align-items: start; }
.lesson-nav { position: sticky; top: 5.6rem; max-height: calc(100svh - 7rem); overflow: auto; padding: 1rem 1rem 0.6rem; border-radius: 16px; background: color-mix(in srgb, var(--surface) 85%, transparent); border: 1px solid var(--border); }
.ln-head { margin-bottom: 0.8rem; } .ln-head b { display: block; font-family: var(--mono); font-size: 0.82rem; margin-bottom: 0.45rem; }
.lesson-nav ol { list-style: none; margin: 0; padding: 0; }
.lesson-nav li { margin: 0; max-width: none; }
.lesson-nav a { display: flex; gap: 0.65rem; align-items: center; padding: 0.42rem 0.5rem; border-radius: 10px; color: var(--muted); text-decoration: none; font-size: 0.86rem; line-height: 1.3; }
.lesson-nav a:hover { background: color-mix(in srgb, var(--text) 8%, transparent); color: var(--text); }
.lesson-nav .n { flex: none; width: 1.55rem; height: 1.55rem; border-radius: 50%; border: 1.5px solid var(--border); display: grid; place-items: center; font-family: var(--mono); font-size: 0.72rem; }
.lesson-nav li.on a { color: var(--text); background: color-mix(in srgb, var(--accent) 16%, transparent); }
.lesson-nav li.on .n { border-color: var(--accent); color: var(--accent); }
.lesson-nav li.done .n { background: var(--good); border-color: var(--good); color: transparent; position: relative; }
.lesson-nav li.done .n::after { content: ''; position: absolute; width: 0.3rem; height: 0.55rem; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg) translate(-1px, -1px); }
.lesson { scroll-margin-top: 6rem; margin: 0 0 1.3rem; padding: 1.5rem 1.7rem 1.3rem; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--accent); transition: border-color 0.25s, background 0.25s; }
.lesson.done { border-left-color: var(--good); background: color-mix(in srgb, var(--good) 6%, var(--surface)); }
.lesson-head { display: flex; align-items: center; gap: 0.9rem; margin-bottom: 0.9rem; }
.lesson-head h2 { margin: 0; flex: 1; font-size: 1.55rem; }
.lesson-head .num { flex: none; width: 2.3rem; height: 2.3rem; border-radius: 50%; background: var(--btn); color: #fff; display: grid; place-items: center; font-family: var(--mono); font-weight: 500; }
.lesson.done .num { background: var(--good); }
.lesson-head .time { font-family: var(--mono); font-size: 0.74rem; color: var(--muted); padding: 0.2rem 0.6rem; border-radius: 99px; background: color-mix(in srgb, var(--text) 8%, transparent); white-space: nowrap; }
.goal { display: flex; gap: 0.8rem; align-items: baseline; padding: 0.6rem 0.9rem; margin-bottom: 0.9rem; border-radius: 10px; background: color-mix(in srgb, var(--accent) 11%, transparent); }
.goal b { flex: none; font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); font-weight: 500; }
.goal p { margin: 0; font-size: 0.95rem; }
.lesson h3 { margin: 1.1rem 0 0.4rem; font-size: 0.72rem; font-family: var(--mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
.terms { list-style: none; display: flex; flex-wrap: wrap; gap: 0.4rem; padding: 0; margin: 0 0 1rem; }
.terms li { margin: 0; padding: 0.2rem 0.75rem; border-radius: 99px; font-size: 0.85rem; border: 1px solid var(--border); background: color-mix(in srgb, var(--bg) 60%, transparent); }
.lesson svg { background: var(--panel); border-radius: 10px; padding: 0.6rem; margin: 0.4rem 0 0.8rem; }
details.quiz { margin: 0.6rem 0; border: 1px dashed color-mix(in srgb, var(--accent) 55%, var(--border)); border-radius: 12px; padding: 0.7rem 1rem; }
details.quiz summary { cursor: pointer; font-weight: 600; color: var(--accent); list-style: none; display: flex; justify-content: space-between; }
details.quiz summary::after { content: '+'; font-size: 1.2rem; line-height: 1; } details.quiz[open] summary::after { content: '–'; }
details.quiz .q { margin: 0.7rem 0 0.3rem; font-weight: 600; } details.quiz .a { margin: 0; padding: 0.5rem 0.8rem; border-left: 3px solid var(--good); background: color-mix(in srgb, var(--good) 9%, transparent); border-radius: 0 8px 8px 0; }
.try { margin: 0.5rem 0; } .try a { display: inline-block; padding: 0.35rem 0.9rem; border-radius: 99px; border: 1px solid var(--accent); text-decoration: none; font-size: 0.9rem; font-weight: 500; } .try a:hover { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.lesson-done { display: inline-flex; align-items: center; gap: 0.7rem; cursor: pointer; margin-top: 0.7rem; padding-top: 0.9rem; border-top: 1px solid var(--border); width: 100%; font-weight: 600; }
.lesson-done input { position: absolute; opacity: 0; pointer-events: none; }
.lesson-done .box { width: 1.6rem; height: 1.6rem; border-radius: 8px; border: 2px solid var(--muted); display: grid; place-items: center; transition: background 0.2s, border-color 0.2s; }
.lesson-done .box::after { content: ''; width: 0.5rem; height: 0.85rem; border: solid #fff; border-width: 0 3px 3px 0; transform: rotate(45deg) scale(0); margin-top: -0.14rem; transition: transform 0.2s; }
.lesson-done input:checked + .box { background: var(--good); border-color: var(--good); } .lesson-done input:checked + .box::after { transform: rotate(45deg) scale(1); }
.lesson-done input:focus-visible + .box { outline: 2px solid var(--accent); outline-offset: 3px; }
.gloss { margin: 2.4rem 0 1.6rem; } .gloss h2 { margin-top: 0; }
.gloss table.dh { width: 100%; font-size: 0.92rem; }
.finish { padding: 1.8rem; border-radius: 18px; text-align: center; background: linear-gradient(135deg, color-mix(in srgb, var(--btn) 22%, var(--surface)), var(--surface)); border: 1px solid var(--border); }
.finish h2 { margin-top: 0; } .finish p { margin-left: auto; margin-right: auto; } .finish .cta { display: flex; justify-content: center; gap: 0.7rem; flex-wrap: wrap; }
@media (max-width: 1000px) { .learn-layout { grid-template-columns: minmax(0, 1fr); } .lesson-nav { position: static; max-height: none; } .lesson-nav ol { columns: 2; } .how ol { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .lesson-nav ol { columns: 1; } .lesson { padding: 1.2rem 1.1rem; } .lesson-head h2 { font-size: 1.25rem; } .goal { flex-direction: column; gap: 0.2rem; } }

/* ---- learn: course cards, boxes, equations, figures, widgets ---- */
.courses { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.8rem; margin: 1.2rem auto 1.6rem; }
.course { position: relative; display: flex; flex-direction: column; gap: 0.2rem; padding: 0.9rem 1.1rem 1.7rem; border-radius: 14px; border: 1px solid var(--border); background: color-mix(in srgb, var(--surface) 80%, transparent); color: var(--text); text-decoration: none; transition: border-color 0.2s, transform 0.2s; }
.course:hover { border-color: var(--accent); transform: translateY(-2px); text-decoration: none; }
.course b { font-family: var(--display); font-stretch: 85%; font-size: 1.1rem; } .course span { color: var(--muted); font-size: 0.85rem; line-height: 1.4; }
.course .cnt { position: absolute; left: 1.1rem; bottom: 0.6rem; font-family: var(--mono); font-style: normal; font-size: 0.75rem; color: var(--accent); }
.course.current { border-color: var(--btn); box-shadow: 0 0 0 3px color-mix(in srgb, var(--btn) 22%, transparent); }
.course.complete .cnt { color: var(--good); } .course.complete .cnt::before { content: '✓ '; }
.intro { margin: 1.4rem auto 2rem; }
.intro > .box { margin-top: 0; }
.lesson h4 { margin: 1.5rem 0 0.5rem; font-size: 1.1rem; font-family: var(--display); font-stretch: 85%; color: var(--accent); }
.lesson > p, .lesson li { max-width: none; }
.lesson ol, .lesson ul { padding-left: 1.4rem; } .lesson ul.terms { padding-left: 0; }
.box { margin: 1rem 0; border-radius: 12px; border: 1px solid var(--border); overflow: hidden; background: color-mix(in srgb, var(--bg) 55%, transparent); }
.box .bt { padding: 0.4rem 1rem; font-weight: 700; font-size: 0.92rem; color: #fff; background: var(--btn); }
.box .bb { padding: 0.8rem 1rem 0.5rem; } .box .bb > p:last-child, .box .bb > ul:last-child, .box .bb > ol:last-child { margin-bottom: 0.4rem; }
.box.idea { border-color: #d98a2b; } .box.idea .bt { background: #d98a2b; }
.box.warn, .box.pitfall { border-color: #c0392b; } .box.warn .bt, .box.pitfall .bt { background: #c0392b; }
.box.method, .box.word { border-color: #2e7d32; } .box.method .bt, .box.word .bt { background: #2e7d32; }
.box.example { border-color: #8a8a8a; } .box.example .bt { background: #7a7a7a; }
.box.exercise { border-color: #d98a2b; background: color-mix(in srgb, #d98a2b 7%, transparent); } .box.exercise .bt { background: #d98a2b; }
.eq { margin: 0.8rem 0; padding: 0.7rem 1rem; text-align: center; overflow-x: auto; font-family: 'IBM Plex Serif', 'Cambria Math', Georgia, 'Times New Roman', serif; font-size: 1.05rem; line-height: 2.1; background: color-mix(in srgb, var(--text) 5%, transparent); border-radius: 10px; max-width: none; }
.lesson i { font-family: 'IBM Plex Serif', 'Cambria Math', Georgia, 'Times New Roman', serif; }
.mx { display: inline-grid; vertical-align: middle; gap: 0.1rem 0.9rem; padding: 0.15rem 0.6rem; margin: 0 0.2rem; line-height: 1.5; border-left: 2px solid currentColor; border-right: 2px solid currentColor; border-radius: 8px; text-align: center; }
.mx.c1 { grid-template-columns: auto; } .mx.c2 { grid-template-columns: repeat(2, auto); } .mx.c3 { grid-template-columns: repeat(3, auto); } .mx.c4 { grid-template-columns: repeat(4, auto); }
.frac { display: inline-flex; flex-direction: column; vertical-align: middle; text-align: center; line-height: 1.35; margin: 0 0.2rem; }
.frac > span:first-child { border-bottom: 1.5px solid currentColor; padding: 0 0.3rem; } .frac > span:last-child { padding: 0 0.3rem; }
.sqrt { display: inline-block; border-top: 1.5px solid currentColor; padding: 0 0.15rem; margin-left: 0.1rem; } .sqrt::before { content: '√'; margin-left: -0.9rem; margin-right: 0.15rem; display: inline-block; transform: translateY(0.05em); }
.sqrt { margin-left: 0.9rem; }
.figure { margin: 1rem 0; text-align: center; } .figure svg.fig { width: 100%; max-width: 480px; background: var(--panel); border-radius: 12px; padding: 0.6rem; margin: 0; color: #cfd8e3; }
svg.fig text { fill: #cfd8e3; font-family: var(--mono); font-size: 13px; }
svg.fig .ax { stroke: #9aa7b6; stroke-width: 1.4; } svg.fig .axz { stroke: #5aa9ff; stroke-width: 1.6; } svg.fig .dash { stroke: #7a8696; stroke-dasharray: 4 4; stroke-width: 1; } svg.fig .dim { stroke: #9aa7b6; stroke-width: 1; stroke-dasharray: 2 3; }
svg.fig .stick, svg.fig .link1 { stroke: #5b8fd6; stroke-width: 6; stroke-linecap: round; fill: none; } svg.fig .link2 { stroke: #ff9f43; stroke-width: 6; stroke-linecap: round; fill: none; }
svg.fig .pt { fill: #ff6b6b; } svg.fig .jt { fill: #e8eef5; } svg.fig .arc { stroke: #ff9f43; fill: none; stroke-width: 1.6; } svg.fig .ring { fill: color-mix(in srgb, #5b8fd6 25%, transparent); stroke: #5b8fd6; } svg.fig .hole { fill: var(--panel); stroke: #5b8fd6; }
svg.fig .base { fill: #3a3a3a; stroke: #9aa7b6; } svg.fig .quill { fill: #7f8ea3; }
svg.fig .c-x { fill: #ff9f43; } svg.fig .c-y { fill: #4ed17f; } svg.fig .c-l { fill: #7fa8ff; } svg.fig .c-l2 { fill: #ff9f43; } svg.fig .c-pt { fill: #ff6b6b; }
svg.fig .fx line { stroke: #9aa7b6; stroke-width: 2; color: #9aa7b6; } svg.fig .fx1 line { stroke: #5aa9ff; stroke-width: 2; color: #5aa9ff; }
svg.fig .pn { fill: color-mix(in srgb, #fff 4%, transparent); stroke: #4a5566; } svg.fig .c-acc, .wsvg .c-acc { stroke: #ff6b6b; stroke-width: 2; } svg.fig .c-vel, .wsvg .c-vel { stroke: #5aa9ff; stroke-width: 2; } svg.fig .c-pos, .wsvg .c-pos { stroke: #4ed17f; stroke-width: 2; }
table.dh.center td, table.dh.center th { text-align: center; }
.qa { list-style: none; padding: 0; margin: 0.6rem 0 0; counter-reset: qq; } .qa li { counter-increment: qq; margin: 0 0 0.8rem; }
.qa .q::before { content: 'Q' counter(qq) '. '; color: var(--accent); font-family: var(--mono); }
.widget { margin: 1.2rem 0; padding: 1rem 1.2rem; border-radius: 14px; border: 1px solid color-mix(in srgb, var(--accent) 50%, var(--border)); background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }
.widget h4 { margin-top: 0; } .wnote { margin: 0 0 0.8rem; color: var(--muted); font-size: 0.92rem; }
.wbox { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 1.2rem; align-items: start; }
.wsvg { width: 100%; background: var(--panel); border-radius: 12px; touch-action: none; cursor: crosshair; color: #cfd8e3; }
.wsvg .ring { fill: color-mix(in srgb, #5b8fd6 18%, transparent); stroke: #5b8fd6; } .wsvg .hole { fill: var(--panel); stroke: #5b8fd6; } .wsvg .ax { stroke: #6f7b8c; stroke-width: 1; }
.wsvg .link1 { stroke: #5b8fd6; stroke-width: 7; stroke-linecap: round; fill: none; } .wsvg .link2 { stroke: #ff9f43; stroke-width: 7; stroke-linecap: round; fill: none; } .wsvg .alt { stroke: #8a8a8a; stroke-width: 3; stroke-dasharray: 6 5; fill: none; }
.wsvg .jt { fill: #e8eef5; } .wsvg .pt { fill: #ff6b6b; } .wsvg .c-pt { fill: #ff8a8a; font-family: var(--mono); font-size: 13px; } .wsvg text { fill: #cfd8e3; font-family: var(--mono); font-size: 12px; } .wsvg .pn { fill: color-mix(in srgb, #fff 4%, transparent); stroke: #4a5566; } .wsvg .dash { stroke: #7a8696; stroke-dasharray: 4 4; }
.wrow { display: grid; grid-template-columns: 3.2rem 1fr 5rem; gap: 0.6rem; align-items: center; margin: 0.3rem 0; } .wrow label { font-family: var(--mono); font-size: 0.85rem; } .wrow output { font-family: var(--mono); font-size: 0.82rem; text-align: right; color: var(--muted); } .wrow input { width: 100%; accent-color: var(--btn); }
.wseg { display: flex; gap: 0.4rem; margin: 0.6rem 0; } .wseg button { flex: 1; font-size: 0.85rem; padding: 0.4rem 0.6rem; background: transparent; color: var(--text); border: 1px solid var(--border); border-radius: 99px; } .wseg button.on { background: var(--btn); border-color: var(--btn); color: #fff; }
.wout { font-family: var(--mono); font-size: 0.82rem; line-height: 1.6; margin-top: 0.6rem; } .wout ul { margin: 0.2rem 0 0.5rem; padding-left: 1.1rem; }
@media (max-width: 900px) { .courses { grid-template-columns: 1fr; } .wbox { grid-template-columns: 1fr; } }
.box p, .box li { max-width: none; }
table.dh.center { width: auto; min-width: min(100%, 26rem); margin: 0.8rem auto; } .cmp-wrap:has(table.center) { overflow-x: auto; }

.lessons, .lesson { min-width: 0; } .lesson { overflow-x: clip; } .eq, .cmp-wrap { max-width: 100%; }
