/* ==========================================================================
   EN / ZH language switching
   Text lives in data-en / data-zh on .i18n nodes; the script sets <html lang>
   and we show the matching attribute value.
   ========================================================================== */

.i18n{}

/* By default English is rendered server-side into the markup for SEO; the
   script rewrites textContent when switching. Hidden until initialised so
   there is no flash of the wrong language. */
html[data-lang-ready="1"] .i18n[data-en]{}

html[lang="zh-CN"] body,
html[lang="zh"] body{}

/* Font stack for Chinese — add the CJK-capable faces */
html[lang="zh"] body,
html[lang="zh-CN"] body{
  font-family:"PingFang SC","Microsoft YaHei","Hiragino Sans GB",
              "Source Han Sans SC","Noto Sans CJK SC","Segoe UI",Roboto,
              "Helvetica Neue",Arial,sans-serif;
}

/* ---------- language switcher ---------- */
.lang-switch{
  display:inline-flex;align-items:center;gap:0;
  margin-left:18px;flex-shrink:0;
  border:1px solid var(--line);border-radius:8px;overflow:hidden;
  background:rgba(46,155,198,.08);
}
.lang-btn{
  appearance:none;border:0;background:transparent;cursor:pointer;
  color:var(--steel-300);font:inherit;font-size:13px;font-weight:600;
  padding:7px 12px;line-height:1.2;
  display:inline-flex;align-items:center;gap:5px;
  transition:background .16s ease,color .16s ease;
}
.lang-btn + .lang-btn{border-left:1px solid var(--line)}
.lang-btn:hover{background:rgba(46,155,198,.16);color:#fff}
.lang-btn[aria-pressed="true"]{
  background:var(--cyan-500);color:#05202e;
}
.lang-btn:focus-visible{outline:2px solid var(--cyan-400);outline-offset:-2px}
.lang-btn .lang-code{
  font-size:11px;opacity:.75;font-weight:700;letter-spacing:.4px;
}

/* On mobile the switcher drops below the logo row and spans full width */
@media(max-width:860px){
  .lang-switch{margin-left:0;order:3;width:100%}
  .lang-btn{flex:1;justify-content:center;padding:9px 12px}
}

@media print{
  .lang-switch{display:none}
}