/* ==========================================================================
   RESPONSIVE SYSTEM - AB DESIGNERS
   Estrategia:
   1) Mobile-first (base em styles.css)
   2) Ajustes progressivos por faixa
   3) Refino de tipografia, espacamento e densidade visual
   ========================================================================== */

/* --------------------------------------------------------------------------
   MOBILE APP-LIKE: até 767px (faixas horizontais + snap)
   -------------------------------------------------------------------------- */
@media (max-width: 767px) {
  /* Cabeçalho: logo ~50%, tema ao lado da marca, menu compacto */
  .header-inner {
    gap: 0.4rem;
    padding: 0.55rem 0 0.5rem;
  }

  .header-mobile-tools {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: auto;
  }

  .header-mobile-tools .theme-toggle-btn {
    border: 0;
    background: transparent;
    padding: 0.2rem;
  }

  .header-mobile-tools .theme-toggle-text {
    display: none;
  }

  .header-mobile-tools .theme-toggle-rail {
    width: 52px;
    height: 28px;
    padding: 0 6px;
  }

  .header-mobile-tools .theme-toggle-knob {
    width: 20px;
    height: 20px;
    top: 4px;
    left: 4px;
  }

  .header-mobile-tools .theme-toggle-icon {
    font-size: 0.72rem;
  }

  html[data-theme="dark"] .header-mobile-tools .theme-toggle-knob {
    transform: translateX(24px);
  }

  .brand img.brand-logo,
  .brand-logo {
    width: 64px;
  }

  .icon-btn {
    width: 36px;
    height: 36px;
    gap: 3.5px;
    border-radius: 8px;
  }

  .icon-btn span {
    width: 16px;
    height: 2px;
  }

  /* Rodapé mais enxuto no mobile */
  .footer-main {
    gap: 0.75rem;
    padding: 0.75rem 0 0.45rem;
  }

  .footer-logo {
    height: clamp(56px, 18vw, 76px);
    width: auto;
    max-width: 100%;
    object-fit: contain;
  }

  .footer-value,
  .footer-area {
    font-size: 0.86rem;
    line-height: 1.45;
    margin-bottom: 0.35rem;
  }

  .footer-title {
    font-size: 0.9rem;
    margin-bottom: 0.35rem;
  }

  .footer-contact-list a,
  .footer-contact-list span {
    min-height: 32px;
    font-size: 0.88rem;
  }

  .footer-bottom {
    padding: 0.55rem 0 0.8rem;
    gap: 0.55rem;
  }

  .footer-meta {
    gap: 0.35rem;
  }

  .footer-dpo {
    font-size: 0.82rem;
  }

  .footer-copy--merged {
    font-size: 0.8rem;
  }

  /*
   * Carréis horizontais: máscara à direita + “pontinhos + seta” no wrapper (.h-scroll-rail, sem texto).
   */
  .trust-scroll.h-scroll-rail .trust-grid,
  .cards-scroll.h-scroll-rail .cards {
    -webkit-mask-image: linear-gradient(90deg, #000 0%, #000 min(100% - 44px, 90%), transparent 100%);
    mask-image: linear-gradient(90deg, #000 0%, #000 min(100% - 44px, 90%), transparent 100%);
  }

  .h-scroll-rail {
    position: relative;
  }

  .h-scroll-rail::after {
    content: "";
    position: absolute;
    z-index: 4;
    right: max(0.45rem, env(safe-area-inset-right, 0px));
    bottom: 0.35rem;
    width: 26px;
    height: 12px;
    pointer-events: none;
    opacity: 0.58;
    background:
      radial-gradient(circle at 3px 6px, var(--gold) 1.75px, transparent 1.85px),
      radial-gradient(circle at 10px 6px, var(--gold) 1.75px, transparent 1.85px),
      radial-gradient(circle at 17px 6px, var(--gold) 1.75px, transparent 1.85px),
      linear-gradient(118deg, transparent 50%, var(--gold) 51%, var(--gold) 55%, transparent 56%) 19px 1px / 8px 11px no-repeat;
  }

  .trust-scroll {
    margin-inline: calc(50% - 50vw);
    width: 100vw;
    max-width: 100vw;
    padding-inline: max(1rem, env(safe-area-inset-left, 0px)) max(1rem, env(safe-area-inset-right, 0px));
    box-sizing: border-box;
  }

  .trust-scroll .trust-grid {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 0.75rem;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: max(1rem, env(safe-area-inset-left, 0px));
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    padding: 1rem 0 1.15rem;
  }

  .trust-scroll .trust-grid::-webkit-scrollbar {
    display: none;
  }

  .trust-scroll .stat-card {
    flex: 0 0 min(86vw, 300px);
    max-width: min(86vw, 300px);
    scroll-snap-align: center;
    scroll-snap-stop: always;
  }

  .cards-scroll {
    margin-inline: calc(50% - 50vw);
    width: 100vw;
    max-width: 100vw;
    padding-inline: max(1rem, env(safe-area-inset-left, 0px)) max(1rem, env(safe-area-inset-right, 0px));
    box-sizing: border-box;
  }

  .cards-scroll .cards {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 0.75rem;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: max(1rem, env(safe-area-inset-left, 0px));
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    padding-bottom: 0.45rem;
  }

  .cards-scroll .cards::-webkit-scrollbar {
    display: none;
  }

  .cards-scroll .card {
    flex: 0 0 min(86vw, 320px);
    max-width: min(86vw, 320px);
    scroll-snap-align: center;
    scroll-snap-stop: always;
  }

  /* Melhora visibilidade das setas no mobile (estilo discreto) */
  .services-premium .carousel-control {
    width: 36px;
    height: 36px;
    top: auto;
    bottom: -8px; /* Próximo aos indicadores */
    background: rgba(255, 255, 255, 0.08);
  }

  .services-premium .carousel-control.prev {
    left: 22%;
  }
  .services-premium .carousel-control.next {
    right: 22%;
  }
}

/* --------------------------------------------------------------------------
   XS DEVICES - ate 359px
   -------------------------------------------------------------------------- */
@media (max-width: 359px) {
  .container {
    width: min(100% - 1rem, 1100px);
  }

  .brand img.brand-logo,
  .brand-logo {
    width: 54px;
  }

  .icon-btn {
    width: 32px;
    height: 32px;
  }

  .icon-btn span {
    width: 4px;
    height: 4px;
  }

  .btn {
    width: 100%;
    text-align: center;
  }

  .floating-whatsapp {
    right: 10px;
    bottom: 10px;
    padding: 0.68rem 0.88rem;
    font-size: 0.88rem;
  }
}

/* --------------------------------------------------------------------------
   SM DEVICES - 360px ate 479px
   -------------------------------------------------------------------------- */
/* --------------------------------------------------------------------------
   MOBILE LARGE - 480px ate 575px
   -------------------------------------------------------------------------- */
@media (min-width: 480px) and (max-width: 575px) {
  .btn {
    padding: 0.8rem 1.02rem;
  }

}

/* --------------------------------------------------------------------------
   SMALL TABLETS / PHABLETS - 576px ate 767px
   -------------------------------------------------------------------------- */
@media (min-width: 576px) and (max-width: 767px) {
  .container {
    width: min(100% - 2.4rem, 1100px);
  }

  .trust-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .showcase {
    grid-template-columns: repeat(2, 1fr);
  }

  .footer-main {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem 1.1rem;
  }
}

/* --------------------------------------------------------------------------
   TABLETS / DESKTOP ENTRY - >= 768px
   -------------------------------------------------------------------------- */
@media (min-width: 768px) {
  .desktop-nav {
    display: flex;
  }

  .hero-grid {
    display: grid;
    grid-template-columns: 1fr;
    height: 100%;
  }

  .hero-copy {
    padding-left: calc((100vw - min(100vw - 2rem, 1100px)) / 2);
    padding-right: calc((100vw - min(100vw - 2rem, 1100px)) / 2);
    padding-top: 0;
    padding-bottom: 0;
    text-align: left;
    align-items: flex-start;
    /* Garante que o texto fique legível sobre a imagem no desktop */
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
  }

  html.dark .hero-copy {
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
  }

  .header-inner {
    position: relative;
  }

  .icon-btn {
    display: none;
  }

  .desktop-nav {
    display: flex;
    align-items: center;
    flex: 1;
    justify-content: flex-end;
  }

  .desktop-nav-links {
    display: flex;
    align-items: center;
    gap: 0.25rem;
  }

  .desktop-nav-links a {
    text-decoration: none;
    color: var(--text);
    font-weight: 600;
    padding: 0.52rem 0.72rem;
    border-radius: 9px;
    transition: background-color 0.2s ease, border-color 0.2s ease;
  }

  .desktop-nav-links a:hover {
    background: var(--bg-soft);
  }

  .desktop-nav .theme-toggle-btn {
    flex-shrink: 0;
    margin-left: 1rem;
  }

  .desktop-nav .theme-toggle-text {
    display: none;
  }

  .mobile-nav {
    display: none !important;
  }

  .differentials-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .trust-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .showcase {
    grid-template-columns: 1.1fr 1fr 1fr;
  }

  .floating-whatsapp {
    right: 16px;
    bottom: 16px;
  }

  .footer-main {
    grid-template-columns: 1.2fr 1fr 1fr 1.15fr;
    align-items: start;
    gap: 1.1rem;
  }

}

/* --------------------------------------------------------------------------
   DESKTOP STANDARD - >= 992px
   -------------------------------------------------------------------------- */
@media (min-width: 992px) {
  .container {
    width: min(100% - 3rem, 1100px);
  }

  .header-inner {
    padding: 0.95rem 0 0.85rem;
  }

  .brand img.brand-logo {
    width: 138px;
  }

  .desktop-nav-links a {
    padding: 0.55rem 0.8rem;
  }

  .section {
    padding: 2.8rem 0;
  }

  .card-body {
    padding: 1.15rem;
  }

  .footer-main {
    gap: 1.25rem;
  }

}

/* --------------------------------------------------------------------------
   LARGE DESKTOP - >= 1200px
   -------------------------------------------------------------------------- */
@media (min-width: 1200px) {
  .container {
    width: min(100% - 4rem, 1180px);
  }

  .trust-grid {
    gap: 1.2rem;
  }

  .cards {
    grid-template-columns: repeat(4, 1fr);
  }

  .showcase {
    gap: 1rem;
  }

}

/* --------------------------------------------------------------------------
   ULTRA-WIDE - >= 1440px
   -------------------------------------------------------------------------- */
@media (min-width: 1440px) {
  .container {
    width: min(100% - 6rem, 1280px);
  }

}

@media (max-width: 767px) {
  .hero-grid {
    flex-direction: column;
    height: auto;
    min-height: calc(100vh - 60px);
  }

  .hero {
    height: auto;
    min-height: calc(100vh - 60px);
  }

  .hero-copy {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }

  .hero-headline {
    font-size: clamp(2rem, 10vw, 3rem);
  }

  .differentials-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) and (max-width: 767px) {
  .trust-scroll.h-scroll-rail .trust-grid,
  .cards-scroll.h-scroll-rail .cards {
    scroll-snap-type: none;
    -webkit-mask-image: none;
    mask-image: none;
  }

  .h-scroll-rail::after {
    opacity: 0.35;
  }
}

/* --------------------------------------------------------------------------
   LANDSCAPE CELULAR/TABLET: hero com altura fixa 100svh em styles.css; sem padding extra
   -------------------------------------------------------------------------- */
@media (orientation: landscape) and (max-height: 540px) {
  .floating-whatsapp {
    padding: 0.6rem 0.8rem;
    font-size: 0.82rem;
  }
  .premium-grid-wrapper {
    padding-inline: max(1.5rem, env(safe-area-inset-left, 0px));
  }

  /* Mantém o comportamento de carrossel configurado em styles.css */
}
