.hub-stage {
  --hub-slide-duration: 340ms;
  --hub-slide-distance: clamp(2.5rem, 15%, 8rem);
  position: relative;
  isolation: isolate;
  inline-size: 100%;
  min-inline-size: 0;
  aspect-ratio: 1440 / 945;
}

.hub-stage > .hub-stage-content {
  inline-size: 100%;
  block-size: 100%;
  aspect-ratio: inherit;
}

.hub-pair-page .hub-stage {
  background: radial-gradient(ellipse at 50% 43%, #24262a, var(--charcoal) 67%);
}

.hub-pair-page .hub-stage-content.hero-image { background: transparent; }
.hub-pair-page .hub-stage-content.hero-image::after { content: none; }

.hub-pair-page .hub-stage::after {
  position: absolute;
  z-index: 2;
  inset: 0;
  background: linear-gradient(to bottom, var(--charcoal), transparent 16%, transparent 90%, var(--charcoal));
  pointer-events: none;
  content: "";
}

.hub-stage > .hub-stage-incoming {
  position: absolute;
  z-index: 1;
  inset: 0;
  inline-size: 100%;
  block-size: 100%;
  object-fit: contain;
  pointer-events: none;
}

.hub-pair-page .hub-stage > .hub-stage-incoming {
  mask-image: linear-gradient(90deg, transparent, black 8%, black 92%, transparent);
}

.hub-stage[data-wheel-direction] { overflow: clip; }

.hub-stage[data-wheel-direction="next"] {
  --hub-slide-in: var(--hub-slide-distance);
  --hub-slide-out: calc(-1 * var(--hub-slide-distance));
}

.hub-stage[data-wheel-direction="prev"] {
  --hub-slide-in: calc(-1 * var(--hub-slide-distance));
  --hub-slide-out: var(--hub-slide-distance);
}

.hub-stage[data-wheel-direction] > .hub-stage-content {
  animation: hub-wheel-out var(--hub-slide-duration) cubic-bezier(.3, .02, .32, 1) both;
  pointer-events: none;
}

.hub-stage[data-wheel-direction] > .hub-stage-incoming {
  animation: hub-wheel-in var(--hub-slide-duration) cubic-bezier(.22, .8, .27, 1) both;
}

@keyframes hub-wheel-out {
  to { opacity: 0; transform: translateX(var(--hub-slide-out)); }
}

@keyframes hub-wheel-in {
  from { opacity: 0; transform: translateX(var(--hub-slide-in)); }
  to { opacity: 1; transform: translateX(0); }
}

.hub-wheel-switch {
  --wheel-inset: .25rem;
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: repeat(var(--wheel-count, 2), minmax(0, 1fr));
  inline-size: min(calc(100% - 1rem), calc(var(--wheel-count, 2) * 7rem + 2 * var(--wheel-inset)));
  margin: .65rem auto .15rem;
  padding: var(--wheel-inset);
  border: 1px solid var(--control-border);
  border-radius: var(--button-radius);
  background: var(--surface);
  touch-action: pan-y pinch-zoom;
}

.hub-wheel-switch[data-ready]::before {
  position: absolute;
  inset-block: var(--wheel-inset);
  inset-inline-start: var(--wheel-inset);
  inline-size: calc((100% - 2 * var(--wheel-inset)) / var(--wheel-count, 2));
  border: 1px solid var(--selection-border);
  border-radius: var(--button-radius);
  background: var(--selection);
  box-shadow: 0 2px 7px #0005;
  transform: translateX(calc(var(--wheel-index, 0) * 100%));
  transition: transform 280ms cubic-bezier(.22, .78, .27, 1);
  pointer-events: none;
  content: "";
}

.hub-wheel-switch > button {
  position: relative;
  min-inline-size: 0;
  min-block-size: var(--button-height);
  padding: .3rem .26rem;
  border: 1px solid transparent;
  border-radius: var(--button-radius);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: .875rem;
  font-weight: 630;
  line-height: 1.25;
  overflow-wrap: anywhere;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.hub-wheel-switch > button > span { white-space: nowrap; }

.hub-wheel-switch > button[aria-pressed="true"] {
  color: var(--accent);
}

.hub-wheel-switch:not([data-ready]) > button[aria-pressed="true"] {
  border-color: var(--selection-border);
  background: var(--selection);
}

.hub-wheel-switch > button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -4px;
}

.hub-pair-page .viewer-bar {
  min-block-size: 3.55rem;
  align-content: center;
}

.inspection.is-hub-pair .hub-stage {
  inline-size: min(100%, 52rem, max(26rem, calc((100svh - 17rem) * 1.5)));
  aspect-ratio: 3 / 2;
  margin-inline: auto;
  border-radius: 1rem;
}

.inspection.is-hub-pair:not(.is-presented) .hub-wheel-switch,
.inspection.is-hub-pair.is-returning .hub-wheel-switch {
  visibility: hidden;
  pointer-events: none;
}

@media (hover: hover) {
  .hub-wheel-switch > button[aria-pressed="false"]:hover {
    border-color: var(--control-border);
    color: var(--ink);
  }
}

@media (max-width: 46rem) {
  .hub-pair-page .hero { padding-block-start: clamp(1.5rem, 6.5vw, 2.75rem); }
  .hub-pair-page .viewer-bar { min-block-size: 4.9rem; }
}

@media (prefers-reduced-motion: reduce) {
  .hub-stage { --hub-slide-duration: 0ms; }
  .hub-stage[data-wheel-direction] > :is(.hub-stage-content, .hub-stage-incoming) { animation: none; }
  .hub-wheel-switch[data-ready]::before { transition: none; }
}
