body {
  margin: 5vh;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #ec8a8a;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 100px;
  padding: 0;
  width: 100%;
  max-width: 50vh;
}

.block {
  position: relative;
  width: 200px;
  height: 200px;
  margin: 0 auto;
}

.block:hover .layer {
  animation-play-state: paused;
}

.layer {
  position: absolute;
  top: calc((var(--i) - 1) * -10px);
  width: 150px;
  height: 150px;
  animation: rotation 5s linear infinite;
  transform-origin: center;
}

@keyframes rotation {
  from { transform: rotate(0deg);}
  to {transform: rotate(360deg);}
}