/* ==========================================================================
   The full-screen menu (templates/default/pieces/mnav.php): on screens narrower than 1000px a menu button slides a sheet up from the bottom (the burger in
   the top bar; on phones, which have no top bar, the floating button bottom right). Logo and a round close button stay at the top while it scrolls. From 1000px up the burger and the sheet never show (the main links are tabs in the top bar).
   Colours come from the site's own tokens, set once here.
   ========================================================================== */
:root {
  --mnav-bg: var(--color-paper);
  --mnav-ink: var(--color-ink);
  --mnav-muted: var(--color-muted);
  --mnav-line: var(--color-rule);
  --mnav-accent: var(--color-accent);
  --mnav-on-accent: var(--color-accent-ink);
  --mnav-dark: var(--k-121417);
  --mnav-on-dark: var(--k-f2f4f6);
}

.mnav-burger, .mnav-sheet { display: none; }

@media (max-width: 999px) {
  /* the burger: two lines that become an X */
  .mnav-burger {
    position: relative; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; flex: none;
    width: 44px; height: 44px; padding: 0; margin-left: var(--space-2xs); border: 0; border-radius: 50%; background: transparent; color: var(--wb-ink, var(--mnav-ink)); cursor: pointer;
  }
  .mnav-burger:hover { background: var(--wb-hover, transparent); }
  .mnav-burger:focus-visible, .mnav-close:focus-visible, .mnav-logo:focus-visible, .mnav-who:focus-visible, .mnav-short:focus-visible, .mnav-row:focus-visible, .mnav-sub:focus-visible, .mnav-feature:focus-visible, .mnav-cta:focus-visible, .mnav-more a:focus-visible, .mnav-more button:focus-visible {
    outline: 2px solid var(--mnav-accent); outline-offset: 2px;
  }
  .mnav-burger-line { display: block; width: 22px; height: 2px; border-radius: 2px; background: currentColor; transition: transform 0.2s ease; }
  .mnav-burger[aria-expanded="true"] .mnav-burger-line:first-child { transform: translateY(4px) rotate(45deg); }
  .mnav-burger[aria-expanded="true"] .mnav-burger-line:last-child { transform: translateY(-4px) rotate(-45deg); }

  /* the page behind stays put and the header bar fades while the sheet is open */
  body.mnav-open { overflow: hidden; }
  .wb-top { transition: opacity 0.2s ease; }
  body.mnav-open .wb-top { opacity: 0; pointer-events: none; }

  /* the sheet */
  .mnav-sheet {
    display: flex; flex-direction: column; position: fixed; inset: 0; z-index: 200; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
    color: var(--mnav-ink); background: var(--mnav-bg);
    opacity: 0; visibility: hidden; transform: translateY(24px);
    transition: opacity 0.28s ease, transform 0.28s ease, visibility 0s linear 0.28s;
  }
  .mnav-sheet[hidden] { display: none; }
  .mnav-sheet.is-open { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
  .mnav-top {
    position: sticky; top: 0; z-index: 2; flex: none; display: flex; align-items: center; justify-content: space-between; gap: var(--space-sm);
    padding: calc(10px + env(safe-area-inset-top)) var(--space-md) 10px; background: var(--mnav-bg); border-bottom: 1px solid var(--mnav-line);
  }
  .mnav-logo { display: inline-flex; align-items: center; color: var(--mnav-ink); text-decoration: none; }
  .mnav-close {
    display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0; border-radius: 50%;
    border: 1px solid var(--mnav-line); background: transparent; color: var(--mnav-ink); cursor: pointer;
  }
  .mnav-close .icon { width: 22px; height: 22px; stroke-width: 2; }
  .mnav-body { flex: 1 0 auto; display: flex; flex-direction: column; gap: var(--space-lg); padding: var(--space-md) var(--space-md) calc(var(--space-xl) + env(safe-area-inset-bottom)); max-width: 640px; width: 100%; margin: 0 auto; }

  /* 1. you: the avatar (your profile), then achievements and the calendar side by side */
  .mnav-me { display: flex; flex-direction: column; gap: var(--space-sm); }
  .mnav-who { display: flex; align-items: center; gap: var(--space-md); color: var(--mnav-ink); text-decoration: none; }
  .mnav-who-text { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
  .mnav-who-text strong { font-size: 1.35rem; font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }
  .mnav-who-text small { font-size: 0.9rem; color: var(--mnav-muted); }
  .mnav-shortcuts { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: var(--space-sm); }
  .mnav-short { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: var(--space-sm) var(--space-md); border: 1px solid var(--mnav-line); border-radius: 16px; color: var(--mnav-ink); text-decoration: none; }
  .mnav-short .icon { width: 24px; height: 24px; margin-bottom: var(--space-3xs); color: var(--mnav-accent); }
  .mnav-short strong { font-size: 1rem; font-weight: 700; }
  .mnav-short small { font-size: 0.85rem; color: var(--mnav-muted); }
  .mnav-short.has-prize { border-color: var(--mnav-accent); }
  .mnav-short.has-prize small { color: var(--mnav-accent); font-weight: 700; }

  /* 2. the feature card */
  .mnav-feature {
    display: flex; align-items: center; gap: var(--space-md); padding: var(--space-md); border-radius: 20px; text-decoration: none;
    background: var(--mnav-accent); color: var(--mnav-on-accent);
  }
  .mnav-photo { flex: none; width: 64px; height: 64px; border-radius: 50%; overflow: hidden; line-height: 0; background: color-mix(in srgb, var(--mnav-ink) 8%, transparent); display: grid; place-items: center; }
  .mnav-photo .nf-avatar { width: 64px; height: 64px; }
  .mnav-feature-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 auto; }
  .mnav-feature-text small { font-size: 0.85rem; font-weight: 600; opacity: 0.85; }
  .mnav-feature-text strong { font-size: 1.15rem; font-weight: 700; line-height: 1.25; }
  .mnav-feature-go { flex: none; width: 24px; height: 24px; }

  /* 3. the main pages: one per row, thin divider, small arrow */
  .mnav-main { display: flex; flex-direction: column; }
  .mnav-row, .mnav-sub {
    display: flex; align-items: center; justify-content: space-between; gap: var(--space-sm); text-decoration: none; color: var(--mnav-ink); cursor: pointer; list-style: none;
  }
  .mnav-row { min-height: 64px; padding: var(--space-xs) var(--space-3xs); border-bottom: 1px solid var(--mnav-line); font-size: 1.5rem; font-weight: 700; letter-spacing: -0.01em; }
  .mnav-row::-webkit-details-marker { display: none; }
  .mnav-row.is-current { color: var(--mnav-accent); }
  .mnav-go, .mnav-caret { flex: none; width: 20px; height: 20px; color: var(--mnav-muted); }
  .mnav-row.is-current .mnav-go, .mnav-row.is-current .mnav-caret { color: var(--mnav-accent); }
  .mnav-caret { transition: transform 0.2s ease; }
  .mnav-group[open] > summary .mnav-caret { transform: rotate(180deg); }
  .mnav-group ul { list-style: none; margin: 0; padding: 0 0 var(--space-xs) var(--space-md); border-bottom: 1px solid var(--mnav-line); }
  .mnav-sub { min-height: 52px; padding: var(--space-xs) var(--space-3xs); border-bottom: 1px solid var(--mnav-line); font-size: 1.1rem; font-weight: 500; }
  .mnav-group li:last-child .mnav-sub { border-bottom: 0; }
  .mnav-sub.is-current { color: var(--mnav-accent); font-weight: 700; }
  .mnav-sub.is-current .mnav-go { color: var(--mnav-accent); }

  /* 4. the smaller links */
  .mnav-more { display: flex; flex-wrap: wrap; gap: var(--space-xs) var(--space-lg); }
  .mnav-more a, .mnav-more button { padding: var(--space-2xs) 0; min-height: 44px; display: inline-flex; align-items: center; border: 0; background: none; font: inherit; font-size: 1rem; font-weight: 500; color: var(--mnav-muted); text-decoration: none; cursor: pointer; }
  .mnav-more a:hover, .mnav-more button:hover { color: var(--mnav-ink); }

  /* 5. the contact card: dark, a short line and a full-width button */
  .mnav-contact { display: flex; flex-direction: column; gap: var(--space-md); padding: var(--space-lg); border-radius: 20px; background: var(--mnav-dark); color: var(--mnav-on-dark); }
  .mnav-contact h2 { margin: 0; font-size: 1.35rem; font-weight: 700; line-height: 1.25; color: inherit; }
  .mnav-cta {
    display: flex; align-items: center; justify-content: center; width: 100%; min-height: 52px; padding: 0 var(--space-md); border-radius: 999px; text-decoration: none;
    background: var(--mnav-accent); color: var(--mnav-on-accent); font-size: 1.05rem; font-weight: 700;
  }
}
/* the phone has the floating menu button, which opens the same sheet, so no burger there */
@media (max-width: 899px) { .mnav-burger { display: none; } }
@media (prefers-reduced-motion: reduce) {
  .mnav-sheet, .mnav-burger-line, .mnav-caret, .wb-top { transition: none; }
}
