/* ==========================================================================
   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;
  }

  .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: 4px;
    border-radius: 8px;
    margin-left: auto;
  }

  .icon-btn span {
    width: 5px;
    height: 5px;
  }

  /*
   * Hero mobile: altura = viewport menos o header; conteúdo empilhado de cima para baixo
   * com ritmo de gap único (sem space-between, para não “espalhar” headline e bullets).
   */
  .hero {
    --hero-top-offset: max(3.85rem, calc(env(safe-area-inset-top, 0px) + 2.85rem));
    height: calc(100svh - var(--hero-top-offset));
    min-height: calc(100svh - var(--hero-top-offset));
    max-height: calc(100svh - var(--hero-top-offset));
    align-items: stretch;
  }

  @supports (height: 100dvh) {
    .hero {
      height: calc(100dvh - var(--hero-top-offset));
      min-height: calc(100dvh - var(--hero-top-offset));
      max-height: calc(100dvh - var(--hero-top-offset));
    }
  }

  .hero > .container.hero-grid {
    gap: clamp(0.2rem, 0.85svh, 0.5rem);
    grid-template-rows: minmax(0, 1fr);
    grid-template-columns: 1fr;
    align-content: stretch;
    align-items: stretch;
    padding-top: clamp(0.35rem, 1.2svh, 0.55rem);
    padding-bottom: max(0.5rem, env(safe-area-inset-bottom, 0px));
  }

  .hero-media {
    display: none !important;
  }

  .hero-copy {
    flex: 1;
    min-height: 0;
    height: 100%;
    justify-content: flex-start;
    align-items: stretch;
    gap: clamp(0.38rem, 1.35svh, 0.62rem);
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    padding-inline-end: max(0.35rem, env(safe-area-inset-right, 0px));
    /* Afasta o bloco do headline do topo do hero (mais “ao meio” do ecrã útil) */
    padding-top: clamp(1rem, 7svh, 2.85rem);
    padding-bottom: clamp(0.35rem, 1.5svh, 0.75rem);
    box-sizing: border-box;
  }

  .hero-copy-intro {
    flex: 0 0 auto;
    flex-shrink: 0;
    gap: clamp(0.22rem, 0.75svh, 0.46rem);
  }

  .hero-proof {
    flex: 0 1 auto;
    min-height: 0;
    gap: clamp(0.2rem, 0.65svh, 0.34rem) clamp(0.32rem, 1.4vw, 0.58rem);
    align-content: flex-start;
    justify-content: flex-start;
  }

  .hero-copy-foot {
    flex: 0 0 auto;
    flex-shrink: 0;
    gap: clamp(0.22rem, 0.65svh, 0.42rem);
  }

  .hero-h1-br {
    display: block;
  }

  .hero h1 {
    width: 100%;
    max-width: 100%;
    font-size: clamp(1.38rem, 2.75svh + 1.45vw, 1.88rem);
    line-height: 1.12;
  }

  .hero-lead {
    font-size: clamp(0.92rem, 2.9vw + 0.35rem, 1.06rem);
    line-height: 1.45;
  }

  .hero-proof li {
    font-size: clamp(0.84rem, 2.5vw + 0.2rem, 0.96rem);
    line-height: 1.4;
  }

  .eyebrow {
    font-size: clamp(0.72rem, 2.1vw + 0.28rem, 0.84rem);
  }

  .hero-actions {
    gap: 0.38rem;
  }

  .hero-actions .btn {
    padding: 0.58rem 0.78rem;
    font-size: clamp(0.84rem, 2.5vw, 0.94rem);
  }

  .hero-scroll-hint {
    margin-top: 0;
    font-size: clamp(0.82rem, 2.5vw, 0.92rem);
  }

  /* VLibras: sobe o widget para não cobrir bullets/CTA nem competir com o WhatsApp flutuante */
  div[vw].enabled {
    bottom: calc(5.75rem + env(safe-area-inset-bottom, 0px)) !important;
    right: max(0.5rem, env(safe-area-inset-right, 0px)) !important;
  }

  /* 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,
  #cases .h-scroll-rail .case-filters,
  .case-carousel-shell .h-scroll-rail .showcase-viewport {
    -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;
  }

  .case-carousel-shell .h-scroll-rail::after {
    bottom: 0.5rem;
    right: max(0.35rem, env(safe-area-inset-right, 0px));
  }

  #cases .h-scroll-rail::after {
    bottom: 0.15rem;
  }

  .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;
  }

  #cases .h-scroll-rail {
    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;
  }

  #cases .h-scroll-rail .case-filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 0.45rem;
    padding-bottom: 0.35rem;
    margin-inline: 0;
    width: 100%;
    max-width: none;
    padding-inline: 0;
    box-sizing: border-box;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    scroll-snap-type: x proximity;
  }

  #cases .h-scroll-rail .case-filters::-webkit-scrollbar {
    display: none;
  }

  #cases .h-scroll-rail .case-filter {
    flex-shrink: 0;
    scroll-snap-align: start;
  }

  .case-carousel-shell {
    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;
  }

  .showcase-viewport.is-grid-mode {
    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(0.25rem, env(safe-area-inset-left, 0px));
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    border-radius: 0;
    padding-bottom: 0.35rem;
  }

  .showcase-viewport.is-grid-mode::-webkit-scrollbar {
    display: none;
  }

  .showcase-viewport.is-grid-mode .showcase-slide {
    flex: 0 0 min(86vw, 320px);
    max-width: min(86vw, 320px);
    scroll-snap-align: center;
    scroll-snap-stop: always;
  }
}

/* Hero mobile muito baixo: compacta tipografia e espaços */
@media (max-width: 767px) and (max-height: 520px) {
  .hero {
    --hero-top-offset: max(3.45rem, calc(env(safe-area-inset-top, 0px) + 2.65rem));
  }

  .hero-copy {
    gap: clamp(0.18rem, 0.75svh, 0.42rem);
    padding-top: clamp(0.45rem, 3.5svh, 1.1rem);
  }

  .hero-copy-intro {
    gap: clamp(0.1rem, 0.45svh, 0.26rem);
  }

  .hero h1 {
    font-size: clamp(1.22rem, 2.35svh + 1.2vw, 1.62rem);
    line-height: 1.12;
  }

  .hero-lead {
    font-size: clamp(0.82rem, 2.4vw + 0.22rem, 0.95rem);
    line-height: 1.4;
  }

  .hero-proof li {
    font-size: clamp(0.76rem, 2.1vw + 0.15rem, 0.88rem);
  }

  .hero-actions .btn {
    padding: 0.52rem 0.7rem;
    font-size: clamp(0.8rem, 2.4vw, 0.9rem);
  }
}

