:root {
  --color-primary: dimgray;
  --rotation-speed: 1s;
}

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

html {
  min-height: 100vh;
  display: grid;
  place-items: center;
}
body {
  background: linear-gradient(to top, #222, #ddd);
}

.container {
  height: 100%;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  perspective: 800px;
  perspective-origin: 50%;
}
.image-cube {
  width: 300px;
  height: 300px;
  transform-style: preserve-3d;
  position: relative;
  transition: var(--rotation-speed);  
}
.image-cube div {
  height: 300px;
  width: 300px;
  position: absolute;
  background-size: cover;
  background-position: 50% 50%;
  border: 3px solid white;
  -webkit-box-reflect: below -3px linear-gradient(to bottom, rgba(0,0,0,0) 80%, rgba(0,0,0,0.15));
}

.front {
  background-image: url('https://www.jqueryscript.net/dummy/2.jpg');
  transform: translateZ(150px);
}
.right {
  background-image: url('https://www.jqueryscript.net/dummy/1.jpg');
  transform: rotateY(-270deg) translateX(150px);
  transform-origin: 100% 0;
}
.back {
  background-image: url('https://www.jqueryscript.net/dummy/3.jpg');
  transform: translateZ(-150px) rotateY(180deg);
}
.left {
  background-image: url('https://www.jqueryscript.net/dummy/4.jpg');
  transform: rotateY(270deg) translateX(-150px);
  transform-origin: 0 50%;
}
.btns {
  position: absolute;
  display: flex;
  justify-content: space-between;
  width: 405px;
  pointer-events: none;
}
.btns button {
  background-color: transparent;
  color: #ffffff;
  border: 3px solid #ffffff;
  background: var(--color-primary);
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  width: 40px;
  height: 40px;
  box-shadow: 0 3px 5px rgba(0,0,0,.5);
  pointer-events: all;
}
