.robot-demos {
  width: 100%;
  overflow: clip;
  color: var(--ink, #332d29);
  background: var(--porcelain, #fbf9f6);
}

.robot-demos__inner {
  position: relative;
  container-type: inline-size;
  max-width: 1440px;
  /* Round the 19:48 stage height before division so half-pixel ties round up. */
  height: min(570px, calc(round(down, 100vw * 19 + 24px, 48px) / 48));
  margin-inline: auto;
}

/* Posters share the carousel geometry; the selected recording keeps its own aspect ratio. */
.robot-demos__stage {
  --center-width: 62.2222cqw;
  --peek-width: 17.7778cqw;
  --peek-height: 18.8889cqw;
  --edge: 0px;
  --top: .8333cqw;
  --center-height: calc(var(--center-width) * .5625);
  --midline: calc(var(--top) + var(--center-height) / 2);
  --arrow-size: clamp(44px, 3.3333cqw, 48px);
  --arrow-inset: 1.3889cqw;
  position: relative;
  overflow: hidden;
  touch-action: pan-y pinch-zoom;
  height: calc(var(--top) + var(--center-height));
}

.robot-demos__card {
  display: block;
  position: absolute;
  top: calc(var(--midline) - var(--peek-height) / 2);
  left: 100%;
  width: var(--peek-width);
  height: var(--peek-height);
  opacity: 0;
  border-radius: 6px;
  background: var(--ink, #332d29);
  overflow: hidden;
  pointer-events: none;
  -webkit-tap-highlight-color: transparent;
}


.robot-demos__card[data-position="before"] {
  left: calc(0px - var(--peek-width) - 2cqw);
}

.robot-demos__card[data-position="after"] { left: 102cqw; }
.robot-demos__card[data-position="previous"] { left: var(--edge); }
.robot-demos__card[data-position="next"] {
  left: calc(100% - var(--peek-width) - var(--edge));
}

.robot-demos__card[data-position="current"] {
  z-index: 1;
  top: var(--top);
  left: calc((100% - var(--center-width)) / 2);
  width: var(--center-width);
  height: var(--center-height);
}

.robot-demos__card:is([data-position="previous"], [data-position="next"], [data-position="current"]) {
  opacity: 1;
  pointer-events: auto;
}

.robot-demos__card > :is(img, video) {
  display: block;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.robot-demos__card > video { opacity: 0; object-fit: contain; background: var(--ink); }
.robot-demos__card > video[data-playing] { opacity: 1; }

.robot-demos__card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgb(0 0 0 / .15);
  transition: opacity 360ms;
  pointer-events: none;
}
.robot-demos__card[data-position="current"]::after { opacity: 0; }
.robot-demos__card:focus-visible { outline: 3px solid #fff; outline-offset: -4px; }

.robot-demos__arrow, .robot-demos__close {
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: var(--ink, #332d29);
}
.robot-demos__arrow {
  position: absolute;
  z-index: 2;
  top: var(--midline);
  transform: translateY(-50%);
  border: 1px solid var(--porcelain);
  width: var(--arrow-size);
  height: var(--arrow-size);
}
.robot-demos__arrow--previous { left: var(--arrow-inset); }
.robot-demos__arrow--next { right: var(--arrow-inset); }
.robot-demos__arrow { color: var(--porcelain); }
.robot-demos__arrow path { stroke-width: 1.5; }
.robot-demos__arrow--previous path { d: path("M10.75 2.75 5.25 8l5.5 5.25"); }
.robot-demos__arrow--next path { d: path("M5.25 2.75 10.75 8l-5.5 5.25"); }
.robot-demos__arrow:focus-visible { outline-color: #fff; outline-offset: -4px; }

.robot-demos__index {
  display: flex;
  justify-content: center;
  position: absolute;
  inset: auto 0 0;
}
.robot-demos__index button {
  position: relative;
  display: grid;
  place-items: center;
  width: 42px;
  height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
}
.robot-demos__index span {
  position: absolute;
  top: calc(100% * 20 / 44);
  left: 50%;
  transform: translateX(-50%);
  display: block;
  width: calc(100% * 22 / 42);
  height: 3px;
  border-radius: 99px;
  background: var(--vermillion, #ae3e06);
  opacity: .85;
  transition: width 200ms, opacity 200ms;
}
.robot-demos__index [aria-current="true"] span { width: 76.2%; height: 4px; opacity: 1; }
.robot-demos__rotation {
  position: absolute;
  z-index: 3;
  top: 8px;
  left: 8px;
  padding: 8px 14px;
  border: 0;
  border-radius: 3px;
  color: #fff;
  background: var(--ink, #332d29);
}
.robot-demos__rotation:not(:focus-visible) {
  width: 1px;
  height: 1px;
  padding: 0;
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}

.robot-demos__dialog {
  box-sizing: border-box;
  width: min(1000px, calc(100% - 32px));
  max-height: 92vh;
  max-height: 92dvh;
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 6px;
  color: #fff;
  background: var(--ink, #332d29);
}
.robot-demos__dialog::backdrop { background: rgb(51 45 41 / .82); }
.robot-demos__player-bar { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px 8px 18px; gap: 12px; }
.robot-demos__player-bar h2 { margin: 0; font-size: clamp(18px, 2.2vw, 25px); }
.robot-demos__close { width: 40px; height: 40px; flex: none; }
.robot-demos__player { display: block; width: 100%; height: auto; max-height: calc(92dvh - 70px); background: var(--ink, #332d29); }
.robot-demos__error { padding: 12px 18px; }

@media (min-width: 1440px) {
  .robot-demos { padding-bottom: 14px; }
}
@media (min-width: 1024px) and (max-width: 1439px) {
  .robot-demos { padding-bottom: 12px; }
}
@media (min-width: 1024px) {
  .robot-demos__card[data-position="previous"] { border-radius: 0 6px 6px 0; }
  .robot-demos__card[data-position="next"] { border-radius: 6px 0 0 6px; }
}
@media (min-width: 600px) and (max-width: 1023px) {
  .robot-demos { padding-bottom: 8px; }
  .robot-demos__inner { height: 49.648vw; }
  .robot-demos__stage {
    --center-width: 77.52cqw;
    --peek-width: 9.62cqw;
    --peek-height: 27.04cqw;
    --top: 0px;
    --arrow-inset: .8cqw;
    --arrow-size: clamp(44px, 5.63cqw, 54px);
  }
  .robot-demos__index button { width: 4.95cqw; height: 5.2cqw; }
}
@media (min-width: 600px) and (max-width: 799px) {
  .robot-demos__inner { height: 53.2308vw; }
  .robot-demos__stage {
    --center-width: 80.31cqw;
    --peek-width: 8.34cqw;
    --peek-height: 28.04cqw;
    --arrow-inset: .9cqw;
    --arrow-size: clamp(44px, 7.4cqw, 55px);
  }
  .robot-demos__index button { width: 6.45cqw; height: 6.72cqw; }
}
@media (max-width: 599px) {
  .robot-demos__inner { height: max(222px, 60.655738vw); }
  .robot-demos__stage {
    --center-width: min(100cqw, max(304px, 83.060109cqw));
    --peek-width: calc(100cqw * 91 / 366);
    --peek-height: calc(100cqw * 114 / 366);
    --edge: calc(-100cqw * 70 / 366);
    --top: 0px;
    --arrow-size: max(44px, 12.021858cqw);
    --arrow-inset: max(4px, 1.092896cqw);
  }
  .robot-demos__card { border-radius: calc(100cqw * 6 / 366); }
  .robot-demos__card::after { opacity: 0; }
  .robot-demos__arrow {
    top: calc(var(--midline) - var(--arrow-size) / 88);
    color: var(--white, #fff);
  }
  .robot-demos__arrow svg { width: calc(var(--arrow-size) * 20 / 44); height: auto; }
  .robot-demos__arrow path { stroke-width: 1.2; }
  .robot-demos__arrow--previous path { d: path("M9.667 3.667 5.333 8l4.334 4.333"); }
  .robot-demos__arrow--next path { d: path("M6.333 3.667 10.667 8l-4.334 4.333"); }
  .robot-demos__index button { width: max(44px, 12.021858cqw); height: max(44px, 12.021858cqw); }
  .robot-demos__index span { width: calc(100% * 12 / 44); height: calc(100% * 3 / 44); }
  .robot-demos__index [aria-current="true"] span { width: calc(100% * 16 / 44); height: calc(100% * 4 / 44); }
}
@media (prefers-reduced-motion: reduce) {
  .robot-demos[data-ready] .robot-demos__card, .robot-demos__card::after, .robot-demos__index span { transition: none; }
}

/* Without scripting, each poster links directly to its full recording. */
@media (scripting: none) {
.robot-demos:not([data-ready]) .robot-demos__inner { height: auto; }
.robot-demos:not([data-ready]) .robot-demos__stage {
  height: auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
  gap: 12px;
  padding: 0 16px;
}
.robot-demos:not([data-ready]) .robot-demos__card {
  position: relative;
  inset: auto;
  width: 100%;
  height: auto;
  aspect-ratio: 16/9;
  opacity: 1;
  border-radius: 6px;
  pointer-events: auto;
}
.robot-demos:not([data-ready]) .robot-demos__card::after { opacity: 0; }
}
