.modal {
  position: fixed;
  width: 100vw;
  height: 100vh;
  max-width: 100vw;
  max-height: 100vh;
  margin: 0;
  border: none;
  padding: 0;

  background-color: rgba(0, 0, 0, 0.3);
  overflow: hidden;

  /* Configuração para o Fade */
  opacity: 0;
  pointer-events: none;
  /* Impede cliques enquanto estiver invisível */
  transition: opacity 0.3s ease-in-out;
}

/* Classe que ativa o modal (adicione via JavaScript) */
.modal.active {
  opacity: 1;
  pointer-events: all;
  /* Ativa os cliques quando visível */
}

.modal-header {
  position: sticky;
  top: 0;
  width: 100%;
  height: 4rem;
  padding: 0.6rem 1rem;
  background: linear-gradient(to bottom, var(--bg-color), transparent);
  display: flex;
  justify-content: flex-end;
  z-index: 4;
}

.header-hero {
  position: relative;

  width: 100%;
  min-height: 30rem;

  overflow: hidden;

  background: var(--bg-primary);

  /*
   * Apenas os cantos superiores são arredondados.
   * Os inferiores permanecem retos.
   */
  border-radius: 16px 16px 0 0;
}

/* Imagem de fundo */

/* =========================================================
     HEADER / CAPA
   ========================================================= */

.page-header {
  margin-bottom: 1.5rem;
}

/* Imagem de fundo */

.header-hero-image {
  position: absolute;
  inset: 0;

  width: 100%;
  height: 100%;

  display: block;

  object-fit: cover;
  object-position: center top;

  z-index: 0;

  opacity: 0;

  transition: opacity 0.6s ease-in-out;

  pointer-events: none;
}

.header-hero-image.active {
  opacity: 1;
}

/* =========================================================
     DEGRADÊ SOBRE A IMAGEM — UNIVERSAL
   ========================================================= */
/* =========================================================
   1. DEFINIÇÃO PADRÃO (TEMA CLARO COMO PADRÃO DO SISTEMA)
   ========================================================= */
:root {
  /* Variáveis do Gradiente Claro */
  --hero-grad-start: rgba(54, 54, 54, 0);
  --hero-grad-mid: rgba(248, 250, 252, 1);
  --hero-grad-end: rgba(248, 250, 252, 1);
  --hero-grad-mid-pos: 50%;
}

/* Modo Escuro Padrão (Nativo do Sistema) */
@media (prefers-color-scheme: dark) {
  :root {
    /* NOVAS CORES DO GRADIENTE ESCURO */
    --hero-grad-start: rgba(54, 54, 54, 0);
    --hero-grad-mid: rgba(18, 19, 20, 0.71);
    --hero-grad-end: rgba(18, 19, 20, 1);
    --hero-grad-mid-pos: 51%;
  }
}

/* =========================================================
   2. LÓGICA DE INVERSÃO (AO CLICAR NO BOTÃO/CHECKBOX)
   ========================================================= */

/* Se o sistema for CLARO e o usuário clicar no botão: Ativa tudo ESCURO */
@media (prefers-color-scheme: light),
(prefers-color-scheme: no-preference) {
  :root:has(.theme-checkbox:checked) {
    /* NOVAS CORES DO GRADIENTE ESCURO FORÇADO */
    --hero-grad-start: rgba(54, 54, 54, 0);
    --hero-grad-mid: rgba(18, 19, 20, 0.71);
    --hero-grad-end: rgba(18, 19, 20, 1);
    --hero-grad-mid-pos: 51%;
  }
}

/* Se o sistema for ESCURO e o usuário clicar no botão: Ativa tudo CLARO */
@media (prefers-color-scheme: dark) {
  :root:has(.theme-checkbox:checked) {
    /* Gradiente Claro forçado */
    --hero-grad-start: rgba(54, 54, 54, 0);
    --hero-grad-mid: rgba(248, 250, 252, 1);
    --hero-grad-end: rgba(248, 250, 252, 1);
    --hero-grad-mid-pos: 50%;
  }
}

.header-hero-gradient {
  position: absolute;
  inset: 0;
  z-index: 1;

  background: #363636;
  /* Fallback caso o navegador antigo não leia gradiente */

  background: linear-gradient(180deg,
      var(--hero-grad-start) 0%,
      var(--hero-grad-mid) var(--hero-grad-mid-pos),
      var(--hero-grad-end) 100%);
}

/* Conteúdo sobre a imagem */

.header-content {
  position: relative;
  z-index: 3;
  max-width: 100%;
  margin: 1rem;
  padding-top: 16rem;
  padding-bottom: 1rem;
}

.header-content h1 {
  margin-top: 0;
  margin-bottom: 0.75rem;
}

.header-content p {
  margin-bottom: 0.75rem;
}

.modal-container {
  display: flex;
  flex-wrap: wrap;
  flex: 1 1 100vw;
  height: 100vh;
}

.modal-aside {
  flex: 1 1 12.5rem;
}

.modal-content {
  position: relative;
  flex: 20 1 31.25rem;
  min-height: calc(100vh - 36.5rem);
  overflow: auto;
  background-color: var(--bg-color);
}

.article-container .container {
  padding-bottom: 1vh;
}

.article-container {
  width: 100%;
  height: 100%;
  background-color: var(--bg-color);
  padding: 1rem;
}

.card ol,
.card ul {
  margin: 1rem;
}

.card li {
  padding-bottom: 1rem;
}

.modal-ads {
  display: none;
}

/* --- Botão Flutuante por cima do Iframe --- */
.btn-fechar-topo {
  background: color-mix(in srgb, var(--bg-color) 60%, transparent);
  backdrop-filter: blur(4px);
  border: 1px solid color-mix(in srgb, var(--text-color) 20%, transparent);
  color: var(--texto-study);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.btn-fechar-topo:hover {
  background-color: rgba(255, 255, 255, 0.2);
  transform: scale(1.05);
}

.related-content {
  align-items: center;
  margin-top: 2rem;
  padding: 1rem;
  background-color: var(--bg-surface);
  border-radius: 0.5rem;
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-secondary);
  height: 10rem;
}

aside.logo {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 3rem;
}

@media only screen and (max-width: 923px) {
  #modal_right {
    display: none;
  }
}

@media only screen and (max-width: 725px) {
  #modal_left {
    display: none;
  }

  .iframe-container,
  .modal-header {
    width: 100%;
  }

  .modal-ads {
    display: block;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 13vh;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 3;
  }
}

/* =========================================================
     RESPONSIVIDADE — TABLETS E CELULARES
   ========================================================= */

@media (max-width: 768px) {

  .header-hero {
    min-height: 480px;

    border-radius: 12px 12px 0 0;
  }

  .header-content {
    padding-top: 15rem;
  }

  .article-container .container {
    padding-bottom: 15vh;
  }
}


/* =========================================================
       RESPONSIVIDADE — CELULARES PEQUENOS
   ========================================================= */

@media (max-width: 480px) {

  .header-hero {
    min-height: 440px;

    border-radius: 10px 10px 0 0;
  }

  .header-content {
    padding-top: 210px;
  }

}