/* ==========================================================================
   Mobile menu — off-canvas slide-in panel + backdrop
   Depends: tokens.css, base.css
   State class: html.menu-open (toggled by mobile-menu.js)
   Z-index: var(--z-mobile-menu) = 800 (token from tokens.css)
   NOTE: body scroll-lock is NOT done here — it is owned by the shared
   html.scroll-locked class in base.css. This file only handles panel
   transform and backdrop visibility.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Off-canvas panel
   -------------------------------------------------------------------------- */

.mobile-menu {
  position: fixed;
  top: 0;
  right: 0;
  width: min(320px, 90vw);
  height: 100vh;
  height: 100dvh; /* dynamic viewport height for iOS Safari */
  background: var(--bg-card);
  z-index: var(--z-mobile-menu);
  transform: translateX(100%);
  transition: transform 300ms ease;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  padding: var(--gap);
  gap: 16px;
}

/* Open state — panel slides in */
html.menu-open .mobile-menu {
  transform: translateX(0);
}

/* --------------------------------------------------------------------------
   Backdrop
   -------------------------------------------------------------------------- */

.mobile-menu-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(12, 18, 32, 0.5);
  z-index: calc(var(--z-mobile-menu) - 1);
  opacity: 0;
  pointer-events: none;
  transition: opacity 300ms ease;
}

html.menu-open .mobile-menu-backdrop {
  opacity: 1;
  pointer-events: auto;
}

/* --------------------------------------------------------------------------
   Panel header (close button row)
   -------------------------------------------------------------------------- */

.mobile-menu__header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-shrink: 0;
}

.mobile-menu__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  border-radius: var(--r-xs);
  color: var(--ink);
  background: none;
  border: none;
  cursor: pointer;
  transition: color 150ms ease, background 150ms ease;
}

.mobile-menu__close:hover {
  color: var(--accent);
  background: var(--accent-soft);
}

.mobile-menu__close:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.mobile-menu__close svg {
  width: 22px;
  height: 22px;
}

/* --------------------------------------------------------------------------
   Navigation inside panel
   -------------------------------------------------------------------------- */

.mobile-menu__nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mobile-menu__nav-heading {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding: 8px 12px 4px;
}

.mobile-menu__nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  min-height: 44px;
  border-radius: var(--r-xs);
  color: var(--ink);
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  transition: background 150ms ease, color 150ms ease;
}

.mobile-menu__nav-link:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.mobile-menu__nav-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.mobile-menu__divider {
  height: 1px;
  background: var(--line);
  margin: 4px 0;
}

/* --------------------------------------------------------------------------
   Footer area inside panel (phone + CTA)
   -------------------------------------------------------------------------- */

.mobile-menu__footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: var(--gap);
  border-top: 1px solid var(--line);
}

.mobile-menu__phone {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  min-height: 44px;
  border-radius: var(--r-xs);
  color: var(--ink);
  text-decoration: none;
  font-size: 16px;
  font-weight: 700;
  transition: color 150ms ease;
}

.mobile-menu__phone:hover {
  color: var(--accent);
}

.mobile-menu__phone:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.mobile-menu__cta {
  width: 100%;
  text-align: center;
  justify-content: center;
  text-decoration: none;
}

/* --------------------------------------------------------------------------
   Hidden on desktop (≥ 641px) — regardless of menu-open state
   -------------------------------------------------------------------------- */

@media (min-width: 641px) {
  .mobile-menu {
    display: none;
  }

  .mobile-menu-backdrop {
    display: none;
  }
}

/* --------------------------------------------------------------------------
   No-JS fallbacks — Decision 11
   Note: html.no-js .mobile-nav-fallback { display: block } is in base.css
   -------------------------------------------------------------------------- */

/* Hide burger if JS is off — panel cannot be opened without it */
html.no-js .burger {
  display: none;
}
