/* Language switcher in the header of every page (English and /zh/). A <details> disclosure: it opens and closes without
   script; lang.js adds Escape, outside click, arrow keys and aria-expanded. One <li> per language; the current one carries
   aria-current="true" and gets the check mark here, so both languages share the same markup.
   Tokens come from the page's own stylesheet (all five define --ink, --line, --hi, --route); fallbacks keep it usable alone. */
.lang-sw { position: relative; flex: none; margin-left: -8px; }
.lang-sw > summary { list-style: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  color: var(--ink, #172031); cursor: pointer; -webkit-tap-highlight-color: transparent; transition: background-color .2s ease; }
.lang-sw > summary::-webkit-details-marker { display: none; }
.lang-sw > summary::marker { content: ""; }
.lang-sw > summary:focus-visible { outline: 3px solid var(--route, #d2582f); outline-offset: 2px; border-radius: 50%; }
.lang-ico { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.lang-sw[open] > summary { background: var(--line, rgba(23, 32, 49, .12)); }
@media (hover: hover) and (pointer: fine) { .lang-sw > summary:hover { background: var(--line, rgba(23, 32, 49, .12)); } }

.lang-menu { position: absolute; z-index: 80; right: 0; top: calc(100% + 6px); min-width: 180px; margin: 0; padding: 6px; list-style: none;
  background: var(--hi, #fbfcfd); border-radius: 8px;
  box-shadow: 0 0 0 1px var(--line, rgba(23, 32, 49, .12)), 0 14px 30px -12px rgba(23, 32, 49, .38); }
.lang-menu li { margin: 0; }
.lang-menu a { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 44px; padding: 0 12px; border-radius: 4px;
  color: var(--ink, #172031); text-decoration: none; white-space: nowrap; letter-spacing: 0; text-transform: none;
  font: 500 16px/1.2 "DM Sans", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif; }
.lang-menu a[aria-current="true"] { font-weight: 600; }
.lang-menu a[aria-current="true"]::after { content: ""; flex: none; width: 11px; height: 6px; margin-top: -4px; border: solid var(--route, #d2582f);
  border-width: 0 0 2px 2px; transform: rotate(-45deg); }
.lang-menu a:focus-visible { outline: 3px solid var(--route, #d2582f); outline-offset: -3px; }
@media (hover: hover) and (pointer: fine) { .lang-menu a:hover { background: var(--line, rgba(23, 32, 49, .12)); } }

.lang-sw[open] > .lang-menu { animation: lang-in .18s cubic-bezier(.23, 1, .32, 1); }
@keyframes lang-in { from { opacity: 0; transform: translateY(-4px); } }
@media (prefers-reduced-motion: reduce) {
  .lang-sw[open] > .lang-menu { animation: none; }
  .lang-sw > summary { transition: none; }
}

/* Phone header (every page): the wordmark and the globe share the first row, the four links take the next. */
@media (max-width: 640px) {
  .top > .lang-sw { order: 2; margin-left: auto; margin-right: -10px; }
}
