/* =========================================================
   SummitFX — Global Mobile Polish
   Loaded LAST on every page so it overrides per-page inline
   styles via source order (no !important needed in most cases).
   Targets <= 900px primarily, with finer tuning at <= 600px
   and <= 420px.
   ========================================================= */

/* ---- Body safety ---- */
html, body { max-width: 100%; }
body { overflow-x: hidden; }

/* ---- Touch tap targets ---- */
@media (hover: none) and (pointer: coarse) {
  a, button { -webkit-tap-highlight-color: rgba(0, 181, 224, 0.18); }
}

/* =========================================================
   NAV — burger / mobile menu
   ========================================================= */

/* Burger button — hidden on desktop, shown on mobile.
   Uses `gap` (not span margins) because the site's CSS reset
   sets `* { margin: 0 }` and would collapse the lines together. */
.nav-burger {
  display: none;
  background: transparent;
  border: 0;
  width: 44px;
  height: 44px;
  padding: 10px;
  cursor: pointer;
  z-index: 210;
  flex-shrink: 0;
  gap: 5px;
}
.nav-burger span {
  display: block;
  width: 22px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.2s ease;
  transform-origin: center;
  flex-shrink: 0;
}
nav.menu-open .nav-burger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
nav.menu-open .nav-burger span:nth-child(2) { opacity: 0; }
nav.menu-open .nav-burger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* =========================================================
   Mobile breakpoint  (<= 960px)
   Threshold matches the legacy `<=960` link-hiding rules in
   product-page.css / whatsapp.html / contact.html so the
   burger appears at exactly the moment desktop links disappear
   (no 901–960 dead zone).
   ========================================================= */
