/* Chilli Badminton languages: fonts per script, right-to-left fixes and the translation notice.
   Loaded on every page (generated head block, i18n/build.js). */

/* ── Fonts: Bebas Neue (headings) has no Vietnamese, Greek, Chinese, Arabic, Devanagari or Gurmukhi letters.
   Those pages use Open Sans + the matching Noto face everywhere. The viewing options fonts (OpenDyslexic etc.)
   still win: their rules are more specific. ── */
html:lang(vi) body *, html:lang(el) body * { font-family: 'Open Sans', system-ui, sans-serif !important; }
html:lang(zh-Hans) body * { font-family: 'Open Sans', 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif !important; }
html:lang(zh-Hant) body * { font-family: 'Open Sans', 'Noto Sans TC', 'PingFang TC', 'Microsoft JhengHei', sans-serif !important; }
html:lang(ar) body * { font-family: 'Noto Sans Arabic', 'Open Sans', Tahoma, sans-serif !important; }
html:lang(hi) body *, html:lang(ne) body * { font-family: 'Open Sans', 'Noto Sans Devanagari', 'Nirmala UI', sans-serif !important; }
html:lang(pa) body * { font-family: 'Open Sans', 'Noto Sans Gurmukhi', 'Nirmala UI', sans-serif !important; }
/* Viewing-options panel samples keep showing each font. */
html body [data-font-sample="atkinson"] { font-family: 'Atkinson Hyperlegible', sans-serif !important; }
html body [data-font-sample="lexend"] { font-family: 'Lexend', sans-serif !important; }
html body [data-font-sample="opendyslexic"] { font-family: 'OpenDyslexic', sans-serif !important; }

/* Letter spacing breaks joined scripts (Arabic) and conjuncts (Devanagari, Gurmukhi); wide tracking also
   looks wrong on Chinese. Uppercase has no meaning there either. */
html:is(:lang(ar), :lang(hi), :lang(ne), :lang(pa), :lang(zh)) body * { letter-spacing: normal !important; }
html:is(:lang(ar), :lang(hi), :lang(ne), :lang(pa), :lang(zh)) body :is(h1, h2, h3) { line-height: 1.25 !important; }

/* ── Right to left (Arabic) ── */
[dir="rtl"] body { text-align: right; }
nav .nav-logo-text { white-space: nowrap; }
[dir="rtl"] .nav-viewing { margin-left: 0; margin-right: 24px; }
[dir="rtl"] nav .nav-links { margin-left: 0; margin-right: auto; }
@media (max-width: 900px) {
  [dir="rtl"] .nav-viewing { margin-right: auto; margin-left: 12px; }
}
[dir="rtl"] .cog-wrap { right: auto; left: var(--sp-4, 16px); }

/* Hidden anti-spam field sits off-screen to the left; in right-to-left pages that would make the page scroll. */
[dir="rtl"] .hp-field { left: auto; right: -9999px; }

/* ── Longer words than English: keep the desktop nav on one line ── */
html:not(:lang(en)) .nav-links a { white-space: nowrap; letter-spacing: 0.04em; }
@media (min-width: 901px) {
  html:not(:lang(en)) .nav-links { gap: 20px; }
}
@media (min-width: 901px) and (max-width: 1240px) {
  html:not(:lang(en)) .nav-links { gap: 14px; }
  html:not(:lang(en)) .nav-links a { font-size: calc(12px * var(--cb-text-scale, 1)); }
  html:not(:lang(en)) nav .nav-logo-text { font-size: 20px; }
}

/* ── Translation notice (bottom of the screen, dismissible) ── */
.cb-i18n-notice {
  position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 2147482000;
  display: flex; align-items: flex-start; gap: 12px;
  max-width: 720px; margin: 0 auto; padding: 12px 14px 12px 16px;
  background: var(--cbv-bg, #121212); color: var(--cbv-fg, #f0f0f0);
  border: 1px solid var(--cbv-line, rgba(255, 255, 255, 0.18)); border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
  font-size: calc(14px * var(--cb-text-scale, 1)); line-height: 1.5;
}
.cb-i18n-notice p { margin: 0; flex: 1; min-width: 0; }
.cb-i18n-notice a { color: inherit; text-decoration: underline; text-underline-offset: 0.2em; font-weight: 700; }
.cb-i18n-close {
  flex: 0 0 auto; width: 36px; height: 36px; margin: -6px -6px -6px 0; padding: 0;
  border: 1px solid transparent; border-radius: 6px; background: none; color: inherit;
  font-size: 22px; line-height: 1; cursor: pointer;
}
.cb-i18n-close:hover { border-color: var(--cbv-line, rgba(255, 255, 255, 0.18)); }
[dir="rtl"] .cb-i18n-close { margin: -6px 0 -6px -6px; }
@media print { .cb-i18n-notice { display: none !important; } }
