/* ==========================================================
   CORREÇÃO GLOBAL DO MOBILE — CASA DE SOSSEGO VÓ TEREZA
   Carregado pelo include/_header.php em todas as páginas.
========================================================== */

@media (max-width: 560px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  *,
  *::before,
  *::after {
    box-sizing: border-box;
  }

  img,
  video,
  iframe {
    max-width: 100%;
  }

  /* Cabeçalho */
  .header .nav-wrap {
    width: calc(100% - 24px) !important;
    height: 106px !important;
    gap: 9px !important;
  }

  .header .logo {
    flex: 0 0 104px !important;
    min-width: 0 !important;
  }

  .header .logo img {
    display: block !important;
    width: 104px !important;
    max-width: 104px !important;
    max-height: 88px !important;
    margin-top: 0 !important;
    object-fit: contain !important;
  }

  .header .menu-button,
  .header .search-button {
    width: 52px !important;
    height: 52px !important;
    flex: 0 0 52px !important;
    padding: 11px !important;
  }

  .header .search-button img {
    width: 30px !important;
    height: 30px !important;
  }

  .header .nav {
    top: 100% !important;
    right: 0 !important;
    left: 0 !important;
    width: 100% !important;
  }

  .header .nav.open {
    max-height: calc(100vh - 106px) !important;
    max-height: calc(100dvh - 106px) !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
  }

  /* Altura única de todos os banners internos */
  .hero,
  .donation-hero,
  .volunteer-hero,
  .casa-hero,
  .casa-about-hero,
  .projects-hero,
  .courses-hero,
  .agenda-hero,
  .institutional-hero,
  .videos-hero {
    width: 100% !important;
    height: 600px !important;
    min-height: 600px !important;
    padding: 0 !important;
    overflow: hidden !important;
    background-repeat: no-repeat !important;
    background-size: cover !important;
  }

  .donation-hero {
    background-position: 56% center !important;
  }

  /* Moldura afastada do logo e dos botões */
  .hero-frame,
  .donation-hero__frame,
  .volunteer-hero__frame,
  .casa-hero__frame,
  .casa-about-hero__frame,
  .projects-hero__frame,
  .courses-hero__frame,
  .agenda-hero__frame,
  .institutional-hero__frame,
  .videos-hero__frame {
    position: relative !important;
    inset: auto !important;
    width: calc(100% - 28px) !important;
    max-width: none !important;
    height: 466px !important;
    min-height: 0 !important;
    margin: 112px auto 22px !important;
    padding: 0 !important;
    border-width: 3px !important;
  }

  /* Títulos internos: tamanho reduzido e sem quebra indesejada */
  .donation-hero h1,
  .volunteer-hero h1,
  .casa-hero h1,
  .casa-about-hero h1,
  .projects-hero h1,
  .courses-hero h1,
  .agenda-hero h1,
  .institutional-hero h1,
  .videos-hero h1 {
    position: absolute !important;
    inset: 24px 14px auto !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 7px !important;
    width: auto !important;
    max-width: calc(100% - 28px) !important;
    margin: 0 !important;
    font-size: clamp(23px, 6.6vw, 27px) !important;
    line-height: 1.04 !important;
  }

  .donation-hero h1 span,
  .volunteer-hero h1 span,
  .casa-hero h1 span,
  .casa-about-hero h1 span,
  .projects-hero h1 span,
  .courses-hero h1 span,
  .agenda-hero h1 span,
  .institutional-hero h1 span,
  .videos-hero h1 span {
    display: inline-block !important;
    width: auto !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 5px 8px 7px !important;
    line-height: 1.04 !important;
    white-space: nowrap !important;
  }

  /* Subtítulos próximos ao título */
  .volunteer-hero__message,
  .casa-hero__message,
  .casa-about-hero p,
  .projects-hero__content > p,
  .institutional-hero__content > p,
  .videos-hero__content > p {
    position: absolute !important;
    inset: 172px 16px auto !important;
    max-width: calc(100% - 32px) !important;
    margin: 0 !important;
    font-size: 17px !important;
    line-height: 1.12 !important;
  }

  /* A Home possui estrutura diferente das páginas internas */
  .hero h1 {
    position: absolute !important;
    inset: 132px 28px auto !important;
    max-width: calc(100% - 56px) !important;
    margin: 0 !important;
    font-size: clamp(23px, 6.6vw, 27px) !important;
    line-height: 1.34 !important;
  }

  .hero h1 mark {
    padding: 4px 8px 6px !important;
    white-space: nowrap !important;
  }

  .hero p {
    inset: 285px 28px auto !important;
    max-width: calc(100% - 56px) !important;
    font-size: 17px !important;
    line-height: 1.12 !important;
  }

  .hero-actions {
    right: 28px !important;
    bottom: 30px !important;
    left: 28px !important;
    width: auto !important;
  }

  /* Conteúdo e rodapé não podem ultrapassar a largura da tela */
  main,
  .section,
  .footer,
  .footer-grid,
  .footer-navigation,
  .footer-contact {
    max-width: 100% !important;
  }

  .footer-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}
