/* ============================================================
   MOBILE OPTIMISATION — SN Batteries
   Fixes horizontal overflow that causes pinch-zoom on phones
   ============================================================ */

/* 1. CRITICAL — Prevent horizontal scroll / zoom-out on iOS & Android */
html,
body {
  overflow-x: hidden;
  /* Ensure content never exceeds viewport width */
  max-width: 100vw;
}

/* 2. UNIVERSAL BOX-SIZING SAFETY NET */
*,
*::before,
*::after {
  max-width: 100%;
}

/* 3. PREVENT INLINE IMAGES / SVG OVERFLOWS */
img,
svg,
video,
iframe,
embed,
object {
  max-width: 100%;
}

/* ============================================================
   GLOBAL TYPOGRAPHY SCALE-DOWN FOR SMALL PHONES (< 400px)
   ============================================================ */
@media (max-width: 400px) {
  :root {
    --text-hero: clamp(28px, 9vw, 42px);
    --text-h1:   clamp(24px, 8vw, 36px);
    --text-h2:   clamp(20px, 6vw, 28px);
    --text-h3:   clamp(16px, 5vw, 22px);
    --text-body-lg: 16px;
    --text-body:    15px;
    --section-py-sm: 48px;
    --grid-gap: 16px;
  }
}

/* ============================================================
   HEADER — prevent logo overflow on small phones
   ============================================================ */
@media (max-width: 380px) {
  .logo-text {
    font-size: 16px;
  }

  .logo-icon {
    width: 24px;
    height: 24px;
  }
}

/* ============================================================
   HERO SECTION — full mobile optimisation
   ============================================================ */
@media (max-width: 640px) {
  /* Give hero more breathing room at top to clear header */
  .hero-section {
    padding-top: 100px;
    padding-bottom: 64px;
    min-height: auto;
  }

  .hero-content h1 {
    font-size: clamp(28px, 8vw, 42px);
    letter-spacing: -0.02em;
  }

  .hero-content p {
    font-size: 16px;
  }

  .hero-ctas {
    flex-direction: column;
    gap: 12px;
  }

  .hero-ctas .btn {
    width: 100%;
    justify-content: center;
  }
}

/* ============================================================
   STATS STRIP — 2-col on phones
   ============================================================ */
@media (max-width: 480px) {
  .stat-card h3 {
    font-size: 28px;
  }
}

/* ============================================================
   SERVICES / BRANDS / BRANCH CARDS — button wrapping
   ============================================================ */
@media (max-width: 480px) {
  .solution-card-buttons,
  .branch-card-ctas,
  .brand-card-ctas {
    grid-template-columns: 1fr;
  }

  .solution-card-buttons .btn,
  .branch-card-ctas .btn,
  .brand-card-ctas .btn {
    width: 100%;
    justify-content: center;
  }
}

/* ============================================================
   CTA BANNER — stack buttons on small screens
   ============================================================ */
@media (max-width: 640px) {
  .cta-banner {
    padding: var(--space-8) var(--space-5);
  }

  .cta-banner h2 {
    font-size: clamp(20px, 6vw, 28px);
  }

  .cta-buttons {
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
  }

  .cta-buttons .btn {
    width: 100%;
    justify-content: center;
  }
}

/* ============================================================
   MARQUEE — constrain on mobile so it doesn't push layout
   ============================================================ */
.marquee-container {
  overflow: hidden;
  width: 100%;
  /* Ensures the scrolling strip never widens the page */
}

/* ============================================================
   PAGE BANNERS — reduce padding on mobile
   ============================================================ */
@media (max-width: 640px) {
  .page-banner {
    padding-block: 100px 48px;
  }

  .page-banner h1 {
    font-size: clamp(24px, 8vw, 38px);
  }

  .page-banner-desc {
    font-size: 15px;
  }
}

/* ============================================================
   ABOUT PAGE — who-we-are visual column
   ============================================================ */
@media (max-width: 768px) {
  .whoweare-visual {
    display: none;
  }
}

/* ============================================================
   SERVICES PAGE — solution card buttons full-width
   ============================================================ */
@media (max-width: 640px) {
  .backup-section-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   BRANCHES PAGE — branch card image area height
   ============================================================ */
@media (max-width: 480px) {
  .branch-img-wrapper {
    height: 160px;
  }
}

/* ============================================================
   BRANDS PAGE — category tabs wrap nicely on mobile
   ============================================================ */
@media (max-width: 640px) {
  .category-tabs {
    gap: 8px;
  }

  .category-tab {
    padding: 6px 14px;
    font-size: 12px;
  }

  /* 2-col brand grid on mobile → 1 col on very small */
  .brands-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 400px) {
  .brands-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   CONTACT PAGE — contact info boxes 2-col → 1-col
   ============================================================ */
@media (max-width: 480px) {
  .contact-cards-row {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   FLOATING ACTION BUTTONS — reduce overlap on very small screens
   ============================================================ */
@media (max-width: 360px) {
  .floating-actions {
    bottom: 12px;
    right: 12px;
    gap: 8px;
  }

  .fab {
    width: 40px;
    height: 40px;
  }

  .fab i,
  .fab svg {
    width: 18px;
    height: 18px;
  }
}

/* ============================================================
   FORM INPUTS — prevent iOS auto-zoom (requires font-size ≥ 16px)
   ============================================================ */
input,
select,
textarea {
  font-size: max(16px, 1em); /* iOS zooms if font-size < 16px */
}

/* ============================================================
   PROCESS STEPS — collapse connector line on mobile
   ============================================================ */
@media (max-width: 767px) {
  .process-grid::before {
    display: none;
  }

  .process-step {
    text-align: left;
    display: flex;
    gap: var(--space-4);
    align-items: flex-start;
  }

  .process-number {
    flex-shrink: 0;
    margin: 0;
  }

  .process-step h3,
  .process-step p {
    text-align: left;
  }
}

/* ============================================================
   SECTION HEADER — tighter max-width on mobile
   ============================================================ */
@media (max-width: 640px) {
  .section-header {
    margin-bottom: var(--space-8);
  }
}

/* ============================================================
   FOOTER — reduce grid padding on mobile
   ============================================================ */
@media (max-width: 480px) {
  .footer-grid {
    gap: var(--space-6);
  }

  .footer-title {
    font-size: 14px;
  }
}

/* ============================================================
   GALLERY SLIDE CARDS — fixed width safety on mobile
   ============================================================ */
@media (max-width: 640px) {
  .gallery-slide-card {
    width: 260px;
  }

  .gallery-slide-img {
    height: 140px;
  }
}

/* ============================================================
   VISIT CARD GRID (branches) — 1-col on mobile
   ============================================================ */
@media (max-width: 480px) {
  .visit-card-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   AUTH CARDS (brands) — 1-col on mobile
   ============================================================ */
@media (max-width: 480px) {
  .auth-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   TOAST NOTIFICATIONS — full width on small screens
   ============================================================ */
@media (max-width: 480px) {
  .toast-container {
    right: var(--space-3);
    left: var(--space-3);
    width: auto;
  }
}

/* ============================================================
   TOUCH TARGET MINIMUM SIZE (WCAG 2.5.5)
   Ensure all tap targets are ≥ 44px tall
   ============================================================ */
@media (max-width: 1024px) {
  .btn-sm {
    min-height: 44px;
  }

  .drawer-link {
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  .nav-link {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
}
