/* Ajuste final do menu para telas pequenas. */
@media (min-width: 601px) {
  .mobile-menu-toggle {
    display: none !important;
  }

  .main-nav {
    display: block !important;
  }
}

@media (max-width: 600px) {
  .mobile-menu-toggle {
    display: inline-flex !important;
  }
}

.search button {
  display: grid;
  place-items: center;
  padding: 0;
  line-height: 1;
}

.category-mode #produtos .section-kicker::before {
  content: none;
}

.category-mode #produtos .filter-label {
  color: #151515;
}

.category-mode #produtos .filter-category {
  color: var(--brand);
  text-transform: uppercase;
}

/* As setas precisam ficar sobre a imagem, uma em cada lado. */
.promo-visual > .promo-arrow {
  position: absolute;
  top: 50%;
  z-index: 4;
  transform: translateY(-50%);
}

.promo-visual > .promo-arrow-prev {
  left: 14px;
}

.promo-visual > .promo-arrow-next {
  right: 14px;
}

.promo-visual > .promo-arrow:hover {
  transform: translateY(-50%) scale(1.06);
}

.promo-visual.has-image::before,
.promo-visual.has-image::after {
  display: none;
}

.promo-sticker {
  top: 18px;
  left: 18px;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  box-shadow: 0 6px 16px #10182744;
  text-shadow: none;
}

/* Deixa somente as setas visíveis, sem círculo, fundo ou sombra. */
.promo-visual > .promo-arrow {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.promo-visual > .promo-arrow:hover {
  background: transparent;
  box-shadow: none;
}

.category-icon-svg {
  display: block;
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

/* Mantém as categorias afastadas do rodapé quando a tela está filtrada. */
.categories-mode #categorias {
  margin-bottom: 28px;
  padding-bottom: 72px;
}

.category-mode #produtos {
  margin-bottom: 28px;
  padding-bottom: 72px;
}

/* O caractere dos três pontos tem uma linha de base baixa; este ajuste o centraliza visualmente. */
.category-more .category-icon {
  transform: translateY(-3px);
}

/* Publicidade: separação, imagem proporcional e leitura mais limpa. */
.site-ad-section {
  margin-top: 36px;
}

.site-ad-content {
  padding-bottom: 38px;
}

.site-ad-content p,
.floating-ad-content p {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.site-ad-visual img,
.floating-ad-art img {
  object-fit: contain;
  background: #eef1ff;
}

#site-ad-label {
  display: none;
}

/* A bolha precisa contrastar com o fundo claro do site. */
.floating-ad {
  border-color: #263b88;
  background: var(--navy);
  box-shadow: 0 16px 40px #07143d55;
}

.floating-ad-close {
  background: #ffffffee;
}

.floating-ad-content strong {
  color: #fff;
}

.floating-ad-content p {
  color: #d9e0ff;
}

.floating-ad-action {
  color: #ff7f7f;
}

/* A primeira visualização ocupa uma única linha com seis posições. */
.category-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

/* Evita a faixa branca e a rolagem horizontal causada por elementos decorativos. */
html,
body {
  max-width: 100%;
  overflow-x: clip;
}

@supports not (overflow: clip) {
  html,
  body {
    overflow-x: hidden;
  }
}

/*
 * Ajustes finais para telas pequenas.
 * Este arquivo é carregado depois dos demais estilos do site principal,
 * portanto estas regras corrigem os overrides anteriores sem alterar o painel.
 */
