/* Capacidad en terreno: encabezado con capacidades, filtros, galería en mosaico y visor ampliado. */
.field {
  padding-block: clamp(4rem, 7vw, 6rem);
  background: var(--ink-900);
}

.field__head {
  display: grid;
  gap: 2.5rem;
  align-items: end;
}

.field .section-title span {
  color: var(--orange);
}

.field__caps {
  display: grid;
  gap: 1rem;
}

.field__caps li {
  display: grid;
  gap: 0.2rem;
  padding-left: 1rem;
  border-left: 2px solid var(--orange);
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.field__caps strong {
  color: var(--white);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
}

@media (min-width: 64em) {
  .field__head {
    grid-template-columns: 1.1fr 1fr;
    gap: 4rem;
  }
}

/* Filtros */
.gallery__filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 3rem;
}

.chip {
  padding: 0.5rem 1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 600;
  transition: background-color 0.3s var(--ease), color 0.3s var(--ease), border-color 0.3s var(--ease);
}

.chip:hover {
  border-color: rgb(232 136 43 / 0.6);
  color: var(--white);
}

.chip[aria-pressed='true'] {
  border-color: var(--orange);
  background: var(--orange);
  color: var(--ink-950);
}

/* Mosaico: celdas base cuadradas; algunas fotos ocupan dos columnas (wide) o dos filas (tall) */
.gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-auto-rows: 9rem;
  grid-auto-flow: dense;
  gap: 0.75rem;
  margin-top: 1.75rem;
}

.gallery__item[hidden] {
  display: none;
}

.gallery__item--wide {
  grid-column: span 2;
}

.gallery__item--tall {
  grid-row: span 2;
}

@media (min-width: 48em) {
  .gallery {
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: 11rem;
  }
}

@media (min-width: 80em) {
  .gallery {
    grid-template-columns: repeat(6, 1fr);
    grid-auto-rows: 12rem;
  }
}

.gallery__button {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: 1rem;
  background: var(--ink-800);
  overflow: hidden;
  cursor: zoom-in;
  transition: transform 0.45s var(--ease), box-shadow 0.45s var(--ease);
}

/* Elevación leve al pasar el cursor (va en el botón: el <li> lo anima Flip al filtrar) */
.gallery__button:hover,
.gallery__button:focus-visible {
  transform: translateY(-5px);
  box-shadow: 0 18px 36px -14px rgb(0 0 0 / 0.75);
}

.gallery__button img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.9s var(--ease), filter 0.6s var(--ease);
}

.gallery__button::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 45%, rgb(18 19 21 / 0.85));
  opacity: 0;
  transition: opacity 0.5s var(--ease);
}

.gallery__caption {
  position: absolute;
  z-index: 1;
  left: 0.9rem;
  right: 0.9rem;
  bottom: 0.85rem;
  display: grid;
  gap: 0.3rem;
  color: var(--white);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.3;
  text-align: left;
  opacity: 0;
  transform: translateY(0.5rem);
  transition: opacity 0.5s var(--ease), transform 0.5s var(--ease);
}

.gallery__tag {
  justify-self: start;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: var(--orange);
  color: var(--ink-950);
  font-family: var(--font-sans);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.gallery__button:hover img,
.gallery__button:focus-visible img {
  transform: scale(1.07);
}

.gallery__button:hover::after,
.gallery__button:focus-visible::after,
.gallery__button:hover .gallery__caption,
.gallery__button:focus-visible .gallery__caption {
  opacity: 1;
  transform: none;
}

/* En pantallas táctiles no hay hover: la leyenda se muestra siempre */
@media (hover: none) {
  .gallery__button::after,
  .gallery__caption {
    opacity: 1;
    transform: none;
  }
}

/* Visor ampliado */
.lightbox {
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgb(10 11 12 / 0.94);
  color: var(--white);
}

.lightbox::backdrop {
  background: rgb(10 11 12 / 0.7);
  backdrop-filter: blur(6px);
}

.lightbox[open] {
  display: grid;
  place-items: center;
  animation: lightbox-in 0.4s var(--ease);
}

@keyframes lightbox-in {
  from { opacity: 0; }
}

.lightbox__figure {
  display: grid;
  gap: 1rem;
  justify-items: center;
  max-width: min(92vw, 80rem);
  pointer-events: none;
}

.lightbox__img {
  max-width: 100%;
  max-height: 78dvh;
  border-radius: 1rem;
  opacity: 0;
  transform: scale(0.97);
  transition: opacity 0.4s var(--ease), transform 0.5s var(--ease);
}

.lightbox__img.is-ready {
  opacity: 1;
  transform: none;
}

.lightbox__caption {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  font-size: 0.9375rem;
}

.lightbox__count {
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

.lightbox__btn {
  position: absolute;
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border: 1px solid rgb(255 255 255 / 0.25);
  border-radius: 50%;
  background: rgb(18 19 21 / 0.6);
  color: var(--white);
  transition: background-color 0.3s var(--ease), border-color 0.3s var(--ease);
}

.lightbox__btn:hover {
  border-color: var(--orange);
  background: var(--orange);
  color: var(--ink-950);
}

.lightbox__btn svg {
  width: 1.4rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.lightbox__btn--prev { left: clamp(0.75rem, 2vw, 2rem); top: 50%; translate: 0 -50%; }
.lightbox__btn--next { right: clamp(0.75rem, 2vw, 2rem); top: 50%; translate: 0 -50%; }
.lightbox__btn--close { top: clamp(0.75rem, 2vw, 1.5rem); right: clamp(0.75rem, 2vw, 1.5rem); }

@media (max-width: 47.99em) {
  .lightbox__btn--prev,
  .lightbox__btn--next {
    top: auto;
    bottom: 1.25rem;
    translate: none;
  }
}
