/* ========================================================================= */
/* INFRAESTRUCTURA - SHOWCASE (mosaico + filmstrip) + LIGHTBOX               */
/* - Solo afecta a #infraestructura                                          */
/* - Mantiene el lightbox existente (inyectado por JS)                       */
/* ========================================================================= */

#infraestructura {
  position: relative;
}

/* Encabezado */
#infraestructura .infra-head {
  max-width: 1200px;
  margin: 0 auto 18px auto;
  text-align: center;
}

#infraestructura .infra-title {
  margin-bottom: 8px;
}

#infraestructura .infra-sub {
  margin: 0;
  color: rgba(11, 27, 42, 0.76);
  font-size: 1.02rem;
  line-height: 1.5;
}

#infraestructura .infra-hint {
  display: inline-block;
  margin-left: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.92rem;
  color: rgba(11, 27, 42, 0.74);
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.06);
}

/* Contenedor */
#infraestructura .infra-gallery-wrap {
  max-width: 100%;
  margin: 0 auto;
}

#infraestructura .infra-gallery {
  border-radius: 22px;
  padding: clamp(12px, 2vw, 16px);
  background: radial-gradient(
      900px 420px at 18% 8%,
      rgba(0, 64, 128, 0.06),
      transparent 55%
    ),
    radial-gradient(
      760px 380px at 88% 38%,
      rgba(255, 195, 0, 0.1),
      transparent 58%
    ),
    linear-gradient(#fff, #fff);
  border: 1px solid rgba(0, 0, 0, 0.07);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.1);
}

/* ===== Layout compacto en viewport (GRID) ===== */
#infraestructura.section-padding {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}

#infraestructura .infra-gallery-wrap {
  flex: 1 1 auto;
  min-height: 0;
}

#infraestructura .infra-gallery {
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#infraestructura .infra-grid {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-flow: dense;
  gap: clamp(10px, 1.4vw, 14px);
  overflow: auto;
  padding-right: 4px;
  scrollbar-width: thin;
}

/* Tiles con variación tipo “revista” */
#infraestructura .infra-thumb--grid {
  aspect-ratio: 4 / 3;
}

#infraestructura .infra-thumb--grid:nth-child(10n + 1) {
  grid-column: span 2;
  grid-row: span 2;
  aspect-ratio: 1 / 1;
}

#infraestructura .infra-thumb--grid:nth-child(10n + 6) {
  grid-column: span 2;
}

#infraestructura .infra-thumb--grid:nth-child(10n + 8) {
  grid-row: span 2;
  aspect-ratio: 3 / 4;
}

#infraestructura .infra-grid::-webkit-scrollbar {
  width: 10px;
}
#infraestructura .infra-grid::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.16);
  border-radius: 999px;
}

/* Mosaico */
#infraestructura .infra-mosaic {
  display: grid;
  grid-template-columns: 1.28fr 1fr;
  gap: 14px;
}

/* Tiles (2x2) */
#infraestructura .infra-tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

/* Base de thumbs */
#infraestructura .infra-thumb {
  appearance: none;
  border: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  cursor: pointer;
  border-radius: 18px;
  overflow: hidden;
  position: relative;
  transform: translateZ(0);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.12);
  transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
}

#infraestructura .infra-thumb:hover {
  transform: translateY(-4px);
  box-shadow: 0 22px 46px rgba(0, 0, 0, 0.16);
}

#infraestructura .infra-thumb:active {
  transform: translateY(-2px);
}

#infraestructura .infra-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transform: scale(1.01);
  transition: transform 220ms ease;
}

#infraestructura .infra-thumb:hover img {
  transform: scale(1.06);
}

/* Overlay elegante */
#infraestructura .infra-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: end;
  gap: 6px;
  padding: 14px;
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0) 52%,
    rgba(0, 0, 0, 0.36) 100%
  );
  opacity: 0.92;
  pointer-events: none;
}

#infraestructura .infra-overlay__label {
  color: rgba(255, 255, 255, 0.92);
  font-weight: 800;
  letter-spacing: 0.3px;
  text-shadow: 0 8px 18px rgba(0, 0, 0, 0.28);
}

#infraestructura .infra-overlay__cta {
  width: max-content;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.95);
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(6px);
  transform: translateY(6px);
  opacity: 0;
  transition: transform 180ms ease, opacity 180ms ease;
}

#infraestructura .infra-thumb:hover .infra-overlay__cta {
  transform: translateY(0);
  opacity: 1;
}

/* Tamaños del mosaico */
#infraestructura .infra-thumb--feature {
  min-height: 360px;
}

#infraestructura .infra-thumb--feature img {
  aspect-ratio: 16 / 10;
}

/* Tiles */
#infraestructura .infra-thumb--tile {
  aspect-ratio: 1 / 1;
}

/* Filmstrip */
#infraestructura .infra-strip {
  margin-top: 14px;
  position: relative;
}

