/* CM_RESPONSIVE_V1 — mobile fixes for pages that use inline grid styles (2026-10-26) */

html, body { max-width: 100%; }
main { position: relative; overflow-x: clip; }
html { overflow-x: clip; }
img, video, canvas, svg { max-width: 100%; }

/* hero glow blobs are 600-800px wide decoration; never let them widen the page */
@media (max-width: 860px) {
  main [style*="repeat(3,1fr)"],
  main [style*="repeat(3, 1fr)"] { grid-template-columns: 1fr !important; }
  main [style*="repeat(4,1fr)"],
  main [style*="repeat(4, 1fr)"] { grid-template-columns: repeat(2, 1fr) !important; }
}

@media (max-width: 720px) {
  /* home: stats bar stays 3-up but compact */
  main [style*="repeat(3,1fr)"]:has(> div[style*="padding:20px 24px"]) { grid-template-columns: repeat(3, 1fr) !important; gap: 8px !important; }
  main [style*="repeat(3,1fr)"] > div[style*="padding:20px 24px"] { padding: 14px 8px !important; }
  main [style*="padding:20px 24px"] > div[style*="font-size:2rem"] { font-size: 1.5rem !important; }

  /* side padding of the home page content wrapper */
  main > div[style*="max-width:1400px"] { padding-left: 16px !important; padding-right: 16px !important; }

  /* hero */
  main form[style*="max-width:560px"] { flex-wrap: nowrap; }

  /* long words/urls never push the layout */
  main { overflow-wrap: break-word; }
  main [style*="padding:20px 24px"] > div[style*="uppercase"] { font-size: 10px !important; letter-spacing: .03em !important; }
}

/* tap targets */
@media (hover: none) and (pointer: coarse) {
  .cm-topnav a, .cm-topnav button { min-height: 36px; }
}

/* footer: 4-col grid -> 2 cols (tablet/phone), brand block full width */
@media (max-width: 860px) {
  footer [style*="2fr 1fr 1fr 1fr"] { grid-template-columns: 1fr 1fr !important; gap: 24px !important; }
  footer [style*="2fr 1fr 1fr 1fr"] > div:first-child { grid-column: 1 / -1; }
  footer > div[style*="max-width:1400px"] { padding-left: 16px !important; padding-right: 16px !important; }
}
body { overflow-x: clip; }

/* fixed 2-col / sidebar grids -> single column on phones */
@media (max-width: 900px) {
  main [style*="grid-template-columns:1fr 340px"],
  main [style*="grid-template-columns:1fr 320px"] { grid-template-columns: 1fr !important; }
}
@media (max-width: 640px) {
  main [style*="grid-template-columns:1fr 1fr"],
  main [style*="grid-template-columns:repeat(2,1fr)"],
  main [style*="grid-template-columns:repeat(2, 1fr)"] { grid-template-columns: 1fr !important; }
  main [style*="grid-template-columns:40px 1fr 160px"] { grid-template-columns: 40px 1fr !important; }
  main [style*="padding:48px 24px"], main [style*="padding:56px 24px"] { padding-left: 16px !important; padding-right: 16px !important; }
}

/* browse: keep the 16px gutter instead of bleeding to the viewport edge */
.cm-fullbleed { margin-left: 0 !important; margin-right: 0 !important; padding-right: 0 !important; }
.cmB-ver { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 999px; background: rgba(6,182,212,.14); border: 1px solid rgba(6,182,212,.3); color: #67e8f9; font-weight: 700; font-size: 11px !important; opacity: 1 !important; white-space: nowrap; }

/* tables (dashboards, applications) scroll inside themselves on phones instead of widening the page */
@media (max-width: 720px) {
  main table { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  /* tables turned into stacked cards by the labeller script in layout.php */
  main table.cm-stack { overflow: visible; }
  main table.cm-stack thead { display: none; }
  main table.cm-stack tbody, main table.cm-stack tr { display: block; }
  main table.cm-stack tr { margin: 0 0 10px; padding: 8px 12px; border: 1px solid rgba(255,255,255,.08); border-radius: 12px; background: rgba(255,255,255,.03); }
  main table.cm-stack td { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 6px 0 !important; border: 0 !important; text-align: right; width: auto !important; }
  main table.cm-stack td::before { content: attr(data-label); flex: 0 0 auto; color: rgba(255,255,255,.45); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; text-align: left; }
  main table.cm-stack td[colspan]::before, main table.cm-stack td:not([data-label])::before { content: none; }
  main img[style*="width:240px"] { max-width: 100%; height: auto !important; }
}
