/* Language switcher: a <details> entry in the main nav (site's own .realm-menu pattern) + a footer row. New self-hosted file (CSP style-src 'self'). Loaded on every page that has alternates. */
.lang-switcher-footer{display:flex;justify-content:center;flex-wrap:wrap;gap:.25rem .75rem;align-items:center;font-size:.875rem;margin-block:.5rem;margin-inline:0;padding:0;line-height:1.4}
.lang-switcher a{color:inherit;text-decoration:none;padding:.25rem .125rem;border-block-end:1px solid transparent;min-height:24px}
.lang-switcher a:hover,.lang-switcher a:focus-visible{border-block-end-color:currentColor}
.lang-switcher a[aria-current="true"]{font-weight:600;border-block-end-color:currentColor}
/* Script-appropriate stacks, system fonts only (font-src 'self' means no web fonts unless self-hosted). */
:lang(zh-Hans){--serif:"Songti SC","Noto Serif CJK SC","Source Han Serif SC","SimSun",serif;--sans:"PingFang SC","Noto Sans CJK SC","Microsoft YaHei",sans-serif}
:lang(ar){--serif:"Geeza Pro","Noto Naskh Arabic","Segoe UI","Arial",serif;--sans:"Geeza Pro","Noto Sans Arabic","Segoe UI","Arial",sans-serif}
:lang(ru),:lang(tr){--serif:Georgia,"Times New Roman",serif}  /* KalRealm (Cinzel latin subset) lacks Cyrillic, and probably Turkish letters: verify */
:lang(zh-Hans),:lang(ar){letter-spacing:0!important;text-transform:none!important;font-style:normal}
:lang(zh-Hans) body,:lang(ar) body{line-height:1.8}
:lang(ru) h1,:lang(ru) h2,:lang(de) h1,:lang(de) h2{overflow-wrap:anywhere;hyphens:auto}

.lang-switcher-footer{flex-basis:100%;width:100%}
.lang-switcher-menu summary{cursor:pointer}

/* The language entry is the LAST item of the nav: its dropdown must open towards the inside of the page (the site's .realm-menu opens
   towards the end edge and was cut off by 80+ px at 1440 px). */
.lang-switcher-menu{position:relative}
.lang-switcher-menu>.realm-menu{left:auto;right:0;min-width:11rem;max-width:calc(100vw - 24px)}
/* Mobile nav: the site's open menu is a column with flex-wrap:wrap and a max-height, so an opened last entry (the language list) jumped into a
   second column off-screen. Keep one scrollable column, and show the languages as a compact wrapping row. */
@media (max-width:920px){
  .realm-site .realm-header[data-menu-open=true] #main-navigation{flex-wrap:nowrap}
  .realm-site .realm-header #main-navigation .lang-switcher-menu .realm-menu{display:flex;flex-direction:row;flex-wrap:wrap;gap:0 4px;max-width:none;min-width:0}
  .realm-site .realm-header #main-navigation .lang-switcher-menu .realm-menu a{flex:0 1 auto;width:auto;min-height:44px;display:inline-flex;align-items:center;padding:6px 12px;border-bottom:0}
}
/* Chinese headings: balance the two lines (a break inside a 2-character word such as 私|服 looked accidental) */
:lang(zh-Hans) :is(h1,h2,h3){text-wrap:balance;line-break:strict}
