/*
 * Enlace "Mira el tutorial en video" + ventana modal con el video de YouTube.
 * Marcado: <button type="button" class="video-tutorial-link" data-video-tutorial="ID">.
 * Lógica en js/video-tutorial.js.
 */

/* Enlace discreto: texto con ícono de play, sin fondo de botón. */
.video-tutorial-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 2px;
  border: 0;
  background: none;
  font: inherit;
  font-size: 17px;
  font-weight: 500;
  line-height: 1.4;
  color: #0a102f;
  cursor: pointer;
}
.video-tutorial-link__icon {
  flex: none;
  width: 32px;
  height: 32px;
  transition: transform 0.15s ease;
}
.video-tutorial-link__icon circle { fill: #0a102f; }
.video-tutorial-link__icon path { fill: #fff; }
.video-tutorial-link__text {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  text-decoration-color: rgba(10, 16, 47, 0.35);
  transition: text-decoration-color 0.15s ease;
}
.video-tutorial-link__time { opacity: 0.7; font-weight: 400; }
.video-tutorial-link:hover .video-tutorial-link__icon { transform: scale(1.08); }
.video-tutorial-link:hover .video-tutorial-link__text { text-decoration-color: currentColor; }
.video-tutorial-link:focus { outline: none; }
.video-tutorial-link:focus-visible { outline: 2px solid currentColor; outline-offset: 4px; border-radius: 6px; }

/* Variante para fondos oscuros (sección "¿Cómo probar CSReporter?"). */
.video-tutorial-link--dark { color: #fff; }
.video-tutorial-link--dark .video-tutorial-link__icon circle { fill: #bef8fc; }
.video-tutorial-link--dark .video-tutorial-link__icon path { fill: #0a102f; }
.video-tutorial-link--dark .video-tutorial-link__text { text-decoration-color: rgba(190, 248, 252, 0.5); }

/* Botón de play al centro de la imagen del producto (hero). */
.video-tutorial-hero { position: relative; }
.video-tutorial-hero img[data-video-tutorial] { cursor: pointer; transition: filter 0.2s ease; }
.video-tutorial-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  cursor: pointer;
}
.video-tutorial-play__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: #2287db; /* azul del botón principal del sitio */
  box-shadow: 0 0 0 10px rgba(255, 255, 255, 0.7), 0 14px 34px rgba(10, 16, 47, 0.35);
  transition: transform 0.2s ease, background-color 0.2s ease;
}
.video-tutorial-play__icon svg { display: block; width: 44px; height: 44px; fill: #fff; }
.video-tutorial-play__label {
  padding: 8px 16px;
  border-radius: 999px;
  background: #fff;
  color: #0a102f;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  box-shadow: 0 6px 18px rgba(10, 16, 47, 0.18);
}
.video-tutorial-hero:hover .video-tutorial-play__icon,
.video-tutorial-play:focus-visible .video-tutorial-play__icon { transform: scale(1.07); background: #1a76c4; }
.video-tutorial-hero:hover img[data-video-tutorial] { filter: drop-shadow(rgba(0, 0, 0, 0.2) -10px 13px 29px) brightness(0.94); }
.video-tutorial-play:focus { outline: none; }
.video-tutorial-play:focus-visible .video-tutorial-play__label { outline: 2px solid #2287db; outline-offset: 2px; }

/* Pulso: dos ondas azules que salen del círculo, desfasadas 1 s.
   Solo transform y opacity (las dibuja la tarjeta gráfica: no mueve la página ni afecta Core Web Vitals).
   Van detrás del círculo: el botón es un contexto de apilamiento (z-index: 2) y las ondas tienen z-index: -1. */
.video-tutorial-play { --play-size: 96px; }
.video-tutorial-play::before,
.video-tutorial-play::after {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  z-index: -1;
  width: var(--play-size);
  height: var(--play-size);
  margin-left: calc(var(--play-size) / -2);
  border-radius: 50%;
  background: rgba(34, 135, 219, 0.6);
  pointer-events: none;
  animation: video-tutorial-pulse 2s cubic-bezier(0.2, 0.6, 0.35, 1) infinite;
}
.video-tutorial-play::after { animation-delay: 1s; }
@keyframes video-tutorial-pulse {
  0% { transform: scale(1); opacity: 0.85; }
  100% { transform: scale(1.9); opacity: 0; }
}
/* Quien pidió menos movimiento en su sistema no ve el pulso. */
@media (prefers-reduced-motion: reduce) {
  .video-tutorial-play::before,
  .video-tutorial-play::after { animation: none; opacity: 0; }
}

@media (max-width: 767.98px) {
  .video-tutorial-play { gap: 10px; --play-size: 64px; }
  .video-tutorial-play__icon { width: 64px; height: 64px; box-shadow: 0 0 0 7px rgba(255, 255, 255, 0.7), 0 10px 24px rgba(10, 16, 47, 0.35); }
  .video-tutorial-play__icon svg { width: 30px; height: 30px; }
  .video-tutorial-play__label { padding: 6px 12px; font-size: 13px; }
}

/* Contenedores donde va el enlace. */
.video-tutorial-wrap { margin-top: 40px; text-align: center; }

/* Ventana modal. El tema pone margin: 0 a todo; se regresa el centrado del <dialog>. */
.video-tutorial-modal {
  position: fixed;
  inset: 0;
  margin: auto;
  height: fit-content;
  width: min(960px, 92vw);
  max-width: none;
  padding: 0;
  border: 0;
  background: transparent;
  overflow: visible;
  outline: none;
}
.video-tutorial-modal::backdrop { background: rgba(10, 16, 47, 0.82); }
.video-tutorial-modal__frame {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}
.video-tutorial-modal__frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
/* Círculo blanco montado sobre la esquina superior derecha del video. */
.video-tutorial-modal__close {
  position: absolute;
  top: -16px;
  right: -16px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #fff;
  color: #0a102f;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s ease;
}
.video-tutorial-modal__close:hover { transform: scale(1.08); }
.video-tutorial-modal__close:focus { outline: none; }
.video-tutorial-modal__close:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
/* Área táctil de 44 px sin agrandar el círculo. */
.video-tutorial-modal__close::after { content: ""; position: absolute; inset: -6px; border-radius: 50%; }
