/* ============================================================
   DR. DAVI — Seção de Vídeos  ·  style_videos.css  v3.0
   "Conheça sua jornada até o resultado ideal"

   CORREÇÃO ESTRUTURAL COMPLETA:
   • Introduz .video-ratio como único container posicional para
     canvas + overlays (skeleton, play, badge, duração).
     Elimina o conflito de siblings absolutos sem pai comum.
   • Background dark aplicado corretamente.
   • Grid 3 → 2 → 1 colunas (desktop / tablet / mobile).
   • Sem conflitos, sem duplicação, sem CSS desnecessário.
   ============================================================ */

/* ══════════════════════════════════════════════════════════
   VARIÁVEIS LOCAIS
══════════════════════════════════════════════════════════ */
:root {
  --vid-bg-from:    #0d1117;
  --vid-bg-to:      #080b10;
  --vid-card-bg:    rgba(255,255,255,.07);
  --vid-border:     rgba(255,255,255,.13);
  --vid-text:       rgba(255,255,255,.93);
  --vid-muted:      rgba(255,255,255,.62);
  --vid-blue:       #4A7FD4;
  --vid-purple:     #2C64B8;
  --vid-cyan:       #80AEDE;
  --vid-shadow:     0 24px 64px rgba(0,0,0,.55);
  --vid-radius:     14px;
  --vid-inner-r:    10px;
}

/* ══════════════════════════════════════════════════════════
   SEÇÃO — FUNDO ESCURO PREMIUM
══════════════════════════════════════════════════════════ */
.videos-section {
  background:
    radial-gradient(ellipse 900px 400px at 15% -5%,
      rgba(91,124,255,.28) 0%, transparent 60%),
    radial-gradient(ellipse 700px 350px at 85% -5%,
      rgba(184,92,255,.22) 0%, transparent 55%),
    linear-gradient(180deg, var(--vid-bg-from) 0%, var(--vid-bg-to) 100%);
  color: var(--vid-text);
  /* Garante fundo independente de outros estilos */
  background-color: var(--vid-bg-from);
}

/* ── Título da seção (herda cor do dark) ── */
.videos-title h2 {
  color: var(--vid-text) !important; /* sobrepõe .section-title h2 que usa --text-dark */
}
.videos-title h2::after {
  background: linear-gradient(90deg, var(--vid-blue), var(--vid-purple)) !important;
}

/* ── Subtítulo ── */
.videos-subtitle {
  text-align: center;
  max-width: 760px;
  margin: 0 auto 52px;
  padding: 0 20px;
  color: var(--vid-muted);
  font-size: .98rem;
  line-height: 1.7;
}

/* ══════════════════════════════════════════════════════════
   GRID DE VÍDEOS
   Desktop ≥ 900px : 3 colunas
   Tablet  580–899 : 2 colunas
   Mobile  < 580px : 1 coluna
══════════════════════════════════════════════════════════ */
.videos-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  align-items: start;
  /* Reset de animação para garantir visibilidade */
  opacity: 1 !important;
  transform: none !important;
}

/* ══════════════════════════════════════════════════════════
   CARD DO VÍDEO
══════════════════════════════════════════════════════════ */
.video-card {
  background: var(--vid-card-bg);
  border: 1px solid var(--vid-border);
  border-radius: var(--vid-radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0,0,0,.28);
  transition:
    transform   .35s cubic-bezier(.25,.46,.45,.94),
    box-shadow  .35s ease,
    border-color .35s ease;
  will-change: transform;
  /* Sem contain:layout — evita corte de filhos */
}
.video-card:hover,
.video-card:focus-within {
  transform: translateY(-8px);
  box-shadow: var(--vid-shadow);
  border-color: rgba(110,231,255,.25);
}

/* ══════════════════════════════════════════════════════════
   ÁREA DE MÍDIA — wrapper externo (só padding visual)
══════════════════════════════════════════════════════════ */
.video-media {
  padding: 12px 12px 0;
  /* Sem position:relative aqui — o .video-ratio faz isso */
}

/* ══════════════════════════════════════════════════════════
   .video-ratio — CONTAINER POSICIONAL DO THUMBNAIL
   ─────────────────────────────────────────────────────────
   Este é o único elemento com position:relative e aspect-ratio.
   TODOS os overlays (skeleton, play, badge, duração) são
   filhos ABSOLUTOS deste container. Garante sobreposição
   correta em qualquer viewport.
══════════════════════════════════════════════════════════ */
.video-ratio {
  position: relative;        /* ← referência para todos os absolute */
  width: 100%;
  aspect-ratio: 16 / 9;     /* ← define altura proporcional */
  border-radius: var(--vid-inner-r);
  overflow: hidden;          /* ← clippa overlays nas bordas */
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  /* Bloqueia interação quando não hover */
  isolation: isolate;
}

/* ── Canvas — preenche o container (position absolute) ── */
.video-thumbnail {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  border-radius: inherit;
  /* object-fit equivalente não existe para canvas,
     mas o drawImage no JS já mapeia corretamente */
}

