/* ============================================================
   Galería — carrusel en móvil, grid desde tablet
   ============================================================ */
.gallery {
  color: var(--color-navy);
  background:
    radial-gradient(circle at 92% 4%, rgba(8,170,165,.08), transparent 20%),
    linear-gradient(180deg, #edf9f8 0%, #f8fcfc 100%);
}

.gallery__header {
  max-width: 900px;
  margin: 0 auto 26px;
  text-align: center;
}

.gallery__header > div { width: 100%; }

.gallery__header > p {
  margin-top: 10px;
  color: var(--color-slate-500);
  font-size: .82rem;
  line-height: 1.55;
}

.gallery__grid {
  width: 100%;
  display: flex;
  gap: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 0 12px;
  scroll-snap-type: x mandatory;
  scroll-padding-left: 0;
  overscroll-behavior-inline: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.gallery__grid::-webkit-scrollbar { display: none; }

.gallery__item {
  position: relative;
  flex: 0 0 min(84%, 320px);
  width: min(84%, 320px);
  min-width: 0;
  overflow: hidden;
  padding: 0;
  border: 1px solid rgba(8,170,165,.12);
  border-radius: 14px;
  background: #dcefee;
  box-shadow: 0 8px 24px rgba(8,45,69,.08);
  aspect-ratio: 4 / 3;
  cursor: pointer;
  scroll-snap-align: start;
}

.gallery__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .35s ease;
}

.gallery__item-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(8,45,69,.02) 35%, rgba(8,45,69,.84) 100%);
}

.gallery__item-caption {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  margin: 0;
  padding: 14px;
  color: #fff;
  font-size: .76rem;
  font-weight: 700;
  line-height: 1.4;
  text-align: left;
}

.gallery__hint {
  margin-top: 7px;
  color: var(--color-slate-500);
  font-size: .67rem;
  font-weight: 700;
  text-align: center;
}

@media (min-width: 640px) {
  .gallery__header { margin-bottom: 34px; }
  .gallery__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    overflow: visible;
    padding: 0;
  }
  .gallery__item { width: 100%; max-width: none; }
  .gallery__hint { display: none; }
}

@media (min-width: 960px) {
  .gallery__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
  .gallery__item { border-radius: 17px; }
}

@media (hover: hover) and (pointer: fine) {
  .gallery__item:hover img,
  .gallery__item:focus-visible img { transform: scale(1.045); }
  .gallery__item:hover,
  .gallery__item:focus-visible { box-shadow: var(--shadow-card-hover); }
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 9000;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5,35,51,.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.lightbox[hidden] { display: none; }
.lightbox__frame { position: relative; width: min(100%, 980px); }
.lightbox__close {
  position: absolute;
  z-index: 3;
  top: 8px;
  right: 8px;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,.24);
  border-radius: 50%;
  color: #fff;
  background: rgba(8,45,69,.72);
  font-size: 17px;
}
.lightbox__image {
  width: 100%;
  max-height: 68vh;
  margin-inline: auto;
  object-fit: contain;
  border-radius: 14px;
  box-shadow: 0 28px 70px rgba(0,0,0,.42);
}
.lightbox__caption { margin-top: 12px; text-align: center; }
.lightbox__caption p:first-child { margin: 0 0 3px; color: #fff; font-size: .82rem; font-weight: 700; }
.lightbox__caption p:last-child { margin: 0; color: rgba(255,255,255,.68); font-size: .72rem; }
.lightbox__nav { display: none; }
.lightbox__nav-mobile { display: flex; justify-content: center; gap: 12px; margin-top: 14px; }
.lightbox__nav-mobile button {
  min-width: 64px;
  min-height: 42px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 10px;
  color: #fff;
  background: rgba(255,255,255,.1);
  font-size: 18px;
  font-weight: 700;
}
@media (min-width: 640px) {
  .lightbox { padding: 44px 72px; }
  .lightbox__close { top: -50px; right: 0; }
  .lightbox__image { max-height: 74vh; border-radius: 18px; }
  .lightbox__nav {
    position: absolute;
    top: 42%;
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255,255,255,.16);
    border-radius: 50%;
    color: #fff;
    background: rgba(255,255,255,.1);
    font-size: 22px;
  }
  .lightbox__nav--prev { left: -62px; }
  .lightbox__nav--next { right: -62px; }
  .lightbox__nav-mobile { display: none; }
}