/* Aggressive mobile overrides for small screens (auto) */
@supports (padding: max(0px)) {
  :root { --safe-top: env(safe-area-inset-top); --safe-bottom: env(safe-area-inset-bottom); }
}
@media (max-width: 768px) {
  /* Layout safety */
  html { font-size: 16px; }
  body { margin: 0; padding-top: max(0px, var(--safe-top)); padding-bottom: max(0px, var(--safe-bottom)); box-sizing: border-box; }
  *, *::before, *::after { box-sizing: border-box; }
  .container, .wrapper, .content, main, section, header, footer { padding-left: 16px; padding-right: 16px; }

  /* Columns stack */
  [class*="col-"], .column, .columns > *, .row > * { flex: 1 1 100% !important; max-width: 100% !important; }
  .row, .columns, [class*="row"], [class*="grid"], .grid, .gallery { display: flex; flex-wrap: wrap; gap: 12px; }
  .grid, [style*="grid-template-columns"] { display: grid !important; grid-template-columns: 1fr !important; }
  .two-col, .three-col, .four-col { display: grid; grid-template-columns: 1fr !important; }

  /* Media */
  img, video, canvas, svg, iframe { max-width: 100% !important; height: auto !important; }
  figure { margin: 0; }

  /* Buttons/links */
  a, button, .btn, .button { min-height: 44px; line-height: 1.2; }
  .btn, .button, button { width: 100%; padding: 12px 16px; display: inline-flex; justify-content: center; align-items: center; }

  /* Forms */
  input, select, textarea { font-size: 16px; width: 100%; }
  form .row > *, form .columns > * { width: 100% !important; }

  /* Tables */
  table { width: 100% !important; display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Typography */
  h1, h2, h3 { word-wrap: break-word; overflow-wrap: anywhere; }
  p { margin: 0 0 12px; }

  /* Spacing fixes for hero/headers */
  .hero, header .inner, .page-header, .topbar { padding-left: 16px; padding-right: 16px; }

  /* Kill fixed widths/heights that break layout */
  [style*="width:"], [style*="max-width:"], [style*="min-width:"] { max-width: 100% !important; }
  [style*="height:"], [style*="min-height:"], [style*="max-height:"] { max-height: 100vh; }
}