/* ── Skeleton de carregamento ── */
.video-skeleton {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(
    90deg,
    rgba(255,255,255,.04) 0%,
    rgba(255,255,255,.11) 50%,
    rgba(255,255,255,.04) 100%
  );
  background-size: 200% 100%;
  animation: vidSkeleton 1.5s linear infinite;
  transition: opacity .4s ease;
  pointer-events: none;
  z-index: 1;
}
@keyframes vidSkeleton {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Overlay central do botão play ── */
.video-play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 3;
}

/* ── Botão play ── */
.video-play-btn {
  pointer-events: auto;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,.28);
  background: rgba(8,11,16,.5);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 28px rgba(0,0,0,.4), 0 0 0 0 rgba(110,231,255,0);
  transition:
    transform    .25s ease,
    box-shadow   .25s ease,
    border-color .25s ease,
    background   .25s ease;
}
.video-card:hover .video-play-btn,
.video-card:focus-within .video-play-btn {
  transform: scale(1.1);
  border-color: rgba(110,231,255,.5);
  background: rgba(91,124,255,.22);
  box-shadow:
    0 8px 36px rgba(0,0,0,.45),
    0 0 0 6px rgba(91,124,255,.12);
}
.video-play-icon {
  color: #fff;
  font-size: 17px;
  line-height: 1;
  display: block;
  transform: translateX(2px); /* centrar triângulo visualmente */
}

/* ── Badge "Novo" — canto superior direito ── */
.video-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 4;
  background: linear-gradient(
    90deg,
    rgba(91,124,255,.92) 0%,
    rgba(184,92,255,.92) 100%
  );
  color: #fff;
  font-family: 'Poppins', sans-serif;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  pointer-events: none;
  line-height: 1.3;
  box-shadow: 0 4px 16px rgba(91,124,255,.3);
}

/* ── Duração — canto superior esquerdo ── */
.video-meta-top {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 4;
  pointer-events: none;
}
.video-duration {
  display: inline-block;
  background: rgba(0,0,0,.5);
  border: 1px solid rgba(255,255,255,.2);
  color: rgba(255,255,255,.92);
  font-family: 'Poppins', sans-serif;
  font-size: .76rem;
  font-weight: 500;
  line-height: 1;
  padding: 4px 9px;
  border-radius: 999px;
}

/* ══════════════════════════════════════════════════════════
   CONTEÚDO TEXTUAL DO CARD
══════════════════════════════════════════════════════════ */
.video-content {
  padding: 18px 18px 22px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.video-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: rgba(255,255,255,.96);
  line-height: 1.4;
  margin: 0;
}
.video-description {
  font-family: 'Poppins', sans-serif;
  font-size: .85rem;
  color: var(--vid-muted);
  line-height: 1.65;
  margin: 0;
}

/* ══════════════════════════════════════════════════════════
   MODAL DE VÍDEO
══════════════════════════════════════════════════════════ */
.video-modal {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.video-modal.is-open { display: flex; }

.video-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.82);
  cursor: pointer;
}

.video-modal__panel {
  position: relative;
  z-index: 1;
  width: min(960px, 92vw);
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(10,14,22,.75);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 32px 80px rgba(0,0,0,.6);
  overflow: hidden;
  animation: modalIn .22s ease-out both;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(18px) scale(.96); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}

.video-modal__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 13px 16px;
  border-bottom: 1px solid rgba(255,255,255,.09);
  gap: 12px;
}
.video-modal__hint {
  margin: 0;
  font-family: 'Poppins', sans-serif;
  font-size: .86rem;
  color: rgba(255,255,255,.65);
}
.video-modal__close {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: 9px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.06);
  color: rgba(255,255,255,.85);
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform .2s ease, background .2s ease;
  line-height: 1;
  font-family: 'Poppins', sans-serif;
}
.video-modal__close:hover { transform: scale(1.06); background: rgba(255,255,255,.12); }

.video-modal__body { padding: 0; }
.video-modal__player video,
.video-modal__player iframe {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  border: none;
  background: #000;
}

/* ══════════════════════════════════════════════════════════
   RESPONSIVIDADE
══════════════════════════════════════════════════════════ */

/* Tablet ≤ 899px → 2 colunas */
@media (max-width: 899px) {
  .videos-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    max-width: 640px;
    margin-left: auto;
    margin-right: auto;
  }
  /* Terceiro card ocupa as 2 colunas para não ficar órfão */
  .video-card:nth-child(3) {
    grid-column: 1 / -1;
    max-width: 360px;
    margin: 0 auto;
  }
}

/* Mobile ≤ 579px → 1 coluna */
@media (max-width: 579px) {
  .videos-grid {
    grid-template-columns: 1fr;
    max-width: 420px;
    gap: 18px;
  }
  .video-card:nth-child(3) {
    grid-column: auto;
    max-width: 100%;
    margin: 0;
  }
  .videos-subtitle { margin-bottom: 36px; }
  .video-play-btn  { width: 52px; height: 52px; }
  .video-play-icon { font-size: 15px; }
  .video-content   { padding: 14px 16px 18px; }
}

/* ── Acessibilidade: foco ── */
.video-play-btn:focus-visible,
.video-modal__close:focus-visible {
  outline: 2px solid rgba(110,231,255,.7);
  outline-offset: 3px;
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  .video-card        { transition: none !important; }
  .video-play-btn    { transition: none !important; }
  .video-skeleton    { animation: none !important; }
  .video-modal__panel { animation: none !important; }
}