/* ============================================================
   Overflow / button-width audit fixes (v6)
   Checkpoint: dcce407 — revert this file + btn-primary if needed
   ============================================================ */

/* ── Global horizontal overflow containment ── */
html {
  overflow-x: clip;
  max-width: 100%;
}

body.site-body,
body.public-landing-body {
  overflow-x: clip;
  max-width: 100%;
  position: relative;
}

.page-shell,
.site-main,
.container.page-content,
.public-landing-main,
.public-landing-header,
.public-landing-footer,
.command-center,
.command-feed,
.list-page-body,
.list-page-content,
.admin-shell,
.admin-shell-main {
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

/* Media never blows past parents */
img,
video,
canvas,
svg,
iframe {
  max-width: 100%;
  height: auto;
}

/* Flex/grid children can shrink instead of overflowing */
.site-body .card,
.site-body .signal-card,
.site-body .parlay-card,
.site-body .pick-card,
.site-body .dashboard-col,
.site-body .dashboard-section,
.public-landing-body .public-section,
.public-landing-body .public-hero-card,
.public-landing-body .public-hero-left,
.public-landing-body .public-hero-right {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

/* ── Buttons: never stretch full viewport by default ── */
.site-body .btn,
.site-body a.btn,
.site-body button.btn,
.public-landing-body .btn,
.public-landing-body a.btn,
.public-landing-body button.btn {
  max-width: 100%;
  box-sizing: border-box;
  white-space: normal;
  text-align: center;
}

/* Inline CTAs stay content-sized */
.site-body .btn-primary:not([type="submit"]),
.public-landing-body .btn-primary:not([type="submit"]),
.public-landing-body a.btn-primary,
.public-landing-body a.public-cta-primary,
.public-landing-body a.public-cta-hero {
  width: auto !important;
  max-width: min(100%, 22rem);
  flex: 0 1 auto;
}

/* Hero CTA row — side by side, no full-width stretch on desktop */
.public-landing-body .public-hero-ctas {
  display: flex !important;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  max-width: 100%;
}

.public-landing-body .public-hero-ctas .btn,
.public-landing-body .public-hero-ctas .btn-primary,
.public-landing-body .public-hero-ctas .btn-muted,
.public-landing-body .public-hero-ctas .public-cta-hero {
  width: auto !important;
  max-width: 100%;
  flex: 0 1 auto;
  transform: none !important; /* kill scale(1.02) overflow */
  box-sizing: border-box;
}

/* Footer / section CTAs on landing — pair stays side-by-side, not full bleed */
.public-landing-body .public-landing-cta .btn,
.public-landing-body .public-landing-cta .btn-primary,
.public-landing-body .public-landing-cta .btn-muted,
.public-landing-body section .btn.btn-primary:not([type="submit"]) {
  width: auto !important;
  max-width: min(100%, 20rem);
  display: inline-flex;
}

.public-landing-body .public-landing-cta {
  overflow: hidden;
  max-width: 100%;
  box-sizing: border-box;
}

.public-landing-body .public-landing-cta .public-hero-ctas {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
}

.public-landing-body .public-landing-cta .public-hero-ctas .btn {
  width: auto !important;
  flex: 0 0 auto;
}

/* Nav CTA chip */
.public-landing-body .public-nav-cta,
.public-landing-body .public-nav-cta.btn,
.public-landing-body a.public-nav-cta {
  width: auto !important;
  max-width: 100%;
  white-space: nowrap;
  flex-shrink: 1;
}

/* Header nav wrap — prevent horizontal blowout */
.public-landing-body .public-landing-header,
.public-landing-body .unified-site-header,
.site-body .site-header-v2,
.site-body .site-header-inner {
  max-width: 100%;
  overflow-x: clip;
  box-sizing: border-box;
}

.public-landing-body .unified-header-nav,
.public-landing-body .public-landing-nav {
  max-width: 100%;
  flex-wrap: wrap;
  min-width: 0;
}

/* Hero card can't escape viewport */
.public-landing-body .public-hero,
.public-landing-body .public-hero-card {
  width: 100%;
  max-width: min(1100px, 100%);
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
}

.public-landing-body .public-hero-card {
  display: flex;
  flex-wrap: nowrap;
}

@media (max-width: 768px) {
  .public-landing-body .public-hero-card {
    flex-direction: column;
  }

  .public-landing-body .public-hero-ctas {
    flex-direction: row !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 0.55rem !important;
  }

  .public-landing-body .public-hero-ctas .btn,
  .public-landing-body .public-hero-ctas .btn-primary,
  .public-landing-body .public-hero-ctas .btn-muted,
  .public-landing-body .public-hero-ctas .public-cta-hero {
    width: auto !important;
    max-width: 100% !important;
    justify-content: center;
  }

  .public-landing-body .public-hero-left,
  .public-landing-body .public-hero-right {
    flex: 1 1 auto;
    width: 100%;
    max-width: 100%;
  }
}

@media (max-width: 520px) {
  .public-landing-body .public-hero-ctas,
  .public-landing-body .public-landing-cta .public-hero-ctas {
    flex-direction: column !important;
    align-items: stretch !important;
  }

  .public-landing-body .public-hero-ctas .btn,
  .public-landing-body .public-hero-ctas .btn-primary,
  .public-landing-body .public-hero-ctas .btn-muted,
  .public-landing-body .public-hero-ctas .public-cta-hero {
    width: 100% !important;
  }
}

/* Update-explain + images stay in bounds */
.public-landing-body .public-update-explain,
.public-landing-body .update-explain-grid,
.public-landing-body .update-visual,
.public-landing-body .update-genie-img {
  max-width: 100%;
  box-sizing: border-box;
}

.public-landing-body .update-genie-img {
  display: block;
  width: 100%;
  height: auto;
}

/* POD actions: don't force flex:1 full stretch on desktop */
@media (min-width: 769px) {
  .public-landing-body .pick-of-day-actions {
    flex-wrap: wrap;
    align-items: center;
  }

  .public-landing-body .pick-of-day-cta,
  .public-landing-body .pick-of-day-actions .btn-muted {
    flex: 0 1 auto !important;
    width: auto !important;
    max-width: 100%;
  }
}

/* ── Member app: wide buttons only where intended ── */
.site-body .list-filters-rail .btn,
.site-body .list-filters-rail .btn-sm,
.site-body .list-filters-rail .filters-quick-apply {
  width: 100%;
  max-width: 100%;
}

.site-body .command-feed .btn-primary:not([type="submit"]),
.site-body .page-hero-zone .btn-primary:not([type="submit"]),
.site-body .section-header .btn-primary,
.site-body a.btn-primary.section-link,
.site-body .pick-of-day-cta {
  width: auto !important;
  max-width: min(100%, 22rem);
}

/* Tables: scroll inside wrap, don't expand page */
.site-body .responsive-table-wrap,
.site-body .table-scroll-wrap,
.site-body .schedule-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Pre/code blocks */
.site-body pre,
.site-body code {
  max-width: 100%;
  overflow-x: auto;
  word-break: break-word;
}

/* Mono long IDs wrap */
.site-body .mono.signal-id-short,
.site-body .signal-id-short {
  word-break: break-all;
  overflow-wrap: anywhere;
}

/* Home ticket buttons stay full-width of their grid cell only */
.site-body .home-ticket-nav-btn {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* Ad slots never overflow */
.site-body .ad-slot,
.public-landing-body .ad-slot {
  max-width: 100%;
  overflow: hidden;
  box-sizing: border-box;
}

/* Dropdown menus constrained to viewport */
.site-body .nav-dropdown-menu,
.site-body .unified-nav-panel,
.public-landing-body .unified-nav-panel {
  max-width: min(20rem, calc(100vw - 1.5rem));
  box-sizing: border-box;
}
