/* Carousel base class */
.carousel {
  margin-bottom: 2rem;
}

/* Smooth transitions for all devices */
.carousel-inner {
  overflow: hidden;
  border-radius: 0;
}

.carousel-item {
  transition: transform 0.5s ease-in-out;
  backface-visibility: hidden;
  transform: translateZ(0);
}

/* Optimized transitions for mobile devices */
@media (max-width: 768px) {
  .carousel-item {
    transition: transform 0.3s ease-out;
    will-change: transform;
  }
  
  /* Completely disable bootstrap touch handling */
  .carousel-inner {
    touch-action: pan-y pinch-zoom;
  }
  
  /* Force hardware acceleration for smoother transitions */
  .carousel-item.active {
    transform: translate3d(0, 0, 0);
  }
  
  /* Prevent any visual glitches during transitions */
  .carousel-item-next,
  .carousel-item-prev {
    transform: translate3d(100%, 0, 0) !important;
  }
  
  .carousel-item-prev {
    transform: translate3d(-100%, 0, 0) !important;
  }
  
  /* Ensure clean state after transitions */
  .carousel-item.active.carousel-item-start,
  .carousel-item.active.carousel-item-end {
    transform: translate3d(0, 0, 0) !important;
  }
}

/* Dark overlay for better text readability */
.carousel-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.3);
  z-index: 1;
}

/* Since positioning the image, we need to help out the caption */
.carousel-caption {
  bottom: 3rem;
  z-index: 10;
}

/* Text shadow for better readability */
.carousel-caption h1 {
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
}

.carousel-caption p {
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.6);
}

/* Declare heights because of positioning of img element */
.carousel-item {
  height: 32rem;
  position: relative;
}

.carousel-item > img {
  position: absolute;
  top: 0;
  left: 0;
  min-width: 100%;
  height: 32rem;
  object-fit: cover;
}