#infraestructura .infra-strip-track {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 8px 6px;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
}

#infraestructura .infra-strip-track::-webkit-scrollbar {
  height: 10px;
}
#infraestructura .infra-strip-track::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.18);
  border-radius: 999px;
}

#infraestructura .infra-thumb--strip {
  flex: 0 0 auto;
  width: min(320px, 78vw);
  aspect-ratio: 4 / 3;
  scroll-snap-align: start;
}

/* Fading edges para el filmstrip */
#infraestructura .infra-strip::before,
#infraestructura .infra-strip::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 34px;
  pointer-events: none;
  z-index: 2;
}

#infraestructura .infra-strip::before {
  left: 0;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 1),
    rgba(255, 255, 255, 0)
  );
}

#infraestructura .infra-strip::after {
  right: 0;
  background: linear-gradient(
    270deg,
    rgba(255, 255, 255, 1),
    rgba(255, 255, 255, 0)
  );
}

/* Responsive */
@media (max-width: 980px) {
  #infraestructura .infra-mosaic {
    grid-template-columns: 1fr;
  }
  #infraestructura .infra-thumb--feature {
    grid-row: auto;
    min-height: unset;
  }
  #infraestructura .infra-thumb--feature img {
    aspect-ratio: 16 / 10;
  }
  /* Tiles siguen en 2 columnas */
  #infraestructura .infra-tiles {
    gap: 12px;
  }
  #infraestructura .infra-mosaic .infra-thumb--tile {
    border-radius: 16px;
  }
  #infraestructura .infra-strip::before,
  #infraestructura .infra-strip::after {
    width: 26px;
  }

  #infraestructura .infra-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  #infraestructura .infra-gallery {
    border-radius: 18px;
  }
  #infraestructura .infra-thumb {
    border-radius: 14px;
  }
  #infraestructura .infra-hint {
    display: block;
    width: max-content;
    margin: 10px auto 0 auto;
  }
  #infraestructura .infra-thumb--strip {
    width: min(260px, 82vw);
  }

  #infraestructura .infra-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 420px) {
  #infraestructura .infra-tiles {
    grid-template-columns: ;
  }

  #infraestructura .infra-grid {
    gap: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #infraestructura .infra-thumb,
  #infraestructura .infra-thumb img,
  #infraestructura .infra-overlay__cta {
    transition: none;
  }
}

/* ========================================================================= */
/* Lightbox (inyectado por JS)                                                */
/* ========================================================================= */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.68);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.lightbox.is-open {
  opacity: 1;
  pointer-events: auto;
}

.lightbox-dialog {
  width: min(1100px, 96vw);
  max-height: 86vh;
  background: rgba(10, 14, 20, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 26px 60px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(10px);
  display: grid;
  grid-template-rows: auto 1fr;
}

.lightbox-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.lightbox-title {
  color: rgba(255, 255, 255, 0.92);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.2px;
}

.lightbox-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lightbox-btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 1.2rem;
  transition: transform 150ms ease, background 150ms ease;
}

.lightbox-btn:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.12);
}

.lightbox-media {
  position: relative;
  display: grid;
  place-items: center;
  padding: 12px;
}

.lightbox-media img {
  width: 100%;
  height: 100%;
  max-height: calc(86vh - 62px);
  object-fit: contain;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.18);
}

.lightbox-nav {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
  pointer-events: none;
}

.lightbox-nav .lightbox-btn {
  pointer-events: auto;
  width: 44px;
  height: 44px;
  border-radius: 14px;
}

/* ===== Infraestructura con fondo fijo (pinned) ===== */
.band--infra.band--pinned-bg {
  padding: clamp(2.7rem, 4.6vw, 4.2rem) 0;
}
.band--infra.band--pinned-bg #infraestructura.section-padding {
  max-width: min(95%, 94vw);
  margin: 0 auto;
  padding: clamp(1.6rem, 3vw, 2.4rem);
  border-radius: 26px;
  /* background: rgba(255, 255, 255, 0.92); */
  /*  border: 1px solid rgba(255, 255, 255, 0.28); */
  box-shadow: 0 22px 55px rgba(0, 0, 0, 0.22);
  /* backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px); */
}

/* ========================================================================= */
/* INFRA - GALERÍA TIPO "CATEGORÍAS" (compacta + paginación)                 */
/* Solo afecta a .infra-grid--categories dentro de #infraestructura          */
/* ========================================================================= */

#infraestructura .infra-gallery-wrap {
  /* Mantiene la sección dentro del viewport sin invadir toda la página */
  max-width: 1500px;
  margin: 0 auto;
}

#infraestructura .infra-gallery {
  /* Alto cómodo para que el título siga respirando */
  height: min(68vh, 620px);
}

