/*
 * Os Avós do Brasil - ajustes finais mobile.
 * Objetivo: no celular, manter logo e hamburger na primeira linha
 * e colocar o texto do cabeçalho abaixo deles.
 */

@media only screen and (max-width: 1100px) {
  html body .header-sidebar.header-1 .spnc-navbar,
  html body .header-sidebar.header-2 .spnc-navbar,
  html body .header-sidebar .spnc-navbar {
    background: #ffffff !important;
    border-bottom: 1px solid #eeeeee !important;
  }

  html body .header-sidebar.header-1 .spnc-navbar > .spnc-container.osavos-header-reordered,
  html body .header-sidebar.header-2 .spnc-navbar > .spnc-container.osavos-header-reordered,
  html body .header-sidebar .spnc-navbar > .spnc-container.osavos-header-reordered {
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr) auto !important;
    grid-template-areas:
      "osavos-logo osavos-spacer osavos-menu"
      "osavos-text osavos-text osavos-text" !important;
    align-items: center !important;
    justify-content: stretch !important;
    column-gap: 12px !important;
    row-gap: 10px !important;
    width: 100% !important;
    max-width: 100% !important;
    min-height: 0 !important;
    padding: 14px 18px 18px !important;
    margin: 0 auto !important;
    box-sizing: border-box !important;
  }

  html body .header-sidebar.header-1 .spnc-navbar > .spnc-container.osavos-header-reordered > .osavos-header-logo-right,
  html body .header-sidebar.header-2 .spnc-navbar > .spnc-container.osavos-header-reordered > .osavos-header-logo-right,
  html body .header-sidebar .spnc-navbar > .spnc-container.osavos-header-reordered > .osavos-header-logo-right {
    grid-area: osavos-logo !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    justify-self: start !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  html body .header-sidebar.header-1 .osavos-header-logo-right .custom-logo-link,
  html body .header-sidebar.header-1 .osavos-header-logo-right .dark-custom-logo-link,
  html body .header-sidebar.header-2 .osavos-header-logo-right .custom-logo-link,
  html body .header-sidebar.header-2 .osavos-header-logo-right .dark-custom-logo-link,
  html body .header-sidebar .osavos-header-logo-right .custom-logo-link,
  html body .header-sidebar .osavos-header-logo-right .dark-custom-logo-link {
    position: static !important;
    transform: none !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 84px !important;
    height: 84px !important;
    max-width: 84px !important;
    max-height: 84px !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  html body .header-sidebar.header-1 .osavos-header-logo-right .custom-logo,
  html body .header-sidebar.header-1 .osavos-header-logo-right .dark-custom-logo,
  html body .header-sidebar.header-2 .osavos-header-logo-right .custom-logo,
  html body .header-sidebar.header-2 .osavos-header-logo-right .dark-custom-logo,
  html body .header-sidebar .osavos-header-logo-right .custom-logo,
  html body .header-sidebar .osavos-header-logo-right .dark-custom-logo {
    display: block !important;
    width: 84px !important;
    height: 84px !important;
    max-width: 84px !important;
    max-height: 84px !important;
    min-width: 84px !important;
    min-height: 84px !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 999px !important;
    object-fit: cover !important;
    object-position: center !important;
  }

  html body .header-sidebar.header-1 .spnc-navbar > .spnc-container.osavos-header-reordered > .spnc-menu-open.spnc-toggle,
  html body .header-sidebar.header-2 .spnc-navbar > .spnc-container.osavos-header-reordered > .spnc-menu-open.spnc-toggle,
  html body .header-sidebar .spnc-navbar > .spnc-container.osavos-header-reordered > .spnc-menu-open.spnc-toggle {
    grid-area: osavos-menu !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    justify-self: end !important;
    align-self: center !important;
    width: 48px !important;
    height: 48px !important;
    min-width: 48px !important;
    min-height: 48px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 1px solid rgba(0, 0, 0, 0.12) !important;
    border-radius: 999px !important;
    background: #6fa5a0 !important;
    color: #ffffff !important;
    box-shadow: none !important;
    text-decoration: none !important;
    line-height: 1 !important;
  }

  html body .header-sidebar .spnc-menu-open.spnc-toggle i {
    display: none !important;
  }

  html body .header-sidebar .spnc-menu-open.spnc-toggle::before {
    content: "☰" !important;
    display: block !important;
    font-family: Arial, Helvetica, sans-serif !important;
    font-size: 28px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    color: #ffffff !important;
  }

  html body .header-sidebar .spnc-menu-close i {
    display: none !important;
  }

  html body .header-sidebar .spnc-menu-close::before {
    content: "×" !important;
    display: block !important;
    font-family: Arial, Helvetica, sans-serif !important;
    font-size: 30px !important;
    font-weight: 500 !important;
    line-height: 1 !important;
    color: #111111 !important;
  }

  html body .header-sidebar.header-1 .spnc-navbar > .spnc-container.osavos-header-reordered > .osavos-header-site-text,
  html body .header-sidebar.header-2 .spnc-navbar > .spnc-container.osavos-header-reordered > .osavos-header-site-text,
  html body .header-sidebar .spnc-navbar > .spnc-container.osavos-header-reordered > .osavos-header-site-text {
    grid-area: osavos-text !important;
    position: static !important;
    display: block !important;
    justify-self: stretch !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    text-align: center !important;
  }

  html body .header-sidebar .osavos-header-site-text .custom-logo-link-url {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 auto !important;
    text-align: center !important;
  }

  html body .header-sidebar .osavos-header-site-text .site-title {
    display: block !important;
    margin: 0 auto !important;
    padding: 0 !important;
    max-width: 100% !important;
    font-size: clamp(25px, 7.2vw, 34px) !important;
    line-height: 1.08 !important;
    font-weight: 800 !important;
    letter-spacing: -0.02em !important;
    text-align: center !important;
  }

  html body .header-sidebar .osavos-header-site-text .site-title a,
  html body .header-sidebar .osavos-header-site-text .site-title-name {
    color: #000000 !important;
    text-decoration: none !important;
  }

  html body .header-sidebar .osavos-header-site-text .site-description {
    display: block !important;
    width: 100% !important;
    max-width: 330px !important;
    margin: 8px auto 0 !important;
    padding: 0 !important;
    color: #111111 !important;
    font-size: clamp(15px, 4.3vw, 19px) !important;
    line-height: 1.32 !important;
    text-align: center !important;
    overflow: visible !important;
    -webkit-line-clamp: unset !important;
    -webkit-box-orient: initial !important;
  }

  html body .header-sidebar.header-1 .spnc-navbar > .spnc-container.osavos-header-reordered > .spnc-head-wrap,
  html body .header-sidebar.header-2 .spnc-navbar > .spnc-container.osavos-header-reordered > .spnc-head-wrap,
  html body .header-sidebar .spnc-navbar > .spnc-container.osavos-header-reordered > .spnc-head-wrap {
    display: none !important;
  }

  html body .header-sidebar.header-1 .spnc-navbar > .spnc-container.osavos-header-reordered > .collapse.spnc-collapse,
  html body .header-sidebar.header-2 .spnc-navbar > .spnc-container.osavos-header-reordered > .collapse.spnc-collapse,
  html body .header-sidebar .spnc-navbar > .spnc-container.osavos-header-reordered > .collapse.spnc-collapse {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    z-index: 99997 !important;
    width: min(86vw, 330px) !important;
    max-width: min(86vw, 330px) !important;
    height: 100vh !important;
    min-height: 100vh !important;
    padding: 20px 18px 32px !important;
    margin: 0 !important;
    overflow-y: auto !important;
    background: #ffffff !important;
    border: 0 !important;
    border-right: 1px solid #ececec !important;
    box-shadow: 6px 0 26px rgba(0, 0, 0, 0.16) !important;
    transform: translateX(-120%) !important;
    opacity: 0 !important;
    transition: transform 0.28s ease, opacity 0.28s ease !important;
  }

  html body .header-sidebar.header-1 .spnc-navbar > .spnc-container.osavos-header-reordered > .collapse.spnc-collapse.open,
  html body .header-sidebar.header-2 .spnc-navbar > .spnc-container.osavos-header-reordered > .collapse.spnc-collapse.open,
  html body .header-sidebar .spnc-navbar > .spnc-container.osavos-header-reordered > .collapse.spnc-collapse.open {
    display: block !important;
    visibility: visible !important;
    pointer-events: auto !important;
    transform: translateX(0) !important;
    opacity: 1 !important;
  }
}

@media only screen and (max-width: 480px) {
  html body .header-sidebar.header-1 .spnc-navbar > .spnc-container.osavos-header-reordered,
  html body .header-sidebar.header-2 .spnc-navbar > .spnc-container.osavos-header-reordered,
  html body .header-sidebar .spnc-navbar > .spnc-container.osavos-header-reordered {
    padding: 12px 16px 16px !important;
    row-gap: 9px !important;
  }

  html body .header-sidebar .osavos-header-logo-right .custom-logo-link,
  html body .header-sidebar .osavos-header-logo-right .dark-custom-logo-link,
  html body .header-sidebar .osavos-header-logo-right .custom-logo,
  html body .header-sidebar .osavos-header-logo-right .dark-custom-logo {
    width: 76px !important;
    height: 76px !important;
    max-width: 76px !important;
    max-height: 76px !important;
    min-width: 76px !important;
    min-height: 76px !important;
  }

  html body .header-sidebar .spnc-navbar > .spnc-container.osavos-header-reordered > .spnc-menu-open.spnc-toggle {
    width: 46px !important;
    height: 46px !important;
    min-width: 46px !important;
    min-height: 46px !important;
  }

  html body .header-sidebar .osavos-header-site-text .site-title {
    font-size: clamp(24px, 7.4vw, 31px) !important;
  }

  html body .header-sidebar .osavos-header-site-text .site-description {
    max-width: 310px !important;
    font-size: clamp(15px, 4.2vw, 18px) !important;
  }
}

/* Correção anti-duplicação do logo no mobile.
   O segundo logo vinha do bloco do menu off-canvas (.collapse.spnc-collapse)
   aparecendo no fluxo do cabeçalho antes de o menu ser aberto. */
@media only screen and (max-width: 1100px) {
  html body .header-sidebar .spnc-navbar > .spnc-container.osavos-header-reordered > .collapse.spnc-collapse:not(.open) {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    transform: translateX(-120%) !important;
  }

  html body .header-sidebar .spnc-navbar > .spnc-container.osavos-header-reordered > .collapse.spnc-collapse:not(.open) .spnc-header,
  html body .header-sidebar .spnc-navbar > .spnc-container.osavos-header-reordered > .collapse.spnc-collapse:not(.open) .custom-logo-link,
  html body .header-sidebar .spnc-navbar > .spnc-container.osavos-header-reordered > .collapse.spnc-collapse:not(.open) .custom-logo,
  html body .header-sidebar .spnc-navbar > .spnc-container.osavos-header-reordered > .collapse.spnc-collapse:not(.open) .dark-custom-logo-link,
  html body .header-sidebar .spnc-navbar > .spnc-container.osavos-header-reordered > .collapse.spnc-collapse:not(.open) .dark-custom-logo {
    display: none !important;
  }
}

/* Correção final: dentro do bloco de logo do topo mobile deve existir visualmente apenas uma imagem.
   O Newscrunch pode gerar custom-logo e dark-custom-logo; aqui mantemos só o primeiro link. */
@media only screen and (max-width: 1100px) {
  html body .header-sidebar .osavos-header-logo-right > a:not(:first-child),
  html body .header-sidebar .osavos-header-logo-right > .dark-custom-logo-link,
  html body .header-sidebar .osavos-header-logo-right .dark-custom-logo {
    display: none !important;
    visibility: hidden !important;
    width: 0 !important;
    height: 0 !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-width: 0 !important;
    max-height: 0 !important;
    overflow: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
  }

  html body .header-sidebar .osavos-header-logo-right > a:first-child,
  html body .header-sidebar .osavos-header-logo-right > a:first-child img {
    display: flex !important;
  }
}
