/**
 * Galleria Prima e dopo – card (foto 1080×1350 + Prenota consulenza)
 * Scroll orizzontale quando i casi sono più di tre.
 *
 * @package Martina
 */

.w-ba-gallery {
  width: 100%;
  overflow: hidden;
}

/* Galleria a scroll orizzontale: si vede 1 card (mobile), 2 (tablet), 3 (desktop) e si scorre per le altre */
.w-ba-gallery__list {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  padding-bottom: 8px;
}

.w-ba-gallery__list::-webkit-scrollbar {
  height: 8px;
}

.w-ba-gallery__list::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.06);
  border-radius: 4px;
}

.w-ba-gallery__list::-webkit-scrollbar-thumb {
  background: rgba(var(--color-primary-rgb), 0.4);
  border-radius: 4px;
}

.w-ba-gallery__card {
  flex: 0 0 auto;
  width: calc(100% - 24px);
  max-width: 320px;
  scroll-snap-align: start;
  border-radius: 18px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
}

@media (min-width: 600px) {
  .w-ba-gallery__card {
    width: calc(50% - 14px);
    max-width: 340px;
  }
}

@media (min-width: 900px) {
  .w-ba-gallery__card {
    width: calc(33.333% - 18px);
    max-width: 360px;
  }
}

/* Foto in rapporto 1080×1350 (4:5), visibile intera */
.w-ba-gallery__media {
  aspect-ratio: 1080 / 1350;
  background: var(--color-gray-100);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.w-ba-gallery__image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.w-ba-gallery__body {
  padding: 16px 20px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  flex: 0 0 auto;
}

.w-ba-gallery__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1rem;
  border-radius: 999px;
  font-weight: 700;
  color: var(--color-text-primary);
  background: rgba(var(--color-primary-rgb), 0.6);
  border: 1px solid var(--color-border);
  transition: transform 220ms ease, background-color 220ms ease;
  text-decoration: none;
}

.w-ba-gallery__cta:hover {
  background: rgba(var(--color-primary-rgb), 0.85);
  transform: translateY(-1px);
  color: var(--color-text-primary);
}

@media (prefers-reduced-motion: reduce) {
  .w-ba-gallery__cta {
    transition: none;
  }
  .w-ba-gallery__cta:hover {
    transform: none;
  }
}
