/* Robot-policy explorer (/works/robot-policy/): inference timeline + 3D stage, training article, results.
   Sits inside the site layout (al-folio navbar, footer, theme toggle) and takes its colours from the site's
   --global-* tokens, so the pages match the rest of the (light-only) portfolio. The only extra hues are the diagram
   categories: green = observations, amber = vision/encoders, blue = action decoder, rose = actions. */
:root {
  --rp-paper: var(--global-bg-color);
  --rp-panel: var(--global-card-bg-color);
  --rp-ink: var(--global-text-color);
  --rp-muted: var(--global-text-color-light);
  --rp-rule: var(--global-divider-color);
  --rp-accent: var(--global-theme-color);
  --rp-accent-ink: var(--global-warning-block-title);
  --rp-blue: var(--global-theme-color);
  --rp-pending: #8a929c;
  --rp-stage-bg: #eef0f2;
  --rp-stage-floor: #dde1e5;
  --rp-in: #e3f3e5;
  --rp-in-line: #3f8f4e;
  --rp-enc: #fcf0cf;
  --rp-enc-line: #b9850b;
  --rp-dec: #e1e8fc;
  --rp-dec-line: #4d74eb;
  --rp-out: #fae3e7;
  --rp-out-line: #c24a63;
  --rp-note: var(--global-code-bg-color);
  --rp-font-mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
  --rp-nav: 56px;
  --rp-sub: 48px;
}
.rp code,
.rp kbd {
  font-family: var(--rp-font-mono);
  font-size: 0.88em;
}
.rp kbd {
  color: var(--rp-ink);
  background: var(--rp-note);
  box-shadow: none;
  padding: 1px 4px;
}
.rp :not(pre) > code {
  background: var(--rp-note);
  padding: 1px 5px;
  border-radius: 3px;
  white-space: nowrap;
}
.rp :focus-visible {
  outline: 2px solid var(--rp-accent);
  outline-offset: 2px;
}

