/* Header navigation on small screens: a collapsible burger menu.
   CSS only – the checkbox #nav-toggle holds the open/closed state. */
@layer components {
/* Logo and menu stay at the top while scrolling. */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
}
/* in-page anchors (#k1 …) must not end up underneath the sticky header */
html { scroll-padding-top: 96px; }
/* the sticky side column on the compliance pages must stop below the header */
.flex-col-6 { top: 100px; }

/* Language switch: flags; the language name is for screen readers on desktop
   and shown next to the flag in the mobile menu. */
.lang-switch { align-items: center; gap: 12px; }
.lang-link, .lang-current { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--muted); }
.flag {
  display: block;
  width: 24px;
  height: 16px;
  border-radius: 3px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12);
}
.flag-de, .flag-en, .flag-zh { flex: 0 0 auto; }
.lang-link .flag { opacity: 0.75; transition: opacity .15s, transform .15s; }
.lang-link:hover .flag, .lang-link:focus-visible .flag { opacity: 1; transform: translateY(-1px); }
.lang-current .flag { box-shadow: 0 0 0 2px var(--white), 0 0 0 4px var(--red); }
.lang-name {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.nav-toggle {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}
.nav-burger { display: none; }
.nav-burger-text { line-height: 1; }

@media (max-width: 960px) {
  .site-header-inner { position: relative; }
  .nav-burger {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 15px;
    font-weight: 500;
    color: var(--ink);
    cursor: pointer;
    user-select: none;
  }
  .nav-toggle:focus-visible + .nav-burger { outline: 2px solid var(--red); outline-offset: 2px; }
  /* three bars, turning into a cross when open */
  .nav-burger-icon, .nav-burger-icon::before, .nav-burger-icon::after,
  .nav-burger-icon > span {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 2px;
    background: var(--ink);
    transition: transform .2s, opacity .2s;
  }
  .nav-burger-icon { position: relative; background: transparent; height: 14px; }
  .nav-burger-icon::before, .nav-burger-icon::after, .nav-burger-icon > span {
    position: absolute;
    left: 0;
    content: "";
  }
  .nav-burger-icon::before { top: 0; }
  .nav-burger-icon > span { top: 6px; }
  .nav-burger-icon::after { top: 12px; }
  .nav-toggle:checked + .nav-burger .nav-burger-icon::before { transform: translateY(6px) rotate(45deg); }
  .nav-toggle:checked + .nav-burger .nav-burger-icon > span { opacity: 0; }
  .nav-toggle:checked + .nav-burger .nav-burger-icon::after { transform: translateY(-6px) rotate(-45deg); }

  .main-nav {
    display: none;
    width: 100%;
    flex-direction: column;
    /* the design's nav may wrap; in a height-limited column that would start a
       second column instead of scrolling */
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 0;
    padding: 8px 0 4px;
    border-top: 1px solid var(--line);
    font-size: 16px;
  }
  .nav-toggle:checked ~ .main-nav {
    display: flex;
    /* a long open menu scrolls inside the screen instead of running off it */
    max-height: calc(100dvh - 90px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .main-nav > a, .main-nav > .dd > a {
    padding: 12px 4px;
    border-bottom: 1px solid var(--line);
  }
  /* sub-menus are always expanded and indented – touch screens have no hover */
  .main-nav .dd { display: block; }
  .main-nav .nav-caret { display: none; }
  .main-nav .dd-menu { display: block; position: static; padding: 0; }
  .main-nav .dd-menu > div {
    min-width: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 4px 0 8px 16px;
    border-bottom: 1px solid var(--line);
  }
  .main-nav .dd-menu a { padding: 9px 4px; color: var(--muted); }
  .main-nav .lang-switch {
    flex-wrap: wrap;
    border-left: 0;
    padding: 14px 4px 6px;
    gap: 22px;
    font-size: 15px;
  }
  .main-nav .lang-name { position: static; width: auto; height: auto; overflow: visible; clip: auto; }
  .main-nav .lang-current { color: var(--red); font-weight: 600; }
}
}