#infraestructura .infra-grid--categories {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  gap: 14px;
  padding: 10px;
  border-radius: 22px;
  overflow: auto; /* si hay muchas imágenes, hace scroll interno */
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;

  /* Mobile: 2 columnas como tu referencia */
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: 150px;
}

#infraestructura .infra-grid--categories::-webkit-scrollbar {
  height: 10px;
  width: 10px;
}
#infraestructura .infra-grid--categories::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.18);
  border-radius: 999px;
}
#infraestructura .infra-grid--categories::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.06);
  border-radius: 999px;
}

#infraestructura .infra-card {
  position: relative;
  border: 0;
  padding: 0;
  border-radius: 18px;
  overflow: hidden;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.08);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.1);
  transform: translateZ(0);
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

#infraestructura .infra-card img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transform: scale(1.02);
  transition: transform 0.35s ease;
}

#infraestructura .infra-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 26px 60px rgba(0, 0, 0, 0.16);
}

#infraestructura .infra-card:hover img {
  transform: scale(1.08);
}

#infraestructura .infra-card:focus-visible {
  outline: 3px solid rgba(212, 164, 31, 0.75);
  outline-offset: 4px;
}

/* Overlay estilo "categoría" */
#infraestructura .infra-card .infra-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 14px 14px;
  gap: 6px;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.58),
    rgba(0, 0, 0, 0.08) 55%,
    rgba(0, 0, 0, 0)
  );
  opacity: 1;
}

#infraestructura .infra-card .infra-overlay__label {
  font-weight: 800;
  letter-spacing: 0.2px;
  font-size: 16px;
  color: #fff;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.55);
}

#infraestructura .infra-card .infra-overlay__cta {
  font-size: 13px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.92);
  opacity: 0.92;
}

/* Tamaño destacado en escritorio (como tu ejemplo) */
@media (min-width: 1024px) {
  #infraestructura .infra-grid--categories {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    grid-auto-rows: 165px;
  }
  #infraestructura .infra-card.is-featured {
    grid-column: 1 / span 2;
    grid-row: 1 / span 2;
    border-radius: 22px;
  }
  #infraestructura .infra-card.is-featured .infra-overlay__label {
    font-size: 18px;
  }
}

/* Tablet */
@media (min-width: 700px) and (max-width: 1023px) {
  #infraestructura .infra-grid--categories {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-auto-rows: 160px;
  }
  #infraestructura .infra-card.is-featured {
    grid-column: 1 / span 2;
    grid-row: 1 / span 2;
  }
}

/* En móvil dejamos todo homogéneo a 2 columnas */
@media (max-width: 699px) {
  #infraestructura .infra-card.is-featured {
    grid-column: auto;
    grid-row: auto;
  }
}
@media (max-width: 900px) {
  .infra-gallery-wrap {
    margin-left: -1.5rem !important;
  }
}

/* Paginación */
#infraestructura .infra-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 12px 6px 2px 6px;
}

#infraestructura .infra-prev {
  border: 0;
  cursor: pointer;
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 800;
  letter-spacing: 0.2px;
  background: rgba(255, 255, 255, 0.72);
  color: #1a1a1a;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.1);
  transition: transform 0.18s ease, filter 0.18s ease, box-shadow 0.18s ease;
  backdrop-filter: blur(8px);
}

#infraestructura .infra-prev:hover {
  transform: translateY(-1px);
  filter: brightness(1.02);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.14);
}

#infraestructura .infra-page {
  font-weight: 700;
  color: rgba(0, 0, 0, 0.72);
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.04);
}

#infraestructura .infra-page b {
  color: rgba(0, 0, 0, 0.92);
}

/* animación sutil al cambiar de página */
#infraestructura .infra-card.is-page-in {
  animation: infraPageIn 0.42s ease both;
}
@keyframes infraPageIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#infraestructura .infra-next {
  border: 0;
  cursor: pointer;
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 800;
  letter-spacing: 0.2px;
  background: linear-gradient(135deg, #dcae27, #c99917);
  color: #1a1a1a;
  box-shadow: 0 18px 40px rgba(212, 164, 31, 0.22);
  transition: transform 0.18s ease, filter 0.18s ease, box-shadow 0.18s ease;
}

#infraestructura .infra-next:hover {
  transform: translateY(-2px);
  box-shadow: 0 22px 50px rgba(212, 164, 31, 0.28);
  filter: saturate(1.05);
}

#infraestructura .infra-next:active {
  transform: translateY(0);
}

#infraestructura .infra-next__icon {
  margin-left: 8px;
}

#infraestructura .infra-count {
  font-size: 13px;
  color: rgba(0, 0, 0, 0.62);
}

/* Ocultar y animar reveal */
#infraestructura .infra-thumb.is-hidden {
  display: none !important;
}
#infraestructura .infra-thumb.is-revealed {
  animation: infraReveal 0.55s ease both;
}
@keyframes infraReveal {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
