/* ============================================================
   gallery.css — Maná 1979 Gastro Bar
   Estilos de la galería: carrusel infinito de fotos,
   carrusel de videos y lightbox.
   ============================================================ */

/* ══════════════════════════════════════════════
   GALLERY SECTION WRAPPER
══════════════════════════════════════════════ */
.gallery-section {
  background: rgba(6, 13, 31, 0.6);
  border-top: 1px solid rgba(28, 168, 200, 0.15);
  padding-bottom: 4rem;
  overflow: hidden;
}

.gallery-section-sub {
  font-family: 'Josefin Sans', sans-serif;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .25em;
  text-transform: uppercase;
  color: var(--aqua);
  margin-bottom: .5rem;
}

.gallery-section-title {
  font-family: 'DM Serif Display', serif;
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 400;
  color: var(--foam);
  line-height: 1.1;
}

/* ══════════════════════════════════════════════
   CAROUSEL CONTAINER (usado por fotos Y videos)
══════════════════════════════════════════════ */
.carousel-container {
  padding: 0 0 2.5rem;
}

.carousel-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  font-family: 'Josefin Sans', sans-serif;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--aqua-light);
  padding: 1.8rem 1rem 1.2rem;
}

/* ══════════════════════════════════════════════
   CARRUSEL INFINITO DE FOTOS
══════════════════════════════════════════════ */
.infinite-track-wrapper {
  width: 100%;
  overflow: hidden;
  /* oculta lo que desborda a los lados */
  cursor: grab;
  -webkit-user-select: none;
  user-select: none;
  /* máscara difuminada en los bordes */
  -webkit-mask-image: linear-gradient(
    to right,
    transparent 0%,
    black 6%,
    black 94%,
    transparent 100%
  );
  mask-image: linear-gradient(
    to right,
    transparent 0%,
    black 6%,
    black 94%,
    transparent 100%
  );
}

.infinite-track-wrapper:active { cursor: grabbing; }

.infinite-track {
  display: flex;
  gap: 19px;          /* debe coincidir con getGap() en JS */
  /* NO tiene width fijo — se extiende según sus hijos */
  will-change: transform;
}

/* Cada tarjeta de foto */
.inf-item {
  flex: 0 0 auto;
  /* width se asigna por JS (200px / 160px / 130px) */
  aspect-ratio: 9 / 16;
  border-radius: 14px;
  overflow: hidden;
  position: relative;
  cursor: pointer;
  background: #071428;
  border: 1px solid rgba(28, 168, 200, 0.18);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
  transition: transform .3s, box-shadow .3s;
  -webkit-user-select: none;
  user-select: none;
}

.inf-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
  -webkit-user-drag: none;
  user-drag: none;
}

/* Dots de fotos */
.carousel-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding-top: 1rem;
  flex-wrap: wrap;
}

.carousel-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  padding: 0;
  cursor: pointer;
  transition: background .25s, transform .25s;
  flex-shrink: 0;
}

.carousel-dot.active {
  background: var(--aqua);
  transform: scale(1.4);
}

.carousel-dot:hover { background: var(--aqua-light); }

/* ══════════════════════════════════════════════
   CARRUSEL DE VIDEOS (scroll snap)
══════════════════════════════════════════════ */
.carousel-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 3.5rem;   /* espacio para los botones laterales */
  overflow: hidden;
}

.video-carousel {
  display: flex;
  gap: 18px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding: .5rem .25rem 1rem;
  flex: 1;
}

.video-carousel::-webkit-scrollbar { display: none; }

/* Cada tarjeta de video */
.carousel-item {
  flex: 0 0 auto;
  width: clamp(160px, 28vw, 240px);
  aspect-ratio: 9 / 16;
  border-radius: 14px;
  overflow: hidden;
  position: relative;
  cursor: pointer;
  scroll-snap-align: start;
  background: #071428;
  border: 1px solid rgba(28, 168, 200, 0.18);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
  transition: transform .3s, box-shadow .3s;
}

