/* Shared mobile nav takeover — fix/mobile-nav 2026-08-21
 * Loaded by every site/*.html page that ships <nav class="top">.
 * One rule set, one breakpoint (880px), so all 10 pages collapse the same way:
 * main links + CTA buttons move into a hamburger drawer instead of being
 * hidden with no replacement (old bug) or overflowing the viewport (old bug).
 * See reports/fix-mobile-nav-2026-08-21.md for the audit this answers.
 *
 * Relies on design tokens already defined on every page's own :root
 * (--carbon/--rule/--rule-2/--bone/--gutter/--display etc.) — falls back to
 * literal values if a page is missing one, so this file never depends on
 * load order relative to the page's inline <style>.
 */

.nav-burger {
  display: none;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--rule-2, rgba(255, 255, 255, 0.16));
  background: transparent;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  flex: 0 0 auto;
  -webkit-tap-highlight-color: transparent;
}
.nav-burger span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--bone, #e9e7e2);
  transition: transform 0.18s ease, opacity 0.18s ease;
}
.nav-burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.nav-burger:focus-visible { outline: 2px solid var(--ignite, #f4c542); outline-offset: 2px; }

/* Desktop/base: the wrapper is transparent to layout — ul/.cta stay direct
   children of nav.top .inner exactly as before this fix, zero visual change. */
.nav-menu { display: contents; }

@media (max-width: 880px) {
  nav.top .inner {
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    position: relative;
    flex-wrap: nowrap;
  }

  .nav-burger { display: inline-flex; }

  .nav-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--carbon, #141413);
    border-bottom: 1px solid var(--rule, rgba(255, 255, 255, 0.08));
    padding: 8px var(--gutter, 24px) 24px;
    max-height: calc(100vh - 64px);
    overflow-y: auto;
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.4);
  }
  .nav-menu.is-open { display: flex; }

  .nav-menu ul {
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    gap: 0 !important;
    list-style: none;
    width: 100%;
  }
  .nav-menu ul li { border-bottom: 1px solid var(--rule, rgba(255, 255, 255, 0.08)); }
  .nav-menu ul li:last-child { border-bottom: none; }
  .nav-menu ul a { display: block !important; padding: 14px 4px; }

  /* Product dropdown: no hover on touch, so it's always expanded inline
     inside the drawer instead of behaving like a hover popover. */
  .nav-menu .nav-dd-menu {
    position: static !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    transform: none !important;
    display: block !important;
    box-shadow: none !important;
    background: transparent !important;
    border: none !important;
    padding: 0 0 4px 16px !important;
  }
  .nav-menu .nav-dd-menu a { padding: 10px 4px !important; }
  .nav-menu .nav-dd-toggle .dd-caret { display: none; }

  .nav-menu .cta {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--rule, rgba(255, 255, 255, 0.08));
  }
  .nav-menu .cta .btn { justify-content: center; width: 100%; }

  /* Minimal-tier pages (reserve/software: logo + back-link only, no menu to
     collapse) still get the CTA-overflow safety net via nav.top .inner above. */
  .back-link { white-space: normal; text-align: right; }
}

@media (max-width: 420px) {
  nav.top .inner { padding-left: 20px !important; padding-right: 20px !important; }
}
