/* ============================================================================
   mobile.css — mobile-only refinements for baremetalrt.ai
   Every rule is scoped to (max-width:768px). Desktop is intentionally untouched.
   Injected controls (.mnav-*) are display:none at all widths until the media
   query reveals them, so they add nothing to the desktop layout.
   Loaded on every public page; paired with mobile.js.
   ============================================================================ */

/* Injected-by-JS controls: invisible on desktop, revealed only on mobile below */
.mnav-toggle,
.mnav-drawer,
.mnav-backdrop { display: none; }

@media (max-width: 768px) {

  /* ---- #1  Header: collapse the desktop grid nav into brand | CTA | burger -- */
  .nav {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 11px 15px !important;
    /* Match the bar to each page's own background so the brand text — which is
       light on dark pages and dark on the light enterprise page — stays legible. */
    background: var(--bg, #07080d);
    border-bottom: 1px solid color-mix(in srgb, currentColor 10%, transparent);
  }

  .brand { justify-self: auto !important; min-width: 0; }
  .brand-wm { white-space: nowrap; font-size: 15px; }

  /* Hide the desktop inline link rows — they move into the drawer.
     Covers both nav variants: the grouped nav (.nav-links / .nav-right) and the
     flat nav where links are direct children of .nav (e.g. rtx-spark). The
     brand is never a direct <a> child hidden here. */
  .nav-links { display: none !important; }
  .nav-right .nav-textlink { display: none !important; }
  .nav > a:not(.brand) { display: none !important; }
  .nav-right { gap: 8px; justify-self: auto !important; margin-left: auto; }
  .nav-right .btn { padding: 9px 13px; font-size: 13px; }

  /* Hamburger button */
  .mnav-toggle {
    display: inline-flex !important;
    align-items: center; justify-content: center;
    width: 44px; height: 44px; flex: none;
    background: transparent; border: 1px solid color-mix(in srgb, currentColor 22%, transparent);
    border-radius: 9px; cursor: pointer; padding: 0; color: inherit;
  }
  .mnav-toggle span, .mnav-toggle span::before, .mnav-toggle span::after {
    content: ""; display: block; width: 18px; height: 2px; border-radius: 2px;
    background: currentColor; position: relative; transition: transform .22s ease, opacity .22s ease;
  }
  .mnav-toggle span::before { position: absolute; top: -6px; }
  .mnav-toggle span::after  { position: absolute; top:  6px; }
  .mnav-toggle[aria-expanded="true"] span { background: transparent; }
  .mnav-toggle[aria-expanded="true"] span::before { transform: translateY(6px) rotate(45deg); }
  .mnav-toggle[aria-expanded="true"] span::after  { transform: translateY(-6px) rotate(-45deg); }

  /* Slide-in drawer */
  .mnav-drawer {
    display: block; position: fixed; top: 0; right: 0; z-index: 1000;
    width: min(82vw, 320px); height: 100%; height: 100dvh;
    background: #0b0d15; color: #eaecf4;
    border-left: 1px solid rgba(255,255,255,.08);
    transform: translateX(100%); transition: transform .26s cubic-bezier(.4,0,.2,1);
    overflow-y: auto; -webkit-overflow-scrolling: touch;
    padding: 78px 20px 32px;
  }
  .mnav-drawer.open { transform: translateX(0); }
  .mnav-drawer a {
    display: flex; align-items: center; min-height: 48px;
    padding: 4px 6px; font-size: 17px; text-decoration: none;
    color: #dfe2ee; border-bottom: 1px solid rgba(255,255,255,.06);
  }
  .mnav-drawer a.mnav-cta {
    justify-content: center; margin-top: 18px; border: 1px solid #6366f1;
    border-radius: 10px; color: #fff; font-weight: 600; background: #4d4dd6;
  }
  .mnav-drawer .mnav-group {
    font-size: 11px; letter-spacing: .14em; text-transform: uppercase;
    color: #7b8199; margin: 22px 0 4px; border: 0;
  }
  .mnav-backdrop {
    display: block; position: fixed; inset: 0; z-index: 999;
    background: rgba(0,0,0,.5); opacity: 0; visibility: hidden;
    transition: opacity .26s ease, visibility .26s ease;
  }
  .mnav-backdrop.open { opacity: 1; visibility: visible; }
  html.mnav-lock, body.mnav-lock { overflow: hidden; }

  /* ---- #3  Code blocks must scroll inside themselves, not stretch the page -- */
  pre {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* ---- #8  Contain decorative marquees / diagrams that overrun the viewport - */
  .lm, .lm-track, .moat, .moat-viz, .hero, section { overflow-x: clip; }

  /* ---- #7  Give crowded controls a fingertip-sized tap target ------------- */
  .mnav-toggle, .mnav-drawer a { touch-action: manipulation; }
  /* filter/category chips (integrations, models, skills) */
  .cat-tools a, .cat-tools button,
  .filters a, .filters button,
  .chip-row a, .chip-row button {
    min-height: 40px; padding-top: 9px; padding-bottom: 9px;
    display: inline-flex; align-items: center;
  }
  /* footer link rows */
  .foot-links a, .foot-grid a, footer nav a {
    min-height: 40px; display: inline-flex; align-items: center;
  }

  /* ---- #6  Lift the smallest metadata labels off the 10px floor ----------- */
  .badge, .card-cat, .needs-lbl, .cap { font-size: 11px; }

  /* ---- #4  Collapsible section shell (opt-in via mobile.js data hooks) ------- */
  .mcollapse-trigger {
    cursor: pointer; user-select: none;
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
  }
  .mcollapse-trigger::after {
    content: ""; flex: none; width: 10px; height: 10px; margin-left: auto;
    border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
    transform: rotate(45deg); transition: transform .2s ease; opacity: .6;
  }
  .mcollapse-trigger[aria-expanded="true"]::after { transform: rotate(-135deg); }
  .mcollapse-body[hidden] { display: none !important; }

  /* ---- #4  Cap long card grids on mobile; reveal the rest on demand ------- */
  .card.capped { display: none !important; }
  .grid-more { display: flex; justify-content: center; margin: 26px 0 4px; }
  .grid-more button {
    min-height: 44px; padding: 12px 24px; cursor: pointer;
    font: inherit; font-weight: 600; letter-spacing: .02em;
    color: var(--ink, #eaecf4); background: transparent;
    border: 1px solid color-mix(in srgb, currentColor 30%, transparent);
    border-radius: 10px;
  }
  .grid-more button:hover { background: color-mix(in srgb, currentColor 8%, transparent); }
}
