/* QD-H2 — shared mobile navigation (hamburger + slide panel).
   Loaded by every page that has the standard `.nav > .nav-inner > .nav-links`
   header. Each page keeps its own existing breakpoint for hiding
   `.nav-links` — this file only styles the toggle button and panel that
   appear in its place; it does not change when that breakpoint fires. */

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  background: none;
  border: 1px solid var(--border-strong, var(--border-soft, rgba(255, 255, 255, 0.16)));
  border-radius: var(--radius-btn, var(--r-btn, 8px));
  cursor: pointer;
  flex: 0 0 auto;
}

.nav-toggle-bars {
  position: relative;
  width: 18px;
  height: 12px;
}

.nav-toggle-bars span {
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  border-radius: 2px;
  background: var(--text, #e9e7e0);
  transition: transform 0.2s ease, opacity 0.2s ease, top 0.2s ease;
}

.nav-toggle-bars span:nth-child(1) { top: 0; }
.nav-toggle-bars span:nth-child(2) { top: 5px; }
.nav-toggle-bars span:nth-child(3) { top: 10px; }

.nav-toggle[aria-expanded="true"] .nav-toggle-bars span:nth-child(1) {
  top: 5px;
  transform: rotate(45deg);
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bars span:nth-child(2) {
  opacity: 0;
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bars span:nth-child(3) {
  top: 5px;
  transform: rotate(-45deg);
}

.mobile-nav-overlay {
  position: fixed;
  inset: 0;
  z-index: 998;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.22s ease, visibility 0.22s ease;
}

.mobile-nav-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

.mobile-nav-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 999;
  width: min(320px, 84vw);
  background: var(--bg2, var(--surface, #17181c));
  border-left: 1px solid var(--border-strong, var(--border-soft, rgba(255, 255, 255, 0.12)));
  transform: translateX(100%);
  transition: transform 0.24s ease;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.mobile-nav-panel.is-open {
  transform: translateX(0);
}

.mobile-nav-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-strong, var(--border-soft, rgba(255, 255, 255, 0.12)));
  flex: 0 0 auto;
}

.mobile-nav-panel-title {
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted, #9b978c);
  margin: 0;
}

.mobile-nav-close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--border-strong, var(--border-soft, rgba(255, 255, 255, 0.16)));
  border-radius: var(--radius-btn, var(--r-btn, 8px));
  color: var(--text, #e9e7e0);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.mobile-nav-links {
  list-style: none;
  margin: 0;
  padding: 8px 8px 24px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mobile-nav-links li {
  margin: 0;
}

.mobile-nav-links a,
.mobile-nav-links button {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 48px;
  padding: 12px 16px;
  border-radius: var(--radius-btn, var(--r-btn, 8px));
  color: var(--text, #e9e7e0);
  font-size: 15px;
  text-decoration: none;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
}

.mobile-nav-links a:hover,
.mobile-nav-links a:focus-visible,
.mobile-nav-links button:hover,
.mobile-nav-links button:focus-visible {
  background: var(--surface-2, rgba(255, 255, 255, 0.06));
}

.mobile-nav-links a.active {
  color: var(--accent, #c8f000);
}

.nav-toggle:focus-visible,
.mobile-nav-close:focus-visible,
.mobile-nav-links a:focus-visible,
.mobile-nav-links button:focus-visible {
  outline: 2px solid var(--accent, #c8f000);
  outline-offset: 2px;
}

body.mobile-nav-locked {
  overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
  .mobile-nav-overlay,
  .mobile-nav-panel,
  .nav-toggle-bars span {
    transition: none;
  }
}
