/* ─── MODAL APRESENTAÇÃO (LIMITADO À TELA / SEM OVERFLOW) ─── */
.modal_overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(7, 11, 20, 0.95);
  backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px 20px;
  overflow: hidden; /* Evita qualquer barra de rolagem na tela */
  
  /* opacity: 1 !important; */
  /* visibility: visible !important; */
  /* pointer-events: auto !important; */

  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal_overlay.open {
  opacity: 1;
  pointer-events: auto;
  visibility: inherit;
}

.modal_container {
  position: relative;
  width: 100%;
  max-width: 90vw;
  max-height: 85vh; /* Trava a altura total do modal */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Botão Fechar */
.modal_close_btn {
  position: absolute;
  top: -42px;
  right: 0;
  background: transparent;
  border: none;
  color: var(--fg);
  font-size: 2.2rem;
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s ease, transform 0.2s ease;
  z-index: 10;
}

.modal_close_btn:hover {
  color: var(--sm-a);
  transform: scale(1.15);
}

/* Corpo e Botoes Laterais */
.modal_body {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

/* Moldura Proporcional 16:9 (Ajustada para não estourar) */
.modal_media_frame {
  position: relative;
  width: 100%;
  max-height: 78vh; /* Altura segura para caber em qualquer monitor */
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal_slide_img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: opacity 0.25s ease;
}

/* Botões de Navegação Lateral */
.modal_nav_btn {
  background: rgba(10, 16, 30, 0.85);
  border: 1px solid var(--border);
  color: var(--fg);
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.25s ease, border-color 0.25s ease, color 0.25s ease, transform 0.25s ease;
}

.modal_nav_btn:hover {
  background: var(--sm-a);
  border-color: var(--sm-a);
  color: var(--sm-o);
  transform: scale(1.1);
}

/* Paginação / Contador Flutuante na Base da Imagem */
.modal_footer {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10, 16, 30, 0.75);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  padding: 4px 16px;
  border-radius: 100px;
  z-index: 5;
  pointer-events: none;
}

.modal_counter {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--fg);
  letter-spacing: 0.05em;
}

.modal_media_frame {
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}

.modal_media_frame:active {
  cursor: grabbing;
}

.modal_slide_img {
  pointer-events: none; /* Garante que os cliques/toques passem direto para a moldura */
}

/* Responsividade Mobile */
@media (max-width: 860px) {
  .modal_container {
    max-width: 100%;
  }
  .modal_media_frame {
    max-height: 70vh;
  }
  .modal_nav_btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 6;
    width: 42px;
    height: 42px;
    font-size: 1.1rem;
  }
  .modal_prev { left: 8px; }
  .modal_next { right: 8px; }
}