/* ---------- page header + sub-navigation ---------- */
.rp-head {
  padding-top: 3rem;
}
.rp-head .post-header {
  margin-bottom: 0;
  border-bottom: 0;
}
.rp-head .post-description {
  margin-bottom: 1.25rem;
}
.rp .post-title .rp-on {
  color: var(--rp-muted);
}
.rp-crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  color: var(--rp-muted);
}
.rp-crumbs a {
  color: var(--rp-muted);
}
.rp-crumbs a:hover {
  color: var(--rp-accent);
  text-decoration: none;
}
.rp-subnav {
  position: sticky;
  top: var(--rp-nav);
  z-index: 20;
  background: var(--rp-paper);
  border-top: 1px solid var(--rp-rule);
  border-bottom: 1px solid var(--rp-rule);
}
.rp-subnav-inner {
  display: flex;
  align-items: stretch;
  gap: 24px;
  height: var(--rp-sub);
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px));
}
.rp-models,
.rp-tabs {
  display: flex;
  gap: 20px;
}
.rp-models a,
.rp-tabs button {
  display: flex;
  align-items: center;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: none;
  color: var(--rp-ink);
  font-size: 1rem;
  font-weight: 400;
  padding: 2px 0 0;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.rp-models a:hover,
.rp-tabs button:hover {
  color: var(--rp-accent);
  text-decoration: none;
}
.rp-models a[aria-current="page"],
.rp-tabs button[aria-selected="true"] {
  color: var(--rp-accent);
  border-bottom-color: var(--rp-accent);
}
.rp-tabs {
  margin-left: auto;
}

/* ---------- panels ---------- */
.rp-panel[hidden] {
  display: none !important;
}
/* Panels sit at the top of the page: a #training or #results link should not scroll under the sticky bar. */
.rp-panel {
  scroll-margin-top: 100vh;
}

/* explorer: the diagram on the left; the 3D stage (inference only), the step explanation and formulas on the right */
.rp-explorer {
  max-width: 1440px;
  margin: 0 auto;
  border-left: 1px solid var(--rp-rule);
  border-right: 1px solid var(--rp-rule);
  border-bottom: 1px solid var(--rp-rule);
  height: calc(100dvh - var(--rp-nav) - var(--rp-sub));
  min-height: 620px;
}
.rp-split {
  --rp-split: 0.6;
  display: grid;
  grid-template-columns: minmax(0, calc(var(--rp-split) * 100%)) 10px minmax(0, 1fr);
  height: 100%;
}
.rp-side {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
  background: var(--rp-paper);
}
.has-stage .rp-side {
  grid-template-rows: minmax(0, 42%) minmax(0, 1fr) auto;
}
.rp-diagram {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--rp-ink) 14%, transparent) 1px, transparent 1.4px) 0 0 / 22px 22px,
    var(--rp-panel);
  touch-action: none;
  cursor: grab;
}
.rp-diagram.is-dragging {
  cursor: grabbing;
}
.rp-diagram > svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  color: var(--rp-ink);
}
.rp-diagram-tools {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: flex;
  gap: 4px;
}
.rp-diagram-tools button,
.rp-stage-tools button {
  border: 1px solid var(--rp-rule);
  background: var(--rp-panel);
  color: var(--rp-ink);
  border-radius: 4px;
  font-size: 0.8rem;
  padding: 6px 10px;
  cursor: pointer;
}
.rp-diagram-tools button:hover,
.rp-stage-tools button:hover {
  border-color: var(--rp-accent);
  color: var(--rp-accent);
}
.rp-splitter {
  cursor: col-resize;
  background: var(--rp-paper);
  border-left: 1px solid var(--rp-rule);
  border-right: 1px solid var(--rp-rule);
  position: relative;
}
.rp-splitter::after {
  content: "";
  position: absolute;
  left: 3px;
  right: 3px;
  top: 50%;
  height: 36px;
  margin-top: -18px;
  border-left: 1px solid var(--rp-muted);
  border-right: 1px solid var(--rp-muted);
  opacity: 0.6;
}
.rp-stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--rp-stage-bg);
}
.rp-stage-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.rp-stage-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 6px;
  padding: 24px;
  text-align: center;
  color: var(--rp-muted);
  font-size: 14px;
}
.rp-stage-tools {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 3;
  display: flex;
  gap: 4px;
}

