/* ==========================================================================
   GALERÍA - FICHAS DE VÍDEO
   Conviven con las imágenes dentro del carrusel de la galería (#ourPromotions).
   Reutiliza .promotions-listing / .item, solo aporta lo propio de la ficha.
   ========================================================================== */

/* La ficha define su propia altura para no colapsar nunca: la miniatura puede
   faltar (embed sin póster) y el resto de piezas van posicionadas en absoluto. */
#ourPromotions .gallery-video {
  position: relative;
  min-height: 15rem;
  aspect-ratio: 3 / 2;
  background-color: #23281f;
  overflow: hidden;
}

#ourPromotions .gallery-video__media {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* La miniatura es un <video>: los clics deben llegar al botón de apertura */
  pointer-events: none;
}

/* Velo oscuro para garantizar contraste del icono y del título sobre cualquier fotograma */
#ourPromotions .gallery-video:before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.35);
  transition: background-color 0.25s ease-out;
  pointer-events: none;
  z-index: 1;
}

#ourPromotions .gallery-video:hover:before {
  background-color: rgba(0, 0, 0, 0.2);
}

/* Mientras se previsualiza, el velo se aclara para no ensuciar el vídeo */
#ourPromotions .gallery-video.is-playing:before {
  background-color: rgba(0, 0, 0, 0.15);
}

/* --------------------------------------------------------------------------
   Botón de apertura: cubre la ficha entera
   -------------------------------------------------------------------------- */

#ourPromotions .gallery-video__open {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  margin: 0;
  border: 0;
  background: none;
  cursor: pointer;
  z-index: 2;
}

#ourPromotions .gallery-video__open:focus-visible {
  outline: 3px solid #fff;
  outline-offset: -6px;
}

/* Icono de play: triángulo dentro de un círculo, sin depender de fuentes de iconos */
#ourPromotions .gallery-video__play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 4.375rem;
  height: 4.375rem;
  border: 1px solid #fff;
  border-radius: 100%;
  background-color: rgba(0, 0, 0, 0.35);
  transition: background-color 0.25s ease-out, opacity 0.25s ease-out;
}

#ourPromotions .gallery-video__play:before {
  content: "";
  position: absolute;
  top: 50%;
  left: 54%;
  transform: translate(-50%, -50%);
  width: 0;
  height: 0;
  border-top: 0.75rem solid transparent;
  border-bottom: 0.75rem solid transparent;
  border-left: 1.25rem solid #fff;
}

#ourPromotions .gallery-video__open:hover .gallery-video__play {
  background-color: var(--primary-color);
}

/* Si ya se está reproduciendo, el play estorba: se atenúa y vuelve al enfocar o pasar por encima */
#ourPromotions .gallery-video.is-playing .gallery-video__play {
  opacity: 0;
}

#ourPromotions .gallery-video.is-playing .gallery-video__open:hover .gallery-video__play,
#ourPromotions .gallery-video.is-playing .gallery-video__open:focus-visible .gallery-video__play {
  opacity: 1;
}

/* --------------------------------------------------------------------------
   Control de pausa de la previsualización automática
   -------------------------------------------------------------------------- */

#ourPromotions .gallery-video__toggle {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  margin: 0;
  border: 1px solid #fff;
  border-radius: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  cursor: pointer;
  transition: background-color 0.25s ease-out;
  z-index: 3;
}

#ourPromotions .gallery-video__toggle:hover {
  background-color: var(--primary-color);
}

#ourPromotions .gallery-video__toggle:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 2px;
}

/* Icono de pausa: dos barras dibujadas con los bordes laterales */
#ourPromotions .gallery-video__toggle-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 0.75rem;
  height: 0.875rem;
  border-left: 0.25rem solid #fff;
  border-right: 0.25rem solid #fff;
}

/* Pausado por el usuario: la misma pieza se convierte en un triángulo de play */
#ourPromotions .gallery-video.is-paused-by-user .gallery-video__toggle-icon {
  width: 0;
  height: 0;
  border-left: 0.875rem solid #fff;
  border-right: 0;
  border-top: 0.5rem solid transparent;
  border-bottom: 0.5rem solid transparent;
  transform: translate(-35%, -50%);
}

/* --------------------------------------------------------------------------
   Título
   -------------------------------------------------------------------------- */

#ourPromotions .gallery-video__title {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  padding: 1.25rem 1.5rem;
  font-family: var(--font-family-1);
  font-size: 1.25rem;
  line-height: 1.4;
  color: #fff;
  pointer-events: none;
  z-index: 3;
}

/* --------------------------------------------------------------------------
   Lightbox
   -------------------------------------------------------------------------- */

/* El JS fija la caja de Colorbox (#cboxLoadedContent) según el viewport y la
   proporción del vídeo: aquí solo hay que ocuparla por completo. Con height:auto
   el vídeo desbordaba la caja y aparecía la barra de scroll del lightbox. */
.gallery-video-modal {
  width: 100%;
  height: 100%;
  background-color: #000;
}

.gallery-video-modal video {
  display: block;
  width: 100%;
  height: 100%;
  /* contain y no cover: nunca se recorta imagen del vídeo */
  object-fit: contain;
  background-color: #000;
}

@media only screen and (max-width: 767px) {
  #ourPromotions .gallery-video__play {
    width: 3.4375rem;
    height: 3.4375rem;
  }

  #ourPromotions .gallery-video__play:before {
    border-top-width: 0.5625rem;
    border-bottom-width: 0.5625rem;
    border-left-width: 0.9375rem;
  }

  #ourPromotions .gallery-video__title {
    padding: 0.9375rem;
    font-size: 1.125rem;
  }
}

/* Respeta la preferencia del sistema de movimiento reducido: sin previsualización
   automática, el control de pausa deja de tener sentido y se oculta. */
@media (prefers-reduced-motion: reduce) {
  #ourPromotions .gallery-video:before,
  #ourPromotions .gallery-video__play,
  #ourPromotions .gallery-video__toggle {
    transition: none;
  }

  #ourPromotions .gallery-video__toggle {
    display: none;
  }

  #ourPromotions .gallery-video.is-playing .gallery-video__play {
    opacity: 1;
  }
}
