/* ============================================================
   PHOTO GALLERY — gallery.css
   Hero Slider + Lightbox con filtros por categoría
   San Blas on Sailboats

   INTEGRACIÓN: <link rel="stylesheet" href="css/gallery.css">
   Requiere: style.css (variables) + Font Awesome 6
   ============================================================ */

/* ── SECTION WRAPPER ────────────────────────────────────────── */
#photo-gallery {
  background: var(--color-dark);
}

/* ══════════════════════════════════════════════════════════════
   1. HERO SLIDER
   ══════════════════════════════════════════════════════════════ */

.pg-hero {
  position: relative;
  width: 100%;
  height: 70vh;
  min-height: 480px;
  max-height: 720px;
  overflow: hidden;
  background: var(--color-dark);
  cursor: default;
}

/* Track — los slides se alinean en fila */
.pg-hero__track {
  display: flex;
  height: 100%;
  transition: transform 0.8s cubic-bezier(0.77, 0, 0.175, 1);
  will-change: transform;
}

/* Slide individual */
.pg-hero__slide {
  flex-shrink: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  position: relative;
}

/* Gradiente: foco en los bordes, luminoso en el centro */
.pg-hero__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(10, 24, 38, 0.15) 0%,
    rgba(10, 24, 38, 0.0)  40%,
    rgba(10, 24, 38, 0.55) 80%,
    rgba(10, 24, 38, 0.80) 100%
  );
}

/* Caption sobre la foto */
.pg-hero__caption {
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  z-index: 2;
  white-space: nowrap;
  opacity: 0;
  transform: translateX(-50%) translateY(10px);
  transition: opacity 0.5s ease 0.3s, transform 0.5s ease 0.3s;
}

.pg-hero__slide.is-active .pg-hero__caption {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.pg-hero__caption p {
  color: rgba(255, 255, 255, 0.90);
  font-size: clamp(16px, 2.5vw, 22px);
  font-weight: 300;
  letter-spacing: 0.04em;
  margin-top: 4px;
}

/* Botones prev/next */
.pg-hero__btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: var(--color-white);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), transform var(--transition);
  cursor: pointer;
}

.pg-hero__btn:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateY(-50%) scale(1.08);
}

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

/* Dots de posición */
.pg-hero__dots {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 10;
}

.pg-hero__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  border: none;
  cursor: pointer;
  padding: 0;
  transition: background var(--transition), transform var(--transition);
}

.pg-hero__dot.is-active {
  background: var(--color-white);
  transform: scale(1.4);
}

/* Barra de progreso del autoplay */
.pg-hero__progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: var(--color-teal-light);
  z-index: 10;
  transition: width linear;
}

/* Pausa en hover */
.pg-hero:hover .pg-hero__progress {
  animation-play-state: paused;
}

/* ══════════════════════════════════════════════════════════════
   2. GALLERY — Tabs + Grid
   ══════════════════════════════════════════════════════════════ */

.pg-gallery {
  background: var(--color-dark);
}

.pg-gallery .section__header h2 {
  color: var(--color-white);
}

/* ── Tabs ────────────────────────────────────────────────────── */
.pg-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: var(--space-xl);
}

.pg-tab {
  padding: 9px 22px;
  border-radius: var(--radius-pill);
  border: 1.5px solid rgba(255, 255, 255, 0.18);
  background: transparent;
  color: rgba(255, 255, 255, 0.60);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.pg-tab:hover {
  border-color: rgba(255, 255, 255, 0.45);
  color: rgba(255, 255, 255, 0.90);
}

.pg-tab--active {
  background: var(--color-teal);
  border-color: var(--color-teal);
  color: var(--color-white);
}

/* ── Grid de thumbnails ──────────────────────────────────────── */
.pg-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.pg-item {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: var(--color-dark);
}

.pg-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
  display: block;
}

/* Hover overlay con ícono */
.pg-item__hover {
  position: absolute;
  inset: 0;
  background: rgba(10, 24, 38, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition);
  color: var(--color-white);
  font-size: 22px;
}

.pg-item:hover img         { transform: scale(1.06); }
.pg-item:hover .pg-item__hover { opacity: 1; }

/* Fotos filtradas: ocultar animando */
.pg-item.is-hidden {
  display: none;
}

/* ══════════════════════════════════════════════════════════════
   3. LIGHTBOX
   ══════════════════════════════════════════════════════════════ */

.pg-lightbox {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

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

/* Backdrop oscuro */
.pg-lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 18, 28, 0.95);
  backdrop-filter: blur(8px);
  cursor: pointer;
}

/* Stage con la imagen */
.pg-lightbox__stage {
  position: relative;
  z-index: 1;
  max-width: 90vw;
  max-height: 88vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pg-lightbox__img {
  max-width: 90vw;
  max-height: 88vh;
  object-fit: contain;
  border-radius: var(--radius-sm);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
  user-select: none;
  transition: opacity 0.2s ease;
}

/* Botón cerrar */
.pg-lightbox__close {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 2;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: var(--color-white);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition);
}

.pg-lightbox__close:hover { background: rgba(255, 255, 255, 0.25); }

/* Botones prev/next */
.pg-lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.20);
  color: var(--color-white);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
}

.pg-lightbox__nav:hover {
  background: rgba(255, 255, 255, 0.22);
  transform: translateY(-50%) scale(1.08);
}

.pg-lightbox__nav--prev { left: 20px; }
.pg-lightbox__nav--next { right: 20px; }

/* Contador */
.pg-lightbox__counter {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.55);
  letter-spacing: 0.08em;
}

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════════ */

@media (max-width: 1024px) {
  .pg-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .pg-hero {
    height: 55vh;
    min-height: 320px;
  }

  .pg-hero__btn {
    width: 38px;
    height: 38px;
    font-size: 13px;
  }

  .pg-hero__btn--prev { left: 12px; }
  .pg-hero__btn--next { right: 12px; }

  .pg-hero__caption {
    bottom: 60px;
    white-space: normal;
    width: 90%;
  }

  .pg-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
  }

  .pg-tabs {
    gap: 6px;
  }

  .pg-tab {
    padding: 7px 16px;
    font-size: 13px;
  }

  .pg-lightbox__nav--prev { left: 8px; }
  .pg-lightbox__nav--next { right: 8px; }

  .pg-lightbox__nav {
    width: 40px;
    height: 40px;
    font-size: 15px;
  }
}

@media (max-width: 480px) {
  .pg-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ── Reducir movimiento para accesibilidad ───────────────────── */
@media (prefers-reduced-motion: reduce) {
  .pg-hero__track        { transition: none; }
  .pg-item img           { transition: none; }
  .pg-lightbox__img      { transition: none; }
  .pg-hero__progress     { transition: none; }
}
