.carousel-section {
  /* padding: 100px 0; */
  min-height: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  /* background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 50%, #16213e 100%); */
  /* background: var(--muted-foreground); */
}

.container-carousel {
  max-width: 100%;
  margin: 1.5rem auto;
  padding: 0 20px;
  text-align: center;
  width: 90%;
  height: 100%;
}

.section-title {
  font-size: 3rem;
  font-weight: 700;
  margin-bottom: 1rem;
  background: linear-gradient(45deg, #fff, #a8c0ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.section-description {
  font-size: 1.2rem;
  color: #ccc;
  margin-bottom: 4rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.carousel-3d {
  position: relative;
  width: 100%;
  height: 100%;
  perspective: 1700px;
  margin: 0 auto;
}

#carousel3d {
  width: 100%;
  height: 900px;
  border-radius: 0.5rem;
  overflow: visible;
  box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.15);
}

.carousel-container {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transform-origin: 50% 50%;
  transition: transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  will-change: transform;

  transition: transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* make sure preserve-3d is enabled (you already have it) */
.carousel-3d {
  perspective: 1700px;
}

/* carousel container will be rotated by JS (rotateX + rotateY) */
/* ensure transform-origin is at center so tilt looks natural */
.carousel-container {
  transform-style: preserve-3d;
  transform-origin: 50% 50%;
  transition: transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  will-change: transform;
}

/* make sure non-active items still keep their translateZ (we set transforms from JS) */
.carousel-item {
  transition: transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  will-change: transform;
}

.carousel-item {
  position: absolute;
  width: 300px;
  height: 400px;
  top: 50%;
  left: 50%;
  transform-origin: center center;
  transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.1);
  cursor: pointer;
}

.carousel-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.carousel-item:hover img {
  transform: scale(1.05);
}

.carousel-item::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    45deg,
    rgba(255, 255, 255, 0.1) 0%,
    transparent 50%,
    rgba(0, 0, 0, 0.3) 100%
  );
  pointer-events: none;
}

.carousel-item.active {
  transform: translate(-50%, -50%) translateZ(200px) scale(1.1);
  z-index: 10;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(168, 192, 255, 0.3),
    0 0 30px rgba(168, 192, 255, 0.2);
}

.carousel-controls {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  transform: translateY(-50%);
  display: flex;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 20;
}

.control-btn {
  background: var(--muted-foreground);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.control-btn:hover {
  background: var(--foreground);
  transform: scale(1.1);
  box-shadow: 0 10px 30px rgba(168, 192, 255, 0.3);
}

.control-btn:active {
  transform: scale(0.95);
}

/* Indicators – more visible */
.carousel-indicators {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 12px;
  z-index: 40;
  align-items: center;
  justify-content: center;
  padding: 6px 8px;
  border-radius: 40px;
  background: rgba(0, 0, 0, 0.25);
}
.indicator {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  cursor: pointer;
  transition: all 0.2s ease;
  border: 2px solid rgba(255, 255, 255, 0.06);
}
.indicator.active {
  background: #a8c0ff;
  transform: scale(1.25);
  box-shadow: 0 6px 18px rgba(168, 192, 255, 0.35);
}

/* 3D positioning for carousel items */
.carousel-item:nth-child(1) {
  transform: translate(-50%, -50%) rotateY(0deg) translateZ(400px);
}
.carousel-item:nth-child(2) {
  transform: translate(-50%, -50%) rotateY(45deg) translateZ(400px);
}
.carousel-item:nth-child(3) {
  transform: translate(-50%, -50%) rotateY(90deg) translateZ(400px);
}
.carousel-item:nth-child(4) {
  transform: translate(-50%, -50%) rotateY(135deg) translateZ(400px);
}
.carousel-item:nth-child(5) {
  transform: translate(-50%, -50%) rotateY(180deg) translateZ(400px);
}
.carousel-item:nth-child(6) {
  transform: translate(-50%, -50%) rotateY(225deg) translateZ(400px);
}
.carousel-item:nth-child(7) {
  transform: translate(-50%, -50%) rotateY(270deg) translateZ(400px);
}
.carousel-item:nth-child(8) {
  transform: translate(-50%, -50%) rotateY(315deg) translateZ(400px);
}

/* Responsive: switch to simple slider on small screens */
@media (max-width: 768px) {
  #carousel3d {
    height: 520px;
    overflow: hidden;
    border-radius: 12px;
  }
  .carousel-container {
    transform: none !important;
    transition: transform 0.45s ease;
    height: 100%;
  }
  .carousel-item {
    width: 100%;
    max-width: 100%;
    height: 100%;
    left: 50%;
    top: 50%;
    /* We will set translateX via JS on mobile; these defaults keep center */
    transform: translate(-50%, -50%);
    position: absolute;
    margin: 0;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
  }
  .carousel-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
  .carousel-item.active {
    transform: translate(-50%, -50%) scale(1) !important;
    z-index: 25;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  }

  /* Make controls overlay the sides more obviously */
  .carousel-controls {
    padding: 0 10px;
  }
  .control-btn {
    width: 52px;
    height: 52px;
  }

  /* Bigger, clearer indicators */
  .carousel-indicators {
    bottom: 12px;
    gap: 10px;
    padding: 6px 10px;
  }
  .indicator {
    width: 12px;
    height: 12px;
  }
}

/* Small phones */
@media (max-width: 480px) {
  #carousel3d {
    height: 420px;
  }
  .control-btn {
    width: 48px;
    height: 48px;
  }
  .section-title {
    font-size: 2rem;
  }
}
