/*
 * videos.css — Estilos de la plantilla Vídeos GMAO-GSAT.
 *
 * Depende de main.css. Prefijo: vi-
 *
 * Paleta: fondo oscuro tipo estudio/pantalla. Colores de categoría:
 *   orange → --color-primary / --color-accent
 *   red    → #ef4444
 *   teal   → #0d9488
 *   blue   → #2563eb
 *
 * Estructura:
 *   1. Hero
 *   2. Galería de vídeos (grid + cards)
 *   3. Lightbox de vídeo
 *   4. Banda demo (CTA)
 *   5. Animaciones
 *   6. Responsive
 */

/* ─── 1. Hero ──────────────────────────────────────────────────────────── */

.vi-hero {
  position: relative;
  overflow: hidden;
  padding: 6.5rem 0 5rem;
  background: linear-gradient(155deg, var(--color-dark) 0%, #0f1e2d 60%, #0b1520 100%);
  color: var(--color-dark-on);
}

.vi-hero__backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 60% at 10% 40%,  rgba(216,131,41,.22)  0%, transparent 55%),
    radial-gradient(ellipse 60% 50% at 90% 60%,  rgba(255,171,0,.12)   0%, transparent 50%),
    radial-gradient(ellipse 40% 40% at 50% 100%, rgba(16,32,47,.9)     0%, transparent 60%);
  pointer-events: none;
}

.vi-hero__inner {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3rem;
  align-items: center;
}

.vi-hero__copy .eyebrow { margin-bottom: .75rem; }

.vi-hero__copy h1 {
  font-family: "Barlow Semi Condensed", sans-serif;
  font-size: clamp(3rem, 7vw, 7rem);
  line-height: .88;
  letter-spacing: -.04em;
  margin: 0 0 1.5rem;
  color: var(--color-dark-on);
}

.vi-hero__lead {
  font-size: 1.1rem;
  color: rgba(244,247,251,.72);
  max-width: 54ch;
  margin: 0 0 1.75rem;
  line-height: 1.67;
}

.vi-hero__meta {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  font-size: .82rem;
  letter-spacing: .07em;
  text-transform: uppercase;
  font-weight: 600;
  color: rgba(244,247,251,.4);
}

.vi-hero__meta span::before {
  content: "▸ ";
  color: var(--color-primary);
  font-size: .9em;
}

/* Play icon decorativo */
.vi-hero__play-icon {
  width: 9rem;
  height: 9rem;
  color: rgba(216,131,41,.2);
  transition: color .3s;
}
.vi-hero__play-icon:hover { color: rgba(216,131,41,.35); }
.vi-hero__play-icon svg { width: 100%; height: 100%; }

/* ─── 2. Galería ─────────────────────────────────────────────────────── */

.vi-gallery {
  background: var(--color-light);
}

.vi-gallery .section-heading { text-align: center; max-width: 60ch; margin: 0 auto 3.5rem; }

/* Grid: 3 columnas, última fila centrada si queda huérfana */
.vi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

/* ─── Tarjeta de vídeo ─── */
.vi-card {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  box-shadow: 0 4px 20px rgba(16,32,47,.07);
  transition: transform .3s ease, box-shadow .3s ease;
}

.vi-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); }

/* Thumbnail placeholder */
.vi-card__thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, #0f1e2d 0%, #1a2e40 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
}

/* Grid sutil de fondo */
.vi-card__thumb::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.03) 1px, transparent 1px);
  background-size: 28px 28px;
}

/* Icono temático centrado */
.vi-card__thumb-icon {
  width: 3.5rem;
  height: 3.5rem;
  color: rgba(255,255,255,.18);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  transition: opacity .25s;
}
.vi-card__thumb-icon svg { width: 100%; height: 100%; }

/* Botón play central */
.vi-card__play {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  background: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
  box-shadow: 0 0 0 6px rgba(216,131,41,.2);
  transition: transform .25s, box-shadow .25s, background .25s;
}

.vi-card__play svg {
  width: 1.2rem;
  height: 1.2rem;
  fill: white;
  margin-left: .15rem; /* optical centering del triángulo */
}

.vi-card:hover .vi-card__play {
  transform: scale(1.12);
  box-shadow: 0 0 0 10px rgba(216,131,41,.15);
  background: var(--color-accent);
}

.vi-card:hover .vi-card__thumb-icon { opacity: 0; }

