/**
 * ============================================================================
 * GORILLA NUTRITION SINALOA - Gallery CSS (v2 — Slider moderno)
 * ============================================================================
 *
 * Grid masonry con título overlay, slider con flechas, dots e indicador
 * de progreso. Acorde al estilo dark/gold del tema.
 *
 * @package Gorilla_Nutrition
 * @since   2.0.0
 */

/* ════════════════════════════════════════════════════════════════════════════
   SECCIÓN BASE
   ════════════════════════════════════════════════════════════════════════════ */

.gallery {
  padding: 110px 0 100px;
  background-color: var(--color-bg-secondary);
  background-image: url('../images/gallery-bg.png');
  background-size: cover;
  background-position: center;
  overflow: hidden;
  position: relative;
}

/* Overlay semi-oscuro sobre la imagen de fondo */
.gallery::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(7, 7, 7, 0.88) 0%,
    rgba(7, 7, 7, 0.80) 50%,
    rgba(7, 7, 7, 0.90) 100%
  );
  z-index: 0;
  pointer-events: none;
}

/* ── Elementos decorativos de fondo ── */
.gallery__bg-deco {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: var(--z-overlay);
}

.gallery__deco-line {
  position: absolute;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(201, 169, 79, 0.06),
    transparent
  );
  height: 1px;
  width: 100%;
}
.gallery__deco-line--1 { top: 0; }
.gallery__deco-line--2 { bottom: 0; }

.gallery__deco-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.05;
}
.gallery__deco-orb--1 {
  width: 600px;
  height: 600px;
  background: var(--color-gold);
  top: -200px;
  right: -200px;
}
.gallery__deco-orb--2 {
  width: 400px;
  height: 400px;
  background: var(--color-red);
  bottom: -150px;
  left: -100px;
}

/* ════════════════════════════════════════════════════════════════════════════
   HEADER
   ════════════════════════════════════════════════════════════════════════════ */

.gallery__header {
  text-align: center;
  margin-bottom: 64px;
  position: relative;
  z-index: var(--z-content);
}

.gallery__subtitle {
  margin-top: 14px;
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--color-text-secondary);
}

/* ════════════════════════════════════════════════════════════════════════════
   SLIDER WRAP
   ════════════════════════════════════════════════════════════════════════════ */

.gallery__slider-wrap {
  position: relative;
  z-index: var(--z-content);
}

/* ── Track (contenedor de páginas) ── */
.gallery__track {
  position: relative;
  overflow: hidden;
}

/* ── Página (grupo de 6 ítems) ── */
.gallery__page {
  display: none;
  animation: galleryFadeIn 0.5s var(--ease-reveal) both;
}
.gallery__page.is-active {
  display: block;
}
.gallery__page.is-leaving {
  animation: galleryFadeOut 0.3s ease both;
}

@keyframes galleryFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes galleryFadeOut {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-16px);
  }
}

/* ════════════════════════════════════════════════════════════════════════════
   GRID (3 columnas, 2 filas — primer ítem destacado ocupa 2 filas)
   ════════════════════════════════════════════════════════════════════════════ */

.gallery__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: 280px 220px;
  gap: 10px;
}

/* ════════════════════════════════════════════════════════════════════════════
   ÍTEM
   ════════════════════════════════════════════════════════════════════════════ */

.gallery__item {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border-gold);
  cursor: pointer;

  /* Animación de entrada individual */
  opacity: 0;
  transform: translateY(24px);
  transition:
    transform 0.5s var(--ease-reveal),
    opacity   0.5s var(--ease-reveal),
    border-color 0.3s ease,
    box-shadow   0.3s ease;
}

/* Ítem destacado: ocupa 2 filas en la primera columna */
.gallery__item--featured {
  grid-row: span 2;
}

/* Estado visible (activado por JS tras renderizar) */
.gallery__item.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Hover */
.gallery__item:hover {
  border-color: rgba(201, 169, 79, 0.5);
  box-shadow:
    0 0 0 1px rgba(201, 169, 79, 0.2),
    0 20px 60px rgba(0, 0, 0, 0.6);
  transform: translateY(-4px) scale(1.01);
}
.gallery__item--featured:hover {
  transform: translateY(-4px) scale(1.005);
}

/* ── Imagen ── */
.gallery__item-img {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.gallery__item-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.gallery__item:hover .gallery__item-img img {
  transform: scale(1.08);
}

/* ── Placeholder sin imagen ── */
.gallery__no-img {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #111 0%, #1a1a1a 100%);
}

.gallery__no-img-icon {
  font-size: 3rem;
  opacity: 0.2;
}

/* ── Overlay (visible en hover) ── */
.gallery__item-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.92) 0%,
    rgba(0, 0, 0, 0.5)  40%,
    transparent         70%
  );
  display: flex;
  align-items: flex-end;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.35s ease;
}

.gallery__item:hover .gallery__item-overlay {
  opacity: 1;
}

/* Ítems sin descripción: mostrar overlay siempre con gradiente suave */
.gallery__item:not(:hover) .gallery__item-overlay {
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.7) 0%,
    transparent        50%
  );
  opacity: 1;
}

