/* Galería producto desde widget Gallery de Elementor */
.dtcom-product-gallery {
  width: 100%;
}

/* Ocultamos el grid original solo cuando la galería custom ya está creada */
.dtcom-product-gallery.is-dtcom-gallery-ready .elementor-gallery__container {
  display: none !important;
}

/* Imagen principal */
.dtcom-product-gallery .dtcom-gallery-main {
  width: 100%;
  position: relative;
  overflow: hidden;
  background: #000;
}

.dtcom-product-gallery .dtcom-gallery-main a {
  display: block;
  width: 100%;
}

.dtcom-product-gallery .dtcom-gallery-main img {
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  object-fit: cover;
  object-position: center;
  display: block;
}

/* Área inferior de miniaturas */
.dtcom-product-gallery .dtcom-gallery-thumbs-wrap {
  position: relative;
  margin-top: 15px;
  width: 100%;
}

/* Carril de miniaturas */
.dtcom-product-gallery .dtcom-gallery-thumbs {
  display: flex;
  gap: 15px;
  overflow-x: auto;
  scroll-behavior: smooth;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  padding-bottom: 2px;
}

.dtcom-product-gallery .dtcom-gallery-thumbs::-webkit-scrollbar {
  display: none;
}

/* Cada miniatura */
.dtcom-product-gallery .dtcom-gallery-thumb {
  appearance: none;
  -webkit-appearance: none;

  flex: 0 0 calc((100% - 60px) / 5);
  aspect-ratio: 4 / 3;

  padding: 0;
  margin: 0;
  border: 2px solid transparent;
  background-color: #111;

  cursor: pointer;
  position: relative;
  overflow: hidden;
  scroll-snap-align: start;

  background-size: cover !important;
  background-position: center !important;
  background-repeat: no-repeat !important;

  transition: opacity 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
  opacity: 0.55;
}

/* Miniatura activa */
.dtcom-product-gallery .dtcom-gallery-thumb.is-active {
  border-color: #ff6400;
  opacity: 1;
}

/* Hover en escritorio */
.dtcom-product-gallery .dtcom-gallery-thumb:hover {
  opacity: 1;
}

/* Focus accesible, pero integrado */
.dtcom-product-gallery .dtcom-gallery-thumb:focus {
  outline: none;
}

.dtcom-product-gallery .dtcom-gallery-thumb:focus-visible {
  outline: 2px solid #ff6400;
  outline-offset: 3px;
}

/* Ocultamos completamente los botones generados por JS */
.dtcom-product-gallery .dtcom-gallery-nav {
  display: none !important;
}

/* Tablet */
@media (max-width: 1024px) {
  .dtcom-product-gallery .dtcom-gallery-thumb {
    flex-basis: calc((100% - 30px) / 3);
  }
}

/* Móvil */
@media (max-width: 767px) {
  .dtcom-product-gallery .dtcom-gallery-main img {
    aspect-ratio: 4 / 3;
  }

  .dtcom-product-gallery .dtcom-gallery-thumbs {
    gap: 8px;
  }

  .dtcom-product-gallery .dtcom-gallery-thumb {
    flex: 0 0 82px;
  }
}