/* Language switcher (EN / 简 / 繁) in the site header. Logic: /js/lang-switch.js.
   Added to every page by tools/i18n/build.py. Colors use the page's tokens when it
   has them (home / calculator / daily) and the site palette otherwise (articles). */
header.site { flex-wrap: wrap; row-gap: 8px; }
.header-right { display: flex; align-items: center; gap: 16px; margin-left: auto; }
.lang-switch { position: relative; }
/* Pages without a header bar (articles, legal pages): top-right, level with "← Ming". */
.lang-switch--float { float: right; margin: -4px 0 0 12px; z-index: 50; }
.lang-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg-elev, #142338); border: 1px solid var(--border-strong, rgba(201, 168, 76, 0.35)); border-radius: 999px;
  color: var(--cream, #e8d5a3); font: inherit; font-size: 13px; line-height: 1; padding: 7px 10px 7px 9px; cursor: pointer;
}
.lang-btn:hover, .lang-btn[aria-expanded="true"] { border-color: var(--gold, #c9a84c); }
.lang-btn:focus-visible { outline: 2px solid var(--gold, #c9a84c); outline-offset: 2px; }
.lang-btn svg { width: 14px; height: 14px; flex: none; }
.lang-btn .chev { width: 10px; height: 10px; color: var(--text-dim, #8a9bb5); }
.lang-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 50; min-width: 168px;
  background: var(--bg-elev, #142338); border: 1px solid var(--border-strong, rgba(201, 168, 76, 0.35)); border-radius: 10px;
  padding: 6px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45); line-height: 1.4;
}
.lang-menu[hidden] { display: none; }
.lang-menu-cap { font-size: 11px; letter-spacing: 0.5px; text-transform: uppercase; color: var(--text-mute, #4a5e75); padding: 6px 10px 4px; white-space: nowrap; }
.lang-menu button {
  display: flex; width: 100%; justify-content: space-between; align-items: center;
  background: transparent; border: 0; border-radius: 6px; color: var(--text, #c8d8ec);
  font: inherit; font-size: 14px; text-align: left; padding: 8px 10px; cursor: pointer;
}
.lang-menu button:hover, .lang-menu button:focus-visible { background: rgba(201, 168, 76, 0.1); outline: none; }
.lang-menu button[aria-selected="true"] { color: var(--gold, #c9a84c); }
.lang-menu button[aria-selected="true"]::after { content: "✓"; }
@media (max-width: 420px) {
  .header-right { gap: 10px; }
  nav.top a { margin-left: 12px; font-size: 13px; }
}

/* Legal pages in Chinese: which version prevails. */
.lang-note { font-size: 13px; color: var(--text-mute, #8a9bb5); border-left: 2px solid var(--gold, #c9a84c); padding: 6px 12px; margin: 0 0 24px; }

/* A visitor who picked another language before is being sent to that version
   (inline <head> script): keep this page hidden meanwhile. */
html.i18n-wait body { visibility: hidden; }
