/* Player da VSL (vídeo de venda). Vídeo e capa no R2 da casa (midia.nerdofertas.com/vsl/<slug>.mp4|.jpg|.webp),
   endereço estável: versão nova troca o arquivo lá, sem deploy.
   Suporta controle 16:9 (pílula no canto inferior esquerdo, molde A) e modo mobile-first inline 4:5 / 9:16
   (capa <picture> WebP+JPG, play circular 68x68 em top:56%, overlay mínimo com alvos >= 44px e auto-hide 2,5s).
   Cor de destaque: --vsl-cor no .vsl. */
.vsl {
  position: relative;
  container-type: inline-size;
  aspect-ratio: 16 / 9;
  width: 100%;
  background: #0b0d12;
  overflow: hidden;
  isolation: isolate;
}

.vsl[data-proporcao="4:5"],
:root[data-vsl-variante="b"] .vsl:not(.vsl-espera) {
  aspect-ratio: 4 / 5;
  max-height: var(--vsl-max-h, min(62svh, 520px));
  width: min(100%, calc(var(--vsl-max-h, min(62svh, 520px)) * 0.8));
  margin-inline: auto;
}

:root[data-vsl-variante="b"] .vsl:not(.vsl-espera) .vsl-pilula {
  display: none;
}

.vsl[data-proporcao="9:16"] {
  aspect-ratio: 9 / 16;
  max-height: var(--vsl-max-h, min(62svh, 520px));
  width: min(100%, calc(var(--vsl-max-h, min(62svh, 520px)) * 0.5625));
  margin-inline: auto;
}

.vsl:fullscreen,
.vsl:-webkit-full-screen {
  width: 100%;
  height: 100%;
  max-height: none;
  border-radius: 0;
  border: 0;
  background: #000;
}

.vsl video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #0b0d12;
  transition: opacity 180ms cubic-bezier(0.22, 1, 0.36, 1);
}

.vsl.com-capa video {
  opacity: 0;
}

.vsl.tocando video {
  opacity: 1;
}

.vsl video:fullscreen,
.vsl video:-webkit-full-screen,
.vsl:fullscreen video,
.vsl:-webkit-full-screen video {
  object-fit: contain;
}

/* Capa <picture> (evita flash preto durante o carregamento da hls.js e otimiza LCP com WebP) */
.vsl-capa {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 1;
  transition: opacity 180ms cubic-bezier(0.22, 1, 0.36, 1);
}

.vsl-capa img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.vsl.tocando .vsl-capa {
  opacity: 0;
  visibility: hidden;
}

