/* ═══════════════════════════════════════════════════════════
   artwork-carousel.css — Instagram-style image carousel
   
   Approach: CSS scroll-snap for native swipe on mobile,
   arrows + dots for desktop navigation.
   ═══════════════════════════════════════════════════════════ */

.carousel {
  position: relative;
  overflow: hidden;
  border-radius: inherit;
  /* Prevent any text selection while swiping */
  -webkit-user-select: none;
  user-select: none;
}

/* ── Track (scroll-snap container) ────────────────────── */

.carousel__track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;

  /* Hide scrollbar across browsers */
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
}
.carousel__track::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

/* ── Slide ────────────────────────────────────────────── */

.carousel__slide {
  flex: 0 0 100%;
  scroll-snap-align: start;
  min-width: 100%;
}

.carousel__img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
}

/* ── Arrows ───────────────────────────────────────────── */

.carousel__arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;

  display: flex;
  align-items: center;
  justify-content: center;

  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  color: #1a1a1a;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  cursor: pointer;

  /* Hidden by default on desktop, shown on hover */
  opacity: 0;
  transition:
    opacity 0.2s ease,
    background 0.15s ease,
    transform 0.15s ease;
}

.carousel__arrow--prev {
  left: 12px;
}
.carousel__arrow--next {
  right: 12px;
}

.carousel__arrow:hover {
  background: #fff;
  transform: translateY(-50%) scale(1.05);
}

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

.carousel__arrow:disabled {
  opacity: 0 !important;
  pointer-events: none;
}

/* Show arrows on carousel hover (desktop) */
.carousel:hover .carousel__arrow:not(:disabled) {
  opacity: 1;
}

/* Always show arrows on mobile — there's no hover */
@media (hover: none) and (pointer: coarse) {
  .carousel__arrow:not(:disabled) {
    opacity: 0.85;
    width: 32px;
    height: 32px;
  }
  .carousel__arrow--prev {
    left: 8px;
  }
  .carousel__arrow--next {
    right: 8px;
  }
}

/* ── Dots ─────────────────────────────────────────────── */

.carousel__dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 12px 0 8px;
}

.carousel__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: none;
  padding: 0;
  cursor: pointer;
  background: var(--color-border, #d1d5db);
  transition:
    background 0.2s ease,
    transform 0.2s ease;
}

.carousel__dot--active {
  background: var(--color-primary, #3b82f6);
  transform: scale(1.25);
}

.carousel__dot:focus-visible {
  outline: 2px solid var(--color-primary, #3b82f6);
  outline-offset: 2px;
}

/* ── Counter badge (top-right) ────────────────────────── */

.carousel__counter {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;

  padding: 4px 10px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1;
  pointer-events: none;
}

/* ── Dark theme overrides ─────────────────────────────── */

[data-theme="dark"] .carousel__arrow {
  background: rgba(38, 38, 38, 0.9);
  color: #e5e5e5;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .carousel__arrow:hover {
  background: #333;
}

[data-theme="dark"] .carousel__counter {
  background: rgba(0, 0, 0, 0.75);
}

/* ── Transition for slide focus (keyboard navigation) ── */

.carousel__slide:focus-within {
  outline: 2px solid var(--color-primary, #3b82f6);
  outline-offset: -2px;
}

/* ── Accessibility: respect reduced motion ─────────────── */

@media (prefers-reduced-motion: reduce) {
  .carousel__track {
    scroll-behavior: auto;
  }
  .carousel__arrow,
  .carousel__dot {
    transition: none;
  }
}
