/* PiXENDA mobile menu (pairs with /js/nav.js) */
.menu-btn { display: none; }

@media (max-width: 640px) {
  .menu-btn {
    display: inline-flex; align-items: center; justify-content: center;
    flex: 0 0 auto; width: 38px; height: 38px; margin-left: 10px; padding: 0;
    border: 1px solid var(--line, rgba(128,128,128,.35)); border-radius: 50%;
    background: transparent; color: inherit; cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .menu-btn:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
  .menu-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
  .menu-btn .i-close { display: none; }
  header.top.menu-open .menu-btn .i-open { display: none; }
  header.top.menu-open .menu-btn .i-close { display: block; }

  header.top.menu-open .nav-links {
    display: flex; flex-direction: column; gap: 0;
    position: fixed; left: 0; right: 0; top: var(--menu-top, 64px); z-index: 1000;
    margin: 0; padding: 4px 24px calc(12px + env(safe-area-inset-bottom, 0px));
    background: var(--menu-bg, #0b1120);
    border-bottom: 1px solid var(--line, rgba(128,128,128,.35));
    box-shadow: 0 14px 28px rgba(0,0,0,.28);
    max-height: calc(100vh - var(--menu-top, 64px));
    max-height: calc(100dvh - var(--menu-top, 64px));
    overflow-y: auto;
  }
  header.top.menu-open .nav-links a {
    display: block; padding: 15px 2px; font-size: 17px;
    border-bottom: 1px solid var(--line, rgba(128,128,128,.35));
  }
  header.top.menu-open .nav-links a:last-child { border-bottom: 0; }
}

/* Anchored header on mobile: stays reachable, tucks away while reading */
@media (max-width: 640px) {
  html { scroll-padding-top: 72px; }
  header.top {
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: transform .25s ease, box-shadow .25s ease;
  }
  header.top.is-scrolled { box-shadow: 0 1px 0 rgba(0,0,0,.08), 0 6px 16px rgba(0,0,0,.06); }
  header.top.is-hidden { transform: translateY(-100%); }
}
@media (prefers-reduced-motion: reduce) {
  header.top { transition: none; }
}

/* ===== Accessibility (WCAG 2.2 AA) — shared by every page ===== */
/* text on accent-colored fills: white on the light theme's deep violet, navy on the dark theme's light violet */
:root { --on-accent: #FFFFFF; }
:root[data-theme="dark"] { --on-accent: #07111E; }

/* skip link: hidden until focused */
.skip-link {
  position: absolute; left: 12px; top: 12px; z-index: 3000;
  padding: 10px 16px; border-radius: 8px;
  background: var(--ink, #161310); color: var(--bg, #FAFAF8);
  font: 600 15px/1.2 var(--sans, system-ui, sans-serif); text-decoration: none;
  transform: translateY(-160%);
}
.skip-link:focus { transform: none; outline: 2px solid var(--accent, #6D28D9); outline-offset: 2px; }
main:focus { outline: none; }

/* visually hidden, still read by screen readers */
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* keyboard focus on sideways-scrolling regions */
[data-scroll-region]:focus-visible { outline: 2px solid var(--accent, #6D28D9); outline-offset: 4px; border-radius: 6px; }

/* buttons may wrap at narrow widths so text never clips (WCAG 1.4.10 / 1.4.12) */
@media (max-width: 480px) {
  .btn { white-space: normal; }
}
