/* ==========================================================================
   VICIADO COMENTA — Site Shell
   Design system partilhado, carregado em último em todas as páginas públicas.
   Cobre: menu mobile unificado (hambúrguer), posição do botão de tema,
   alvos de toque acessíveis e consistência de navegação em mobile.
   Carregado DEPOIS do CSS inline de cada página, pelo que vence por ordem.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Botão de tema: posição unificada (sempre no canto superior direito)
   -------------------------------------------------------------------------- */
.theme-toggle {
  position: absolute;
  top: 16px;
  right: 16px;
  left: auto;
}

/* Variante usada quando a página não tem <header> (ex.: 404) */
.theme-toggle--fixed {
  position: fixed;
  top: 12px;
  right: 12px;
  left: auto;
  z-index: 900;
}

body.dark .theme-toggle,
body.dark .theme-toggle--fixed {
  border-color: rgba(255, 255, 255, 0.2);
}

/* --------------------------------------------------------------------------
   2. Menu mobile unificado (hambúrguer)
   O site-shell.js injeta um botão .shell-burger antes da <nav> e alterna
   a classe .shell-open. Em desktop nada disto é aplicado.
   -------------------------------------------------------------------------- */
.shell-burger {
  display: none;
}

@media (max-width: 768px) {
  .shell-burger {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: calc(100% - 24px);
    max-width: 560px;
    margin: 10px auto 0;
    padding: 10px 14px;
    min-height: 44px;
    border: 1px solid rgba(0, 102, 204, 0.18);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.95);
    color: #0052a3;
    font-family: 'Sora', sans-serif;
    font-size: 0.94rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 102, 204, 0.1);
    transition: background 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  }

  .shell-burger:hover {
    background: #ffffff;
    border-color: rgba(0, 102, 204, 0.35);
  }

  .shell-burger__bars {
    position: relative;
    display: inline-block;
    width: 20px;
    height: 14px;
  }

  .shell-burger__bars i {
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
    transition: transform 0.25s ease, opacity 0.2s ease, top 0.25s ease;
  }

  .shell-burger__bars i:nth-child(1) { top: 0; }
  .shell-burger__bars i:nth-child(2) { top: 6px; }
  .shell-burger__bars i:nth-child(3) { top: 12px; }

  .shell-burger[aria-expanded="true"] .shell-burger__bars i:nth-child(1) {
    top: 6px;
    transform: rotate(45deg);
  }

  .shell-burger[aria-expanded="true"] .shell-burger__bars i:nth-child(2) {
    opacity: 0;
  }

  .shell-burger[aria-expanded="true"] .shell-burger__bars i:nth-child(3) {
    top: 6px;
    transform: rotate(-45deg);
  }

  /* Nav fechada em mobile: totalmente escondida (elimina menus gordos/sticky) */
  nav.shell-nav {
    display: none !important;
  }

  /* Nav aberta: gaveta em coluna, sem sticky */
  nav.shell-nav.shell-open {
    display: flex !important;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    flex-wrap: nowrap;
    gap: 5px;
    position: static;
    width: calc(100% - 24px);
    max-width: 560px;
    margin: 8px auto 12px;
    padding: 8px;
    border: 1px solid rgba(0, 102, 204, 0.14);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.97);
    box-shadow: 0 10px 26px rgba(0, 102, 204, 0.12);
  }

  nav.shell-open ul {
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 100%;
    margin: 0;
    padding: 0;
    list-style: none;
  }

  nav.shell-open li {
    width: 100%;
  }

  nav.shell-open > a,
  nav.shell-open ul a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 38px;
    padding: 7px 12px;
    border: 1px solid rgba(0, 102, 204, 0.12);
    border-radius: 10px;
    border-bottom: none;
    background: rgba(227, 242, 253, 0.6);
    color: #1a1f3a;
    font-size: 0.88em;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
  }

  nav.shell-open > a:hover,
  nav.shell-open ul a:hover {
    border-color: #0066cc;
    color: #0066cc;
  }

  /* Dark mode da gaveta */
  body.dark .shell-burger {
    background: rgba(17, 24, 39, 0.95);
    border-color: rgba(255, 255, 255, 0.14);
    color: #e5e7eb;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  }

  body.dark nav.shell-open {
    background: rgba(17, 24, 39, 0.98);
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.45);
  }

  body.dark nav.shell-open > a,
  body.dark nav.shell-open ul a {
    background: rgba(30, 41, 59, 0.85);
    border-color: rgba(255, 255, 255, 0.1);
    color: #e5e7eb !important;
  }

  /* Alvos de toque ≥44px */
  .social-media a {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
  }

  .redes-sociais a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
  }

  .redes-sociais a img {
    width: 40px;
    height: 40px;
  }
}

@media (max-width: 480px) {
  /* Anula o salto do botão de tema para a esquerda (ex.: index.html) */
  .theme-toggle,
  .theme-toggle--fixed {
    top: 10px;
    right: 10px;
    left: auto;
  }

  .shell-burger {
    margin-top: 10px;
  }
}

/* --------------------------------------------------------------------------
   3. Tipografia mínima: evita textos abaixo do legível em mobile
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .noticia-categoria,
  .featured-categoria,
  .artigo-categoria,
  .card-categoria {
    font-size: 0.75em;
  }

  nav a,
  nav.shell-open > a,
  nav.shell-open ul a {
    font-size: 0.88em;
  }
}
