:root {
  color-scheme: dark;
  background: #101011;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  background: radial-gradient(ellipse at center, #222224 0%, #171718 45%, #0c0c0d 100%);
}

.gallery {
  --size: min(94vmin, 1000px);
  --orbit-size: calc(var(--size) * 0.12);
  --radius: calc(var(--size) * 0.422);
  --period: 64s;
  --motion: running;
  position: relative;
  display: grid;
  place-items: center;
  width: var(--size);
  aspect-ratio: 1;
}

.center {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(4px, 0.8vmin, 8px);
  width: 46%;
  z-index: 1;
}

.gallery img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  object-position: var(--focus, center);
  background: #262627;
  border-radius: clamp(3px, 0.65vmin, 7px);
  box-shadow: 0 4px 16px #0005;
}

.orbit {
  position: absolute;
  inset: 0;
  animation: revolve var(--period) linear infinite;
  animation-play-state: var(--motion);
}

.arm {
  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--orbit-size);
  transform: translate(-50%, -50%) rotate(var(--angle)) translateX(var(--radius)) rotate(calc(-1 * var(--angle)));
}

.arm img {
  animation: revolve var(--period) linear infinite reverse;
  animation-play-state: var(--motion);
}

@keyframes revolve {
  to { transform: rotate(1turn); }
}

html[data-orbit="paused"] .gallery {
  --motion: paused;
}

@media (prefers-reduced-motion: reduce) {
  html:not([data-orbit="running"]) .gallery {
    --motion: paused;
  }
}

.motion {
  position: fixed;
  right: max(12px, env(safe-area-inset-right));
  bottom: max(12px, env(safe-area-inset-bottom));
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid #ffffff26;
  border-radius: 50%;
  background: #171718;
  color: #ededee;
  cursor: pointer;
}

.motion[hidden] { display: none; }
.motion:hover { background: #282829; }
.motion:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }

.motion span {
  box-sizing: border-box;
  width: 11px;
  height: 12px;
  border-inline: 3px solid currentColor;
}

html[data-orbit="paused"] .motion span {
  width: 0;
  height: 0;
  margin-inline-start: 3px;
  border: 6px solid transparent;
  border-right: 0;
  border-left: 9px solid currentColor;
}
