/* ===== RESPONSIVE ===== */

@media (max-width: 980px) {
  /* Evita o zoom automático do iOS Safari ao focar em qualquer campo
     (ele dá zoom sozinho quando a fonte do input fica abaixo de 16px). */
  input, select, textarea { font-size: 16px !important; }

  .modal__body { flex-direction: column; }
  .tabs-nav { width: 100%; flex-direction: row; align-items: center; overflow-x: auto; border-right: none; border-bottom: 1px solid var(--cinza-100); gap: 0.75rem; }
  .tabs-nav__list { flex-direction: row; }
  .tabs-nav button .nav-label { display: none; }
  .tabs-nav__summary { display: none; }
  .product-detail { grid-template-columns: 1fr; }
  .product-tabs { grid-template-columns: 1fr; }
  .trust-badges { grid-template-columns: repeat(2, 1fr); }
  .product-detail__gallery { flex-direction: column-reverse; }
  .product-detail__thumbs { flex-direction: row; overflow-x: auto; }
  .product-detail__thumb { width: 56px; height: 56px; }
  .product-detail__specs li { grid-template-columns: 18px 110px 1fr; }
  .product-detail__image { aspect-ratio: 4 / 3; }
  .product-detail__image img { object-fit: contain; padding: 1.25rem; box-sizing: border-box; background: var(--branco); }
  .header-nav__links { display: none; }
  .products-grid, .products-grid--5col { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .search-page__layout { grid-template-columns: 1fr; }
  .search-page__filters { position: static; }
}

@media (max-width: 760px) {
  /* Mantém a página firme no eixo horizontal. A rolagem vertical e o zoom
     continuam funcionando normalmente. */
  html, body {
    width: 100%; max-width: 100%;
    overflow-x: clip;
    overscroll-behavior-x: none;
    touch-action: pan-y pinch-zoom;
  }
  .site-header, main, .hero, .site-footer { width: 100%; max-width: 100%; overflow-x: clip; }

  /* ---- cabeçalho compacto da vitrine mobile ---- */
  .site-header { border-bottom: 0; border-radius: 0 0 22px 22px; box-shadow: 0 3px 14px rgba(15, 41, 92, 0.06); }
  .header-top { flex-wrap: wrap; row-gap: 0.65rem; padding: 0.7rem 0 0.8rem; }
  .logo { min-width: 0; flex: 1 1 0; gap: 0.42rem; font-size: 0.9rem; }
  .logo__mark { width: 42px; height: 42px; }
  .header-actions { order: 2; margin-left: auto; flex-wrap: nowrap; gap: 0.35rem; }
  .header-action {
    width: 42px; height: 42px; padding: 0; justify-content: center;
    border-radius: 50%; border: 1px solid var(--cinza-300);
  }
  .header-action span:last-child { display: none; }
  .header-action .icon { width: 17px; height: 17px; }
  /* No celular, sair continua disponível dentro de "Minha conta". Ocultar
     o atalho evita que quatro ícones quebrem a primeira linha do cabeçalho. */
  #btn-sair { display: none !important; }
  .icon-btn { width: 42px; height: 42px; }
  .menu-toggle { display: none; }
  .search-bar { order: 3; flex-basis: 100%; min-height: 48px; padding-left: 0.8rem; }
  .search-bar__leading { display: inline-flex; width: 20px; height: 20px; color: var(--azul-900); flex-shrink: 0; }
  .search-bar__leading .icon { width: 20px; height: 20px; }
  .search-bar input { padding-block: 0.45rem; font-size: 0.82rem !important; }
  .search-bar__btn { width: 42px; height: 42px; }
  .select-pill { order: 4; flex-basis: 100%; }
  .select-pill select { width: 100%; box-sizing: border-box; }

  /* ---- hero: texto à esquerda e composição visual à direita ---- */
  .hero {
    min-height: 465px; padding: 0;
    background: radial-gradient(circle at 88% 20%, #72c2ff 0 10%, transparent 38%),
      linear-gradient(135deg, #f5fbff 0%, #d9f0ff 46%, #2588ed 100%);
  }
  .hero::after { content: ""; position: absolute; inset: auto 0 0; height: 135px; background: linear-gradient(0deg, rgba(255,255,255,.92), transparent); pointer-events: none; z-index: 1; }
  .hero__inner { position: relative; display: block; min-height: 465px; }
  .hero__content { position: relative; z-index: 3; width: min(58%, 255px); min-width: 0; padding-top: 0.7rem; gap: 0.95rem; }
  .hero__eyebrow { font-size: 0.62rem; padding: 0.35rem 0.55rem; }
  .hero__title { font-size: clamp(1.72rem, 8vw, 2.2rem); line-height: 1.02; letter-spacing: -0.04em; }
  .hero__subtitle { font-size: 0.78rem; line-height: 1.3; max-width: 22ch; }
  .hero__actions { display: grid; gap: 0.65rem; margin-top: 0.4rem; width: min(230px, 100%); }
  .hero__actions a { min-height: 42px; padding: 0.6rem 0.75rem; justify-content: center; font-size: 0.75rem; }
  .hero__actions .btn-whatsapp-lg { background: rgba(255,255,255,.96); color: #16a34a; box-shadow: var(--sombra-sm); }
  .hero__art { position: absolute; z-index: 2; left: -0.5rem; bottom: -0.25rem; width: 760px; max-width: none; min-width: 0; min-height: 0; display: block; pointer-events: none; }
  .hero__art picture { width: 100%; display: block; mask-image: linear-gradient(90deg, transparent 0%, rgba(0,0,0,.18) 23%, #000 42%); }
  .hero__art-img { width: 100%; max-width: none; border-radius: 0; }
  .hero__features { display: none; }
  .mobile-benefits {
    position: relative; z-index: 5;
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0;
    margin-top: -0.8rem; margin-bottom: 0; padding: 0.85rem 0.25rem; min-height: 104px;
    list-style: none;
    border-radius: 18px; background: rgba(255,255,255,.96);
    box-shadow: 0 10px 30px rgba(21, 59, 118, 0.11);
    backdrop-filter: blur(8px);
  }
  .mobile-benefits li {
    position: relative; display: flex; flex-direction: column; align-items: center;
    justify-content: flex-start; gap: 0.35rem; padding: 0 0.3rem; text-align: center;
  }
  .mobile-benefits li:not(:last-child)::after {
    content: ""; position: absolute; top: 0.35rem; right: 0; bottom: 0.35rem;
    width: 1px; background: var(--cinza-200);
  }
  .mobile-benefits__icon {
    display: grid; place-items: center; flex-shrink: 0; border-radius: 50%;
    width: 43px; height: 43px; box-sizing: border-box; padding: 10px;
    color: var(--azul-700); background: #e9f2ff; box-shadow: none;
  }
  .mobile-benefits__icon .icon, .mobile-benefits__icon svg { width: 100%; height: 100%; }
  .mobile-benefits__icon--whatsapp { color: #16a34a; background: #dcfce7; }
  .mobile-benefits strong { display: block; color: var(--azul-900); font-size: 0.65rem; line-height: 1.15; }
  .mobile-benefits li > div > span {
    display: block; color: var(--cinza-500);
    margin-top: 0.25rem; font-size: 0.53rem; line-height: 1.2;
    text-transform: uppercase;
  }

  .cart-drawer { width: 100vw; }
  .modal--sheet { padding-bottom: 0; }
  body:has(.bottom-nav) { padding-bottom: calc(58px + env(safe-area-inset-bottom)); }
  .bottom-nav { display: flex; }
  .related-products__track .product-card { flex: 0 0 calc((100% - 1rem) / 2); }
  .related-products__head h2 { font-size: 1.1rem; }

  /* O acesso à conta continua disponível também no topo, como na vitrine. */
  #btn-entrar { display: inline-flex; }

  /* Toast no mobile: embaixo (no desktop fica em cima, ver style.css). */
  .toast {
    top: auto;
    bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    transform: translate(-50%, 20px);
  }
  .toast.show { transform: translate(-50%, 0); }

  /* Com o carrinho aberto, o rodapé (subtotal/total/botão Finalizar) reserva
     um espaço extra embaixo pra caber o toast sem tampar o botão. */
  .cart-drawer__summary { padding-bottom: calc(1.25rem + 60px); }
  body:has(.cart-drawer.is-open) .toast {
    bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  }

  /* ---- catálogo/busca: filtros viram painel recolhível ---- */
  .search-page__btn-filtros { display: flex; }
  .products-grid { grid-template-columns: repeat(2, 1fr); }
  .search-page__filters {
    display: none;
    margin-bottom: 1.25rem;
    position: static;
    padding: 0.25rem 1.1rem;
  }
  .search-page__filters.is-aberto { display: block; }
  .search-page__filters-head { display: none; }
}

@media (max-width: 480px) {
  .container { width: 94vw; }
  .products-grid { grid-template-columns: repeat(2, 1fr); gap: 0.7rem; }
  .products-grid--5col { grid-template-columns: repeat(2, 1fr); }
  /* minmax(0, 1fr) permite que as três colunas encolham dentro da tela,
     inclusive quando uma categoria tem nome longo. */
  .categories-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .category-card { min-width: 0; }
  .stat-card span { font-size: 1.3rem; }

  /* Cards de produto em tamanho padrão: nome não estica o card, trunca com "..." */
  .product-card__brand { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .product-card__name {
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden; min-height: calc(1.3em * 2);
  }
  /* Botões empilhados em vez de lado a lado, WhatsApp com texto */
  .product-card__actions { flex-direction: column; }
  .product-card__add { width: 100%; padding: 0.6rem 0.8rem; font-size: 0.85rem; }
  .product-card__ask {
    width: 100%; height: auto; border-radius: var(--raio-sm); padding: 0.6rem 0.8rem;
    font-size: 0.85rem; font-weight: 600; gap: 0.45rem;
  }
  .product-card__ask span { display: inline; }
}

@media (min-width: 1600px) {
  .container { width: min(1440px, 88vw); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
