.cube-container {
  width: 360px;  /* 300px + 20% */
  height: 360px; /* 300px + 20% */
  perspective: 1200px;  /* Aumentato per adattarsi al nuovo cubo più grande */
  margin: 0 auto;
  position: relative;
}

.cube {
  width: 100%;
  height: 100%;
  position: absolute;
  transform-style: preserve-3d;
  transform: rotateX(0deg) rotateY(0deg);
  animation: customRotate 8s infinite ease-in-out;
}

.cube-face {
  position: absolute;
  width: 100%;
  height: 100%;
  background: #fff;
  border: 2px solid #ccc;
  box-sizing: border-box;
}

.cube-face img {
  width: 100%;
  height: 100%;
}

.front  { transform: translateZ(180px); }  /* 150px + 20% */
.back   { transform: rotateY(180deg) translateZ(180px); }
.right  { transform: rotateY(90deg) translateZ(180px); }
.left   { transform: rotateY(-90deg) translateZ(180px); }
.top    { transform: rotateX(90deg) translateZ(180px); }
.bottom { transform: rotateX(-90deg) translateZ(180px); }

@keyframes customRotate {
  0%, 16% {
    transform: rotateX(0deg) rotateY(0deg);
  }
  32% {
    transform: rotateX(0deg) rotateY(90deg);
  }
  48% {
    transform: rotateX(0deg) rotateY(180deg);
  }
  64% {
    transform: rotateX(0deg) rotateY(270deg);
  }
  80% {
    transform: rotateX(30deg) rotateY(360deg);
  }
  100% {
    transform: rotateX(90deg) rotateY(360deg);
  }
}




/* Ombra dinamica più ampia e più in basso sotto il cubo */
.cube-container:after {
  content: '';
  position: absolute;
  width: 434px;  /* 334px + 100px */
  height: 47px;  /* Altezza mantenuta */
  background: rgba(0, 0, 0, 0.3);
  border-radius: 50%;
  bottom: -130px; /* Ombra abbassata ulteriormente */
  left: 50%;
  transform: translateX(-50%);
  filter: blur(10px);
  animation: shadowMove 8s infinite ease-in-out;
}

@keyframes shadowMove {
  0%, 16%, 48%, 100% {
    transform: translateX(-50%) scale(1) translateY(0);
  }
  32%, 64%, 80% {
    transform: translateX(-50%) scale(0.8) translateY(10px);
  }
}

.cube-container:hover .cube {
  animation-play-state: paused;
  cursor: grab;
}

.cube-container:active .cube {
  cursor: grabbing;
}


/* Media Query per ridimensionare il cubo su dispositivi mobili */
@media (max-width: 600px) {
  .cube-container {
    width: 240px;  /* 200px + 20% */
    height: 240px;
  }

  .cube {
    width: 240px;
    height: 240px;
  }

  .front  { transform: translateZ(120px); }
  .back   { transform: rotateY(180deg) translateZ(120px); }
  .right  { transform: rotateY(90deg) translateZ(120px); }
  .left   { transform: rotateY(-90deg) translateZ(120px); }
  .top    { transform: rotateX(90deg) translateZ(120px); }
  .bottom { transform: rotateX(-90deg) translateZ(120px); }

  .cube-container:after {
    width: 281px;  /* 234px + 20% */
    height: 33px;  /* Altezza mantenuta */
    bottom: -84px;
  }
}

@media (max-width: 400px) {
  .cube-container {
    width: 180px;  /* 150px + 20% */
    height: 180px;
  }

  .cube {
    width: 180px;
    height: 180px;
  }

  .front  { transform: translateZ(90px); }
  .back   { transform: rotateY(180deg) translateZ(90px); }
  .right  { transform: rotateY(90deg) translateZ(90px); }
  .left   { transform: rotateY(-90deg) translateZ(90px); }
  .top    { transform: rotateX(90deg) translateZ(90px); }
  .bottom { transform: rotateX(-90deg) translateZ(90px); }

  .cube-container:after {
    width: 260px;  /* 217px + 20% */
    height: 23px;  /* Altezza mantenuta */
    bottom: -72px;
  }
}