/* Gallery Section */
.gallery-section {
  margin-top: 8rem;
  margin-bottom: 6rem;
}

.gallery-section h2 {
  text-align: center;
  margin-bottom: 4rem;
}

.carousel-container {
  position: relative;
  width: 100%;
}

.carousel-track {
  display: flex;
  gap: 2rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  padding: 1rem 0 2rem 0; /* Add top padding for shadow visibility if needed */
  -ms-overflow-style: none; /* IE and Edge */
  scrollbar-width: none; /* Firefox */
  cursor: grab;
}

.carousel-track:active {
  cursor: grabbing;
  scroll-behavior: auto; /* Allow direct manipulation without smooth scroll fighting */
}

/* Hide scrollbar for Chrome, Safari and Opera */
.carousel-track::-webkit-scrollbar {
  display: none;
}

.carousel-slide {
  flex: 0 0 auto; /* Allow width to be determined by content (image) */
  width: auto;
  scroll-snap-align: center; /* Center the active slide */
  border-radius: 20px;
  overflow: hidden;
  height: 40rem; /* Fixed height for consistency */
  position: relative;
  /* box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05); */
  border: 1px solid #cacaca;
}

.carousel-slide img {
  width: auto; /* Let width scale naturally */
  height: 100%; /* Fill the fixed height */
  object-fit: contain; /* Ensure full image is visible if distinct aspect ratio is forced, but with width:auto and height:100% on image + block container, it should be fine.  */
  max-width: none; /* Override any global max-width */
  transition: transform 0.3s ease;
}

.carousel-slide:hover img {
  transform: scale(1.03);
}

.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.9);
  border: none;
  width: 5rem;
  height: 5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: all 0.2s ease;
  font-size: 1.8rem;
  color: #222;
}

.carousel-btn:hover {
  background: #fba009;
  color: #222;
  transform: translateY(-50%) scale(1.1);
}

.carousel-btn.prev {
  left: -2rem;
}

.carousel-btn.next {
  right: -2rem;
}

/* Desktop adjustments */
@media screen and (min-width: 768px) {
  .carousel-slide {
    height: 40rem; /* Consistent height on desktop */
  }
}

@media screen and (min-width: 1100px) {
  .carousel-slide {
    height: 50rem; /* Taller on large screens to show detail */
  }
}

/* specific mobile adjustments */
@media screen and (max-width: 600px) {
  .gallery-section {
    margin-top: 6rem;
    margin-bottom: 4rem;
  }

  /* Full width on mobile */
  .gallery-section .element-wrap {
    margin-left: 0;
    margin-right: 0;
    width: 100%;
  }

  .gallery-section h2 {
    margin-bottom: 2rem;
    padding: 0 2rem; /* Keep padding for title */
  }

  .carousel-track {
    padding-left: 2rem; /* Initial offset so image isn't glued to screen edge on load */
    padding-right: 2rem;
  }

  .carousel-slide {
    flex: 0 0 auto;
    width: auto;
    height: 50vh; /* Max height relative to screen, or fixed */
    max-height: 45rem;
    border-radius: 15px;
  }

  .carousel-btn {
    display: none; /* Keep buttons hidden on mobile, rely on swipe */
  }

  .carousel-btn.prev {
    left: 1rem;
  }

  .carousel-btn.next {
    right: 1rem;
  }
}
