/* Photo Carousel Styles */
.photo-carousel-container {
  width: 100%;
  max-width: 1000px;
  margin: 2rem auto;
  padding-bottom: 2rem;
  position: relative;
  will-change: transform; /* Hint to browser about upcoming changes */
}

.photo-carousel {
  position: relative;
  overflow: hidden;
  margin-bottom: 1rem;
  -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

.carousel-inner {
  display: flex;
  transition: none; /* Start with no transition */
  transform: translate3d(0, 0, 0); /* Use hardware acceleration */
  backface-visibility: hidden; /* Prevent flickering */
  perspective: 1000px; /* 3D acceleration */
}

/* Add transition only when animating */
.carousel-inner.animating {
  transition: transform 0.3s cubic-bezier(0.25, 0.1, 0.25, 1); /* Smoother easing */
}

.carousel-item {
  flex: 0 0 calc(33.333% - 10px);
  margin: 0 5px;
  height: 250px;
  transform: translateZ(0); /* Force GPU rendering */
  backface-visibility: hidden; /* Prevent flickering */
  box-sizing: border-box; /* Ensure padding and borders are included in width calculation */
}

.carousel-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transform: translateZ(0); /* Force GPU rendering */
  backface-visibility: hidden; /* Prevent flickering */
  /* Add a subtle fade-in effect for lazy-loaded images */
  opacity: 1;
  transition: opacity 0.3s ease;
}

/* Style for placeholder images */
.carousel-item img[data-src] {
  opacity: 0.1;
}

.carousel-control {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  background: rgba(0, 0, 0, 0.5);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: background 0.2s, transform 0.2s;
  /* Improve button appearance */
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  -webkit-tap-highlight-color: transparent; /* Remove tap highlight on mobile */
}

.carousel-control:hover {
  background: rgba(0, 0, 0, 0.8);
  transform: translateY(-50%) scale(1.05);
}

.carousel-control:active {
  transform: translateY(-50%) scale(0.95);
}

.carousel-control:disabled {
  cursor: default;
  opacity: 0.5;
}

.carousel-control.prev {
  left: 10px;
}

.carousel-control.next {
  right: 10px;
}

.carousel-caption {
  text-align: left;
  margin-top: 10px;
  color: #666;
  font-size: 15px;
}

/* Responsive styles */
@media (max-width: 768px) {
  .carousel-item {
    flex: 0 0 calc(50% - 10px); /* Show 2 images on tablets */
  }

  .carousel-control {
    width: 36px;
    height: 36px;
    font-size: 18px;
  }
}

@media (max-width: 480px) {
  .carousel-item {
    flex: 0 0 calc(100% - 10px); /* Show 1 image on mobile */
  }

  .carousel-control {
    width: 32px;
    height: 32px;
    font-size: 16px;
  }
}
