/* ============================================================
   MOBILE NAV back button and hamburger drawer.

   The desktop app bar hides .dash-tabs below 900px, which left
   phones with no way to move between sections. This adds three
   things that work on every page:

     1. a back button in the app bar (Android users expect one)
     2. a slide-in drawer listing every section

   Loaded alongside mobile-nav.js.
   ============================================================ */

/* ---------- Back button ---------- */
.mn-back {
  display: none;
  place-items: center;
  width: 40px; height: 40px;
  flex-shrink: 0;
  margin-right: -14px;
  border: none;
  border-radius: 50%;
  background: none;
  color: #fff;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.mn-back.is-shown { display: grid; }
.mn-back:hover { background: rgba(255, 255, 255, 0.1); }
.mn-back svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.2; }

/* ---------- Hamburger ---------- */
.mn-burger {
  display: none;
  place-items: center;
  width: 42px; height: 42px;
  flex-shrink: 0;
  border: none;
  border-radius: 50%;
  background: none;
  color: #fff;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.mn-burger:hover { background: rgba(255, 255, 255, 0.1); }
.mn-burger svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; }

/* ---------- Drawer ---------- */
.mn-scrim {
  position: fixed;
  inset: 0;
  z-index: 1180;
  background: rgba(6, 6, 9, 0.72);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-fast), visibility var(--transition-fast);
}

.mn-scrim.is-open { opacity: 1; visibility: visible; }

.mn-drawer {
  position: fixed;
  top: 0; left: 0;
  z-index: 1190;
  width: min(330px, 86vw);
  height: 100%;
  display: flex;
  flex-direction: column;
  background: #0c0d11;
  border-right: 1px solid var(--surface-border-bright);
  transform: translateX(-100%);
  transition: transform var(--transition-normal);
}

.mn-drawer.is-open { transform: none; }

.mn-drawer-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 18px 16px;
  border-bottom: 1px solid var(--surface-border);
}

.mn-drawer-head .logo-img { height: 34px; width: auto; }

.mn-close {
  display: grid; place-items: center;
  width: 40px; height: 40px;
  margin-left: auto;
  border: none;
  border-radius: 50%;
  background: none;
  color: #fff;
  cursor: pointer;
}

.mn-close:hover { background: rgba(255, 255, 255, 0.1); }
.mn-close svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; }

.mn-drawer-body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 14px 0 20px;
}

.mn-label {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 18px 20px 8px;
}

.mn-link {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 50px;
  padding: 12px 20px;
  color: #e5e7eb;
  font-size: 15.5px;
  font-weight: 600;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.mn-link:hover { background: rgba(255, 255, 255, 0.05); color: #fff; }
.mn-link svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.7; flex-shrink: 0; }

.mn-link.is-current {
  color: var(--accent-coral);
  background: rgba(255, 107, 53, 0.1);
  box-shadow: inset 3px 0 0 var(--accent-cyan);
}

.mn-drawer-foot {
  border-top: 1px solid var(--surface-border);
  padding: 12px 0 calc(12px + env(safe-area-inset-bottom, 0px));
}

/* ---------- Phone rules ---------- */
@media (max-width: 900px) {
  .mn-burger { display: grid; }
  .an-drawer, .mn-drawer { padding-bottom: env(safe-area-inset-bottom, 0px); }
}

@media (min-width: 901px) {
  /* On desktop the drawer must never be reachable. */
  .mn-drawer, .mn-scrim { display: none; }
}
