*, *::before, *::after {
  padding: 0;
  margin: 0;
  box-sizing: border-box;
}

body {
  background-color: #222;
  color: #fff;
  min-height: 100vh;
  display: grid;
  place-items: center;
  perspective: 1300px;
  overflow: clip;

  * {
    transform-style: preserve-3d;
  }
}

.scene {
  position: relative;
  -webkit-animation: sceneRotate 50s infinite linear;
          animation: sceneRotate 50s infinite linear;
  transform: rotateX(-30deg);

  * { position: absolute; }

  --duration: 8s;
  --outerSize: 8em;
  --innerSize: 4em;
  --wheelDepth: 2em;
  --_outerWidth: calc(tan(15deg) * (var(--outerSize) / -2));
  --_inX: calc(var(--_outerWidth) * 60);
}

@-webkit-keyframes sceneRotate {
  from { transform: rotateX(-30deg) rotateY(0deg); }
  to { transform: rotateX(-30deg) rotateY(360deg); }
}

@keyframes sceneRotate {
  from { transform: rotateX(-30deg) rotateY(0deg); }
  to { transform: rotateX(-30deg) rotateY(360deg); }
}

.floor {
  inset: -30em;
  transform: translateY(calc((var(--outerSize)) / 2 - 1px)) rotateX(90deg);
  background-image: radial-gradient(closest-side, transparent 25%, 60%, #222 80%);
}

.zoom {
  -webkit-animation: zoom var(--duration) infinite linear;
          animation: zoom var(--duration) infinite linear;
}

@-webkit-keyframes zoom {
  0% { transform: scale3d(1, 1, 1); }
  100% { transform: scale3d(2, 1, 2); }
}

@keyframes zoom {
  0% { transform: scale3d(1, 1, 1); }
  100% { transform: scale3d(2, 1, 2); }
}

.shadow {
  inset: -5em;
  border-radius: 50%;
  border: 1em solid #0007;
  -webkit-animation: shadow var(--duration) infinite;
          animation: shadow var(--duration) infinite;
  transform: translateY(calc((var(--outerSize)) / 2 - 1px)) rotateX(90deg) translateY(calc((var(--outerSize) + var(--wheelDepth)) / -2)) translateX(var(--_inXs, 0));
  filter: blur(1em);
}

@-webkit-keyframes shadow {
  0% {
    background-color: #0007;
    transform: translateY(calc((var(--outerSize)) / 2 - 1px)) rotateX(90deg) translateY(calc((var(--outerSize) + var(--wheelDepth)) / -2)) translateX(var(--_inX)) scale(0.75, 0.25);
    opacity: 0;
    -webkit-animation-timing-function: ease-out;
            animation-timing-function: ease-out;
  }
  50% {
    background-color: #0007;
    transform: translateY(calc((var(--outerSize)) / 2 - 1px)) rotateX(90deg) translateY(calc((var(--outerSize) + var(--wheelDepth)) / -2)) translateX(0) scale(1, 0.25);
    opacity: 1;
    -webkit-animation-timing-function: ease-in;
            animation-timing-function: ease-in;
  }
  75% {
    background-color: #0000;
    transform: translateY(calc((var(--outerSize)) / 2 - 1px)) rotateX(90deg) translateY(0) translateX(0) scale(1, 1);
    opacity: 1;
    -webkit-animation-timing-function: ease-out;
            animation-timing-function: ease-out;
  }
  100% {
    transform: translateY(calc((var(--outerSize)) / 2 - 1px)) rotateX(90deg) translateY(0) translateX(0) scale(1, 1);
    opacity: 0;
  }
}

@keyframes shadow {
  0% {
    background-color: #0007;
    transform: translateY(calc((var(--outerSize)) / 2 - 1px)) rotateX(90deg) translateY(calc((var(--outerSize) + var(--wheelDepth)) / -2)) translateX(var(--_inX)) scale(0.75, 0.25);
    opacity: 0;
    -webkit-animation-timing-function: ease-out;
            animation-timing-function: ease-out;
  }
  50% {
    background-color: #0007;
    transform: translateY(calc((var(--outerSize)) / 2 - 1px)) rotateX(90deg) translateY(calc((var(--outerSize) + var(--wheelDepth)) / -2)) translateX(0) scale(1, 0.25);
    opacity: 1;
    -webkit-animation-timing-function: ease-in;
            animation-timing-function: ease-in;
  }
  75% {
    background-color: #0000;
    transform: translateY(calc((var(--outerSize)) / 2 - 1px)) rotateX(90deg) translateY(0) translateX(0) scale(1, 1);
    opacity: 1;
    -webkit-animation-timing-function: ease-out;
            animation-timing-function: ease-out;
  }
  100% {
    transform: translateY(calc((var(--outerSize)) / 2 - 1px)) rotateX(90deg) translateY(0) translateX(0) scale(1, 1);
    opacity: 0;
  }
}

.wheel {
  -webkit-animation: wheel-in var(--duration) infinite;
          animation: wheel-in var(--duration) infinite;

  div {
    transform: rotateZ(calc(var(--d) * 30deg));
    background-color: inherit;

    i {
      background-color: inherit;
      &:nth-child(1) {
        inset: calc(var(--wheelDepth) / -2) var(--_outerWidth);
        transform: rotateX(90deg) translateZ(calc(var(--outerSize) / 2));
      }
      &:nth-child(2) {
        inset: calc(var(--wheelDepth) / -2) calc(tan(15deg) * (var(--innerSize) / -2) - 1px);
        background-image:
          linear-gradient(0deg, #2227, 10%, transparent),
          linear-gradient(180deg, #2227, 10%, transparent);
        transform: rotateX(90deg) translateZ(calc(var(--innerSize) / 2));
      }
      &:nth-child(3) {
        inset: calc((var(--outerSize) - var(--innerSize)) / -4) var(--_outerWidth);
        background-image: radial-gradient(circle at 50% calc(100% + var(--innerSize) / 2), #2227 calc(var(--innerSize) / 2), transparent);
        transform: translateY(calc(var(--outerSize) / -2 + 50%)) translateZ(calc(var(--wheelDepth) / 2));
      }
      &:nth-child(4) {
        inset: calc((var(--outerSize) - var(--innerSize)) / -4) var(--_outerWidth);
        background-image: radial-gradient(circle at 50% calc(100% + var(--innerSize) / 2), #2227 calc(var(--innerSize) / 2), transparent);
        transform: translateY(calc(var(--outerSize) / -2 + 50%)) translateZ(calc(var(--wheelDepth) / -2));
      }
    }
  }
}

@-webkit-keyframes wheel-in {
  0% {
    transform: translateZ(calc((var(--outerSize) + var(--wheelDepth)) / -2)) translateX(var(--_inX)) rotateZ(-900deg);
    transform-origin: center;
    -webkit-animation-timing-function: ease-out;
            animation-timing-function: ease-out;
    background-color: #222;
  }
  50% {
    transform-origin: center;
    transform: translateZ(calc((var(--outerSize) + var(--wheelDepth)) / -2)) translateX(0) rotateZ(0deg);
    -webkit-animation-timing-function: step-end;
            animation-timing-function: step-end;
    background-color: #fff;
  }
  50% {
    transform-origin: 50% calc(var(--outerSize) / 2) calc(var(--wheelDepth) / 2);
    transform: translateZ(calc((var(--outerSize) + var(--wheelDepth)) / -2));
    -webkit-animation-timing-function: ease-in;
            animation-timing-function: ease-in;
  }
  75% {
    transform-origin: 50% calc(var(--outerSize) / 2) calc(var(--wheelDepth) / 2);
    transform: translateZ(calc((var(--outerSize) + var(--wheelDepth)) / -2)) rotateX(-90deg);
    -webkit-animation-timing-function: ease-out;
            animation-timing-function: ease-out;
  }
  100% {
    transform-origin: 50% calc(var(--outerSize) / 2) calc(var(--wheelDepth) / 2);
    transform: translateZ(calc((var(--outerSize) + var(--wheelDepth)) / -2)) rotateX(-90deg) translateZ(2em);
  }
}

@keyframes wheel-in {
  0% {
    transform: translateZ(calc((var(--outerSize) + var(--wheelDepth)) / -2)) translateX(var(--_inX)) rotateZ(-900deg);
    transform-origin: center;
    -webkit-animation-timing-function: ease-out;
            animation-timing-function: ease-out;
    background-color: #222;
  }
  50% {
    transform-origin: center;
    transform: translateZ(calc((var(--outerSize) + var(--wheelDepth)) / -2)) translateX(0) rotateZ(0deg);
    -webkit-animation-timing-function: step-end;
            animation-timing-function: step-end;
    background-color: #fff;
  }
  50% {
    transform-origin: 50% calc(var(--outerSize) / 2) calc(var(--wheelDepth) / 2);
    transform: translateZ(calc((var(--outerSize) + var(--wheelDepth)) / -2));
    -webkit-animation-timing-function: ease-in;
            animation-timing-function: ease-in;
  }
  75% {
    transform-origin: 50% calc(var(--outerSize) / 2) calc(var(--wheelDepth) / 2);
    transform: translateZ(calc((var(--outerSize) + var(--wheelDepth)) / -2)) rotateX(-90deg);
    -webkit-animation-timing-function: ease-out;
            animation-timing-function: ease-out;
  }
  100% {
    transform-origin: 50% calc(var(--outerSize) / 2) calc(var(--wheelDepth) / 2);
    transform: translateZ(calc((var(--outerSize) + var(--wheelDepth)) / -2)) rotateX(-90deg) translateZ(2em);
  }
}

.hole {

  div {
    transform: translateY(calc((var(--outerSize) + var(--wheelDepth)) / 2)) rotateY(calc(var(--d) * 30deg)) translateZ(calc(var(--outerSize) / 2));

    i {
      &:nth-child(1) {
        background-color: #fff;
        inset: calc(var(--wheelDepth) / -2) calc(tan(15deg) * (var(--outerSize) / -2) - 1px);
        background-image:
          linear-gradient(0deg, #2227, 10%, transparent),
          linear-gradient(180deg, #2227, 10%, transparent);
      }
      &:nth-child(2) {
        left: 50%; top: calc(var(--wheelDepth) / -2);
        width: 13em; height: 20em;;
        transform: translateX(-50%) rotateX(90deg);
        transform-origin: top;
        background-repeat: no-repeat;
        overflow: hidden;

        &::after {
          content: '';
          position: absolute;
          inset: 0 0 0% 0;
          background-color: #fff;
          transform-origin: top;
          background-image: radial-gradient(circle at 50% calc(var(--outerSize) / -2), #2227 calc(var(--outerSize) / 2), transparent calc(var(--outerSize) / 2 + (var(--outerSize) - var(--innerSize))));
          -webkit-animation: hole var(--duration) infinite linear;
                  animation: hole var(--duration) infinite linear;
        }
      }
    }
  }
}

@-webkit-keyframes hole {
  0% { transform: scale(1) translateY(0); }
  100% { transform: scale(0.5) translateY(calc(var(--innerSize) - var(--outerSize))); }
}

@keyframes hole {
  0% { transform: scale(1) translateY(0); }
  100% { transform: scale(0.5) translateY(calc(var(--innerSize) - var(--outerSize))); }
}