/* Botão Play inicial */
.vsl-play {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.vsl-pilula {
  position: absolute;
  left: 5cqw;
  bottom: 4.06cqw;
  display: flex;
  align-items: center;
  gap: max(8px, 1.4cqw);
  padding: max(5px, 0.94cqw) max(14px, 2.34cqw) max(5px, 0.94cqw) max(5px, 0.94cqw);
  border-radius: 999px;
  background: #fff;
  color: #181a20;
  box-shadow: 0 1.1cqw 2.8cqw rgba(0, 0, 0, 0.35);
  transition: transform 160ms cubic-bezier(0.22, 1, 0.36, 1);
}

.vsl-pilula i {
  width: max(34px, 6.56cqw);
  height: max(34px, 6.56cqw);
  border-radius: 50%;
  background: var(--vsl-cor, #1d71b8);
  display: grid;
  place-items: center;
}

.vsl-pilula svg {
  width: 43%;
  height: 43%;
  margin-left: 7%;
  fill: #fff;
}

.vsl-pilula b {
  font-family: var(--vsl-fonte, inherit);
  font-weight: 800;
  font-size: max(16px, 3.6cqw);
  line-height: 1;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

.vsl-play:hover .vsl-pilula {
  transform: scale(1.04);
}

/* Botão Play circular central 68x68 (top: 56%) para formatos verticais 4:5 / 9:16 */
.vsl-play-centro {
  position: absolute;
  left: 50%;
  top: 56%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.vsl-play-circulo {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: var(--vsl-cor, #1d71b8);
  display: grid;
  place-items: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.42), 0 0 0 3px rgba(255, 255, 255, 0.92);
  transition: transform 160ms cubic-bezier(0.22, 1, 0.36, 1);
}

.vsl-play-circulo svg {
  width: 28px;
  height: 28px;
  margin-left: 4px;
  fill: #ffffff;
}

.vsl-play-rotulo {
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(11, 13, 18, 0.88);
  color: #ffffff;
  font-family: var(--vsl-fonte, inherit);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.vsl-play:hover .vsl-play-circulo {
  transform: scale(1.06);
}

.vsl-play:focus-visible {
  outline: 3px solid #fff;
  outline-offset: -6px;
}

.vsl-play:focus-visible .vsl-pilula,
.vsl-play:focus-visible .vsl-play-circulo {
  outline: 3px solid var(--vsl-cor, #1d71b8);
  outline-offset: 3px;
}

/* Spinner enquanto carrega o 1º quadro (mantém capa visível, zero flash preto) */
.vsl-spinner {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 3;
  display: none;
  width: 52px;
  height: 52px;
  margin: -26px 0 0 -26px;
  border-radius: 50%;
  background: rgba(11, 13, 18, 0.72);
  place-items: center;
  pointer-events: none;
}

.vsl-spinner::after {
  content: "";
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.28);
  border-top-color: #ffffff;
  animation: vsl-girar 0.75s linear infinite;
}

@keyframes vsl-girar {
  to {
    transform: rotate(360deg);
  }
}

.vsl.carregando .vsl-play {
  opacity: 0;
  pointer-events: none;
}

.vsl.carregando .vsl-spinner {
  display: grid;
}

.vsl.tocando .vsl-play,
.vsl.tocando .vsl-spinner {
  display: none;
}

/* Overlay mínimo customizado (data-controles="minimo" no modo inline) */
.vsl-toque {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: none;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.vsl.tocando.com-ui-minima .vsl-toque {
  display: block;
}

.vsl-barra {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  display: none;
  align-items: center;
  gap: 2px;
  padding: 20px 4px 4px;
  background: linear-gradient(to top, rgba(8, 10, 14, 0.9) 0%, rgba(8, 10, 14, 0.56) 62%, transparent 100%);
  opacity: 1;
  transition: opacity 200ms cubic-bezier(0.22, 1, 0.36, 1);
}

.vsl.tocando.com-ui-minima .vsl-barra {
  display: flex;
}

.vsl.tocando.com-ui-minima.vsl-ui-oculta .vsl-barra {
  opacity: 0;
  pointer-events: none;
}

.vsl-btn {
  flex: 0 0 44px;
  min-width: 44px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #ffffff;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 150ms cubic-bezier(0.22, 1, 0.36, 1);
}

.vsl-btn:hover {
  background: rgba(255, 255, 255, 0.14);
}

.vsl-btn:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: -2px;
}

.vsl-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
  display: block;
}

.vsl-prog {
  position: relative;
  flex: 1 1 auto;
  min-width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  padding: 0 4px;
  cursor: pointer;
  touch-action: none;
}

.vsl-prog:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: -4px;
  border-radius: 6px;
}

.vsl-prog-trilho {
  position: relative;
  width: 100%;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.28);
  overflow: hidden;
}

.vsl-prog-cheio {
  height: 100%;
  width: 0%;
  background: var(--vsl-cor, #1d71b8);
  border-radius: 999px;
}

.vsl-tempo {
  flex: 0 0 auto;
  padding: 0 4px;
  color: #ffffff;
  font-family: var(--vsl-fonte, inherit);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  user-select: none;
}

/* Linha de progresso de 3 px visível após auto-hide de 2,5 s */
.vsl-linha {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  height: 3px;
  background: rgba(8, 10, 14, 0.48);
  pointer-events: none;
  opacity: 0;
  transition: opacity 200ms cubic-bezier(0.22, 1, 0.36, 1);
}

.vsl-linha-cheia {
  height: 100%;
  width: 0%;
  background: var(--vsl-cor, #1d71b8);
}

.vsl.tocando.com-ui-minima.vsl-ui-oculta .vsl-linha {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .vsl video,
  .vsl-capa,
  .vsl-pilula,
  .vsl-play-circulo,
  .vsl-barra,
  .vsl-btn,
  .vsl-linha {
    transition: none;
  }
  .vsl-spinner::after {
    animation-duration: 2.4s;
  }
}
