/* ========================================
   HOOPLA ROTATING CAN — SAFARI OPTIMIZED
   ======================================== */

.hoopla-cans-scene {
  position: relative;
  width: 260px;
  height: 480px;
  margin: 0 auto;
  opacity: 0;
  
  transition: opacity 0.4s ease-in-out;
  transform-style: preserve-3d;
  will-change: transform, opacity;
  -webkit-transform: translateZ(0);
  backface-visibility: hidden;
}

.hoopla-cans-scene.is-visible {
  opacity: 1;
}

.hoopla-cans-scene::after {
  content: '';
  position: absolute;
  bottom: 0px;
  width: 100%;
  left: 20px;
  height: 30px;
  background-color: rgba(0, 0, 0, 0.442);
  border-radius: 50%;
  filter: blur(20px);
  opacity: 0;
  animation: fadeInShadow 0.4s ease-out forwards;
  will-change: opacity, filter;
  transform: translateZ(0);
}

@keyframes fadeInShadow {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* --- CAN STRUCTURE --- */

.can-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 172px;
  transform-style: preserve-3d;
  backface-visibility: hidden;
  will-change: transform, filter;
  user-select: none;
  transform-origin: center center;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  perspective: 1000px;
}

.can--front {
  z-index: 2;
  left: 130px;
}
.can--back {
  z-index: 1;
  top: -2px;
  left: -12px;
}

.can-background {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
  backface-visibility: hidden;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  will-change: transform, filter;
  image-rendering: -webkit-optimize-contrast; /* Safari sharper image fix */
}

.can-mask {
  position: absolute;
  left: 0;
  right: 0;
  top: 9%;
  height: 86%;
  overflow: hidden;
  clip-path: polygon(4.34% -0.16%, 32.09% -0.38%, 52.37% -4.02%, 67.42% -3.11%, 80.29% -0.5%, 94.91% -0.29%, 95.62% 97.01%, 93.76% 97.99%, 86.96% 98.34%, 78.27% 98.77%, 50.8% 98.6%, 33.56% 98.62%, 15.49% 98.38%, 3.77% 97.85%);
  );
  pointer-events: none;
  backface-visibility: hidden;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  will-change: transform, filter;
}

.can-label {
  position: absolute;
  inset: 0;
  z-index: 1;
  backface-visibility: hidden;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  background-repeat: repeat-x;
  background-size: auto 100%;
  background-image: url('https://hoopladrinks.nl/wp-content/uploads/2025/09/hoopla-label.svg');
  transition: background-position 0.05s linear;
  will-change: transform;
  transform-style: preserve-3d;
  
}

.can-gradient {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(
    to right,
    rgb(0 0 0 / 40%) 0%,
    rgb(0 0 0 / 0%) 18%,
    rgb(0 0 0 / 6%) 82%,
    rgb(0 0 0 / 40%) 100%
  );
  will-change: opacity;
  backface-visibility: hidden;
  transform: translateZ(0);
}

/* --- FRUIT STYLING & ANIMATION --- */

.fruit-item {
  position: absolute;
  height: auto;
  transform-origin: center center;
  will-change: transform;
  backface-visibility: hidden;
  transform: translateZ(0);
}

/* Subtle floating keyframes (no change) */
@keyframes floatLychee1 {
  0%, 100% { transform: translate(-70px, 300px); }
  50% { transform: translate(-70px, 310px); }
}
@keyframes floatLychee2 {
  0%, 100% { transform: translate(125px, -72px) rotate(168deg); }
  50% { transform: translate(125px, -62px) rotate(168deg); }
}
@keyframes floatLime1 {
  0%, 100% { transform: translate(187px, 295px) rotate(15deg); }
  50% { transform: translate(187px, 305px) rotate(15deg); }
}
@keyframes floatLime2 {
  0%, 100% { transform: translate(-104px, 77px) rotate(-25deg); }
  50% { transform: translate(-104px, 87px) rotate(-25deg); }
}
@keyframes floatPassion1 {
  0%, 100% { transform: translate(-133px, -14px) rotate(25deg); }
  50% { transform: translate(-133px, -4px) rotate(25deg); }
}
@keyframes floatPassion2 {
  0%, 100% { transform: translate(252px, 29px) rotate(135deg); }
  50% { transform: translate(252px, 39px) rotate(135deg); }
}