.carousel-item:hover {
  transform: scale(1.04) translateY(-6px);
  box-shadow: 0 16px 36px rgba(0, 0, 0, .7), 0 0 0 1px var(--aqua);
}

.carousel-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

/* Overlay de reproducción */
.video-overlay {
  position: absolute;
  inset: 0;
  background: rgba(6, 13, 31, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .3s;
}

.carousel-item:hover .video-overlay {
  background: rgba(6, 13, 31, 0.55);
}

.play-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(28, 168, 200, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: #fff;
  box-shadow: 0 4px 18px rgba(28, 168, 200, 0.5);
  transition: transform .25s, background .25s;
}

.carousel-item:hover .play-icon {
  transform: scale(1.15);
  background: var(--aqua);
}

/* Botones prev/next del carrusel de videos */
.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(6, 13, 31, 0.85);
  border: 1px solid rgba(28, 168, 200, 0.35);
  color: var(--aqua-light);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .25s, border-color .25s, transform .25s;
  flex-shrink: 0;
}

.carousel-btn:hover {
  background: var(--aqua);
  border-color: var(--aqua);
  color: #fff;
  transform: translateY(-50%) scale(1.1);
}

.carousel-btn--prev { left: .5rem; }
.carousel-btn--next { right: .5rem; }

/* ══════════════════════════════════════════════
   LIGHTBOX
══════════════════════════════════════════════ */
.glb {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(3, 8, 15, 0.93);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.glb.open {
  opacity: 1;
  pointer-events: all;
}

.glb-content {
  position: relative;
  max-width: min(92vw, 560px);
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.glb-close {
  position: absolute;
  top: -2.5rem;
  right: 0;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.75);
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  transition: color .2s, transform .2s;
  z-index: 10;
}

.glb-close:hover {
  color: #fff;
  transform: rotate(90deg) scale(1.15);
}

.glb-media {
  max-width: 100%;
  max-height: 85vh;
  border-radius: 14px;
  object-fit: contain;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .8);
  display: block;
}

/* ══════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════ */
@media (max-width: 768px) {
  .carousel-wrapper {
    padding: 0 2.8rem;
  }

  .carousel-item {
    width: clamp(130px, 38vw, 200px);
  }

  .carousel-btn {
    width: 34px;
    height: 34px;
    font-size: .9rem;
  }

  .play-icon {
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }

  .infinite-track {
    gap: 12px;   /* coincide con getGap() < 480px */
  }
}

@media (max-width: 480px) {
  .carousel-wrapper {
    padding: 0 2.4rem;
  }

  .carousel-btn--prev { left: .25rem; }
  .carousel-btn--next { right: .25rem; }
}

/* ══════════════════════════════════════════════
   MODO DÍA — overrides de gallery
══════════════════════════════════════════════ */
body.day-mode .gallery-section {
  background: rgba(200, 235, 252, 0.6);
  border-top-color: rgba(14, 127, 170, 0.18);
}

body.day-mode .gallery-section-title { color: var(--text-main); }
body.day-mode .gallery-section-sub   { color: var(--aqua); }
body.day-mode .carousel-title        { color: var(--aqua); }

body.day-mode .inf-item,
body.day-mode .carousel-item {
  border-color: rgba(14, 127, 170, 0.25);
  box-shadow: 0 4px 16px rgba(14, 127, 170, 0.15);
}

body.day-mode .carousel-btn {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(14, 127, 170, 0.3);
  color: var(--aqua);
}

body.day-mode .carousel-btn:hover {
  background: var(--aqua);
  color: #fff;
}

body.day-mode .play-icon {
  background: rgba(14, 127, 170, 0.88);
}

body.day-mode .video-overlay {
  background: rgba(200, 235, 252, 0.25);
}

body.day-mode .carousel-dot {
  background: rgba(14, 127, 170, 0.25);
}

body.day-mode .carousel-dot.active {
  background: var(--aqua);
}

body.day-mode .glb {
  background: rgba(200, 235, 252, 0.92);
}

body.day-mode .glb-close {
  color: var(--text-main);
}
