/* ═══ Shared mobile navigation (guide & platform pages) ═════════════════
   Same pattern as the landing menu: hamburger ⇄ X in the header row,
   slide-down panel pinned under the fixed header, dimmed backdrop,
   focus trap. No scroll-spy — every row is an outbound page link.

   Markup contract per page:
     nav > div           ← header row (gets .mm-row)
     #mobileMenuBtn      ← hamburger toggle (.mm-toggle)
     #mobileNavBackdrop (.mm-backdrop)  ← direct child of <body>, NOT inside
                        the fixed nav (backdrop-filter on the nav makes it
                        the containing block for position:fixed descendants,
                        which would clip the backdrop to the header strip)
     #mobileNav (.mm-panel) ← inside the fixed nav, after the header row
     a.mm-pill           ← header analyse pill, hidden ≤768px
   ═════════════════════════════════════════════════════════════════════ */

.mm-row { position: relative; z-index: 2; }

/* Hamburger toggle: fully CSS-styled so pages don't depend on which
   Tailwind utilities are compiled. Display flex ≤768px, ≥44px tap target. */
#mobileMenuBtn {
  display: none;
  color: #cbd5e1;
  align-items: center;
  gap: .5rem;
  padding: 8px;
  cursor: pointer;
}
#mobileMenuBtn:hover { color: #22d3ee; }

@media (max-width: 768px) {
  #mobileMenuBtn {
    display: flex;
    margin-left: auto;
    min-width: 44px;
    min-height: 44px;
  }
  /* Header analyse pill: hidden on mobile (the menu replaces it) */
  a.mm-pill { display: none; }
}

/* ── Backdrop ──
   Lives as a direct child of <body> (see markup contract above) so it
   really covers the viewport. z-index 40 keeps it above page content and
   below the fixed nav (z-50) so the header row and panel stay tappable. */
.mm-backdrop {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(0,0,0,.55);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .22s ease, visibility 0s linear .22s;
}
.mm-backdrop.open {
  opacity: 1; visibility: visible; pointer-events: auto;
  transition: opacity .22s ease;
}

/* ── Slide-down panel pinned under the fixed header ── */
.mm-panel {
  position: absolute; left: 0; right: 0; top: 100%; z-index: 3;
  max-height: calc(100vh - 100%);
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: rgba(5, 7, 12, .96);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 18px 42px -18px rgba(0,0,0,.9);
  padding-bottom: 1rem;
  opacity: 0; transform: translateY(-8px);
  visibility: hidden; pointer-events: none;
  transition: opacity .22s ease, transform .22s ease, visibility 0s linear .22s;
}
.mm-panel.open {
  opacity: 1; transform: none;
  visibility: visible; pointer-events: auto;
  transition: opacity .22s ease, transform .22s ease;
}

.mm-list { list-style: none; margin: 0; padding: .5rem .5rem 0; }
.mm-list li + li { border-top: 1px solid rgba(255,255,255,.06); }
.mm-link {
  display: flex; align-items: center; gap: .75rem;
  min-height: 52px; padding: .75rem 1rem;
  border-radius: .5rem;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12px; font-weight: 600;
  letter-spacing: .2em; text-transform: uppercase;
  color: #cbd5e1; /* slate-300 */
  transition: color .15s ease, background-color .15s ease;
}
.mm-link:hover, .mm-link:focus-visible { color: #22d3ee; background: rgba(255,255,255,.04); }

/* Hamburger ⇄ X animation */
#mobileMenuBtn svg line {
  transition: transform .22s ease, opacity .22s ease;
  transform-box: view-box; transform-origin: center;
}
#mobileMenuBtn[aria-expanded="true"] svg line:nth-child(1) { transform: translateY(6px) rotate(45deg); }
#mobileMenuBtn[aria-expanded="true"] svg line:nth-child(2) { opacity: 0; }
#mobileMenuBtn[aria-expanded="true"] svg line:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* Desktop (>768px): toggle, panel and backdrop are never rendered */
@media (min-width: 769px) {
  .mm-backdrop, .mm-panel { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .mm-panel, .mm-backdrop, #mobileMenuBtn svg line { transition: none; }
}
