/* ==========================================================================
   UNIVERSAL CAROUSEL - CAROUSEL-SPECIFIC STYLES ONLY
   ========================================================================== */

/* Carousel Wrapper */

.carousel-wrapper {
  position: relative;
  overflow: visible;
  margin-bottom: 40px;
}

/* Carousel Track */

.carousel-scroll {
  --gap: 16px;
  --items-mobile: 1;
  --items-desktop: 4;
  --items: var(--items-mobile);
  display: flex;
  gap: var(--gap);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding: 2px;
  position: relative;
}

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

/* Firefox scrollbar hiding */

.carousel-scroll {
  scrollbar-width: none;
}

@media (min-width: 1024px) {
  .carousel-scroll {
    --items: var(--items-desktop);
  }
}

/* Carousel Items */

.carousel-scroll > * {
  flex: 0 0 calc((100% - (var(--gap) * (var(--items) - 1))) / var(--items));
  min-width: 0;
  scroll-snap-align: start;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  height: auto;
  border-radius: 14px;
  background: var(--color-light-grey);
  overflow: hidden;
}

/* ==========================================================================
   BUTTONS - UNIFIED STYLES
   ========================================================================== */

/* Base Button Styles */

.carousel-btn,
.carousel-wrapper button {
  inline-size: 40px;
  block-size: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #ddd;
  border-radius: 50%;
  background: #e6e9ed;
  opacity: 1;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.carousel-btn:focus-visible,
.carousel-wrapper button:focus-visible {
  outline: 2px solid #111;
  outline-offset: 2px;
}

.carousel-btn img,
.carousel-wrapper button img {
  width: 20px;
  height: 20px;
}

/* Overlay Button Positioning */

.carousel-wrapper button {
  position: absolute;
  z-index: 1001;
  top: 100px;
  transform: translateY(-50%);
}

.carousel-wrapper .carousel-btn--prev2 {
  left: -20px;
}

.carousel-wrapper .carousel-btn--next2 {
  right: -20px;
}

/* Traditional Button Layout */

.carousel-controls {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
}

/* ==========================================================================
   PROGRESS BAR
   ========================================================================== */

.carousel-progress-track {
  width: 200px;
  margin: 20px auto;
  height: 4px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 2px;
  overflow: hidden;
}

.carousel-progress-fill {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #041429, #2974b9);
  border-radius: 2px;
  transition: width 0.3s ease;
}

/* ==========================================================================
   UTILITIES
   ========================================================================== */

.is-hidden {
  visibility: hidden;
  pointer-events: none;
}

@media (max-width: 1024px) {
  .carousel-scroll > * {
    max-width: 400px;
    flex: 0 0 min(400px, calc((100% - (var(--gap) * (var(--items) - 1))) / var(--items)));
  }
}
