/* Carousel Main Wrapper */
.carousel-wrapper {
  max-width: var(--max-width);
  margin: 1rem auto;
  padding: 10rem 1.5rem auto;
}

.carousel {
  position: relative;
  border-radius: 1rem;
  overflow: hidden;
  background: transparent;
}

/* Screen Reader Only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Viewport & Slides */
.carousel-viewport {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; /* Hide scrollbar for clean look */
  gap: 1.5rem;
  padding: 1rem 0.5rem 4rem; /* Bottom padding for dots and top for shadows */
}

.carousel-viewport::-webkit-scrollbar {
  display: none;
}

.carousel-slide {
  flex: 0 0 100%;
  scroll-snap-align: center;
  position: relative;
  background: rgba(15, 23, 42, 0.4); /* Dark glass for deep ocean theme */
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 1rem;
  overflow: hidden;
  box-shadow:
    0 15px 25px -5px rgba(0, 0, 0, 0.3),
    0 8px 10px -6px rgba(0, 0, 0, 0.2);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
}

/* Tablet: 2 items */
@media (min-width: 640px) {
  .carousel-slide {
    flex: 0 0 calc((100% - 1.5rem) / 2);
    scroll-snap-align: start;
  }
}

/* Desktop: 3 items */
@media (min-width: 1024px) {
  .carousel-slide {
    flex: 0 0 calc((100% - 3rem) / 3);
    scroll-snap-align: start;
  }
}

.carousel-slide img {
  width: 100%;
  height: 200px; /* Fixed height for consistent card size */
  object-fit: cover;
  display: block;
}

/* Captions moved below image */
.slide-caption {
  padding: 1.5rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  background: transparent;
  color: white;
  opacity: 1;
  transform: none;
}

.slide-caption h3 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
  color: white;
}

.slide-caption p {
  color: #94a3b8; /* Slate gray text */
  font-size: 0.95rem;
  line-height: 1.5;
}

/* Navigation Buttons */
.carousel-controls {
  position: absolute;
  top: calc(50% - 2rem); /* Adjusted for captions below images */
  left: 0;
  right: 0;
  transform: translateY(-50%);
  display: flex;
  justify-content: space-between;
  padding: 0 0.5rem;
  pointer-events: none;
  z-index: 10;
}

.carousel-btn {
  pointer-events: auto;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: white;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

.carousel-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
  color: var(--primary-color);
}

.carousel-btn svg {
  width: 1.5rem;
  height: 1.5rem;
}

.carousel-btn:focus-visible {
  outline: 3px solid var(--primary-color);
  outline-offset: 4px;
}

/* Pagination & Autoplay Wrapper */
.carousel-pagination-wrapper {
  position: absolute;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.5rem 1.25rem;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 99rem;
  z-index: 10;
}

.carousel-pagination {
  position: static;
  transform: none;
  display: flex;
  gap: 0.75rem;
}

.pagination-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  border: none;
  padding: 0;
  cursor: pointer;
  transition: var(--transition);
}

.pagination-dot.active {
  background: var(--primary-color);
  width: 20px; /* Pill shape for active dot */
  border-radius: 4px;
}

.autoplay-toggle {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem;
  transition: var(--transition);
  border-left: 1px solid rgba(255, 255, 255, 0.2);
  padding-left: 1rem;
}

.autoplay-toggle:hover {
  color: var(--primary-color);
  transform: scale(1.1);
}

.autoplay-toggle:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 4px;
  border-radius: 4px;
}

/* Scale effect for focused slide */
.carousel-slide:hover {
  transform: translateY(-5px);
  box-shadow: 0 30px 40px -15px rgba(0, 0, 0, 0.5);
  border-color: rgba(255, 255, 255, 0.15);
}

/* Reduce Motion */
@media (prefers-reduced-motion: reduce) {
  .carousel-viewport {
    scroll-behavior: auto;
  }
}