/* --------------------------------------------------------------------------
   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) {
  .hero-actions {
    gap: 0.62rem;
  }

  .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) {
  .icon-btn {
    display: none;
  }

  .desktop-nav {
    display: flex;
    align-items: center;
    gap: clamp(0.35rem, 1.2vw, 0.65rem);
    margin-left: auto;
    min-width: 0;
  }

  .desktop-nav-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.15rem;
    min-width: 0;
  }

  .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: clamp(0.45rem, 2vw, 1.1rem);
  }

  .desktop-nav .theme-btn {
    padding: 0.36rem 0.4rem;
    border-radius: 9px;
    background: transparent;
    border-color: transparent;
    display: inline-flex;
    align-items: center;
  }

  .desktop-nav .theme-toggle-text {
    display: none;
  }

  .mobile-nav {
    display: none !important;
  }

  .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;
  }

  .hero p {
    max-width: 54ch;
  }

  .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);
  }

  .hero h1 {
    max-width: 18ch;
  }

  .hero p {
    max-width: 58ch;
  }

}

@media (prefers-reduced-motion: reduce) and (max-width: 767px) {
  .trust-scroll.h-scroll-rail .trust-grid,
  .cards-scroll.h-scroll-rail .cards,
  .case-carousel-shell .h-scroll-rail .showcase-viewport,
  #cases .h-scroll-rail .case-filters {
    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;
  }
}
