#viewpoints { background: var(--bg); }

.driving-section .rv-wrap {
  container-type: inline-size;
  --stage-gap: clamp(12px, 1.68vw, 26.4px);
  --example-gap: clamp(10px, 1.6vw, 22px);
}

.driving-stage {
  --pose-width: 30cqi;
  --rgb-width: calc((100cqi - 2 * var(--stage-gap) - var(--pose-width)) / 2);
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--pose-width) minmax(0, 1fr);
  gap: var(--stage-gap);
  align-items: end;
}

.driving-panel { position: relative; min-width: 0; margin: 0; }
.driving-panel figcaption { margin: 0 0 10px; color: var(--ink-2); font-size: 14px; font-weight: 600; }
.driving-panel video { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; object-position: center; border: 2px solid #51a6cf; border-radius: var(--radius-sm); background: transparent; }
.driving-panel.panel-ours video { border-color: #dca746; }
.panel-pose figcaption { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 2px 10px; text-align: center; }
.pose-viewport { position: relative; width: 100%; height: calc(var(--rgb-width) * 3 / 4); }
.panel-pose canvas { display: block; width: 100%; height: 100%; background: transparent; }
.pose-connections { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; overflow: hidden; pointer-events: none; }
.pose-key { display: inline-flex; gap: 8px; white-space: nowrap; font-size: 11px; font-weight: 500; }
.pose-key span { display: inline-flex; align-items: center; gap: 3px; }
.pose-key span::before { content: ''; width: 9px; height: 3px; background: #51a6cf; border-radius: 2px; }
.pose-key span:last-child::before { background: #dca746; }
.pose-controls {
  position: absolute;
  z-index: 2;
  bottom: 5px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  width: 90%;
  padding: 0 14px 0 2px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 1px 5px rgb(23 55 70 / 14%);
}
.pose-controls .demo-play, .pose-controls .demo-seek { pointer-events: auto; color: #173746; background: transparent; }
.pose-controls .demo-play { width: 44px; height: 44px; }
.demo-time { flex: none; margin-left: 8px; color: #173746; font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.demo-time:has(.demo-jump) { display: inline-flex; align-items: center; gap: 4px; }
.demo-jump { box-sizing: content-box; width: 4.5ch; padding: 3px 1px; border: 0; border-bottom: 1px dashed #7c969f; border-radius: 0; color: inherit; background: transparent; font: inherit; text-align: right; appearance: textfield; }
.demo-jump::-webkit-inner-spin-button, .demo-jump::-webkit-outer-spin-button { appearance: none; margin: 0; }
.demo-jump:focus { outline: 2px solid #285f7d; outline-offset: 1px; border-radius: 2px; }
.demo-play svg { width: 16px; height: 16px; }
.demo-seek { flex: 1; min-width: 0; height: 44px; margin: 0; padding: 0; appearance: none; cursor: pointer; touch-action: none; }
.demo-seek::-webkit-slider-runnable-track { height: 3px; border-radius: 2px; background: linear-gradient(to right, currentColor var(--played, 0%), #a5b3ba var(--played, 0%)); }
.demo-seek::-moz-range-track { height: 3px; border-radius: 2px; background: #a5b3ba; }
.demo-seek::-moz-range-progress { height: 3px; border-radius: 2px; background: currentColor; }
.demo-seek::-webkit-slider-thumb { appearance: none; width: 12px; height: 12px; margin-top: -4.5px; border: 0; border-radius: 50%; background: currentColor; }
.demo-seek::-moz-range-thumb { width: 12px; height: 12px; border: 0; border-radius: 50%; background: currentColor; }
.demo-seek:disabled { opacity: .4; cursor: default; }
.pose-controls :focus-visible { outline: 2px solid #285f7d; outline-offset: -2px; }
.demo-play .stop, .demo-play.is-playing .start { display: none; }
.demo-play.is-playing .stop { display: block; }
.demo-error { margin: 6px 0 0; color: #954619; }

@media (min-width: 621px) and (max-width: 900px) {
  .pose-controls { display: grid; grid-template-columns: 44px minmax(0, 1fr); padding: 0 8px 0 2px; }
  .pose-controls .demo-play { grid-column: 1; grid-row: 1 / 3; }
  .pose-controls .demo-seek { grid-column: 2; grid-row: 1; width: 100%; height: 22px; }
  .pose-controls .demo-time { grid-column: 2; grid-row: 2; justify-self: end; margin-left: 0; line-height: 20px; }
  .pose-controls .demo-jump { padding-block: 0; }
}

.driving-examples {
  /* Wrap larger galleries while retaining readable captions. */
  --rv-thumb-width: calc((100cqi - 5 * var(--example-gap)) / 6);
  grid-template-columns: repeat(var(--example-columns, 5), minmax(0, 1fr));
}
.driving-examples .thumb-img { position: relative; aspect-ratio: auto; height: calc(var(--rv-thumb-width) * 9 / 16); }
.driving-examples .thumb-duration { position: absolute; right: 6px; bottom: 6px; padding: 2px 6px; border-radius: 5px; color: #fff; background: rgb(15 24 30 / 82%); font-size: 13px; font-weight: 600; line-height: 1.4; font-variant-numeric: tabular-nums; }
.driving-examples .thumb-meta { display: block; margin-top: 4px; color: var(--ink-2); font-size: 14px; line-height: 1.4; font-weight: 400; }


@media (min-width: 741px) and (max-width: 1100px) {
  .driving-examples { --rv-thumb-width: calc((100cqi - 2 * var(--example-gap)) / 3); grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 741px) and (max-width: 900px) {
  .driving-examples .thumb-title { font-size: 12.5px; line-height: 17.5px; }
}

@media (max-width: 740px) {
  .driving-examples {
    --rv-thumb-width: max(100px, calc((100cqi - 5 * var(--example-gap)) / 6));
    grid-template-columns: repeat(var(--example-count, 5), minmax(150px, 1fr));
  }
}

@media (max-width: 620px) {
  .driving-stage {
    --stage-gap: 9.6px;
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
  }
  .driving-panel { width: 94%; }
  .driving-panel figcaption { margin-bottom: 2px; font-size: 13px; line-height: 17px; }
  .driving-stage > figure:nth-of-type(3) { display: flex; flex-direction: column-reverse; }
  .driving-stage > figure:nth-of-type(3) figcaption { margin: 2px 0 0; }
  .pose-viewport { height: auto; padding-bottom: 20px; }
  .panel-pose canvas { height: clamp(132px, 44cqi, 210px); }
  .driving-examples .thumb-img { height: calc(var(--rv-thumb-width) * 10 / 16); }
}