/* Base styles for each fruit (Desktop) */
.fruit--lychee {
  width: 160px;
  z-index: 3;
  transform: translate(-70px, 300px);
  animation: floatLychee1 6s ease-in-out infinite;
  animation-delay: 0.5s;
}
.fruit--lychee-2 {
  width: 126px;
  z-index: 1;
  transform: translate(125px, -72px) rotate(168deg);
  animation: floatLychee2 5s ease-in-out infinite;
  animation-delay: 0.5s;
}
.fruit--lime {
  width: 180px;
  z-index: 3;
  transform: translate(187px, 295px) rotate(15deg);
  animation: floatLime1 5.5s ease-in-out infinite;
  animation-delay: 0.5s;
}
.fruit--lime-2 {
  width: 160px;
  z-index: 0;
  transform: translate(-104px, 77px) rotate(-25deg);
  animation: floatLime2 7s ease-in-out infinite;
  animation-delay: 0.5s;
}
.fruit--passion {
  width: 130px;
  z-index: 1;
  transform: translate(-133px, -14px) rotate(25deg);
  animation: floatPassion1 4.5s ease-in-out infinite;
  animation-delay: 0.5s;
}
.fruit--passion-2 {
  width: 200px;
  z-index: 3;
  transform: translate(252px, 29px) rotate(135deg);
  animation: floatPassion2 6.5s ease-in-out infinite;
  animation-delay: 0.5s;
}

/* --- MEDIA QUERIES --- */

@media (max-width:1200px) {
  .hoopla-cans-scene {
    transform: scale(0.9);
    height: 430px;
  }
}
@media (max-width: 767px) {
  .hoopla-cans-scene {
    width: 208px;
    height: 304px;
    top: 20px;
  }
  .can-container { width: 104px; }
  .hoopla-cans-scene::after {
    bottom: 80px;
    background-color: rgb(0 0 0 / 23%);
  }
  .can--front {
    top: 0;
    left: 98px;
  }
  .can--back {
    top: 0;
    left: 12px;
  }

  /* Mobile Fruit Layouts */
  .fruit--lychee { width: 108px; transform: translate(-36px, 160px); }
  .fruit--lychee-2 { width: 101px; transform: translate(100px, -58px) rotate(168deg); }
  .fruit--lime { width: 104px; transform: translate(145px, 146px) rotate(15deg); }
  .fruit--lime-2 { width: 108px; transform: translate(-43px, 62px) rotate(-25deg); }
  .fruit--passion { width: 94px; transform: translate(-76px, -11px) rotate(25deg); }
  .fruit--passion-2 { width: 120px; transform: translate(172px, 23px) rotate(135deg); }

  /* ✅ Override de keyframes voor mobiel, zodat ze starten vanaf de juiste posities */
  @keyframes floatLychee1 {
    0%, 100% { transform: translate(-36px, 160px); }
    50% { transform: translate(-36px, 170px); }
  }
  @keyframes floatLychee2 {
    0%, 100% { transform: translate(100px, -58px) rotate(168deg); }
    50% { transform: translate(100px, -48px) rotate(168deg); }
  }
  @keyframes floatLime1 {
    0%, 100% { transform: translate(145px, 146px) rotate(15deg); }
    50% { transform: translate(145px, 156px) rotate(15deg); }
  }
  @keyframes floatLime2 {
    0%, 100% { transform: translate(-43px, 62px) rotate(-25deg); }
    50% { transform: translate(-43px, 72px) rotate(-25deg); }
  }
  @keyframes floatPassion1 {
    0%, 100% { transform: translate(-76px, -11px) rotate(25deg); }
    50% { transform: translate(-76px, -1px) rotate(25deg); }
  }
  @keyframes floatPassion2 {
    0%, 100% { transform: translate(172px, 23px) rotate(135deg); }
    50% { transform: translate(172px, 33px) rotate(135deg); }
  }
}

/* Safari-only fallback for 3D stability */
@supports (-webkit-touch-callout: none) {
  .can-label,
  .can-background,
  .can-mask {
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
  }
}
