/* ---------- Header on narrow screens: brand + menu button; the menu, search and languages open as a panel ---------- */
.menu-toggle { display: none; }
.head-menu { display: contents; }
.flag { display: block; width: 24px; height: 16px; flex: none; box-shadow: 0 0 0 1px var(--hair); }
.langs .lang-name { display: none; }
.langs a:has(.flag) { gap: 10px; }

/* Same breakpoint as the desktop header in header.css. */
@media (max-width: 1279px) {
  .site-head .wrap { min-height: 64px; gap: 8px 12px; padding-bottom: 0; }
  .site-head .brand span { font-size: 13px; letter-spacing: 0.06em; }
  .menu-toggle {
    display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0; margin-right: -10px;
    background: none; color: var(--ink); border: 1px solid transparent; cursor: pointer;
  }
  .menu-toggle svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: square; }
  .menu-toggle .icon-close, .menu-toggle[aria-expanded="true"] .icon-open { display: none; }
  .menu-toggle[aria-expanded="true"] .icon-close { display: block; }
  .menu-toggle[aria-expanded="true"] { border-color: var(--hair-strong); }

  /* Without script the menu stays visible below the brand; the button needs script, so it hides too. */
  .site-head:not(.menu-ready) .menu-toggle { display: none; }
  .site-head:not(.menu-ready) .head-menu { display: flex; flex: 1 0 100%; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding-bottom: 6px; }

  .site-head.menu-ready .head-menu {
    display: none; position: fixed; z-index: 45; top: var(--head-h); left: 0; right: 0; bottom: 0; overflow-y: auto; overscroll-behavior: contain;
    flex-direction: column; gap: 28px; padding: 8px max(24px, env(safe-area-inset-right)) 40px max(24px, env(safe-area-inset-left));
    background: var(--black); border-top: 1px solid var(--hair);
  }
  .site-head.menu-ready.menu-open .head-menu { display: flex; }

  .site-head.menu-ready .head-menu nav { order: 1; width: 100%; overflow: visible; }
  .site-head.menu-ready .nav { flex-direction: column; gap: 0; margin: 0; }
  .site-head.menu-ready .nav a { width: 100%; min-height: 56px; padding: 0; font-size: 15px; border-bottom: 1px solid var(--hair); }
  .site-head.menu-ready .nav a:hover, .site-head.menu-ready .nav a[aria-current] { color: var(--ink); }

  /* The search toggle is for the wide header; in the panel the form is always shown. */
  .site-head.menu-ready .head-menu .search-toggle { display: none; }
  .site-head.menu-ready .head-menu .head-search { display: flex; order: 2; flex: none; width: 100%; padding: 0; }

  .site-head.menu-ready .head-menu .langs { order: 3; flex-direction: column; gap: 0; }
  .site-head.menu-ready .head-menu .langs a { justify-content: flex-start; width: 100%; min-height: 56px; padding: 0 2px; border: 0; border-bottom: 1px solid var(--hair); font-size: 13px; }
  .site-head.menu-ready .head-menu .langs .lang-name { display: inline; font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; }
  .site-head.menu-ready .head-menu .langs a[aria-current] { color: var(--ink); }
  .site-head.menu-ready .head-menu .langs a[aria-current]::after { content: ""; margin-left: auto; width: 8px; height: 8px; background: currentColor; }
}
