/* Robot teardown: scroll-driven exploded view (robot-teardown.html). */
:root {
  --rt-bg: #0b0d0f;
  --rt-bg-2: #151a1e;
  --rt-ink: #eef3f6;
  --rt-mute: #9aa8b2;
  --rt-line: rgba(255, 255, 255, 0.12);
  --rt-card: rgba(12, 16, 19, 0.8);
  --rt-green: #28e98c;
  --rt-cyan: #14c5fd;
  --rt-orange: #f58220;
  --rt-gradient: linear-gradient(135deg, #28e98c, #14c5fd);
  --rt-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Consolas, monospace;
  --rt-gutter: clamp(16px, 3vw, 32px);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: auto; }
body.rt-page {
  margin: 0;
  background: var(--rt-bg);
  color: var(--rt-ink);
  font-family: 'Inter', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
.rt-page a { color: inherit; }
.rt-page h1, .rt-page h2, .rt-page h3 { margin: 0; text-wrap: balance; }
.rt-page p { margin: 0; }

.rt-skip {
  position: absolute; left: 12px; top: -60px; z-index: 50;
  padding: 10px 16px; border-radius: 8px;
  background: var(--rt-ink); color: var(--rt-bg); font-weight: 600; text-decoration: none;
}
.rt-skip:focus { top: 12px; }

/* Embedded in the homepage popup: no header, no scroll chaining to the parent page */
html.rt-embed, html.rt-embed body { overscroll-behavior: none; }
.rt-embed .rt-header, .rt-embed .rt-skip { display: none; }
.rt-embed .rt-hud { top: 24px; }
.rt-embed .rt-camera { top: 76px; }
.rt-embed .rt-page.is-static .rt-stage { padding-top: 56px; }

/* Header */
.rt-header {
  position: fixed; inset: 0 0 auto 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px var(--rt-gutter);
  background: linear-gradient(180deg, rgba(11, 13, 15, 0.92), rgba(11, 13, 15, 0));
  pointer-events: none;
}
.rt-header > * { pointer-events: auto; }
.rt-header .brand { font-weight: 700; text-decoration: none; letter-spacing: 0.02em; }
.rt-header .tt-brand-wordmark img { width: clamp(112px, 12vw, 168px); }
.rt-nav { display: flex; gap: 6px; }
.rt-nav a {
  padding: 8px 12px; border-radius: 999px;
  font-size: 14px; font-weight: 500; text-decoration: none; color: var(--rt-mute);
  transition: color 0.2s ease, background-color 0.2s ease;
}
.rt-nav a:hover, .rt-nav a:focus-visible { color: var(--rt-ink); background: rgba(255, 255, 255, 0.07); }

/* Scroll track and sticky stage */
.rt-track { position: relative; height: 900vh; }
.rt-stage {
  position: sticky; top: 0;
  height: 100vh; height: 100svh;
  overflow: hidden;
  background:
    radial-gradient(120% 80% at 50% 42%, #1b2329 0%, #11161a 45%, var(--rt-bg) 100%);
}
/* touch-action: a vertical swipe still scrolls the page; a sideways one orbits the close-up */
.rt-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; opacity: 0; transition: opacity 0.6s ease; touch-action: pan-y; }
.rt-page.is-ready .rt-canvas { opacity: 1; }
.rt-poster { display: none; }
.rt-vignette {
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(140% 100% at 50% 50%, transparent 55%, rgba(0, 0, 0, 0.55) 100%);
}

/* HUD */
.rt-hud, .rt-camera {
  position: absolute; top: 104px; z-index: 5;
  display: grid; gap: 6px;
  font-family: var(--rt-mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--rt-mute);
  pointer-events: none;
}
.rt-hud { left: var(--rt-gutter); }
.rt-hud__phase { color: var(--rt-ink); font-size: 13px; }
.rt-hud__bar { position: relative; display: block; width: 180px; height: 2px; margin-top: 4px; background: var(--rt-line); overflow: hidden; }
.rt-hud__bar i { position: absolute; inset: 0; background: var(--rt-gradient); transform-origin: 0 50%; transform: scaleX(0); }
.rt-camera { right: var(--rt-gutter); justify-items: end; opacity: 0; }
.rt-camera [data-timecode] { color: var(--rt-ink); font-size: 15px; letter-spacing: 0.08em; font-variant-numeric: tabular-nums; }
.rt-rec { display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: #ff3b30; box-shadow: 0 0 8px #ff3b30; vertical-align: 1px; }

/* Intro / outro */
.rt-eyebrow {
  font-family: var(--rt-mono); font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase;
  background: var(--rt-gradient); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.rt-intro {
  position: absolute; z-index: 6; left: var(--rt-gutter); top: 50%;
  width: min(460px, calc(100% - 2 * var(--rt-gutter)));
  transform: translateY(-50%);
  display: grid; gap: 16px;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.6);
}
.rt-intro h1 { font-size: clamp(40px, 6vw, 76px); font-weight: 700; line-height: 1; letter-spacing: -0.03em; }
.rt-intro p:not(.rt-eyebrow) { color: #c9d3d9; font-size: clamp(15px, 1.4vw, 18px); line-height: 1.55; max-width: 42ch; }
.rt-cue {
  display: inline-flex; align-items: center; gap: 8px; width: max-content;
  margin-top: 8px; padding: 8px 14px; border: 1px solid var(--rt-line); border-radius: 999px;
  font-family: var(--rt-mono); font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--rt-mute);
  animation: rt-cue 1.8s ease-in-out infinite;
}
.rt-cue i { font-size: 18px; }
@keyframes rt-cue { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(6px); } }

.rt-outro {
  position: absolute; z-index: 6; left: var(--rt-gutter); top: 50%;
  width: min(460px, calc(100% - 2 * var(--rt-gutter)));
  transform: translateY(-50%);
  display: grid; justify-items: start; gap: 14px;
  opacity: 0; visibility: hidden;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.7);
}
.rt-outro h2 { font-size: clamp(30px, 4.2vw, 56px); font-weight: 700; line-height: 1.05; letter-spacing: -0.03em; }
.rt-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 6px; }
.rt-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 10px 20px; border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22); background: rgba(255, 255, 255, 0.04);
  font-weight: 600; font-size: 15px; text-decoration: none; color: var(--rt-ink);
  transition: transform 0.16s ease-out, background-color 0.2s ease, border-color 0.2s ease;
}
.rt-btn:hover { border-color: rgba(255, 255, 255, 0.45); background: rgba(255, 255, 255, 0.08); }
.rt-btn:active { transform: scale(0.97); }
.rt-btn--primary { border: 0; background: var(--rt-gradient); color: #06110c; }
.rt-btn--primary:hover { background: var(--rt-gradient); filter: brightness(1.08); }
.rt-btn:focus-visible, .rt-marker:focus-visible, .rt-legend button:focus-visible, .rt-nav a:focus-visible {
  outline: 2px solid var(--rt-cyan); outline-offset: 3px;
}

/* Markers, leader line and callout card */
.rt-leader { position: absolute; inset: 0; z-index: 6; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.rt-leader polyline { fill: none; stroke: var(--rt-cyan); stroke-width: 1.25; opacity: 0.9; }
.rt-leader circle { fill: var(--rt-cyan); filter: drop-shadow(0 0 6px var(--rt-cyan)); }
.rt-markers { position: absolute; inset: 0; z-index: 7; pointer-events: none; }
.rt-marker {
  position: absolute; left: 0; top: 0;
  width: 28px; height: 28px; margin: -14px 0 0 -14px; padding: 0;
  display: grid; place-items: center;
  border-radius: 50%; border: 1px solid rgba(20, 197, 253, 0.65);
  background: rgba(8, 14, 18, 0.72); color: var(--rt-ink);
  font-family: var(--rt-mono); font-size: 11px; font-weight: 500;
  cursor: pointer; pointer-events: auto; opacity: 0;
  transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.rt-marker::after {
  content: ''; position: absolute; inset: -12px; border-radius: 50%;
}
.rt-marker:hover { border-color: var(--rt-cyan); }
.rt-marker.is-active {
  background: var(--rt-cyan); color: #04121a; border-color: var(--rt-cyan);
  box-shadow: 0 0 0 6px rgba(20, 197, 253, 0.18), 0 0 22px rgba(20, 197, 253, 0.55);
}

.rt-card {
  position: absolute; left: 0; top: 0; z-index: 8;
  width: min(340px, calc(100vw - 2 * var(--rt-gutter)));
  padding: 18px 20px 20px;
  display: grid; gap: 10px;
  border: 1px solid rgba(20, 197, 253, 0.28); border-radius: 14px;
  background: var(--rt-card);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
  opacity: 0; visibility: hidden;
  will-change: transform, opacity;
}
.rt-card__num { font-family: var(--rt-mono); font-size: 12px; letter-spacing: 0.14em; color: var(--rt-cyan); }
.rt-card__count { position: absolute; right: 20px; top: 18px; font-family: var(--rt-mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--rt-mute); }
.rt-card__title { font-size: 21px; font-weight: 650; letter-spacing: -0.01em; }
.rt-card__body { color: #c3cdd3; font-size: 14.5px; line-height: 1.55; }
.rt-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 0; padding: 0; list-style: none; }
.rt-tags li {
  padding: 5px 10px; border-radius: 999px;
  border: 1px solid rgba(40, 233, 140, 0.35); background: rgba(40, 233, 140, 0.07);
  font-size: 12px; font-weight: 500; color: #c9f8df;
}

/* A component being run: live readouts, close button, previous / next */
.rt-page [hidden] { display: none !important; }
.rt-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.rt-card.is-part { border-color: rgba(40, 233, 140, 0.4); }
.rt-card.is-part .rt-card__num { color: var(--rt-green); padding-right: 44px; }
.rt-card.is-part .rt-card__count { position: static; margin-top: -4px; color: var(--rt-mute); }
.rt-card.is-part .rt-card__count:empty { display: none; }
.rt-card__close {
  position: absolute; right: 8px; top: 8px;
  width: 40px; height: 40px; padding: 0; display: grid; place-items: center;
  border: 0; border-radius: 50%; background: transparent; color: var(--rt-mute); font-size: 18px; cursor: pointer;
  transition: color 0.15s ease, background-color 0.15s ease;
}
.rt-card__close:hover { color: var(--rt-ink); background: rgba(255, 255, 255, 0.08); }
.rt-stats { display: grid; margin: 2px 0 0; border: 1px solid var(--rt-line); border-radius: 10px; }
.rt-stats div { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 8px 12px; }
.rt-stats div + div { border-top: 1px solid var(--rt-line); }
.rt-stats dt { font-family: var(--rt-mono); font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--rt-mute); }
.rt-stats dd { margin: 0; font-family: var(--rt-mono); font-size: 13px; color: var(--rt-ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rt-card__parts { display: grid; gap: 8px; margin-top: 4px; padding-top: 12px; border-top: 1px solid var(--rt-line); }
.rt-card__label { font-family: var(--rt-mono); font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--rt-mute); }
.rt-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.rt-chip, .rt-part__run {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 34px; padding: 6px 12px; border-radius: 999px;
  border: 1px solid rgba(20, 197, 253, 0.45); background: rgba(20, 197, 253, 0.08);
  font: 600 12.5px/1.2 'Inter', sans-serif; color: #d9f4ff; cursor: pointer;
  transition: transform 0.16s ease-out, background-color 0.15s ease, border-color 0.15s ease;
}
.rt-chip::before { content: ''; border-style: solid; border-width: 4px 0 4px 6px; border-color: transparent transparent transparent var(--rt-cyan); }
.rt-chip:hover, .rt-part__run:hover { border-color: var(--rt-cyan); background: rgba(20, 197, 253, 0.18); }
.rt-chip:active, .rt-part__run:active { transform: scale(0.97); }
.rt-card__nav {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 2px; padding-top: 10px; border-top: 1px solid var(--rt-line);
  font-family: var(--rt-mono); font-size: 12px; letter-spacing: 0.1em; color: var(--rt-mute); font-variant-numeric: tabular-nums;
}
.rt-card__nav button {
  width: 40px; height: 40px; padding: 0; display: grid; place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.18); border-radius: 50%; background: rgba(255, 255, 255, 0.04);
  color: var(--rt-ink); font-size: 18px; cursor: pointer;
  transition: transform 0.16s ease-out, background-color 0.15s ease, border-color 0.15s ease;
}
.rt-card__nav button:hover { border-color: rgba(255, 255, 255, 0.45); background: rgba(255, 255, 255, 0.1); }
.rt-card__nav button:active { transform: scale(0.94); }
.rt-chip:focus-visible, .rt-part__run:focus-visible, .rt-card__close:focus-visible, .rt-card__nav button:focus-visible {
  outline: 2px solid var(--rt-cyan); outline-offset: 3px;
}

/* Name tag for the component under the pointer */
.rt-tip {
  position: absolute; left: 0; top: 0; z-index: 7;
  padding: 6px 11px; border-radius: 999px;
  border: 1px solid rgba(20, 197, 253, 0.55); background: rgba(8, 14, 18, 0.88);
  font: 600 12.5px/1.2 'Inter', sans-serif; color: var(--rt-ink); white-space: nowrap;
  pointer-events: none; opacity: 0; transition: opacity 0.14s ease;
}
.rt-tip.is-on { opacity: 1; }

.rt-legend {
  position: absolute; z-index: 7; left: var(--rt-gutter); bottom: clamp(20px, 5vh, 48px);
  display: grid; gap: 2px; margin: 0; padding: 0; list-style: none;
  opacity: 0; visibility: hidden;
}
.rt-legend button {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 5px 10px 5px 6px; border: 0; border-radius: 8px; background: transparent;
  font: 500 13px/1.2 'Inter', sans-serif; color: var(--rt-mute); text-align: left; cursor: pointer;
  transition: color 0.2s ease, background-color 0.2s ease;
}
.rt-legend button:hover { color: var(--rt-ink); background: rgba(255, 255, 255, 0.05); }
.rt-legend b { width: 22px; font-family: var(--rt-mono); font-size: 11px; font-weight: 500; color: rgba(154, 168, 178, 0.7); }
.rt-legend small { margin-left: auto; padding-left: 12px; font-family: var(--rt-mono); font-size: 10px; color: rgba(154, 168, 178, 0.6); }
.rt-legend li.is-active button { color: var(--rt-ink); background: rgba(20, 197, 253, 0.1); }
.rt-legend li.is-active b { color: var(--rt-cyan); }

.rt-loading {
  position: absolute; inset: 0; z-index: 9;
  display: grid; place-content: center; justify-items: center; gap: 10px;
  font-family: var(--rt-mono); font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--rt-mute);
  transition: opacity 0.4s ease, visibility 0.4s;
}
.rt-loading b { font-size: 22px; font-weight: 500; letter-spacing: 0.04em; color: var(--rt-ink); font-variant-numeric: tabular-nums; }
.rt-page.is-ready .rt-loading, .rt-page.is-static .rt-loading { opacity: 0; visibility: hidden; }

/* Static fallback: reduced motion, data saver, or no WebGL */
.rt-page.is-static .rt-track { height: auto; }
.rt-page.is-static .rt-stage {
  position: relative; height: auto; min-height: 100svh;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; gap: 24px;
  padding: 96px var(--rt-gutter) 48px;
}
.rt-page.is-static .rt-canvas,
.rt-page.is-static .rt-tip,
.rt-page.is-static .rt-hud,
.rt-page.is-static .rt-camera,
.rt-page.is-static .rt-leader,
.rt-page.is-static .rt-markers,
.rt-page.is-static .rt-card,
.rt-page.is-static .rt-legend,
.rt-page.is-static .rt-outro,
.rt-page.is-static .rt-cue,
.rt-page.is-static .rt-vignette { display: none; }
.rt-page.is-static .rt-intro { position: relative; left: auto; top: auto; transform: none; width: auto; grid-column: 1; grid-row: 1; justify-self: end; max-width: 460px; }
.rt-page.is-static .rt-poster { display: block; grid-column: 2; grid-row: 1; width: 100%; max-width: 520px; height: auto; justify-self: start; }
.rt-static-link { display: none; }
.rt-page.is-static .rt-static-link { display: inline-flex; width: max-content; margin-top: 8px; }

/* Specs */
.rt-specs {
  position: relative; z-index: 2;
  padding: clamp(64px, 10vw, 120px) var(--rt-gutter) clamp(48px, 8vw, 96px);
  background: linear-gradient(180deg, var(--rt-bg) 0%, var(--rt-bg-2) 100%);
}
.rt-specs__head { max-width: 760px; margin: 0 auto 40px; display: grid; gap: 12px; text-align: center; justify-items: center; }
.rt-specs__head h2 { font-size: clamp(28px, 4vw, 44px); font-weight: 650; letter-spacing: -0.02em; }
.rt-specs__head p:not(.rt-eyebrow) { color: var(--rt-mute); line-height: 1.6; max-width: 60ch; }
.rt-spec-grid {
  max-width: 1180px; margin: 0 auto;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 16px;
}
.rt-spec {
  display: grid; align-content: start; gap: 10px;
  padding: 22px; border: 1px solid var(--rt-line); border-radius: 14px;
  background: rgba(255, 255, 255, 0.025);
}
.rt-spec__num { font-family: var(--rt-mono); font-size: 12px; letter-spacing: 0.14em; color: var(--rt-cyan); }
.rt-spec h3 { font-size: 19px; font-weight: 650; }
.rt-spec p { color: #b9c4cb; font-size: 15px; line-height: 1.6; }
/* What is inside each subsystem; "Run in 3D" appears once the 3D parts have loaded */
.rt-parts { display: grid; gap: 14px; margin: 6px 0 0; padding: 16px 0 0; list-style: none; border-top: 1px solid var(--rt-line); }
.rt-part { display: grid; gap: 4px; justify-items: start; }
.rt-part__name { margin: 0; font-size: 15px; font-weight: 600; color: var(--rt-ink); }
.rt-spec .rt-part__desc { color: #a3b0b8; font-size: 14px; line-height: 1.55; }
.rt-part__run { margin-top: 6px; min-height: 40px; }
.rt-part__run i { font-size: 13px; color: var(--rt-cyan); }
.rt-specs__cta { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 40px; }

.rt-footer {
  display: grid; gap: 8px; padding: 28px var(--rt-gutter) 36px;
  border-top: 1px solid var(--rt-line); background: var(--rt-bg-2);
  color: var(--rt-mute); font-size: 13px; line-height: 1.6; text-align: center;
}
.rt-footer a { color: #cfd8de; text-underline-offset: 3px; }

/* Narrow screens */
@media (max-width: 900px) {
  .rt-legend { display: none; }
}
@media (max-width: 760px) {
  .rt-nav a:not(:last-child) { display: none; }
  .rt-hud, .rt-camera { top: 80px; }
  .rt-embed .rt-hud { top: 20px; }
  .rt-embed .rt-camera { top: 68px; }
  .rt-hud__bar { width: 120px; }
  .rt-hud__id { display: none; }
  .rt-camera span:first-child { display: none; }
  .rt-intro, .rt-outro { top: auto; bottom: 28px; transform: none; }
  .rt-intro h1 { font-size: clamp(36px, 11vw, 52px); }
  .rt-card { width: auto; }
  .rt-card.is-docked { left: 12px !important; right: 12px; top: auto !important; bottom: 12px; transform: none !important; }
  /* Docked at the bottom of a phone: keep the card short so the part stays in view */
  .rt-card.is-docked .rt-chips { flex-wrap: nowrap; overflow-x: auto; margin: 0 -20px; padding: 0 20px 2px; scrollbar-width: none; }
  .rt-card.is-docked .rt-chip { flex: none; min-height: 40px; }
  .rt-card.is-docked.is-part { gap: 8px; padding-bottom: 12px; }
  .rt-card.is-docked.is-part .rt-tags { display: none; }
  .rt-card.is-docked.is-part .rt-card__body { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
  .rt-card.is-docked.is-part .rt-stats div { padding: 6px 12px; }
  .rt-page.is-static .rt-stage { grid-template-columns: 1fr; padding-top: 84px; }
  .rt-page.is-static .rt-intro { grid-row: 2; justify-self: start; }
  .rt-page.is-static .rt-poster { grid-column: 1; grid-row: 1; justify-self: center; max-width: 420px; }
}

@media (prefers-reduced-motion: reduce) {
  .rt-cue { animation: none; }
  .rt-btn, .rt-canvas, .rt-chip, .rt-part__run, .rt-card__nav button, .rt-tip { transition: none; }
}
