/* ============================================================
   TEIXEIRA STYLE — responsive.css
   Breakpoints: 1200px | 1024px | 768px | 480px
   ============================================================ */

/* ============================================================
   LARGE DESKTOP (≤ 1200px)
   ============================================================ */
@media (max-width: 1200px) {
  :root {
    --container-pad: 1.5rem;
  }

  .categories__grid {
    grid-template-columns: repeat(5, 1fr);
  }

  .highlights__grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .footer__grid {
    grid-template-columns: 1.5fr 1fr 1.5fr 1.5fr;
    gap: 3rem;
  }
}

/* ============================================================
   TABLET / SMALL LAPTOP (≤ 1024px)
   ============================================================ */
@media (max-width: 1024px) {
  /* Navbar */
  .navbar__menu,
  .navbar__cta {
    display: none;
  }

  .navbar__hamburger {
    display: flex;
  }

  /* Body cursor hidden on touch devices */
  body {
    cursor: auto;
  }

  .cursor,
  .cursor-follower {
    display: none;
  }

  /* Hero */
  .hero__title {
    font-size: clamp(4rem, 12vw, 7rem);
  }

  /* Categories */
  .categories__grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Highlights */
  .highlights__grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* About */
  .about__grid {
    grid-template-columns: 1fr;
    gap: 3rem;
  }

  .about__image-wrap {
    max-width: 600px;
    margin-inline: auto;
  }

  .about__img-accent {
    display: none;
  }

  /* Differentials */
  .differentials__grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Instagram */
  .instagram__grid {
    grid-template-columns: repeat(3, 1fr);
  }

  /* Footer */
  .footer__grid {
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
  }
}

/* ============================================================
   MENU MOBILE — GARANTIA ABSOLUTA
   Independente de qualquer estado JS/bfcache/CSS cascade:
   menu sem .open = invisível e não-clicável em qualquer tamanho de tela
   ============================================================ */
.navbar__mobile-menu:not(.open) {
  display: none !important;
  pointer-events: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
}

/* ============================================================
   TABLET PORTRAIT (≤ 768px)
   ============================================================ */
@media (max-width: 768px) {
  :root {
    --container-pad: 1.2rem;
    --space-xl: 4rem;
    --space-lg: 2.5rem;
  }

  /* Section titles */
  .section-title {
    font-size: clamp(2rem, 8vw, 3rem);
  }

  /* Navbar — home */
  .navbar {
    padding: 0.7rem 0;
  }

  .navbar.scrolled {
    padding: 0.45rem 0;
  }

  /* Hero: z-index alto para ficar acima de qualquer elemento fixo de outra página */
  .hero {
    z-index: 1;
  }

  /* CTA Section: padding para não colapsar sem imagem de fundo */
  .cta-section {
    padding-block: 4rem;
    min-height: auto;
  }

  .cta-section__content {
    padding-inline: 1.5rem;
    width: 100%;
  }

  .cta-section__title {
    font-size: clamp(2rem, 10vw, 3.5rem);
    margin-bottom: 1rem;
  }

  .cta-section__subtitle {
    font-size: 0.9rem;
    margin-bottom: 2rem;
  }


  /* Navbar search HOME: menor mas visível */
  .page-index .navbar__search {
    max-width: 140px;
  }

  .page-index .navbar__search-input {
    width: 90px;
  }

  /* Google btn HOME: mostra apenas ícone, sem texto */
  .page-index .navbar__google-btn {
    font-size: 0;
    padding: 0.4rem 0.55rem;
    gap: 0;
    min-width: 36px;
    justify-content: center;
  }

  .page-index .navbar__google-btn svg {
    width: 18px;
    height: 18px;
  }

  /* Hero — garantir que o conteúdo não fique atrás do header */
  .hero {
    padding-top: calc(34px + 56px);
    box-sizing: border-box;
    align-items: flex-end;
    justify-content: center;
  }

  .hero__content {
    margin-bottom: 4rem;
    padding-bottom: 1rem;
  }

  .hero__logo-img {
    max-width: min(520px, 88vw);
    margin-bottom: 1.2rem;
  }

  .hero__title {
    font-size: clamp(3.5rem, 16vw, 6rem);
  }

  .hero__subtitle {
    font-size: 0.95rem;
  }

  .hero__actions {
    flex-direction: column;
    align-items: center;
  }

  .hero__actions .btn {
    width: 100%;
    max-width: 320px;
    justify-content: center;
  }

  /* Categories */
  .categories__grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .category-card {
    aspect-ratio: 1;
  }

  .category-card__name {
    font-size: 1.6rem;
  }

  /* Highlights */
  .highlights__grid {
    grid-template-columns: 1fr;
    max-width: 420px;
    margin-inline: auto;
  }

  /* Banner — padding garante altura sem colapsar no mobile */
  .banner {
    min-height: auto;
    padding-block: 5rem;
  }

  .banner__title {
    font-size: clamp(3.5rem, 16vw, 6rem);
  }

  /* About */
  .about__stats {
    gap: 2rem;
    flex-wrap: wrap;
  }

  /* Differentials */
  .differentials__grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }

  .diff-card {
    padding: 2rem 1.5rem;
  }

  /* Instagram */
  .instagram__grid {
    grid-template-columns: repeat(3, 1fr);
  }

  /* CTA */
  .cta-section__title {
    font-size: clamp(2.2rem, 10vw, 3.5rem);
  }

  /* Footer */
  .footer__grid {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }

  .footer__bottom-inner {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
  }

  /* Back to top */
  .back-to-top {
    bottom: 1.5rem;
    right: 1.5rem;
    width: 42px;
    height: 42px;
  }
}