/* HUD drawn over the WebGL canvas */
.rp-hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  font-family: var(--rp-font-mono);
  font-size: 11.5px;
  color: var(--rp-ink);
}
.rp-hud-status,
.rp-hud-chunk {
  background: color-mix(in srgb, var(--rp-panel) 82%, transparent);
  border: 1px solid var(--rp-rule);
  border-radius: 4px;
  padding: 6px 8px;
}
.rp-hud-status {
  position: absolute;
  left: 12px;
  top: 12px;
  display: grid;
  gap: 2px;
}
.rp-hud-subtask {
  font:
    500 15px/1.2 Roboto,
    sans-serif;
}
.rp-hud-clock {
  color: var(--rp-muted);
}
.rp-hud-chunk {
  position: absolute;
  right: 12px;
  top: 12px;
  width: min(300px, 46%);
  display: none;
  gap: 5px;
  text-align: right;
}
.rp-hud.show-chunk .rp-hud-chunk {
  display: grid;
}
.rp-hud-chunk-bar {
  height: 6px;
  border-radius: 3px;
  background: color-mix(in srgb, var(--rp-pending) 35%, transparent);
  overflow: hidden;
}
.rp-hud-chunk-bar span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--rp-accent);
}
.rp-hud-chunk-text {
  color: var(--rp-muted);
}
.rp-hud-cams {
  position: absolute;
  left: 12px;
  bottom: 34px;
  display: none;
  gap: 6px;
}
.rp-hud.show-cams .rp-hud-cams {
  display: flex;
}
.rp-hud-cam {
  position: relative;
  width: clamp(84px, 13vw, 168px);
  aspect-ratio: 4 / 3;
  border: 1.5px solid var(--rp-ink);
  border-radius: 3px;
}
.rp-hud-cam-label {
  position: absolute;
  left: 0;
  bottom: 100%;
  margin-bottom: 2px;
  font-size: 10.5px;
  color: var(--rp-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
/* data-beat is set from JS, so PurgeCSS cannot see the value in the HTML. */
.rp-stage[data-beat="observe"] .rp-hud-cam {
  border-color: var(--rp-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--rp-accent) 35%, transparent);
}
.rp-hud-joints {
  position: absolute;
  left: 12px;
  top: 76px;
  display: none;
  gap: 1px;
  background: color-mix(in srgb, var(--rp-panel) 82%, transparent);
  border: 1px solid var(--rp-rule);
  border-radius: 4px;
  padding: 6px 8px;
}
.rp-hud.show-joints .rp-hud-joints {
  display: grid;
}
.rp-hud-joint {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  font-variant-numeric: tabular-nums;
}
.rp-hud-joint span {
  color: var(--rp-muted);
}
.rp-hud-note {
  position: absolute;
  left: 12px;
  bottom: 10px;
  color: var(--rp-muted);
  font-size: 10.5px;
}

/* step explanation */
.rp-step-card {
  display: grid;
  grid-auto-rows: max-content;
  align-content: start;
  gap: 10px;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 22px 20px;
  border-top: 1px solid var(--rp-rule);
}
.rp-explorer:not(.has-stage) .rp-step-card {
  border-top: 0;
  padding-top: 26px;
}
.rp-step-count {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--rp-muted);
}
.rp-step-card h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 400;
  line-height: 1.2;
  text-wrap: balance;
}
.rp-step-card p {
  margin: 0 0 0.6em;
  font-size: 15px;
  color: var(--rp-ink);
}
.rp-step-card p:last-child {
  margin-bottom: 0;
}
.rp-formulas {
  display: grid;
  gap: 2px;
  padding: 6px 14px;
  border-left: 3px solid var(--rp-accent);
  background: var(--rp-panel);
  border-radius: 0 6px 6px 0;
  overflow-x: auto;
}
.rp-tex {
  font-family: var(--rp-font-mono);
  font-size: 12.5px;
  white-space: pre-wrap;
  padding: 4px 0;
}
.rp-tex.is-typeset {
  font-family: inherit;
  white-space: normal;
  padding: 0;
}
.rp-tex .katex-display {
  margin: 0.55em 0;
  text-align: left;
}
.rp-tex .katex-display > .katex {
  text-align: left;
}
.rp-tex .katex {
  font-size: 1.2em;
}
.rp-where p {
  font-size: 13.5px;
  color: var(--rp-muted);
}
.rp-step-card .rp-step-shapes {
  font-family: var(--rp-font-mono);
  font-size: 12.5px;
  color: var(--rp-muted);
  border-top: 1px dashed var(--rp-rule);
  padding-top: 8px;
}
.rp-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  padding: 12px 22px 14px;
  border-top: 1px solid var(--rp-rule);
}
.rp-buttons {
  display: flex;
  gap: 6px;
}
.rp-buttons button {
  border: 1px solid var(--rp-ink);
  background: transparent;
  color: var(--rp-ink);
  border-radius: 0;
  min-width: 44px;
  height: 36px;
  padding: 0 14px;
  font-size: 0.8rem;
  text-transform: uppercase;
  cursor: pointer;
}
.rp-buttons button:hover {
  border-color: var(--rp-accent);
  color: var(--rp-accent);
}
.rp-buttons button.primary {
  background: var(--rp-accent);
  border-color: var(--rp-accent);
  color: var(--global-hover-text-color);
}
.rp-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.rp-dots button {
  width: 22px;
  height: 6px;
  border: 0;
  padding: 0;
  border-radius: 3px;
  background: var(--rp-rule);
  cursor: pointer;
}
.rp-dots button[aria-current="step"] {
  background: var(--rp-accent);
}
.rp-kbd-hint {
  margin-left: auto;
  font-size: 11.5px;
  color: var(--rp-muted);
}
.rp-after {
  padding-top: 2.5rem;
}