@media (max-width: 960px) {

  /* ---- NAV: smaller, tighter ---- */
  nav {
    height: 70px !important;
    padding: 0 1rem !important;
  }
  nav.scrolled {
    height: 60px !important;
  }

  /* Shrink the cropped logo by ~40% so it fits a small viewport */
  .logo-wrap {
    height: 42px !important;
    margin-left: -78px !important;
  }
  .logo-svg {
    height: 140px !important;
    margin-top: -56px !important;
  }
  nav.scrolled .logo-wrap {
    height: 36px !important;
  }
  nav.scrolled .logo-svg {
    height: 120px !important;
    margin-top: -48px !important;
  }

  /* Show burger — positioned absolutely so the wide cropped logo
     SVG can't squeeze it out of the flex layout */
  nav { position: fixed; }
  .nav-burger {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    position: absolute;
    top: 50%;
    right: 0.75rem;
    transform: translateY(-50%);
    z-index: 5;
  }

  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--navy, #0d213c);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-direction: column;
    align-items: stretch;
    gap: 0 !important;
    margin: 0 !important;
    padding: 0.25rem 0 0.5rem !important;
    transform: translateY(-8px);
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    transition: transform 0.25s ease, opacity 0.25s ease, visibility 0s linear 0.25s;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
    display: flex !important;
    max-height: calc(100vh - 70px);
    overflow-y: auto;
  }
  nav.menu-open .nav-links {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
    transition-delay: 0s;
  }
  .nav-links li { width: 100%; }
  .nav-links a {
    display: block;
    padding: 0.95rem 1.5rem !important;
    font-size: 1rem !important;
    color: #fff !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  }
  .nav-links a.btn-nav {
    margin: 0.75rem 1.25rem 0.5rem !important;
    padding: 0.85rem 1.4rem !important;
    border-radius: 6px;
    text-align: center;
    border-bottom: 0;
    color: #0d213c !important;
  }

  /* Ticker sits below the (now smaller) fixed nav.
     The .nav-scrolled class is added/removed by components.js
     to avoid relying on the modern :has() selector for the
     scrolled-state offset. */
  #tickerWrap {
    margin-top: 70px !important;
  }
  #tickerWrap.nav-scrolled {
    margin-top: 60px !important;
  }

  /* =========================================================
     HERO — keep headlines inside the viewport
     ========================================================= */
  .hero {
    min-height: auto !important;
    padding: 5rem 1.25rem 3rem !important;
  }
  .hero h1,
  .hero-content h1,
  h1 {
    font-size: clamp(1.9rem, 8.5vw, 2.6rem) !important;
    line-height: 1.12 !important;
    overflow-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
  }
  /* Override inline white-space: nowrap on hero copy spans */
  .hero h1 span,
  .hero-content h1 span,
  h1 span,
  h2 span {
    white-space: normal !important;
  }
  .hero-sub, .hero p {
    font-size: 0.98rem !important;
    line-height: 1.7 !important;
  }
  .hero-actions {
    flex-direction: column;
    align-items: stretch !important;
    gap: 0.75rem !important;
  }
  .hero-actions .btn-primary,
  .hero-actions .btn-whatsapp,
  .hero-actions .btn-ghost,
  .hero-actions a,
  .hero-actions button {
    width: 100%;
    justify-content: center;
    text-align: center;
  }
  /* Decorative mountain bg shouldn't compete with hero copy on mobile */
  .mtn-bg { width: 100% !important; opacity: 0.08 !important; }

  /* =========================================================
     Sections / typography rhythm
     ========================================================= */
  .section { padding: 3rem 1.25rem !important; }

  h2 {
    font-size: clamp(1.55rem, 6.5vw, 2.1rem) !important;
    line-height: 1.18;
    overflow-wrap: break-word;
  }
  h3 {
    font-size: 1.15rem !important;
    overflow-wrap: break-word;
  }

  /* Common grid containers — collapse to single column */
  .equity-grid,
  .wa-grid,
  .features-grid,
  .steps-grid,
  .testi-grid,
  .cta-inner,
  .stats-grid,
  .partners-grid,
  .footer-grid,
  .equity,
  .contact,
  .testimonials,
  .steps {
    grid-template-columns: 1fr !important;
    gap: 1.5rem !important;
  }
  /* Stats prefer 2-up on small phones */
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  /* =========================================================
     WhatsApp feature carousel
     ========================================================= */
  .wa-slides-wrap {
    height: auto !important;
    min-height: 540px;
  }
  .wa-slide {
    flex-direction: column !important;
    padding: 0.5rem 0.25rem 0 !important;
    gap: 1.5rem !important;
    align-items: stretch !important;
  }
  .wa-slide-copy {
    max-width: 100% !important;
    padding-right: 0 !important;
  }
  .wa-slide-phone {
    justify-content: center !important;
  }
  .wa-phone-shell {
    transform: scale(0.85);
    transform-origin: top center;
  }

  /* =========================================================
     Tables — let them scroll horizontally when too wide
     ========================================================= */
  .rates,
  .rates__table,
  table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }
  .rates__table { display: table; min-width: 480px; }
  .rates { padding: 0; }

  /* =========================================================
     Floating WhatsApp button — keep it tappable, away from edge
     ========================================================= */
  .whatsapp-float {
    right: 16px !important;
    bottom: 16px !important;
    width: 52px !important;
    height: 52px !important;
  }

  /* =========================================================
     Forms — full-width inputs and large tap area
     ========================================================= */
  .contact__form,
  form {
    padding: 1.25rem !important;
  }
  .field input,
  .field select,
  .field textarea,
  input[type="text"],
  input[type="email"],
  input[type="tel"],
  select,
  textarea {
    font-size: 16px !important; /* prevents iOS auto-zoom on focus */
    width: 100%;
  }

  /* =========================================================
     Footer (already responsive at 560px) — small spacing tweak
     ========================================================= */
  footer { padding: 2.5rem 1.25rem 1.5rem !important; }

  /* Misc: prevent any 320px-fixed images/cards overflowing */
  img, video, svg, iframe { max-width: 100%; height: auto; }
}

/* =========================================================
   Tighter phone breakpoint (<= 480px)
   ========================================================= */
@media (max-width: 480px) {
  .hero h1, .hero-content h1, h1 {
    font-size: clamp(1.7rem, 9vw, 2.3rem) !important;
  }
  h2 {
    font-size: clamp(1.4rem, 7.5vw, 1.9rem) !important;
  }
  .hero-eyebrow, .eyebrow {
    font-size: 0.7rem !important;
  }
  .hero {
    padding: 4.5rem 1rem 2.5rem !important;
  }
  .section { padding: 2.5rem 1rem !important; }
  .stats-grid { grid-template-columns: 1fr !important; }
  .nav-burger { width: 40px; height: 40px; padding: 8px; }
}

/* =========================================================
   Very small (<= 360px)
   ========================================================= */
@media (max-width: 360px) {
  .logo-wrap { height: 36px !important; margin-left: -68px !important; }
  .logo-svg { height: 120px !important; margin-top: -48px !important; }
  nav { padding: 0 0.85rem !important; }
}
