/* Carrusel automático para galerías de imágenes.
   Mantiene las tarjetas existentes y solo cambia la forma de desplazarlas. */

.image-carousel {
  --carousel-gap: 18px;
  display: flex;
  align-items: stretch;
  gap: var(--carousel-gap);
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  scroll-snap-type: x mandatory;
  touch-action: pan-y;
  cursor: grab;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.image-carousel:active {
  cursor: grabbing;
}

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

.image-carousel > * {
  flex: 0 0 calc((100% - var(--carousel-gap) - var(--carousel-gap)) / 3);
  max-width: calc((100% - var(--carousel-gap) - var(--carousel-gap)) / 3);
  scroll-snap-align: start;
  cursor: zoom-in;
}

.image-carousel > .carousel-clone {
  pointer-events: auto;
}

.image-carousel.carousel-resetting {
  scroll-behavior: auto;
}

.image-carousel-controls {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin: -4px 0 16px;
}

.image-carousel-btn {
  width: 46px;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,253,248,.9);
  color: var(--earth);
  box-shadow: 0 14px 34px rgba(62,49,36,.12);
  display: inline-grid;
  place-items: center;
  font-size: 1.55rem;
  line-height: 1;
  cursor: pointer;
  transition: .22s ease;
}

.image-carousel-btn:hover,
.image-carousel-btn:focus-visible {
  background: var(--earth);
  color: white;
  transform: translateY(-2px);
  outline: none;
}

.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background:
    radial-gradient(circle at 10% 10%, rgba(216, 59, 183, .18), transparent 28%),
    rgba(20, 14, 9, .94);
}

.image-lightbox.active {
  display: flex;
}

.image-lightbox-panel {
  width: min(1120px, 100%);
  max-height: calc(100vh - 36px);
  /* dvh = alto real del celular con la barra del navegador visible */
  max-height: calc(100dvh - 36px);
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(280px, .62fr);
  overflow: hidden;
  border: 1px solid rgba(255,253,248,.28);
  border-radius: 34px;
  background: var(--paper);
  box-shadow: 0 28px 90px rgba(0,0,0,.42);
}

.image-lightbox-media {
  min-height: 68vh;
  display: grid;
  place-items: center;
  padding: 18px;
  background: var(--earth);
}

.image-lightbox-media img {
  width: 100%;
  height: 100%;
  max-height: calc(100vh - 88px);
  object-fit: contain;
  border-radius: 24px;
  background: var(--cream);
}

.image-lightbox-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
  padding: 34px;
  color: var(--earth);
  overflow-y: auto;
}

.image-lightbox-copy small {
  color: var(--olive);
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
  font-size: .72rem;
}

.image-lightbox-copy h3 {
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(2.4rem, 5vw, 4.8rem);
  line-height: .9;
  letter-spacing: -.05em;
}

.image-lightbox-copy p {
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.65;
}

.image-lightbox-close {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 10001;
  width: 52px;
  height: 52px;
  border: 1px solid rgba(255,253,248,.36);
  border-radius: 999px;
  background: rgba(255,253,248,.94);
  color: var(--earth);
  box-shadow: 0 18px 40px rgba(0,0,0,.28);
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
}

.image-lightbox-close:hover,
.image-lightbox-close:focus-visible {
  background: var(--earth);
  color: white;
  outline: none;
}

body.image-open {
  overflow: hidden;
}

@media (max-width: 700px) {
  .image-carousel {
    --carousel-gap: 12px;
  }

  .image-carousel > * {
    flex: 0 0 calc((100% - var(--carousel-gap)) / 2);
    max-width: calc((100% - var(--carousel-gap)) / 2);
  }

  .image-carousel-controls {
    justify-content: center;
    margin: 4px 0 14px;
  }

  .image-carousel-btn {
    width: 42px;
    height: 42px;
    font-size: 1.35rem;
  }

  .image-lightbox {
    padding: 10px;
  }

  .image-lightbox-panel {
    max-height: calc(100vh - 20px);
    max-height: calc(100dvh - 20px);
    grid-template-columns: 1fr;
    border-radius: 28px;
  }

  .image-lightbox-media {
    min-height: 58vh;
    padding: 12px;
  }

  .image-lightbox-media img {
    max-height: 58vh;
    border-radius: 20px;
  }

  .image-lightbox-copy {
    max-height: 34vh;
    padding: 18px;
    gap: 8px;
  }

  .image-lightbox-copy h3 {
    font-size: clamp(2rem, 10vw, 3.2rem);
  }

  .image-lightbox-copy p {
    font-size: .96rem;
    line-height: 1.5;
  }

  .image-lightbox-close {
    top: 12px;
    right: 12px;
    width: 48px;
    height: 48px;
    font-size: 1.8rem;
  }

  .image-carousel .product-side-card,
  .image-carousel .gallery-card {
    min-height: 360px;
    border-radius: 28px;
  }

  .image-carousel .poster-card {
    border-radius: 26px;
  }

  .image-carousel .poster-card img {
    height: 245px;
  }

  .image-carousel .product-copy,
  .image-carousel .gallery-copy {
    left: 14px;
    right: 14px;
    bottom: 14px;
  }

  .image-carousel .product-copy small,
  .image-carousel .gallery-copy small,
  .image-carousel .poster-copy small {
    font-size: .62rem;
    letter-spacing: .12em;
    margin-bottom: 6px;
  }

  .image-carousel .product-copy h3,
  .image-carousel .gallery-copy h3 {
    font-size: clamp(1.25rem, 5vw, 1.7rem);
    line-height: 1;
    margin-bottom: 6px;
  }

  .image-carousel .product-copy p,
  .image-carousel .gallery-copy p {
    display: -webkit-box;
    overflow: hidden;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    font-size: .78rem;
    line-height: 1.28;
  }

  .image-carousel .poster-copy {
    padding: 14px;
  }

  .image-carousel .poster-copy strong {
    font-size: 1.08rem;
    line-height: 1;
  }

  .image-carousel .poster-copy span {
    font-size: .82rem;
    line-height: 1.32;
  }
}

@media (max-width: 420px) {
  .image-carousel {
    --carousel-gap: 10px;
  }

  .image-carousel .product-side-card,
  .image-carousel .gallery-card {
    min-height: 330px;
    border-radius: 24px;
  }

  .image-carousel .poster-card img {
    height: 210px;
  }

  .image-carousel .poster-copy span {
    font-size: .76rem;
  }
}
