/* Slide-out side menu shared by the map (index.html) and the text pages.
   Markup comes from scripts/build_pages.py (drawer_html); behaviour from assets/menu.js.
   Pattern: menu button -> panel slides in from the left over a dimmed scrim; closes with the
   close button, a tap on the scrim, Esc, a swipe to the left, or following a link. */
.menu-btn { width: 44px; height: 44px; flex: none; display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 12px; background: transparent; color: inherit; cursor: pointer; padding: 0; }
.menu-btn:hover { background: var(--card); }
.menu-btn svg, .drawer svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round; flex: none; }
.menu-btn:focus-visible, .drawer a:focus-visible, .drawer summary:focus-visible, .drawer-close:focus-visible {
  outline: 2px solid var(--accent); outline-offset: -2px; }

.drawer-scrim { position: fixed; inset: 0; z-index: 3000; background: rgba(0, 0, 0, .45);
  opacity: 0; pointer-events: none; transition: opacity .25s ease; }
.drawer { position: fixed; top: 0; bottom: 0; left: 0; z-index: 3001; width: min(320px, 86vw);
  display: flex; flex-direction: column; background: var(--bg); color: var(--fg);
  box-shadow: 4px 0 24px rgba(0, 0, 0, .18); overflow-y: auto; overscroll-behavior: contain;
  transform: translateX(-102%); visibility: hidden;
  transition: transform .25s ease, visibility 0s linear .25s;
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: env(safe-area-inset-bottom); }
body.menu-open .drawer { transform: none; visibility: visible; transition: transform .25s ease, visibility 0s; }
body.menu-open .drawer-scrim { opacity: 1; pointer-events: auto; }
body.menu-open { overflow: hidden; }

.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 8px 10px 18px; border-bottom: 1px solid var(--border); min-height: 60px; }
.drawer-head .logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px;
  color: var(--fg); text-decoration: none; }
.drawer-head .logo img { width: 30px; height: 30px; }
.drawer-close { width: 44px; height: 44px; border: 0; border-radius: 12px; background: transparent; color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.drawer-close:hover { background: var(--card); color: var(--fg); }

.drawer nav { padding: 8px 0; }
.drawer nav a, .drawer summary { display: flex; align-items: center; gap: 16px; min-height: 48px; padding: 0 20px;
  color: var(--fg); text-decoration: none; cursor: pointer; }
.drawer nav a:hover, .drawer summary:hover { background: var(--card); }
.drawer nav a[aria-current="page"] { color: var(--accent); background: var(--card); font-weight: 600;
  box-shadow: inset 3px 0 0 var(--accent); }
.drawer nav a svg, .drawer summary svg { color: var(--muted); }
.drawer nav a[aria-current="page"] svg { color: var(--accent); }
.drawer summary { list-style: none; }
.drawer summary::-webkit-details-marker { display: none; }
.drawer summary .chev { margin-left: auto; width: 18px; height: 18px; transition: transform .2s ease; }
.drawer details[open] summary .chev { transform: rotate(180deg); }
.drawer details a { min-height: 42px; padding-left: 58px; font-size: 15px; }
.drawer details a .count { margin-left: auto; font-size: 13px; color: var(--muted); }
.drawer .sep { height: 1px; background: var(--border); margin: 8px 20px; }
.drawer-foot { margin-top: auto; padding: 16px 20px 20px; font-size: 13px; color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  .drawer, .drawer-scrim, .drawer summary .chev { transition: none !important; }
}
