/* ============================================================
   LANGUAGE  (GR | 中文)
   Loaded last on every page — Greek pages in /  and  Chinese pages in /zh/.
   1. the language switcher (header bar, login/register, portal)
   2. Simplified-Chinese typography (only matches <html lang="zh-CN">)
   Colours, radii and motion come from the tokens in style.css (:root).
   ============================================================ */

/* ── 1. Switcher ────────────────────────────────────────────── */
.lang-switch {
  display: inline-flex;
  align-items: center;
  flex: none;
  gap: 0.1rem;
  padding: 0.15rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.7);
  line-height: 1;
}

.lang-switch-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.1rem;
  height: 2rem;
  padding: 0 0.55rem;
  border-radius: var(--radius-full);
  color: var(--navy);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.lang-switch-link:hover { background: rgba(11, 31, 63, 0.07); }

.lang-switch-link.is-active,
.lang-switch-link.is-active:hover {
  background: var(--navy);
  color: var(--gold-light);
}

.lang-switch-link:focus-visible {
  outline: 2px solid var(--gold-dark);
  outline-offset: 2px;
}

.lang-switch-sep {
  width: 1px;
  height: 0.9rem;
  margin-inline: 0.12rem;
  background: var(--gray-300);
  font-size: 0;          /* the "|" in the markup is only a fallback — the 1px bar is the divider */
  overflow: hidden;
}

/* header bar: sits between the links and the login / register buttons.
   Seven links + switcher + two buttons are wider than the original six-link bar,
   so the bar is tightened a little (from nav.css values) on every desktop width. */
@media (min-width: 1121px) {
  .nav-inner { gap: 0.75rem; }
  .nav-link { padding-inline: 0.62rem; }
  .nav-link::after { left: 0.62rem; right: 0.62rem; }
}

/* login / register: top-right corner of the form column, level with "← back" */
.auth-form-wrapper { position: relative; }
.lang-switch--auth { position: absolute; top: -0.5rem; right: 0; z-index: 2; }

/* portal: right end of the dashboard header */
.lang-switch--portal { margin-left: auto; }

/* 7 links + switcher + login/register need a little more room on small laptops */
@media (min-width: 1121px) and (max-width: 1259px) {
  .nav-inner { gap: 0.5rem; }
  .nav-logo img, .nav-logo-img { height: 40px !important; }
  .nav-link { padding-inline: 0.42rem; font-size: 0.9rem; }
  .nav-link::after { left: 0.42rem; right: 0.42rem; }
  .nav-auth { gap: 0.4rem; }
  .nav-auth .btn-sm { padding-inline: 0.8rem; }
  .lang-switch-link { min-width: 1.9rem; padding: 0 0.45rem; }
}

/* below 1121px the links live in the drawer: switcher stays in the bar, beside the hamburger */
@media (max-width: 1120px) {
  .nav-inner > .lang-switch { margin-left: auto; margin-right: 0; }
}

@media (max-width: 480px) {
  .lang-switch-link { min-width: 2.1rem; height: 1.85rem; padding: 0 0.5rem; font-size: 0.78rem; }
}

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

/* ── 2. Simplified Chinese ──────────────────────────────────── */
/* Latin letters and digits keep IBM Plex Sans / EB Garamond (brand type);
   Chinese characters fall through to the best system CJK face.
   No web font is downloaded for Chinese — Google Fonts is slow or blocked
   in mainland China and the CJK files are several MB. */
html[lang="zh-CN"] {
  --font: 'IBM Plex Sans', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei',
          'Noto Sans SC', 'Noto Sans CJK SC', 'Source Han Sans SC', 'WenQuanYi Micro Hei',
          system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-serif: 'EB Garamond', 'Songti SC', 'Noto Serif SC', 'Noto Serif CJK SC', 'Source Han Serif SC',
                'SimSun', 'GFS Didot', Georgia, serif;
}

/* the Latin type is tracked tightly; that crushes Chinese characters together */
html[lang="zh-CN"] :where(h1, h2, h3, h4, h5, h6, p, a, span, li, div, button, label, td, th,
                          input, textarea, select, blockquote, strong, small, time) {
  letter-spacing: 0;
}

html[lang="zh-CN"] :where(h1, h2, h3, h4, h5, h6) { line-height: 1.3; }
html[lang="zh-CN"] .hero-title span,
html[lang="zh-CN"] .hero h1 { line-height: 1.25; }

/* Chinese has no italics — a slanted CJK face is synthesised and looks broken */
html[lang="zh-CN"] :where(i, em, cite, address, blockquote, .mission-quote) { font-style: normal; }

/* Chinese punctuation must not start a line */
html[lang="zh-CN"] :where(p, li, td, blockquote, h1, h2, h3, h4) { line-break: strict; }
