/* ═══════════════════════════════════════════════════════════════
   ABS MOBILE OPTIMIZATIONS — Shared across all pages
   Non-destructive overrides. Only activates at mobile breakpoints.
   Injected via <link> tag just before </head> on every subpage.
═══════════════════════════════════════════════════════════════ */

/* ─── 1. Prevent horizontal overflow across entire site ────────── */
html, body {
  max-width: 100%;
  overflow-x: hidden;
}

/* ─── 2. Responsive images — never overflow their container ───── */
img, video, iframe {
  max-width: 100%;
  height: auto;
}

/* ─── 3. Better tap feedback on iOS Safari ────────────────────── */
a, button {
  -webkit-tap-highlight-color: rgba(14, 124, 134, 0.2);
}

/* ─── 4. Prevent iOS font-size auto-inflation ─────────────────── */
html {
  -webkit-text-size-adjust: 100%;
}

/* ─── 5. Tables become horizontally scrollable on small screens ─ */
@media (max-width: 768px) {
  table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }
}

/* ═══════════════════════════════════════════════════════════════
   TABLET BREAKPOINT (≤ 768px)
═══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {

  /* Scale down heavy desktop section padding */
  section,
  [class*="-section"] {
    padding-top: 56px !important;
    padding-bottom: 56px !important;
  }

  /* Hero sections — fit in viewport gracefully */
  .page-hero,
  .hero {
    padding-top: 56px !important;
    padding-bottom: 48px !important;
    min-height: auto !important;
  }

  /* Footer — collapse multi-column grids */
  .footer-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 28px !important;
  }

  /* Container side-padding */
  .container {
    padding-left: 20px !important;
    padding-right: 20px !important;
  }

  /* Touch target minimum for all CTAs */
  .btn-primary,
  .btn-outline,
  .btn-white,
  .btn-secondary,
  [class*="-cta"],
  .abs-form-submit,
  .tier-cta,
  .svc-card-cta {
    min-height: 44px;
  }
}

/* ═══════════════════════════════════════════════════════════════
   PHONE BREAKPOINT (≤ 600px)
═══════════════════════════════════════════════════════════════ */
@media (max-width: 600px) {

  /* Further reduce section padding on phones */
  section,
  [class*="-section"] {
    padding-top: 44px !important;
    padding-bottom: 44px !important;
  }

  /* Hero scaling — shorter, tighter */
  .page-hero,
  .hero {
    padding-top: 44px !important;
    padding-bottom: 36px !important;
  }

  .page-hero h1,
  .hero h1 {
    font-size: clamp(1.5rem, 7vw, 2rem) !important;
    line-height: 1.2 !important;
  }

  .page-hero p,
  .hero p {
    font-size: 0.95rem !important;
    line-height: 1.6 !important;
  }

  /* Footer — single column on phones */
  .footer-grid {
    grid-template-columns: 1fr !important;
    gap: 24px !important;
    text-align: left;
  }

  /* Collapse ANY multi-column grid to single column */
  [class*="-grid"]:not(.dept-card-top):not(.abs-form-row) {
    grid-template-columns: 1fr !important;
  }

  /* Two-column form rows collapse to one on phones */
  .abs-form-row {
    grid-template-columns: 1fr !important;
  }

  /* Container tighter on phones */
  .container {
    padding-left: 16px !important;
    padding-right: 16px !important;
  }

  /* H2s shouldn't dominate the viewport */
  h2 {
    font-size: clamp(1.4rem, 6vw, 1.9rem) !important;
  }

  /* Modal tweaks for small screens */
  .abs-modal-overlay {
    padding: 20px 12px !important;
  }
  .abs-modal-header {
    padding: 22px 20px 18px !important;
  }
  .abs-modal-body {
    padding: 20px 20px 26px !important;
  }

  /* Prevent buttons from wrapping awkwardly */
  .btn-primary,
  .btn-outline,
  .btn-white,
  .btn-secondary {
    white-space: normal;
    text-align: center;
  }

  /* Breadcrumb wrapping */
  .breadcrumb {
    flex-wrap: wrap;
    font-size: 0.85rem;
  }
}

/* ═══════════════════════════════════════════════════════════════
   SMALL PHONE BREAKPOINT (≤ 400px)
═══════════════════════════════════════════════════════════════ */
@media (max-width: 400px) {

  /* Tighter padding on very small devices */
  section,
  [class*="-section"] {
    padding-top: 36px !important;
    padding-bottom: 36px !important;
  }

  .container {
    padding-left: 14px !important;
    padding-right: 14px !important;
  }

  /* Ticker banners can hide on tiny screens */
  .ticker-banner,
  [class*="-ticker"] {
    font-size: 0.8rem;
  }

  /* H1 even tighter */
  .page-hero h1,
  .hero h1 {
    font-size: clamp(1.35rem, 7vw, 1.7rem) !important;
  }
}

/* ═══════════════════════════════════════════════════════════════
   PRINT STYLES — clean printing for any page
═══════════════════════════════════════════════════════════════ */
@media print {
  .nav-bar, .hamburger, .abs-chat-launcher, .abs-chat-panel,
  .btn-primary, .breadcrumb, footer {
    display: none !important;
  }
  body {
    background: #fff !important;
    color: #000 !important;
  }
}