/* ============================================================
   MOBILE (≤ 480px)
   ============================================================ */
@media (max-width: 480px) {
  :root {
    --container-pad: 1rem;
  }

  /* Navbar */
  .navbar__logo-img {
    height: 38px;
  }

  /* Navbar actions — carrinho acessível */
  .navbar__actions {
    gap: 0.5rem;
  }

  /* Hero */
  .hero {
    padding-top: calc(34px + 52px);
  }

  .hero__content {
    margin-bottom: 3rem;
  }

  .hero__logo-img {
    max-width: min(420px, 90vw);
    margin-bottom: 1rem;
  }

  .hero__title {
    font-size: clamp(3rem, 18vw, 5rem);
  }

  .hero__eyebrow {
    font-size: 0.65rem;
  }

  .hero__subtitle {
    font-size: 0.9rem;
  }

  /* Categories grid → 1 column on very small screens */
  .categories__grid {
    grid-template-columns: 1fr;
  }

  .category-card {
    aspect-ratio: 4/3;
  }

  /* Highlights 1 col */
  .highlights__grid {
    max-width: 100%;
  }

  /* Banner */
  .banner {
    min-height: auto;
    padding-block: 4rem;
  }

  .banner__title {
    font-size: clamp(3rem, 20vw, 5rem);
  }

  /* About stats */
  .about__stats {
    gap: 1.5rem;
  }

  .about__stat-number {
    font-size: 2rem;
  }

  /* Differentials 1 col */
  .differentials__grid {
    grid-template-columns: 1fr;
  }

  /* Instagram 2 col */
  .instagram__grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Mobile menu link size */
  .navbar__mobile-link {
    font-size: 2rem;
  }

  /* Buttons full width on small */
  .btn--lg {
    padding: 1rem 2rem;
    font-size: 0.8rem;
  }
}

/* ============================================================
   EXTRA SMALL (≤ 360px)
   ============================================================ */
@media (max-width: 360px) {
  .hero__title {
    font-size: clamp(2.5rem, 20vw, 4rem);
  }

  .navbar__logo-img {
    height: 32px;
  }

  .hero__content {
    margin-bottom: 2rem;
  }

  .hero__logo-img {
    max-width: 90vw;
  }

  .instagram__grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ============================================================
   SMALL MOBILE (≤ 430px) — extra tweaks
   ============================================================ */
@media (max-width: 430px) {
  /* Footer compact */
  .footer__top { padding-block: 3rem; }
  .footer__grid { gap: 2rem; }
}

/* ============================================================
   ADMIN SIDEBAR OVERLAY BACKDROP (mobile)
   ============================================================ */
@media (max-width: 768px) {
  /* Backdrop para fechar sidebar ao clicar fora */
  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 199;
  }
  .sidebar-backdrop.visible { display: block; }
}

/* ============================================================
   CHECKOUT PAGE — extra mobile fixes
   ============================================================ */
@media (max-width: 480px) {
  /* QR Code PIX proporcional */
  #qrCodeImg { max-width: 200px; width: 100%; height: auto; }

  /* Campo PIX copia e cola sem overflow */
  .pix-box { font-size: 0.7rem; word-break: break-all; overflow-wrap: anywhere; }

  /* Botões de pagamento empilhados */
  .payment-methods { gap: 0.5rem; }
}

/* ============================================================
   TOUCH DEVICES — disable cursor effects + force reveal visible
   ============================================================ */
@media (hover: none) {
  .cursor,
  .cursor-follower {
    display: none !important;
  }

  body {
    cursor: auto !important;
  }

  button,
  a,
  .category-card,
  .product-card,
  .instagram__item {
    cursor: pointer !important;
  }

  /* CORREÇÃO CRÍTICA: em dispositivos touch o IntersectionObserver
     pode não disparar corretamente. Força todos os .reveal visíveis.
     A animação de scroll é opcional — conteúdo nunca pode ficar opacity:0. */
  .reveal {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}

/* ============================================================
   REDUCED MOTION — respect user preference
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .hero__scroll-line {
    animation: none;
  }

  .hero__scroll-indicator {
    animation: none;
    opacity: 0.5;
  }

  * {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
