/* ==========================================================================
   BREAKPOINTS MODERNOS (Mobile-First / Responsive)
   ========================================================================== */
.more-photos-overlay {
  display: flex;
  position: absolute;
  justify-content: center;
  align-items: center;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  pointer-events: none;
  color: white;
  font-weight: 600;
  font-size: 13px;
}

/* Contenedor Principal */
.ubihome-bento-gallery {
  display: grid;
  grid-template-columns: 2fr 1fr;
  /* Relación de tamaño entre principal y secundarias */
  gap: 12px;
  margin-bottom: 0px;
  height: 70dvh;
}

/* Items de Galería */
.gallery-main-item,
.side-item {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
}

.ubihome-bento-gallery a {
  display: block;
  width: 100%;
  height: 100%;
}

.ubihome-bento-gallery img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Mantiene el grid ordenado aunque la foto sea un cintillo */
  object-position: center;
  /* Se enfoca en el centro de la foto */
}

/* Efectos Hover */
.ubihome-bento-gallery a:hover img {
  transform: scale(1.05);
  filter: brightness(0.85);
}

/* Columna Derecha (4 fotos pequeñas) */
.gallery-side-items {
  display: grid;
  grid-template-rows: 1fr 1fr;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Badge de Zoom en la principal */
.zoom-badge {
  display: flex;
  position: absolute;
  top: auto;
  right: 20px;
  bottom: 2rem;
  justify-content: center;
  align-items: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  border-radius: 50%;
  background: rgb(41 43 44 / 25%);
  padding: 8px;
  width: 40px;
  height: 40px;
  pointer-events: none;
}

.counter-gallery {
  display: none;
}

/* Cuando solo hay una imagen */
.solo-una-foto {
  /* Fondo gris claro por si la foto no llena todo */
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 0px;
  border-radius: 12px;
  background-color: #f7fafc;
  width: 100%;
  max-height: 500px;
  /* Evita que crezca infinito */
  overflow: hidden;
}

.gallery-main-item img {
  aspect-ratio: 5 / 4;
  width: 100%;
}

.solo-una-foto .gallery-main-item {
  width: 100%;
}

.solo-una-foto img {
  width: 100%;
  height: auto;
  /* Mantiene la proporción real */
  max-height: 500px;
  object-fit: contain;
  /* Cambiamos cover por contain para que NO se mutile la foto */
}

.ubihome-bento-gallery img,
.solo-una-foto img {
  transition: all 0.3s ease;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Mantiene la estética del grid */
  object-position: center;
}

/* PANTALLAS EXTRA GRANDES (Monitores Pro, iMacs) */
@media (max-width: 1536px) {
  /* Ajustes para pantallas tipo MacBook Pro 16" o monitores 2K */
}

/* ESCRITORIO GRANDE (Laptops de 15", Monitores de oficina) - Equivalente a 'xl' */
@media (max-width: 1280px) {
  /* El contenedor suele bajar a 1200px o 1140px */
}

/* ESCRITORIO NORMAL / LAPTOPS (MacBook Air, Laptops 13") - Equivalente a 'lg' */
@media (max-width: 1024px) {
  /* Punto crítico: Aquí el menú suele pasar a móvil */
}

/* TABLETS EN VERTICAL (iPad, Tablets Android) - Equivalente a 'md' */
@media (max-width: 768px) {
  /* Diseño a una sola columna */
}

/* MÓVILES (Smartphones actuales: iPhone 15, Samsung S24) - Equivalente a 'sm' */
@media (max-width: 640px) {

  .gallery-main-item img {
    width: 100vw;
    object-fit: cover;
  }

  .tool-badge {
    position: absolute;
    top: auto;
    right: 0px;
    bottom: 30px;
    left: auto;
    z-index: 10;
    pointer-events: none;
    width: 120px;
    height: 50px;
  }

  /* En móvil, convertimos la galería en un carrusel horizontal */
  .zoom-badge {
    top: auto;
    right: 14px;
    bottom: 12px;
  }

  .zoom-badge img {
    width: 26px !important;
    height: 26px !important;
  }

  .more-photos-overlay {
    display: none;
  }

  #ubihome-gallery {
    position: relative;
    overflow: visible !important;
    max-width: 100vw;
  }

  .gallery-mobile-scroll {
    display: flex !important;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    gap: 10px;
    padding-bottom: 0px;
    width: 100vw;
  }

  .gallery-mobile-scroll .gallery-main-item,
  .gallery-mobile-scroll .side-item {
    flex: 0 0 auto;
    border-radius: 0px;
    -webkit-border-radius: 0px;
    -moz-border-radius: 0px;
    -ms-border-radius: 0px;
    -o-border-radius: 0px;
    min-width: 80vw;
    scroll-snap-align: center;
  }

  .gallery-mobile-scroll img {
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    -webkit-border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    -moz-border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    -ms-border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    -o-border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    width: 100vw;
    height: 400px;
    object-fit: cover;
    object-position: center;
  }

  .solo-una-foto .gallery-main-item {
    width: 100%;
    max-height: 400px;
  }

  .solo-una-foto {
    margin-bottom: 0px;
    /* 235px; */
    border-radius: 0px;
    min-height: 400px;
  }

  .counter-gallery {
    display: flex;
    position: absolute;
    top: auto;
    right: 4rem;
    bottom: 20px;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    border-radius: 3px;
    background: rgb(255 255 255 / 98%);
    padding: 2px;
    width: 3rem;
    height: 22px;
    pointer-events: none;
    font-size: 12px;
  }

  .ubihome-bento-gallery {
    grid-template-columns: 1fr;
    /* Mantiene proporción en móvil */
    margin-bottom: 0px;

    /* Solo una columna */
    height: auto;
    max-height: 400px;
  }

  .gallery-side-items {
    display: none;
    /* Escondemos las pequeñas en móvil para priorizar carga */
  }

  .modal-header h3 {
    margin-bottom: 10px;
    width: 90%;
    color: #1a202c;
    font-size: 15px;
    line-height: 1.3;
  }

  .gallery-main-item,
  .side-item {
    border-radius: 0px;
    -webkit-border-radius: 0px;
    -moz-border-radius: 0px;
    -ms-border-radius: 0px;
    -o-border-radius: 0px;
  }

  #gallery-hero-img {
    height: 325px;
  }

  .gallery-main-item,
  .gallery-main-item a img.gal_photo_principal {
    max-height: 400px;
  }

  img.amazon-thumb.active,
  img.amazon-thumb {
    border-radius: 1rem;
    -webkit-border-radius: 1rem;
    -moz-border-radius: 1rem;
    -ms-border-radius: 1rem;
    -o-border-radius: 1rem;
    max-width: 8rem;
  }

  img#lightbox-img {
    /* El desenfoque del fondo */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    background-color: rgba(255, 255, 255, 0.7);
    object-fit: contain;
    /* Soporte para Safari */
  }
}

/* ===== FIN DE LOS AJUSTES === */

/* Overlay de "+ Fotos" */

@media (max-width: 768px) {}

/* Responsivo para Móviles */
@media (max-width: 768px) {}

@media (max-width: 992px) {
  /* Ajustes para tabletas */
}