/* Language switcher */
.lang-switch {
  position: fixed;
  top: 16px;
  right: 20px;
  z-index: 100;
  padding: 5px 10px;
  background: white;
  border: 1px solid black;
  font-family: 'Inter', sans-serif;
}
.lang-switch summary {
  list-style: none;
  cursor: pointer;
  color: black;
  user-select: none;
}
.lang-switch summary::-webkit-details-marker { display: none; }
.lang-switch summary::after {
  content: " \25BE";
  color: #9a9a9a;
}
.lang-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: -1px;
  z-index: 100;
  min-width: 170px;
  padding: 6px 0;
  background: white;
  border: 1px solid black;
}
.lang-menu a {
  display: block;
  padding: 7px 16px;
  color: black;
  text-decoration: none;
  white-space: nowrap;
}
.lang-menu a:hover { background: black; color: white; }
.lang-menu a.active { color: #9a9a9a; pointer-events: none; }

/* Arabic: right-to-left text, layout kept as designed */
html[lang="ar"] p,
html[lang="ar"] h2,
html[lang="ar"] h3,
html[lang="ar"] h4,
html[lang="ar"] li,
html[lang="ar"] td,
html[lang="ar"] button,
html[lang="ar"] .coll,
html[lang="ar"] .next {
  direction: rtl;
}
html[lang="ar"] li:has(> .lang-switch),
html[lang="ar"] .lang-switch,
html[lang="ar"] .lang-menu a { direction: ltr; }
html[lang="ar"] * { font-family: 'Inter', 'Noto Sans Arabic', sans-serif !important; }
html[lang="zh"] * { font-family: 'Inter', 'Noto Sans SC', sans-serif !important; }