@media (max-width: 620px) {
  /* Logo: preserva a palavra inteira e evita que ela seja comprimida. */
  .brand {
    min-width: 0;
    flex: 0 1 auto;
    gap: 0;
  }

  .brand .logo-wordmark,
  .brand-light .logo-wordmark {
    display: block;
    flex: 0 0 auto;
    max-width: none;
    white-space: nowrap;
    font-family: "Arial Black", "Trebuchet MS", Arial, sans-serif;
    font-size: clamp(27px, 8.5vw, 33px);
    font-style: italic;
    font-weight: 900;
    letter-spacing: -1.8px;
    line-height: 0.95;
    transform: rotate(-2deg);
  }

  .brand .logo-wordmark::after,
  .brand-light .logo-wordmark::after {
    bottom: 3px;
    height: 5px;
    border-top-width: 3px;
    box-shadow: 0 2px 0 var(--brand);
  }

  .header-main {
    gap: 8px;
  }

  .header-actions {
    margin-left: auto;
    gap: 6px;
  }

  .mobile-menu-toggle {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
  }

  /* Oferta em destaque: fica inteiramente dentro do bloco, sem cortar a base. */
  .hero-art {
    min-height: 184px;
    margin-top: 4px;
  }

  .hero-card {
    left: 10%;
    top: 16px;
    width: min(220px, 76%);
    padding: 19px;
  }

  .hero-card small {
    margin-bottom: 11px;
  }

  .hero-card strong {
    font-size: 21px;
  }

  .hero-card span {
    margin-top: 11px;
  }

  /* Respiro entre a grade filtrada e o rodapé. */
  .category-mode #produtos,
  .categories-mode #categorias {
    padding-bottom: 64px;
  }

  .category-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    row-gap: 12px;
  }

  .category {
    min-height: 116px;
    padding: 14px 8px;
  }

  .category-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 10px;
  }

  .category-icon-svg {
    width: 23px;
    height: 23px;
  }

  .category-name {
    font-size: 12px;
    line-height: 1.2;
  }

  /* Contador de destaques compacto, sem quebrar "produtos disponíveis". */
  #produtos .section-heading {
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
  }

  #produtos .section-heading > div {
    min-width: 0;
  }

  #produtos .result-label {
    flex: 0 0 auto;
    gap: 3px;
    min-height: 26px;
    padding: 4px 7px;
    font-size: 8px;
  }

  #produtos .result-label strong {
    min-width: 18px;
    width: 18px;
    height: 18px;
    font-size: 9px;
  }

  /* Rodapé compacto no celular: atendimento e compra segura ficam ocultos. */
  .footer-grid > div:nth-child(3),
  .footer-grid > div:nth-child(4) {
    display: none;
  }

  /* Dois produtos por linha, com leitura confortável e imagem completa. */
  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .product-image {
    height: 118px;
    background: #f7f8fa;
  }

  .product-image img {
    object-fit: contain;
  }

  .product-info {
    padding: 9px;
  }

  .product-badge {
    top: 7px;
    left: 7px;
    padding: 4px 6px;
    font-size: 8px;
  }

  .favorite-button {
    top: 6px;
    right: 6px;
    width: 27px;
    height: 27px;
    font-size: 15px;
  }

  .product-category {
    font-size: 8px;
  }

  .product-card h3 {
    min-height: 30px;
    margin: 3px 0 4px;
    font-size: 12px;
    line-height: 1.25;
  }

  .product-description {
    margin-bottom: 7px;
    font-size: 10px;
    line-height: 1.3;
  }

  .product-price {
    font-size: 15px;
  }

  .product-previous-price {
    font-size: 10px;
  }

  .product-meta {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 15px;
    min-width: 0;
    font-size: 8px;
    line-height: 1.25;
    white-space: nowrap;
  }

  .product-meta span {
    display: inline-block;
    min-width: 0;
  }

  .product-meta span:last-child {
    flex: 0 1 auto;
    font-size: 7px;
    letter-spacing: -0.15px;
  }

  .product-button {
    margin-top: 9px;
    padding: 8px 6px;
    font-size: 10px;
  }

  /* Destaque do dia e cursos: redução moderada, sem deixar as áreas apertadas. */
  .promo-carousel,
  .course-callout {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .promo-carousel {
    margin-top: 34px;
  }

  .promo-visual {
    min-height: 170px;
    max-height: 170px;
  }

  .promo-visual > .promo-arrow-prev {
    left: 10px;
  }

  .promo-visual > .promo-arrow-next {
    right: 10px;
  }

  .promo-copy {
    padding: 24px 22px 26px;
  }

  .promo-copy h2,
  .course-callout h2 {
    margin: 7px 0 9px;
    font-size: 21px;
  }

  .promo-copy p,
  .course-callout p {
    font-size: 12px;
    line-height: 1.45;
  }

  .course-callout {
    margin-top: 34px;
    padding: 24px 22px;
  }

  .course-callout .secondary-button {
    margin-top: 14px;
  }
}

/* Menu mobile em formato modal, com fundo escurecido e fechamento por X. */
@media (max-width: 600px) {
  body.mobile-menu-open {
    overflow: hidden;
  }

  .mobile-menu-open .mobile-menu-toggle {
    position: fixed;
    top: 86px;
    right: max(28px, calc((100vw - 380px) / 2 + 18px));
    z-index: 1202;
    width: 32px;
    height: 32px;
    border: 1px solid var(--brand);
    border-radius: 8px;
    background: #fff;
    color: var(--brand);
    font-size: 24px;
    line-height: 1;
    box-shadow: 0 8px 24px #07143d40;
  }

  .mobile-menu-open .main-nav {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: block !important;
    width: 100%;
    height: 100dvh;
    padding: 76px 16px 24px;
    background: #07143dcc;
    border: 0;
    overflow-y: auto;
  }

  .mobile-menu-open .main-nav .nav-inner {
    display: block;
    width: min(100%, 380px);
    max-height: calc(100dvh - 110px);
    margin: 0 auto;
    padding: 18px 18px 12px;
    overflow-y: auto;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 20px 55px #07143d50;
  }

  .mobile-menu-open .nav-category {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 48px;
    padding: 12px 4px;
    border: 0;
    border-bottom: 1px solid var(--line);
    color: var(--navy);
    text-align: left;
    font-size: 14px;
  }

  .mobile-menu-open .nav-category:last-child {
    border-bottom: 0;
  }

  .mobile-menu-open .nav-category.active,
  .mobile-menu-open .nav-category:hover {
    color: var(--brand);
  }
}
