/* Four poses per unit, in reading order within each transparent sheet. */
.unit-motion {
  display: block;
  inline-size: 100%;
  aspect-ratio: 1;
  background-image: var(--unit-sheet);
  background-position: 0 0;
  background-repeat: no-repeat;
  background-size: 200% 200%;
  pointer-events: none;
}

.unit-motion--shield {
  --unit-sheet: url('../art/media/isometric/gulf/city/unit-shield.webp');
  --unit-cycle: unit-shield-drill;
  --unit-time: 3.8s;
  --unit-delay: -.45s;
}

.unit-motion--archer {
  --unit-sheet: url('../art/media/isometric/gulf/city/unit-archer.webp');
  --unit-cycle: unit-archer-drill;
  --unit-time: 3.5s;
  --unit-delay: -1.15s;
}

.unit-motion--camel {
  --unit-sheet: url('../art/media/isometric/gulf/city/unit-camel.webp');
  --unit-cycle: unit-camel-idle;
  --unit-time: 5.5s;
  --unit-delay: -1.8s;
  background-position: 100% 0;
}

@media (prefers-reduced-motion: no-preference) {
  .unit-motion {
    animation: var(--unit-cycle) var(--unit-time) steps(1, end) var(--unit-delay) infinite;
  }

  .world-paused .unit-motion { animation-play-state: paused; }
}

@keyframes unit-shield-drill {
  0%, 100% { background-position: 0 0; }
  29% { background-position: 100% 0; }
  44% { background-position: 0 100%; }
  66% { background-position: 100% 100%; }
  81% { background-position: 0 0; }
}

@keyframes unit-archer-drill {
  0%, 100% { background-position: 0 0; }
  25% { background-position: 100% 0; }
  41% { background-position: 0 100%; }
  69% { background-position: 100% 100%; }
  83% { background-position: 0 0; }
}

@keyframes unit-camel-idle {
  0%, 100% { background-position: 100% 0; }
  57% { background-position: 100% 100%; }
}