/* Colores de acento por categoría */
.vi-card--red    .vi-card__play  { background: #ef4444; box-shadow: 0 0 0 6px rgba(239,68,68,.2); }
.vi-card--red:hover .vi-card__play { background: #f87171; box-shadow: 0 0 0 10px rgba(239,68,68,.15); }

.vi-card--teal   .vi-card__play  { background: #0d9488; box-shadow: 0 0 0 6px rgba(13,148,136,.2); }
.vi-card--teal:hover .vi-card__play { background: #14b8a6; box-shadow: 0 0 0 10px rgba(13,148,136,.15); }

.vi-card--blue   .vi-card__play  { background: #2563eb; box-shadow: 0 0 0 6px rgba(37,99,235,.2); }
.vi-card--blue:hover .vi-card__play { background: #3b82f6; box-shadow: 0 0 0 10px rgba(37,99,235,.15); }

/* Banda de color sutil en thumbnail por categoría */
.vi-card--orange .vi-card__thumb { background: linear-gradient(135deg, #1a1200 0%, #1e1a0e 100%); }
.vi-card--red    .vi-card__thumb { background: linear-gradient(135deg, #1a0a0a 0%, #1e1010 100%); }
.vi-card--teal   .vi-card__thumb { background: linear-gradient(135deg, #001a18 0%, #0b1e1c 100%); }
.vi-card--blue   .vi-card__thumb { background: linear-gradient(135deg, #050d1a 0%, #0c1525 100%); }

/* Embed de vídeo real */
.vi-card__embed {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #000;
}

.vi-card__embed iframe,
.vi-card__embed video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  background: #000;
}

/* Cuerpo de la tarjeta */
.vi-card__body {
  display: flex;
  flex-direction: column;
  gap: .6rem;
  padding: 1.4rem 1.5rem 1.6rem;
  flex: 1;
}

.vi-card__cat {
  display: inline-block;
  font-size: .73rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: .2rem .65rem;
  border-radius: var(--radius-sm);
  width: fit-content;
}

/* Colores chip por categoría */
.vi-card--orange .vi-card__cat { background: rgba(216,131,41,.12); color: var(--color-primary-strong); }
.vi-card--red    .vi-card__cat { background: rgba(239,68,68,.1);   color: #b91c1c; }
.vi-card--teal   .vi-card__cat { background: rgba(13,148,136,.12); color: #0f766e; }
.vi-card--blue   .vi-card__cat { background: rgba(37,99,235,.1);   color: #1d4ed8; }

.vi-card__body h3 {
  font-family: "Barlow Semi Condensed", sans-serif;
  font-size: 1.25rem;
  letter-spacing: -.015em;
  margin: 0;
  color: var(--color-secondary);
  line-height: 1.15;
}

.vi-card__body p {
  font-size: .88rem;
  line-height: 1.6;
  color: var(--color-muted);
  margin: 0;
  flex: 1;
}

.vi-card__link {
  display: inline-block;
  font-size: .88rem;
  font-weight: 700;
  color: var(--color-primary-strong);
  text-decoration: none;
  letter-spacing: .01em;
  transition: color .2s, transform .2s;
  margin-top: .25rem;
}
.vi-card__link:hover { color: var(--color-primary-hover); transform: translateX(3px); }

/* ─── 3. Banda demo ───────────────────────────────────────────────────── */

.vi-demo {
  position: relative;
  overflow: hidden;
  background: linear-gradient(145deg, var(--color-dark) 0%, #0e1d2c 100%);
  color: var(--color-dark-on);
}

.vi-demo__backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 65% 70% at 20% 50%, rgba(216,131,41,.2)  0%, transparent 55%),
    radial-gradient(ellipse 55% 60% at 80% 50%, rgba(255,171,0,.12)  0%, transparent 50%);
  pointer-events: none;
}

.vi-demo__inner {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3rem;
  align-items: center;
}

.vi-demo__copy .eyebrow { margin-bottom: .75rem; }

.vi-demo__copy h2 {
  font-family: "Barlow Semi Condensed", sans-serif;
  font-size: clamp(1.8rem, 3.2vw, 2.8rem);
  line-height: 1;
  letter-spacing: -.025em;
  margin: 0 0 .9rem;
  color: var(--color-dark-on);
}

.vi-demo__copy p {
  font-size: 1rem;
  line-height: 1.68;
  color: rgba(244,247,251,.68);
  margin: 0;
  max-width: 52ch;
}

.vi-demo__actions {
  display: flex;
  flex-direction: column;
  gap: .85rem;
  min-width: 200px;
  flex-shrink: 0;
}

.vi-btn--light {
  background: rgba(255,255,255,.1);
  color: var(--color-dark-on);
  border: 1px solid rgba(255,255,255,.2);
  text-align: center;
}
.vi-btn--light:hover,
.vi-btn--light:focus-visible {
  background: rgba(255,255,255,.18);
  color: var(--color-dark-on);
}

/* ─── 4. Animaciones ─────────────────────────────────────────────────── */

/* Stagger cards */
.vi-grid .vi-card:nth-child(1) { --stagger: 0s; }
.vi-grid .vi-card:nth-child(2) { --stagger: .08s; }
.vi-grid .vi-card:nth-child(3) { --stagger: .16s; }
.vi-grid .vi-card:nth-child(4) { --stagger: .08s; }
.vi-grid .vi-card:nth-child(5) { --stagger: .16s; }

/* Pulso suave en el play button */
@keyframes playPulse {
  0%, 100% { box-shadow: 0 0 0 6px rgba(216,131,41,.2); }
  50%       { box-shadow: 0 0 0 12px rgba(216,131,41,.08); }
}
.vi-card--orange .vi-card__play { animation: playPulse 2.4s ease-in-out infinite; }

@keyframes playPulseRed {
  0%, 100% { box-shadow: 0 0 0 6px rgba(239,68,68,.2); }
  50%       { box-shadow: 0 0 0 12px rgba(239,68,68,.08); }
}
.vi-card--red .vi-card__play { animation: playPulseRed 2.4s ease-in-out infinite; }

@keyframes playPulseTeal {
  0%, 100% { box-shadow: 0 0 0 6px rgba(13,148,136,.2); }
  50%       { box-shadow: 0 0 0 12px rgba(13,148,136,.08); }
}
.vi-card--teal .vi-card__play { animation: playPulseTeal 2.4s ease-in-out infinite; }

@keyframes playPulseBlue {
  0%, 100% { box-shadow: 0 0 0 6px rgba(37,99,235,.2); }
  50%       { box-shadow: 0 0 0 12px rgba(37,99,235,.08); }
}
.vi-card--blue .vi-card__play { animation: playPulseBlue 2.4s ease-in-out infinite; }

/* Desactivar pulso al hover */
.vi-card:hover .vi-card__play { animation: none; }

/* ─── 5. Responsive ─────────────────────────────────────────────────────── */

@media (max-width: 1080px) {
  .vi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 820px) {
  .vi-hero { padding: 5rem 0 3.5rem; }

  .vi-hero__inner {
    grid-template-columns: 1fr;
  }

  .vi-hero__play-icon {
    display: none;
  }

  .vi-demo__inner {
    grid-template-columns: 1fr;
  }

  .vi-demo__actions {
    flex-direction: row;
    flex-wrap: wrap;
    min-width: unset;
  }
}

@media (max-width: 560px) {
  .vi-grid {
    grid-template-columns: 1fr;
  }
}

/* ─── 3. Lightbox de vídeo ───────────────────────────────────────────── */

/* Bloquea el scroll del body mientras el modal está abierto */
body.vi-modal-open { overflow: hidden; }

/* Overlay completo — oculto por defecto sin usar display:none */
.vi-modal {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .25s ease, visibility .25s ease;
}

.vi-modal.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Fondo oscuro semitransparente */
.vi-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 14, 22, .88);
  backdrop-filter: blur(4px);
  cursor: pointer;
}

/* Caja del reproductor — pequeño y centrado */
.vi-modal__box {
  position: relative;
  z-index: 1;
  width: min(720px, 92vw);
  background: #0d1b29;
  border-radius: var(--radius-lg, 12px);
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0,0,0,.7);
  transform: scale(.92);
  transition: transform .25s ease;
}

.vi-modal.is-open .vi-modal__box {
  transform: scale(1);
}

/* Título encima del vídeo */
.vi-modal__title {
  margin: 0;
  padding: .75rem 3.5rem .75rem 1.25rem;
  font-size: .88rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: rgba(244,247,251,.55);
  background: #0a1520;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Contenedor proporcional 16:9 */
.vi-modal__player {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
}

.vi-modal__player video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* Botón cerrar */
.vi-modal__close {
  position: absolute;
  top: .5rem;
  right: .5rem;
  z-index: 2;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,.1);
  color: rgba(244,247,251,.8);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .2s, color .2s;
  padding: 0;
}

.vi-modal__close:hover,
.vi-modal__close:focus-visible {
  background: rgba(255,255,255,.22);
  color: #fff;
  outline: 2px solid rgba(255,255,255,.4);
  outline-offset: 2px;
}

.vi-modal__close svg {
  width: 1rem;
  height: 1rem;
  pointer-events: none;
}

/* Embed iframe (por si se usa YouTube en el futuro) */
.vi-card__embed iframe,
.vi-card__embed video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  background: #000;
}
