/* gallery.css */

/* ── Sección ── */
.gallery-section {
  background: #F5F8FC;
  padding: clamp(4rem, 8vh, 7rem) clamp(2rem, 7vw, 7rem);
  border-top: 1px solid #E8EDF5;
}

.gallery-inner {
  max-width: 1200px;
  margin: 0 auto;
}

/* ── Encabezado ── */
.gallery-header {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(2rem, 5vw, 5rem);
  align-items: flex-end;
  margin-bottom: clamp(2.5rem, 5vh, 4rem);
}

.gallery-tag {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #00AEEF;
  margin-bottom: 1rem;
}

.gallery-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: clamp(2.2rem, 3.8vw, 3.8rem);
  font-weight: 800;
  color: #081F4D;
  line-height: 1.05;
  letter-spacing: -0.01em;
}

.gallery-accent {
  color: #00AEEF;
}

.gallery-desc {
  font-family: 'Inter', sans-serif;
  font-size: clamp(0.85rem, 1vw, 0.95rem);
  color: #8892A4;
  line-height: 1.7;
}

/* ── Grid Masonry ── */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 220px;
  grid-auto-flow: dense;
  gap: 10px;
}

/* ── Items ── */
.gallery-item {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  cursor: pointer;
  background: #081F4D;
}

.gallery-item--tall {
  grid-row: span 2;
}

.gallery-item--wide {
  grid-column: span 2;
}

.gallery-item img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.gallery-item:hover img {
  transform: scale(1.05);
}

/* ── Overlay ── */
.gallery-item-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(8,31,77,0.88) 0%,
    rgba(8,31,77,0.2) 50%,
    transparent 100%
  );
  opacity: 0;
  transition: opacity 0.3s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-end;
  padding: 16px;
}

.gallery-item:hover .gallery-item-overlay {
  opacity: 1;
}

.gallery-item-icon {
  color: rgba(255,255,255,0.9);
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 6px;
  padding: 6px;
  display: flex;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: background 0.2s ease;
}

.gallery-item:hover .gallery-item-icon {
  background: rgba(255,255,255,0.2);
}

.gallery-item-info {
  align-self: flex-start;
  margin-top: auto;
}

.gallery-item-caption {
  display: block;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: #FFFFFF;
  line-height: 1.2;
}

.gallery-item-location {
  display: block;
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  color: rgba(175,192,217,0.9);
  margin-top: 2px;
  letter-spacing: 0.04em;
}

/* ── Lightbox ── */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

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

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: #081F4D !important;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.lightbox-container {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 90vw;
  max-height: 90vh;
  gap: 16px;
}

.lightbox-img-wrap {
  position: relative;
  max-width: 85vw;
  max-height: 78vh;
  border-radius: 8px;
  overflow: hidden;
}

.lightbox-img-wrap img {
  max-width: 85vw;
  max-height: 78vh;
  object-fit: contain;
  display: block;
  border-radius: 8px;
  transition: opacity 0.25s ease;
}

.lightbox-info {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  justify-content: space-between;
}

.lightbox-caption {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: #FFFFFF;
}

.lightbox-location {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  color: #AFC0D9;
}

.lightbox-counter {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  color: #AFC0D9;
  letter-spacing: 0.06em;
  margin-left: auto;
}

/* ── Botones lightbox ── */
.lightbox-close {
  position: fixed;
  top: max(24px, env(safe-area-inset-top));
  right: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1001;
}

.lightbox-prev,
.lightbox-next {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1001;
}

.lightbox-prev { left: 24px; }
.lightbox-next { right: 24px; }

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
  background: rgba(255,255,255,0.2);
  border-color: rgba(255,255,255,0.35);
}

/* ── Responsive Desktop ── */
@media (max-width: 900px) {
  .gallery-header {
    grid-template-columns: 1fr;
  }

  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: 180px;
  }
}

/* ── SLIDER MÓVIL ── */
@media (max-width: 768px) {

  .gallery-header {
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
  }

  .gallery-grid {
    display: block;
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    touch-action: pan-y;
  }

  .gallery-slider-track {
    display: flex;
    transition: transform 0.45s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
    gap: 0;
  }

  .gallery-item {
    flex: 0 0 100%;
    width: 100%;
    height: 72vw;
    max-height: 380px;
    border-radius: 12px;
    position: relative;
  }

  .gallery-item--tall,
  .gallery-item--wide {
    grid-row: unset;
    grid-column: unset;
  }

  .gallery-slider-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 16px;
    padding: 0 4px;
  }

  .slider-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #081F4D;
    border: 1px solid rgba(175,192,217,0.2);
    color: #AFC0D9;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
  }

  .slider-btn:hover {
    background: #0B2F6B;
    border-color: rgba(175,192,217,0.4);
    color: #FFFFFF;
  }

  .slider-btn:active {
    transform: scale(0.92);
  }

  .slider-dots {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    justify-content: center;
  }

  .slider-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #D0D9E8;
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
    padding: 0;
  }

  .slider-dot.active {
    background: #00AEEF;
    width: 20px;
    border-radius: 3px;
  }

  .slider-counter {
    display: block;
    text-align: center;
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 600;
    color: #AFC0D9;
    letter-spacing: 0.08em;
    margin-top: 8px;
  }

  .gallery-item-overlay {
    opacity: 1;
  }
}

/* ── Ocultar controles slider en desktop ── */
@media (min-width: 769px) {
  .gallery-slider-controls { display: none; }
  .slider-counter { display: none; }
  .gallery-slider-track { display: contents; }
}

@media (max-width: 768px) {
  .lightbox-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 0 16px;
    padding-top: env(safe-area-inset-top);
    max-width: 100vw;
    width: 100%;
  }

  .lightbox-img-wrap {
    max-width: 100%;
    max-height: 55vh;
    width: 100%;
    border-radius: 12px;
  }

  .lightbox-img-wrap img {
    max-width: 100%;
    max-height: 55vh;
    width: 100%;
    height: auto;
    object-fit: contain;
    border-radius: 12px;
  }

  .lightbox-prev,
  .lightbox-next {
    position: static;
    transform: none;
    width: 48px;
    height: 48px;
    flex-shrink: 0;
  }

  .lightbox-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    width: 100%;
  }

  .lightbox-info {
    width: 100%;
    text-align: center;
    flex-direction: column;
    align-items: center;
    gap: 4px;
  }

  .lightbox-counter {
    margin-left: 0;
  }

  .lightbox-close {
    position: fixed;
    top: max(20px, env(safe-area-inset-top));
    right: 16px;
    width: 40px;
    height: 40px;
    z-index: 1002;
  }
}
