/* ------------------------------------------------------------------
   Site menu — one definition shared by every page (2026-12-05).
   Layout only: colours, padding and fonts stay with each page.
   ------------------------------------------------------------------ */
.site-header .header-inner,
.site-header .head-inner,
.topbar .wrap { flex-wrap: wrap; height: auto; min-height: 60px; padding-top: 8px; padding-bottom: 8px; }

.site-header .nav,
.topbar .nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  margin-left: auto;
  min-width: 0;
  overflow: visible;
}
.site-header .nav a,
.topbar .nav a { white-space: nowrap; flex: 0 0 auto; }
.site-header .nav .theme-toggle,
.topbar .nav .theme-toggle { flex: 0 0 auto; }
/* on the multilingual checkers the language group and the theme button can
   spill onto a second line; keep them right-aligned like the menu */
.site-header .header-inner > .langsw { margin-left: auto; }
.site-header .header-inner:has(> .langsw) > .theme-toggle { margin-left: auto; }

/* keep the sticky header from covering an anchor target */
[id] { scroll-margin-top: 92px; }

@media (max-width: 860px) {
  /* the menu wraps onto its own rows: let the header scroll away instead of
     holding a third of the screen, and drop the offset that no longer applies */
  .site-header { position: static; }
  /* 40px tap height for the menu on touch screens */
  .site-header .nav a,
  .topbar .nav a { padding-top: 10px; padding-bottom: 10px; }
  .site-header .nav,
  .topbar .nav { order: 3; width: 100%; margin-left: 0; }
  /* keep the theme / language control on the brand row, right aligned */
  .site-header .header-inner > .theme-toggle,
  .site-header .header-inner > .lang-toggle,
  .site-header .header-inner > .langsw,
  .site-header .head-inner > .theme-toggle,
  .topbar .wrap > .iconbtn { order: 2; margin-left: auto; }
  [id] { scroll-margin-top: 12px; }
}
