/* styles.css */
/* Import the font from Google Fonts */
@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk&display=swap");

/* Define some custom properties for easy customization */
:root {
  --cube-size: 150px;
  --text-size: 40px;
  --border-size: 20px;
  --gap: 1.8;
  --main-color: #dc64ff;
  --main-color-transparent: rgba(220, 100, 255, 0.4);
  --translateYLeft: 0;
  --translateYRight: 0;
  --duration: 1.7s;
}

/* Adjust the size for smaller screens */
@media (max-width: 768px) {
  :root {
    --cube-size: 100px;
    --text-size: 20px;
    --border-size: 15px;
  }
}

/* Apply the box-sizing property to all elements */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Style the body element */
body {
  position: relative;
  display: flex;
  justify-content: center;
  height: 100vh;
  padding: 100px 0 0;
  font-family: "Space Grotesk", sans-serif;
  font-optical-sizing: auto;
  font-weight: 400;
  font-style: normal;
  color: white;
  background-color: black;
  overflow: hidden;
}

/* Create a background gradient with circles */
.background {
  position: absolute;
  top: -100%;
  left: -100%;
  width: 200%;
  height: 200%;
  background: radial-gradient(
      circle at 100% 50%,
      transparent 20%,
      #00d4f0 21%,
      #00d4f0 34%,
      transparent 35%,
      transparent
    ),
    radial-gradient(
        circle at 0% 50%,
        transparent 20%,
        #00d4f0 21%,
        #00d4f0 34%,
        transparent 35%,
        transparent
      )
      0 -50px;
  background-size: 16px 20px;
  opacity: 0.07;
  animation: movingGradient 35s linear infinite;
}

/* Center the wrapper element */
.wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: auto;
}

/* Style the text element */
.text {
  margin: 80px 0 0;
  font-size: var(--text-size);
  text-transform: uppercase;
  letter-spacing: 0.2em;
}

/* Enable 3D transformations for the cube element */
.cube {
  position: relative;
  z-index: 2;
  transform-style: preserve-3d;
  transform: rotateX(20deg) rotateY(-135deg);
  animation: cubeRotation var(--duration) cubic-bezier(0, 0.5, 0.7, 1) infinite;
}

/* Set the size of the cube and its faces */
.cube,
.bottom,
.side {
  width: var(--cube-size);
  height: var(--cube-size);
}

/* Position the faces absolutely */
.bottom,
.side {
  position: absolute;
}

/* Style the bottom face */
.bottom {
  background-color: var(--main-color);
  border-radius: 5px;
  box-shadow: 0 0 200px 0 var(--main-color-transparent);
  transform: translateY(calc(var(--cube-size) / var(--gap))) rotateX(-90deg);
}

/* Add a flex container for the side faces */
.side {
  display: flex;
}

/* Style the side faces with pseudo-elements */
.side::after {
  content: "";
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.1);
  border: var(--border-size) solid var(--main-color);
  border-radius: 5px;
  box-shadow: 0 0 200px 0 var(--main-color-transparent);
}

/* Position and rotate the back face */
.back {
  transform: translateZ(calc(var(--cube-size) / var(--gap) * -1))
    rotateY(180deg);
}

/* Animate the back face with keyframes */
.back::after {
  animation: cubeSideOut var(--duration) cubic-bezier(0.5, 1, 0.5, 1) infinite
    both;
}

/* Position and rotate the left face */
.left {
  transform: translateX(calc(var(--cube-size) / var(--gap) * -1))
    rotateY(-90deg);
  display: none;
}

/* Position and rotate the right face */
.right {
  transform: translateX(calc(var(--cube-size) / var(--gap))) rotateY(90deg);
}

/* Animate the right face with keyframes */
.right::after {
  animation: cubeSideIn var(--duration) cubic-bezier(0.5, 1, 0.5, 1) infinite
    both;
}

/* Position and rotate the front face */
.front {
  transform: translateZ(calc(var(--cube-size) / var(--gap)));
  display: none;
}

/* Define the keyframes for the cube rotation */
@keyframes cubeRotation {
  0%,
  80% {
    transform: rotateX(20deg) rotateY(-135deg);
  }

  100% {
    transform: rotateX(20deg) rotateY(-45deg);
  }
}

/* Define the keyframes for the side face in animation */
@keyframes cubeSideIn {
  0% {
    transform: translateY(-100%);
    opacity: 0;
  }

  25%,
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Define the keyframes for the side face out animation */
@keyframes cubeSideOut {
  0%,
  60% {
    transform: translateY(0);
    opacity: 1;
  }

  100% {
    transform: translateY(-100%);
    opacity: 0;
  }
}

/* Define the keyframes for the background gradient animation */
@keyframes movingGradient {
  0% {
    transform: translateX(0);
  }

  100% {
    transform: translate(50%, 50%);
  }
}
