/* ==========================================================================
   Maqueta · Ilustre Municipalidad de Pica
   gallery.css — Galería Fotográfica: mosaico en columnas, efecto al pasar el
   mouse (zoom + velo azul con título y descripción), visor ampliado y créditos.
   Encabezado y títulos: commune.css.
   ========================================================================== */

.gallery-body {
  padding: 3.5rem 0 4.5rem;
  background: linear-gradient(180deg, var(--pm-navy-900) 0%, var(--pm-navy-850) 100%);
}

.gallery-head {
  max-width: 62ch;
  margin-bottom: 2rem;
}

/* --------------------------------------------------------------------------
   Mosaico: columnas que respetan la proporción de cada foto
   -------------------------------------------------------------------------- */
.gallery-grid {
  columns: 3;
  column-gap: 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.gallery-item {
  margin: 0 0 1.25rem;
  break-inside: avoid;
}

.gallery-card {
  position: relative;
  display: block;
  overflow: hidden;
  border: 2px solid rgba(41, 191, 203, .35);
  border-radius: 16px;
  background: var(--pm-navy-900);
  box-shadow: var(--pm-shadow-sm);
  transition: border-color .3s ease, box-shadow .3s ease;
}

.gallery-card img {
  display: block;
  width: 100%;
  height: auto;
  transition: transform .6s cubic-bezier(.2, .7, .2, 1);
}

/* Velo azul: siempre presente abajo (para leer el título) y más intenso al pasar el mouse */
.gallery-card__veil {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(8, 33, 66, 0) 45%, rgba(8, 33, 66, .88) 100%);
  transition: background .35s ease;
}

