/* ============================================================
   MEYRA — Galería: grid, hover, modal de imagen
   ============================================================ */

.gallery {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.gallery__item {
  position: relative;
  aspect-ratio: 1/1;
  overflow: hidden;
  border-radius: 2px;
  cursor: pointer;
  background: var(--c-cream-200);
}
.gallery__item img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .6s ease;
}
.gallery__item:hover img { transform: scale(1.04); }
.gallery__caption {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  padding: 20px;
  color: var(--c-cream-50);
  font-family: var(--f-serif);
  font-size: 17px;
  line-height: 1.2;
  background: linear-gradient(180deg, rgba(26,15,7,0) 50%, rgba(26,15,7,0.62) 100%);
  opacity: 0;
  transition: opacity .3s;
}
.gallery__item:hover .gallery__caption,
.gallery__item:focus-within .gallery__caption { opacity: 1; }
.gallery__actions {
  display: none;
  justify-content: center;
  margin-top: 18px;
}
.gallery__toggle {
  min-width: 180px;
  justify-content: center;
}
.gallery__item--extra {
  display: block;
}
.gallery__item--top img { object-position: center top; }
.gallery__item--center img { object-position: center center; }
.gallery__item--bottom img { object-position: center bottom; }

.gallery-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 15, 7, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 9100;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}
.gallery-modal-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

/* Slider cubre todo el overlay */
.gallery-modal__slider {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

/* Cada slot cubre todo el slider y centra su tarjeta */
.gallery-modal__slide {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 68px 22px 22px; /* top deja espacio para el botón de cierre */
}

/* Tarjeta blanca — se dimensiona sola según la imagen */
.gallery-modal__card {
  background: var(--c-cream-50);
  border-radius: 12px;
  padding: 22px 22px 18px;
  box-shadow: 0 28px 80px rgba(26, 15, 7, 0.38),
              0 0 0 1px rgba(26, 15, 7, 0.06);
  max-width: min(760px, 100%);
}

.gallery-modal__image {
  display: block;
  max-width: 100%;
  max-height: calc(88vh - 200px); /* reserva espacio para padding de slide + card + caption */
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 6px;
  background: var(--c-cream-100);
  user-select: none;
  -webkit-user-drag: none;
}

.gallery-modal__caption {
  margin-top: 14px;
  font-family: var(--f-serif);
  font-size: 22px;
  line-height: 1.2;
  color: var(--c-coffee-900);
  text-align: center;
}

/* Botón de cierre (fijo, fuera de la tarjeta) */
.gallery-modal__close {
  position: fixed;
  top: 20px;
  right: 24px;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 1;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.gallery-modal__close:hover {
  background: rgba(255, 255, 255, 0.26);
  border-color: rgba(255, 255, 255, 0.4);
}

/* Contador "N / Total" (fijo, esquina superior izquierda) */
.gallery-modal__counter {
  position: fixed;
  top: 28px;
  left: 28px;
  color: rgba(255, 255, 255, 0.75);
  font-size: 13px;
  letter-spacing: 0.06em;
  z-index: 1;
}

/* Swipe hint (fijo, abajo centrado) */
.gallery-modal__hint {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.13);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 13px;
  letter-spacing: 0.03em;
  padding: 7px 18px;
  border-radius: 999px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0.4s ease;
  z-index: 1;
}
.gallery-modal__hint.is-visible {
  opacity: 1;
  visibility: visible;
}

/* Flechas de navegación — solo en desktop (pointer: fine) */
.gallery-modal__nav {
  display: none;
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(4px);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  color: #fff;
  transition: background 0.18s, border-color 0.18s;
  padding: 0;
  z-index: 10001;
}
.gallery-modal__nav--prev { left: 20px; }
.gallery-modal__nav--next { right: 20px; }
.gallery-modal__nav:hover {
  background: rgba(255, 255, 255, 0.30);
  border-color: rgba(255, 255, 255, 0.75);
}
@media (pointer: fine) {
  .gallery-modal__nav  { display: flex; }
  .gallery-modal__hint { display: none !important; }
}
