/* IDMS — shared mobile responsiveness.
   Loaded LAST in each page's <helmet> so it overrides the per-page inline mobile CSS.
   Pairs with idms-nav-mobile.js (the hamburger menu). */

/* hamburger + panel are hidden on desktop */
#idms-burger { display: none; }
#idms-mnav-panel { display: none; }

@media (max-width: 760px) {
  /* 1) never let the page scroll sideways.
        Use `clip` (not `hidden`): hidden on <body> promotes it to a scroll
        container and hijacks vertical scrolling / breaks the sticky header. */
  html, body { overflow-x: clip !important; }

  /* 2) collapse wide multi-column layout grids that individual pages missed
        (e.g. Vendors' 1.25fr 0.75fr that caused the horizontal-scroll bug) */
  [style*="repeat(3"], [style*="repeat(4"],
  [style*="1fr 1fr"],
  [style*="1.45fr"], [style*="1.28fr"], [style*="1.25fr"], [style*="1.15fr"],
  [style*="0.92fr"], [style*="0.85fr"], [style*="0.75fr"], [style*="0.72fr"] {
    grid-template-columns: 1fr !important;
  }

  /* 3) big product mockups (min-width:800px frames): shrink to fit and let any
        remaining width scroll inside the frame instead of being clipped off-screen */
  [style*="min-width:800px"], [style*="min-width: 800px"],
  [style*="min-width:860px"], [style*="min-width: 860px"] {
    min-width: 0 !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  /* inline browser-frame mockups (Vendors white-label): let the inner row
     scroll inside the card instead of being clipped at the screen edge */
  [style*="min-height:300px"] {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  /* the full app-cockpit mockup is a true desktop shell that can't reflow;
     scale the whole frame down so it stays coherent and fully visible */
  .idms-fit {
    min-width: 800px !important;
    width: 800px !important;
    overflow: hidden !important;
    zoom: 0.44;
  }
  /* Vendors white-label browser mockup: same idea, narrower frame */
  .idms-fit-wl {
    width: 480px !important;
    min-width: 480px !important;
    max-width: 480px !important;
    overflow: hidden !important;
    zoom: 0.72;
  }

  /* 4) header: keep only the logo; the injected hamburger replaces the nav cluster */
  header > div {
    flex-wrap: nowrap !important;
    gap: 12px !important;
    justify-content: space-between !important;
  }
  header > div > *:not(:first-child) { display: none !important; }

  /* 5) hamburger button + slide-down panel (injected into <body>) */
  #idms-burger {
    display: inline-flex !important;
    position: fixed; top: 13px; right: 14px; z-index: 320;
    width: 42px; height: 42px; align-items: center; justify-content: center;
    background: rgba(255,255,255,0.94);
    -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
    border: 1px solid var(--hairline-strong); border-radius: 12px;
    box-shadow: 0 8px 24px -14px rgba(12,10,9,0.30); cursor: pointer; padding: 0;
  }
  #idms-mnav-panel {
    position: fixed; top: 66px; right: 12px; left: 12px; z-index: 315;
    flex-direction: column; gap: 2px;
    background: #fff; border: 1px solid var(--hairline-strong); border-radius: 16px;
    box-shadow: 0 24px 60px -24px rgba(12,10,9,0.34); padding: 10px;
  }
  #idms-mnav-panel.open { display: flex; }
  #idms-mnav-panel a,
  #idms-mnav-panel button {
    display: flex; align-items: center; justify-content: space-between;
    font-family: var(--font-sans); font-size: 16px; color: var(--ink);
    text-decoration: none; background: transparent; border: none; cursor: pointer;
    padding: 13px 12px; border-radius: 10px; text-align: left; width: 100%;
    box-sizing: border-box;
  }
  #idms-mnav-panel a:active { background: var(--surface-strong); }
  #idms-mnav-panel .idms-mnav-cta {
    background: var(--pill-ink); color: #fff; justify-content: center;
    margin-top: 6px; font-weight: 500;
  }
  #idms-mnav-langs {
    display: flex; gap: 6px; margin-top: 8px; padding-top: 10px;
    border-top: 1px solid var(--hairline);
  }
  #idms-mnav-langs button {
    flex: 1; justify-content: center; padding: 9px 0;
    font-family: var(--font-mono); font-size: 12px; color: var(--muted);
    border: 1px solid var(--hairline-strong); border-radius: 999px;
  }
}
