/**
 * Mirror Tibetan webfont — GLOBAL fallback for all apps (SSG / School / Member / Admin).
 * Keep in sync with @mirror/core/theme (tibetan-web-font.ts).
 *
 * Strategy: load Noto Serif Tibetan with unicode-range, then put it at the end of
 * html/body (and --font-family) so ANY mixed text can fall through to Tibetan glyphs.
 */

/* tibetan */
@font-face {
  font-family: 'Noto Serif Tibetan';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(https://fonts.gstatic.com/s/notoseriftibetan/v24/gokzH7nwAEdtF9N45n0Vaz7O-pk0wsvbBMgm2WY.woff2)
    format('woff2');
  unicode-range: U+0F00-0FFF, U+200C-200D, U+25CC, U+3008-300B;
}
@font-face {
  font-family: 'Noto Serif Tibetan';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(https://fonts.gstatic.com/s/notoseriftibetan/v24/gokzH7nwAEdtF9N45n0Vaz7O-pk0wsvbBMgm2WY.woff2)
    format('woff2');
  unicode-range: U+0F00-0FFF, U+200C-200D, U+25CC, U+3008-300B;
}
@font-face {
  font-family: 'Noto Serif Tibetan';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(https://fonts.gstatic.com/s/notoseriftibetan/v24/gokzH7nwAEdtF9N45n0Vaz7O-pk0wsvbBMgm2WY.woff2)
    format('woff2');
  unicode-range: U+0F00-0FFF, U+200C-200D, U+25CC, U+3008-300B;
}

:root {
  --font-tibetan: 'Noto Serif Tibetan', 'Noto Sans Tibetan', 'Microsoft Himalaya', Jomolhari,
    serif;
}

/*
 * Extend the theme token so `font-family: var(--font-family)` keeps Tibetan fallback.
 * Theme stamps --font-family earlier; we recompose onto --font-family-ui then republish.
 */
html[data-mirror-theme-runtime] {
  --font-family-ui: var(--font-family, system-ui, sans-serif);
  --font-family: var(--font-family-ui), var(--font-tibetan);
}

/*
 * Global document stack — wins over later Latin-only body rules so `inherit`
 * and unstyled text can render Tibetan anywhere.
 */
html {
  font-family:
    var(--font-family, system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans', sans-serif),
    var(--font-tibetan) !important;
}

body,
.school-shell,
.member-shell {
  font-family: inherit !important;
}

/* Dedicated Tibetan-first lines (optional emphasis; global fallback still covers them) */
.shell-body__tibetan,
.shell-card__desc,
.akar-article-tibetan,
.akar-article-body-subtitle,
.card-subtitle,
.card-subtitle-secondary,
.subtitle,
.subtitle-secondary,
.studio-line--tibetan,
[lang='bo'] {
  font-family: var(--font-tibetan);
}

/*
 * Office form controls — Chromium <input>/<textarea> often ignore end-of-stack
 * unicode-range fallback. Tibetan-first matches student .shell-body__tibetan;
 * unicode-range still leaves Latin to system-ui / mono.
 */
.school-office-events__field-control,
.school-office-articles__field input,
.school-office-events__content-textarea,
[data-md-editor-surface='light'] .md-editor .md-textarea,
[data-md-editor-surface='light'] .md-editor-wysiwyg,
[data-md-editor-surface='light'] .md-editor-preview,
[data-office-articles-subtitle] {
  font-family: var(--font-tibetan), system-ui, sans-serif;
}
