/**
 * Mobile Adaptive Reset — neutralizes desktop layout artifacts (≤768px only)
 * Load before mobile-adaptive.css. Desktop unaffected.
 */

@media (max-width: 768px) {
  html.mobile-adaptive-root,
  body.mobile-adaptive {
    overflow-x: clip;
    max-width: 100vw;
  }

  body.mobile-adaptive {
    --ma-touch: 48px;
    --ma-topbar-h: 56px;
    --ma-pad-x: max(16px, env(safe-area-inset-left));
    --ma-pad-x-r: max(16px, env(safe-area-inset-right));
    --ma-safe-bottom: env(safe-area-inset-bottom, 0px);
    --ma-fab-bottom: calc(12px + var(--ma-safe-bottom));
    -webkit-text-size-adjust: 100%;
  }

  /* Kill desktop grid columns */
  body.mobile-adaptive .grid,
  body.mobile-adaptive .grid-cols-2,
  body.mobile-adaptive .grid-cols-3,
  body.mobile-adaptive .grid-cols-4,
  body.mobile-adaptive .stats-grid,
  body.mobile-adaptive .home-directions-layout,
  body.mobile-adaptive .home-directions-grid,
  body.mobile-adaptive .home-help-grid,
  body.mobile-adaptive .home-actions-grid,
  body.mobile-adaptive .news-grid,
  body.mobile-adaptive .events-grid,
  body.mobile-adaptive .benefactors-grid,
  body.mobile-adaptive .contacts-info-grid,
  body.mobile-adaptive .contacts-help-grid,
  body.mobile-adaptive .contacts-form-grid,
  body.mobile-adaptive .settings-form-grid,
  body.mobile-adaptive .dashboard-grid {
    grid-template-columns: 1fr !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  body.mobile-adaptive .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  /* Sticky / perspective / tilt off */
  body.mobile-adaptive .home-directions-intro {
    position: static !important;
    top: auto !important;
  }

  body.mobile-adaptive [data-tilt],
  body.mobile-adaptive .home-dir-card,
  body.mobile-adaptive .home-help-card,
  body.mobile-adaptive .home-dir-card__inner,
  body.mobile-adaptive .home-help-card__inner {
    transform: none !important;
    perspective: none !important;
    transform-style: flat !important;
    animation: none !important;
    will-change: auto !important;
  }

  body.mobile-adaptive .home-help-card {
    opacity: 1 !important;
  }

  body.mobile-adaptive .home-dir-card__glow,
  body.mobile-adaptive .home-help-card__glow {
    display: none !important;
  }

  body.mobile-adaptive .container:not(.dashboard-container):not(.dashboard-hero-inner):not(.settings-container),
  body.mobile-adaptive .news-page-container {
    max-width: 100% !important;
    width: 100% !important;
    padding-left: var(--ma-pad-x) !important;
    padding-right: var(--ma-pad-x-r) !important;
    box-sizing: border-box !important;
  }

  body.mobile-adaptive .main-content {
    overflow-x: clip;
    min-width: 0;
  }

  /* Hero desktop min-heights */
  body.mobile-adaptive .project-hero,
  body.mobile-adaptive.page-home .project-hero,
  body.mobile-adaptive .hero {
    min-height: auto !important;
  }

  /* Partners marquee simplify */
  body.mobile-adaptive .trusted-marquee__row--reverse {
    display: none !important;
  }

  body.mobile-adaptive .trusted-marquee {
    overflow: hidden;
  }

  body.mobile-adaptive .trusted-marquee__row {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
  }

  body.mobile-adaptive .trusted-track {
    animation: none !important;
    flex-wrap: nowrap !important;
    width: max-content !important;
    padding-bottom: 8px;
  }

  body.mobile-adaptive .trusted-track > * {
    scroll-snap-align: start;
    flex-shrink: 0;
  }

  /* Wide cards span fix */
  body.mobile-adaptive .home-dir-card--wide {
    grid-column: span 1 !important;
  }

  body.mobile-adaptive .home-dir-card__inner--wide {
    flex-direction: column !important;
  }

  /* Hover lifts off on touch */
  body.mobile-adaptive .stat-card:hover,
  body.mobile-adaptive .news-card:hover,
  body.mobile-adaptive .event-card:hover,
  body.mobile-adaptive .card:hover {
    transform: none !important;
  }

  /* Inline flex rows → stack where needed */
  body.mobile-adaptive .home-cta-inner,
  body.mobile-adaptive .news-page-toolbar,
  body.mobile-adaptive .events-toolbar {
    flex-direction: column !important;
    align-items: stretch !important;
  }

  /* Stripe checkout desktop 2-col */
  body.mobile-adaptive .stripe-checkout {
    grid-template-columns: 1fr !important;
    display: flex !important;
    flex-direction: column !important;
  }

  body.mobile-adaptive .stripe-checkout__summary {
    order: 2;
    position: static !important;
    max-height: none !important;
  }

  body.mobile-adaptive .stripe-checkout__form-wrap {
    order: 1;
  }

  body.mobile-adaptive .auth-shell {
    grid-template-columns: 1fr !important;
  }

  body.mobile-adaptive .auth-shell__aside {
    display: none !important;
  }
}