.gallery-card__tag {
  position: absolute;
  top: .85rem;
  left: .85rem;
  padding: .25rem .7rem;
  border-radius: 999px;
  background: var(--pm-gold-500);
  color: var(--pm-navy-900);
  font-family: var(--pm-font-condensed);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.gallery-card__zoom {
  position: absolute;
  top: .75rem;
  right: .75rem;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(8, 33, 66, .7);
  color: #fff;
  font-size: .9rem;
  opacity: 0;
  translate: 0 -6px;
  transition: opacity .3s ease, translate .3s ease, background .3s ease;
}

.gallery-card__text {
  position: absolute;
  inset: auto 0 0;
  display: grid;
  gap: .35rem;
  padding: 1.1rem 1.2rem 1.15rem;
  color: #fff;
}

.gallery-card__title {
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.2;
  transition: color .3s ease;
}

/* La descripción aparece deslizándose al pasar el mouse o enfocar con teclado */
.gallery-card__desc {
  display: grid;
  max-height: 0;
  overflow: hidden;
  color: rgba(255, 255, 255, .88);
  font-size: .86rem;
  line-height: 1.5;
  opacity: 0;
  translate: 0 8px;
  transition: max-height .4s ease, opacity .35s ease, translate .35s ease;
}

.gallery-card:hover,
.gallery-card:focus-visible {
  border-color: var(--pm-gold-500);
  box-shadow: var(--pm-shadow);
}

.gallery-card:hover img,
.gallery-card:focus-visible img {
  transform: scale(1.08);
}

.gallery-card:hover .gallery-card__veil,
.gallery-card:focus-visible .gallery-card__veil {
  background: linear-gradient(180deg, rgba(19, 59, 105, .15) 0%, rgba(8, 33, 66, .94) 100%);
}

.gallery-card:hover .gallery-card__title,
.gallery-card:focus-visible .gallery-card__title {
  color: var(--pm-gold-400);
}

.gallery-card:hover .gallery-card__desc,
.gallery-card:focus-visible .gallery-card__desc {
  max-height: 9rem;
  opacity: 1;
  translate: 0 0;
}

.gallery-card:hover .gallery-card__zoom,
.gallery-card:focus-visible .gallery-card__zoom {
  background: var(--pm-gold-500);
  color: var(--pm-navy-900);
  opacity: 1;
  translate: 0 0;
}

/* En pantallas táctiles no hay hover: la descripción queda visible */
@media (hover: none) {
  .gallery-card__desc {
    max-height: 9rem;
    opacity: 1;
    translate: 0 0;
  }

  .gallery-card__zoom {
    opacity: 1;
    translate: 0 0;
  }
}

/* --------------------------------------------------------------------------
   Fila destacada: dos fotos a la misma altura, la primera más ancha
   -------------------------------------------------------------------------- */
.gallery-feature {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
  gap: 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.gallery-item--feature {
  margin: 0;
}

.gallery-item--feature .gallery-card {
  height: 100%;
}

.gallery-item--feature .gallery-card img {
  height: clamp(280px, 30vw, 420px);
  object-fit: cover;
}

.gallery-item--feature .gallery-card__title {
  font-size: 1.3rem;
}

/* --------------------------------------------------------------------------
   "Ver más" y créditos
   -------------------------------------------------------------------------- */
.gallery-more {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 2rem;
  margin-top: 1.5rem;
  padding: 1.25rem 1.75rem;
  border: 3px solid var(--pm-blue-500);
  border-radius: 16px;
  background: var(--pm-navy-900);
}

.gallery-more p {
  margin: 0;
  color: var(--pm-text);
}

.gallery-credits {
  margin-top: 2rem;
  color: var(--pm-text-soft);
  font-size: .85rem;
}

.gallery-credits summary {
  width: fit-content;
  color: var(--pm-gold-300);
  font-family: var(--pm-font-condensed);
  font-size: .85rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  cursor: pointer;
}

.gallery-credits ul {
  display: grid;
  gap: .35rem;
  margin: .75rem 0 0;
  padding-left: 1.2rem;
}

.gallery-credits a {
  color: var(--pm-blue-400);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.gallery-credits a:hover {
  color: var(--pm-gold-300);
}

/* --------------------------------------------------------------------------
   Visor ampliado
   -------------------------------------------------------------------------- */
.gallery-modal .modal-content {
  position: relative;
  overflow: hidden;
  border: 3px solid var(--pm-blue-500);
  border-radius: 18px;
  background: var(--pm-navy-950);
  color: var(--pm-text);
}

.gallery-modal__figure {
  position: relative;
  display: grid;
  place-items: center;
  margin: 0;
  background: #000;
}

.gallery-modal__figure img {
  display: block;
  width: 100%;
  max-height: 68vh;
  object-fit: contain;
}

.gallery-modal__close,
.gallery-modal__nav {
  position: absolute;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: rgba(8, 33, 66, .8);
  color: #fff;
  transition: background .2s ease, color .2s ease;
}

.gallery-modal__close {
  top: .8rem;
  right: .8rem;
}

.gallery-modal__nav {
  top: 50%;
  translate: 0 -50%;
}

.gallery-modal__nav--prev {
  left: .8rem;
}

.gallery-modal__nav--next {
  right: .8rem;
}

.gallery-modal__close:hover,
.gallery-modal__nav:hover {
  background: var(--pm-gold-500);
  color: var(--pm-navy-900);
}

.gallery-modal__info {
  padding: 1.25rem 1.5rem 1.4rem;
}

.gallery-modal__info .commune-eyebrow {
  margin-bottom: .2rem;
}

.gallery-modal__title {
  margin: 0 0 .4rem;
  color: var(--pm-gold-400);
  font-size: 1.5rem;
  font-weight: 800;
}

.gallery-modal__desc {
  max-width: 70ch;
  margin: 0 0 .7rem;
  line-height: 1.6;
}

.gallery-modal__credit {
  margin: 0;
  color: var(--pm-text-soft);
  font-size: .8rem;
}

.gallery-modal__credit a {
  color: var(--pm-blue-400);
  text-decoration: underline;
  text-underline-offset: 3px;
}

@media (max-width: 991.98px) {
  .gallery-grid {
    columns: 2;
  }

  .gallery-feature {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 575.98px) {
  .gallery-grid {
    columns: 1;
  }

  .gallery-feature {
    grid-template-columns: 1fr;
  }

  .gallery-more {
    padding: 1.1rem;
  }

  .gallery-modal__info {
    padding: 1rem 1.1rem 1.2rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gallery-card img,
  .gallery-card__desc,
  .gallery-card__zoom,
  .gallery-card__veil {
    transition: none;
  }

  .gallery-card:hover img,
  .gallery-card:focus-visible img {
    transform: none;
  }
}