/* ── Contenido del overlay ── */
.gallery__item-content {
  width: 100%;
  transform: translateY(8px);
  transition: transform 0.35s var(--ease-reveal);
}

.gallery__item:hover .gallery__item-content {
  transform: translateY(0);
}

.gallery__item-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  color: var(--color-text-primary);
  margin: 0 0 6px;
  letter-spacing: 1.5px;
  line-height: 1.2;
  text-transform: uppercase;
}

.gallery__item--featured .gallery__item-title {
  font-size: 1.7rem;
}

.gallery__item-desc {
  font-family: var(--font-body);
  font-size: 0.75rem;
  color: rgba(242, 237, 228, 0.7);
  margin: 0 0 10px;
  line-height: 1.5;
  letter-spacing: 0.3px;
  display: none;            /* Sólo visible en hover */
}

.gallery__item:hover .gallery__item-desc {
  display: block;
}

/* Línea dorada animada */
.gallery__item-bar {
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--color-gold), var(--color-gold-light));
  border-radius: 2px;
  transition: width 0.4s var(--ease-reveal) 0.05s;
}

.gallery__item:hover .gallery__item-bar {
  width: 40px;
}

/* ── Badge (número) ── */
.gallery__item-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(201, 169, 79, 0.4);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-body);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--color-gold);
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.gallery__item:hover .gallery__item-badge {
  opacity: 1;
}

/* ════════════════════════════════════════════════════════════════════════════
   CONTROLES DEL SLIDER
   ════════════════════════════════════════════════════════════════════════════ */

.gallery__controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-top: 36px;
}

/* ── Flechas ── */
.gallery__arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: transparent;
  border: 1px solid rgba(201, 169, 79, 0.3);
  border-radius: var(--radius-lg);
  color: var(--color-gold);
  cursor: pointer;
  transition:
    background     0.25s ease,
    border-color   0.25s ease,
    color          0.25s ease,
    transform      0.2s ease,
    opacity        0.2s ease;
  outline: none;
  flex-shrink: 0;
}

.gallery__arrow:hover:not(:disabled) {
  background: rgba(201, 169, 79, 0.12);
  border-color: rgba(201, 169, 79, 0.7);
  color: var(--color-gold-light);
  transform: scale(1.08);
}

.gallery__arrow:active:not(:disabled) {
  transform: scale(0.95);
}

.gallery__arrow:disabled {
  opacity: 0.25;
  cursor: default;
}

/* ── Dots ── */
.gallery__dots {
  display: flex;
  align-items: center;
  gap: 8px;
}

.gallery__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(201, 169, 79, 0.2);
  border: 1px solid rgba(201, 169, 79, 0.4);
  cursor: pointer;
  transition:
    background  0.25s ease,
    width       0.3s  var(--ease-reveal),
    border-radius 0.3s var(--ease-reveal);
  padding: 0;
  outline: none;
}

.gallery__dot.is-active {
  background: var(--color-gold);
  width: 24px;
  border-radius: 4px;
  border-color: var(--color-gold);
}

.gallery__dot:hover:not(.is-active) {
  background: rgba(201, 169, 79, 0.45);
}

/* ── Contador ── */
.gallery__counter {
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  letter-spacing: 1px;
  min-width: 40px;
  text-align: center;
}

.gallery__counter-sep {
  margin: 0 2px;
  color: var(--color-text-muted);
}

/* ── Barra de progreso ── */
.gallery__progress {
  margin-top: 20px;
  height: 2px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 2px;
  overflow: hidden;
}

.gallery__progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--color-gold-dark), var(--color-gold-light));
  border-radius: 2px;
  transition: width 0.4s var(--ease-reveal);
}

/* ════════════════════════════════════════════════════════════════════════════
   ESTADO VACÍO
   ════════════════════════════════════════════════════════════════════════════ */

.gallery__empty {
  text-align: center;
  padding: 80px 24px;
  border: 1px dashed rgba(201, 169, 79, 0.2);
  border-radius: var(--radius-lg);
  background: rgba(201, 169, 79, 0.02);
}

.gallery__empty-icon {
  font-size: 4rem;
  display: block;
  margin-bottom: 24px;
  opacity: 0.4;
}

.gallery__empty-title {
  font-family: var(--font-display);
  font-size: 1.8rem;
  letter-spacing: 3px;
  color: var(--color-text-secondary);
  margin: 0 0 12px;
}

.gallery__empty-desc {
  font-family: var(--font-body);
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin: 0;
}

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

@media ( max-width: 1024px ) {
  .gallery__grid {
    grid-template-rows: 240px 200px;
  }
}

@media ( max-width: 768px ) {
  .gallery {
    padding: 80px 0 70px;
  }

  .gallery__grid {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: 200px 200px 200px;
  }

  /* En mobile/tablet el destacado NO ocupa 2 filas */
  .gallery__item--featured {
    grid-row: span 1;
  }

  .gallery__item-title {
    font-size: 1.1rem;
  }

  .gallery__item--featured .gallery__item-title {
    font-size: 1.1rem;
  }
}

