/* Video Modal — popup con video local, se abre por defecto al cargar */

.video-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 0.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.video-modal.is-open {
  opacity: 1;
  pointer-events: auto;
}

.video-modal__card {
  background: #fff;
  border-radius: clamp(0.75rem, 2vw, 1.75rem);
  padding: clamp(0.375rem, 1vw, 0.75rem);
  width: min(99vw, 90rem);
  position: relative;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.3);
  animation: modal-enter 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes modal-enter {
  from { transform: scale(0.88); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .video-modal__card { animation: none; }
}

.video-modal__close {
  position: absolute;
  top: -0.75rem;
  right: -0.75rem;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: var(--color-purple);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  box-shadow: 0 4px 14px rgba(135, 104, 245, 0.5);
  transition: transform var(--transition-fast), background var(--transition-fast);
}

.video-modal__close:hover {
  transform: scale(1.12);
  background: var(--color-purple-dark);
}

.video-modal__player {
  position: relative;
  aspect-ratio: 16 / 10;
  border-radius: clamp(0.5rem, 1vw, 1rem);
  overflow: hidden;
  background: #000;
}

.video-modal__video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  cursor: pointer;
}

/* Controls bar */
.video-modal__controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.75rem 1rem;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.65) 0%, transparent 100%);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  z-index: 1;
}

.video-modal__toggle,
.video-modal__mute {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  flex-shrink: 0;
  transition: transform var(--transition-fast);
}

.video-modal__toggle:hover,
.video-modal__mute:hover {
  transform: scale(1.15);
}

.video-modal__toggle .icon-play  { display: none; }
.video-modal__toggle .icon-pause { display: block; }
.video-modal__player.is-paused .video-modal__toggle .icon-play  { display: block; }
.video-modal__player.is-paused .video-modal__toggle .icon-pause { display: none; }

.video-modal__volume {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

.video-modal__mute .icon-vol-off { display: none; }
.video-modal__player.is-muted .video-modal__mute .icon-vol-on  { display: none; }
.video-modal__player.is-muted .video-modal__mute .icon-vol-off { display: block; }

.video-modal__vol-slider {
  width: clamp(4rem, 8vw, 7rem);
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.35);
  outline: none;
  cursor: pointer;
}

.video-modal__vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
}

.video-modal__vol-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  border: none;
  cursor: pointer;
}

/* Spinner de carga — visible mientras el video está buffereando */
.video-modal__player.is-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 3rem;
  height: 3rem;
  border: 3px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: modal-spin 0.75s linear infinite;
  z-index: 4;
  pointer-events: none;
}

@keyframes modal-spin {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .video-modal__player.is-loading::after { animation: none; opacity: 0.6; }
}

/* Unmute prompt — aparece solo cuando el navegador forzó el mute por autoplay */
.video-modal__unmute-prompt {
  position: absolute;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  border: none;
  border-radius: var(--radius-full);
  padding: 0.5rem 1.25rem;
  font-size: var(--fs-sm);
  font-family: var(--font-body);
  font-weight: 600;
  cursor: pointer;
  z-index: 4;
  white-space: nowrap;
  display: none;
}

.video-modal__player.is-muted .video-modal__unmute-prompt {
  display: block;
  animation: pulse-prompt 2.5s ease-in-out infinite;
}

@keyframes pulse-prompt {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

@media (prefers-reduced-motion: reduce) {
  .video-modal__player.is-muted .video-modal__unmute-prompt {
    animation: none;
  }
}

/* Mobile: el video maximizado desde .solution__player es el vertical — el modal
   respeta ese aspect-ratio (mismo que .solution__player en mobile) en vez del
   16:10 de desktop, y la card se ajusta al ancho del video en vez de quedar
   angosta con márgenes blancos enormes a los lados. */
@media (max-width: 48rem) {
  .video-modal__card {
    width: fit-content;
    max-width: 95vw;
  }

  .video-modal__player {
    aspect-ratio: 320 / 563;
    width: min(90vw, 26rem);
    max-height: 88vh;
    margin-inline: auto;
  }
}
