/* ==========================================================================
   1. GRID DA GALERIA (PÁGINA)
   ========================================================================== */

.video-gallery-page {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
  box-sizing: border-box;
}

.video-gallery__description {
  margin-bottom: 30px;
  font-size: 1.1rem;
  line-height: 1.6;
}

/* Estrutura de 3 colunas para os cards não ficarem minúsculos */
.video-gallery__grid {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 32px !important;
  width: 100%;
  padding-top: 2rem;
}

.video-gallery__item {
  width: 100%;
  min-width: 0;
}

/* Card da Thumbnail na Galeria */
.video-gallery__item .youtube-facade {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background-color: #000;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  overflow: hidden;
}

.video-gallery__item .youtube-facade img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.3s ease;
}

.video-gallery__item .youtube-facade:hover img {
  opacity: 0.85;
}

.video-gallery__item .youtube-facade__play-btn {
  position: absolute;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  transition: transform 0.2s ease;
}

.video-gallery__item .youtube-facade:hover .youtube-facade__play-btn {
  transform: scale(1.1);
}

/* ==========================================================================
   2. MODAL / LIGHTBOX (TELA CHEIA)
   ========================================================================== */

/* Fundo escuro cobrindo toda a tela */
.video-modal {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background-color: rgba(0, 0, 0, 0.9) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  z-index: 99999 !important; /* Fica acima de tudo no Drupal */
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  padding: 20px;
  box-sizing: border-box;
}

.video-modal.is-open {
  opacity: 1 !important;
  visibility: visible !important;
}

/* O Container principal do Player no Modal */
.video-modal__content {
  position: relative;
  width: 90vw !important; /* Ocupa 90% da largura da tela */
  max-width: 1100px !important; /* Tamanho bem grande em telas de PC */
  background: #000;
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
}

/* Wrapper que força a proporção HD (16:9) */
.video-modal__iframe-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  overflow: hidden;
}

.video-modal__iframe-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100% !important;
  height: 100% !important;
  border: none;
}

/* Botão Fechar (X) */
.video-modal__close {
  position: absolute;
  top: -45px;
  right: 0;
  background: none;
  border: none;
  color: #fff;
  font-size: 40px;
  line-height: 1;
  cursor: pointer;
  padding: 5px;
  transition: color 0.2s ease, transform 0.2s ease;
}

.video-modal__close:hover {
  color: #ff4d4d;
  transform: scale(1.2);
}

/* ==========================================================================
   3. RESPONSIVIDADE
   ========================================================================== */

@media (max-width: 1024px) {
  .video-gallery__grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 24px !important;
  }
}

@media (max-width: 640px) {
  .video-gallery__grid {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
  }

  .video-modal__content {
    width: 95vw !important;
  }

  .video-modal__close {
    top: -40px;
    right: 0;
  }
}