/* Reglas específicas para el modo Slider Móvil (1 foto por página) */
@media ( max-width: 767px ) {
  .gallery__grid {
    grid-template-columns: 1fr;
    grid-template-rows: 320px;
    gap: 0;
  }

  .gallery__item {
    height: 100%;
  }
}

@media ( max-width: 480px ) {
  .gallery__grid {
    grid-template-columns: 1fr;
    grid-template-rows: 260px;
  }

  .gallery__controls {
    gap: 12px;
  }

  .gallery__arrow {
    width: 40px;
    height: 40px;
  }
}

/* ════════════════════════════════════════════════════════════════════════════
   ÍCONO ZOOM (en overlay de cada ítem)
   ════════════════════════════════════════════════════════════════════════════ */

/* Reajuste del overlay para acomodar el ícono arriba y el contenido abajo */
.gallery__item-overlay {
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
}

.gallery__item-zoom {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(201, 169, 79, 0.15);
  border: 1px solid rgba(201, 169, 79, 0.5);
  color: #F0D060;
  opacity: 0;
  transform: scale(0.7);
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  flex-shrink: 0;
  backdrop-filter: blur(4px);
}

.gallery__item:hover .gallery__item-zoom {
  opacity: 1;
  transform: scale(1);
}

.gallery__item[data-lightbox-src] {
  cursor: zoom-in;
}

/* ════════════════════════════════════════════════════════════════════════════
   LIGHTBOX
   ════════════════════════════════════════════════════════════════════════════ */

body.gn-lb-open { overflow: hidden; }

.gn-lb {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.gn-lb--open { opacity: 1; pointer-events: auto; }

.gn-lb__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.94);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.gn-lb__close {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 10;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 50%;
  color: rgba(255,255,255,0.8);
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.2s;
  outline: none;
}
.gn-lb__close:hover {
  background: rgba(212,32,32,0.25);
  border-color: rgba(212,32,32,0.5);
  color: #fff;
  transform: rotate(90deg);
}
.gn-lb__close:focus-visible { outline: 2px solid #C9A94F; outline-offset: 3px; }

.gn-lb__stage {
  position: relative;
  z-index: 5;
  max-width: 90vw;
  max-height: 82vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gn-lb__img-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gn-lb__img {
  display: block;
  max-width: 90vw;
  max-height: 80vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 0 0 1px rgba(201,169,79,0.15), 0 40px 80px rgba(0,0,0,0.7);
  opacity: 0;
  transform: scale(0.97);
  transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.16,1,0.3,1);
}

.gn-lb__spinner {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
}
.gn-lb__spinner-ring {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(201,169,79,0.2);
  border-top-color: #C9A94F;
  border-radius: 50%;
  animation: lbSpin 0.8s linear infinite;
}
@keyframes lbSpin { to { transform: rotate(360deg); } }

.gn-lb__arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(201,169,79,0.25);
  border-radius: 4px;
  color: #C9A94F;
  cursor: pointer;
  transition: background 0.25s, border-color 0.25s, color 0.25s, transform 0.2s;
  outline: none;
}
.gn-lb__arrow--prev { left: 20px; }
.gn-lb__arrow--next { right: 20px; }
.gn-lb__arrow:hover { background: rgba(201,169,79,0.15); border-color: rgba(201,169,79,0.6); color: #F0D060; }
.gn-lb__arrow--prev:hover { transform: translateY(-50%) translateX(-3px); }
.gn-lb__arrow--next:hover { transform: translateY(-50%) translateX(3px); }
.gn-lb__arrow:focus-visible { outline: 2px solid #C9A94F; outline-offset: 3px; }

.gn-lb__info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 80px;
  background: linear-gradient(to top, rgba(0,0,0,0.75) 0%, transparent 100%);
}
.gn-lb__info-left { flex: 1; min-width: 0; }
.gn-lb__title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.3rem;
  letter-spacing: 2px;
  color: #F2EDE4;
  margin: 0 0 4px;
  text-transform: uppercase;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gn-lb__desc {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.8rem;
  color: rgba(242,237,228,0.6);
  margin: 0;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gn-lb__counter {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  color: #C9A94F;
  letter-spacing: 1px;
  white-space: nowrap;
  flex-shrink: 0;
}

@media (max-width: 768px) {
  .gn-lb__arrow--prev { left: 10px; }
  .gn-lb__arrow--next { right: 10px; }
  .gn-lb__arrow { width: 42px; height: 42px; }
  .gn-lb__info { padding: 16px 60px; }
  .gn-lb__title { font-size: 1rem; }
}
@media (max-width: 480px) {
  .gn-lb__arrow--prev { left: 6px; }
  .gn-lb__arrow--next { right: 6px; }
  .gn-lb__img { max-height: 60vh; }
  .gn-lb__info { padding: 12px 52px; flex-direction: column; align-items: flex-start; gap: 4px; }
}