/* all-steps list (no-JS and screen readers) */
.rp-step-list {
  display: none;
}
.rp-nojs .rp-step-list {
  display: block;
  padding: 0 16px 24px 40px;
}

/* ---------- diagrams (inline SVG) ---------- */
.rp svg text {
  fill: currentColor;
  font-family: Roboto, "Helvetica Neue", Arial, sans-serif;
}
.rp svg .h {
  font-size: 22px;
  font-weight: 400;
}
.rp svg .h2 {
  font-size: 16px;
  font-weight: 500;
  fill: var(--rp-muted);
}
.rp svg .t {
  font-size: 15px;
  font-weight: 600;
}
.rp svg .m {
  font-family: var(--rp-font-mono);
  font-size: 13px;
}
.rp svg .s {
  font-size: 13px;
  fill: var(--rp-muted);
}
.rp svg .sm {
  font-family: var(--rp-font-mono);
  font-size: 12px;
  fill: var(--rp-muted);
}
.rp svg .lbl {
  font-size: 14px;
  fill: var(--rp-muted);
}
.rp svg .sk {
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.rp svg .f-in {
  fill: var(--rp-in);
  stroke: var(--rp-in-line);
}
.rp svg .f-enc {
  fill: var(--rp-enc);
  stroke: var(--rp-enc-line);
}
.rp svg .f-dec {
  fill: var(--rp-dec);
  stroke: var(--rp-dec-line);
}
.rp svg .f-out {
  fill: var(--rp-out);
  stroke: var(--rp-out-line);
}
.rp svg .f-note {
  fill: var(--rp-note);
  stroke: var(--rp-muted);
}
.rp svg .f-panel {
  fill: var(--rp-panel);
}
.rp svg .ln {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.rp svg .ln-d {
  fill: none;
  stroke: var(--rp-muted);
  stroke-width: 1.6;
  stroke-dasharray: 7 6;
  stroke-linecap: round;
}
.rp svg .ln-a {
  fill: none;
  stroke: var(--rp-accent);
  stroke-width: 2.4;
  stroke-linecap: round;
}
.rp svg .o {
  font-size: 13.5px;
}
.rp svg .i {
  font-family: KaTeX_Math, "Times New Roman", serif;
  font-style: italic;
  font-size: 17px;
}
.rp svg .ss {
  font-size: 0.72em;
}
.rp svg .op {
  fill: var(--rp-panel);
  stroke: currentColor;
  stroke-width: 1.1;
}
.rp svg .op-a {
  fill: var(--rp-panel);
  stroke: var(--rp-accent);
  stroke-width: 1.8;
}
.rp svg .ln-t {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.3;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.rp svg .ah {
  fill: currentColor;
}
.rp svg .ah-a {
  fill: var(--rp-accent);
}
.rp svg .hatch line {
  stroke: currentColor;
  stroke-opacity: 0.16;
  stroke-width: 1.4;
}
.rp svg .tok {
  stroke: currentColor;
  stroke-width: 1;
}
.rp svg [data-step] {
  transition: opacity 0.35s ease;
  cursor: pointer;
}
.rp svg.has-active [data-step]:not(.is-active) {
  opacity: 0.32;
}
.rp svg [data-step].is-active .sk {
  stroke-width: 2.6;
}
.rp svg [data-step]:focus-visible {
  outline: none;
}
.rp svg [data-step]:focus-visible .sk {
  stroke: var(--rp-blue);
}

/* ---------- training + results articles (site typography, only spacing here) ---------- */
.rp-panel.container {
  padding-top: 2rem;
}
.rp-article {
  display: grid;
  gap: 1rem;
}
.rp-article > * {
  margin: 0;
}
.rp-article h2 {
  margin-top: 1.5rem;
}
.rp-article h3 {
  margin-top: 0.75rem;
}
.rp-article .rp-lede {
  font-size: 1.1rem;
  font-weight: 300;
}
.rp-article ul,
.rp-article ol {
  padding-left: 1.3em;
  display: grid;
  gap: 6px;
}
.rp-article pre {
  background: var(--rp-note);
  border-radius: 6px;
  padding: 14px 16px;
  overflow-x: auto;
  font-size: 13px;
  max-width: 100%;
}
.rp-article .highlight {
  background: none;
}
.rp-specs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  list-style: none;
  padding: 0 !important;
  margin: 0;
}
.rp-specs li {
  font: 12.5px/1.4 var(--rp-font-mono);
  color: var(--rp-muted);
}
.rp-specs b {
  color: var(--rp-ink);
  font-weight: 600;
}
.rp-article figure {
  margin: 0;
  display: grid;
  gap: 10px;
}
.rp-article figcaption {
  font-size: 13.5px;
  color: var(--rp-muted);
  max-width: 80ch;
}
.rp-table {
  overflow-x: auto;
  border: 1px solid var(--rp-rule);
  border-radius: 8px;
  background: var(--rp-panel);
}
.rp-table table {
  border-collapse: collapse;
  width: 100%;
  font-size: 14.5px;
}
.rp-table th,
.rp-table td {
  text-align: left;
  padding: 10px 14px;
  vertical-align: top;
  border-bottom: 1px solid var(--rp-rule);
}
.rp-table tr:last-child td {
  border-bottom: 0;
}
.rp-table th {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--rp-muted);
}
.rp-table td:first-child {
  font-weight: 600;
}
.rp-table .num {
  font-family: var(--rp-font-mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.rp-callout {
  border-left: 3px solid var(--rp-accent);
  background: var(--rp-panel);
  padding: 12px 16px;
  border-radius: 0 6px 6px 0;
  font-size: 14.5px;
}
.rp-pill {
  display: inline-block;
  font: 600 11px/1 var(--rp-font-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 5px 8px;
  border-radius: 999px;
  border: 1px solid currentColor;
}
.rp-pill.pending {
  color: var(--rp-accent-ink);
}
.rp-pill.done {
  color: var(--rp-in-line);
}
.rp-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: 16px;
  margin-top: 2rem;
}
a.rp-card {
  color: var(--rp-ink);
  text-decoration: none;
  background: var(--rp-panel);
  border: 1px solid var(--rp-rule);
}
a.rp-card:hover {
  color: var(--rp-ink);
  text-decoration: none;
}
.rp-card .card-body {
  display: grid;
  gap: 8px;
  align-content: start;
}
.rp-card .card-title {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 400;
  color: var(--rp-accent);
}
.rp-card .card-text {
  margin: 0;
}
.rp-foot {
  margin: 2rem 0 0;
  font-size: 0.8rem;
  color: var(--rp-muted);
}

/* ---------- narrow screens ---------- */
@media (max-width: 860px) {
  .rp-subnav-inner {
    gap: 16px;
    overflow-x: auto;
  }
  .rp-models,
  .rp-tabs {
    gap: 14px;
  }
  .rp-explorer {
    height: auto;
    min-height: 0;
  }
  .rp-split {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 60vh auto;
  }
  .rp-splitter {
    display: none;
  }
  .rp-side,
  .has-stage .rp-side {
    grid-template-rows: auto auto auto;
  }
  .rp-side .rp-stage {
    height: 44vh;
  }
  .rp-step-card {
    overflow: visible;
  }
  .rp-kbd-hint {
    display: none;
  }
  .rp-hud-cam {
    width: 25vw;
  }
  .rp-hud-note {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rp svg [data-step] {
    transition: none;
  }
}

/* markdown tables in the training write-up, ruled like the results table */
.rp-article > table {
  display: block;
  overflow-x: auto;
  border-collapse: collapse;
}
.rp-article > table th,
.rp-article > table td {
  padding: 8px 18px 8px 0;
  border-bottom: 1px solid var(--rp-rule);
  vertical-align: top;
}
