/**
 * TAB public pages — additive mobile layout helpers.
 * Covers viewports ~375–900px. All rules are inside media queries; desktop is unchanged.
 */

/* ── Nuclear baseline ────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  html {
    overflow-x: hidden !important;
    max-width: 100vw !important;
    -webkit-text-size-adjust: 100%;
  }

  body {
    overflow-x: hidden !important;
    max-width: 100vw !important;
  }

  /* Every flow element is capped so it cannot widen the viewport */
  *, *::before, *::after {
    box-sizing: border-box !important;
    max-width: 100% !important;
  }

  /* Decorative full-bleed pseudo-element overlays: must NOT be capped */
  body::before, body::after,
  .tab-hero::before, .tab-hero::after,
  .tab-lane::before {
    max-width: none !important;
  }

  /* Media elements: standard responsive rule */
  img, svg, canvas, video, iframe {
    max-width: 100% !important;
    height: auto;
  }
}

/* ── Landing page: hero section ─────────────────────────────────────────── */
@media (max-width: 900px) {
  .tab-hero {
    padding-left: 16px !important;
    padding-right: 16px !important;
    padding-top: 88px !important;
    padding-bottom: 40px !important;
  }

  /* Override the !important 3-column grid on the base rule */
  .tab-hero-lanes {
    grid-template-columns: 1fr !important;
    max-width: calc(100vw - 32px) !important;
    width: calc(100vw - 32px) !important;
  }

  .tab-lane {
    padding: 28px 20px !important;
  }

  .tab-hero-sub {
    max-width: 100% !important;
  }
}

/* ── Landing page: stats bar ─────────────────────────────────────────────── */
@media (max-width: 900px) {
  .tab-stats-bar {
    padding-left: 16px !important;
    padding-right: 16px !important;
    padding-top: 48px !important;
    padding-bottom: 48px !important;
  }

  /* Override the !important 6-column grid */
  .tab-stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* ── Landing page: pillars ───────────────────────────────────────────────── */
@media (max-width: 900px) {
  .tab-pillars {
    padding-left: 16px !important;
    padding-right: 16px !important;
    padding-top: 56px !important;
    padding-bottom: 56px !important;
  }

  /* Override the !important 2-column grid */
  .tab-ps {
    grid-template-columns: 1fr !important;
    gap: 24px !important;
    margin-bottom: 56px !important;
  }

  .tab-ps.rev {
    direction: ltr !important;
  }

  .tab-pv {
    min-height: auto !important;
  }
}

/* ── Landing page: security section ─────────────────────────────────────── */
@media (max-width: 900px) {
  .tab-security {
    padding-left: 16px !important;
    padding-right: 16px !important;
    padding-top: 56px !important;
    padding-bottom: 56px !important;
  }

  /* Override the !important 3-column grid */
  .tab-sg {
    grid-template-columns: 1fr !important;
  }
}

/* ── Landing page: research/five-findings banner ─────────────────────────── */
@media (max-width: 900px) {
  .tab-research-section {
    padding-left: 16px !important;
    padding-right: 16px !important;
  }

  /* Stack badge above heading+body instead of side-by-side */
  .tab-research-row {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 12px !important;
  }

  /* Remove the fixed min-width that causes overflow, and let content fill row */
  .tab-research-content {
    min-width: 0 !important;
    width: 100% !important;
    flex: none !important;
  }
}

/* ── Landing page: marketplace commission table ───────────────────────────── */
@media (max-width: 600px) {
  .tab-commission-wrap {
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch;
  }

  /* Give the table enough room so columns aren't squished */
  .tab-commission-wrap table {
    min-width: 360px;
    max-width: none !important;
  }
}

/* ── Pricing page: rate-card tables ─────────────────────────────────────── */
@media (max-width: 900px) {
  /* Scroll-container for .rate-table (pricing.html) */
  .card:has(> table.rate-table) {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  table.rate-table {
    /* Let the table be wider than its container — scroll handles it */
    max-width: none !important;
    min-width: 480px;
  }
}

/* ── Agent catalogue: card grid ──────────────────────────────────────────── */
@media (max-width: 900px) {
  .agent-grid {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)) !important;
    padding-left: 12px !important;
    padding-right: 12px !important;
  }
}

/* ── Leaderboard: filter/view-tab touch targets ──────────────────────────── */
@media (max-width: 900px) {
  #viewTabs button {
    min-height: 44px;
    padding-left: 14px;
    padding-right: 14px;
  }
}

/* ── Specialty pages: Bootstrap .top-nav ────────────────────────────────── */
@media (max-width: 900px) {
  .top-nav .container {
    flex-wrap: wrap;
    row-gap: 8px;
  }

  .top-nav .nav-links {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    margin-top: 4px;
  }

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