/*
 * MiraX — one Lao typeface across every surface.
 *
 * Loaded by every frontend entry point (Admin, Merchant, PC, H5/PWA, Kefu and
 * the standalone Admin pages) so Lao text renders identically no matter which
 * app the user is in. Previously each bundle fell back to whatever Lao font the
 * device happened to have — Phetsarath on some, Saysettha on others, a Thai
 * substitute on the rest — which is why the same label looked different between
 * the Admin and the storefront.
 *
 * Self-hosted rather than linked from Google Fonts: MiraX deliberately makes no
 * runtime requests to third-party hosts (see docs/crmeb-decoupling.md), and a
 * blocked CDN would silently drop us back to the inconsistent fallbacks.
 *
 * Font: Noto Serif Lao (variable, weight 100–900), SIL Open Font License 1.1.
 * Three unicode-range subsets, 73 KB total; the browser fetches only what the
 * page actually uses.
 *
 * To revert: remove the <link> from the entry HTML files. Nothing else depends
 * on this file.
 */

/* ── the face ─────────────────────────────────────────────────────────────── */

@font-face {
  font-family: 'Noto Serif Lao';
  font-style: normal;
  font-weight: 100 900;
  font-stretch: 100%;
  font-display: swap;
  src: url(/font/noto-serif-lao/noto-serif-lao-lao.woff2) format('woff2');
  unicode-range: U+0E81-0EDF, U+200C-200D, U+25CC;
}
@font-face {
  font-family: 'Noto Serif Lao';
  font-style: normal;
  font-weight: 100 900;
  font-stretch: 100%;
  font-display: swap;
  src: url(/font/noto-serif-lao/noto-serif-lao-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Noto Serif Lao';
  font-style: normal;
  font-weight: 100 900;
  font-stretch: 100%;
  font-display: swap;
  src: url(/font/noto-serif-lao/noto-serif-lao-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* Chinese glyphs still appear in a few unpatched corners of the vendor
     bundles; keeping a CJK face in the stack stops them rendering as tofu. */
  --mirax-lao-font: 'Noto Serif Lao', 'Noto Sans Lao', 'Phetsarath OT',
    'Saysettha OT', 'PingFang SC', 'Microsoft YaHei', system-ui,
    -apple-system, 'Segoe UI', sans-serif;
}

/* ── application ──────────────────────────────────────────────────────────── */

/*
 * The vendor bundles set font-family on hundreds of individual components, so a
 * plain `body { font-family }` loses almost everywhere. A universal !important
 * is what actually wins - but it would also repaint every icon glyph as a
 * letter, because icon fonts work by mapping private-use codepoints in a
 * dedicated family.
 *
 * Hence the guard: skip anything whose class mentions "icon" (element-icons,
 * iconfont, iconfont-next, iconfont-shouye, iconfont-diy, uni-tabbar__icon,
 * weui-icon-* are all matched by that one test), every <i>, and everything
 * inside an <svg>. Matching on the class rather than enumerating families means
 * a new icon set added by a future bundle is covered automatically.
 */
*:not([class*='icon']):not([class*='Icon']):not(i):not(svg):not(svg *) {
  font-family: var(--mirax-lao-font) !important;
}

/* ── icon fonts must never be replaced ────────────────────────────────────── */

/* Belt and braces for icon elements whose class does not contain "icon"
   (Element UI's select caret is the common one), and for ::before pseudo
   elements, which inherit from a parent the guard above may have repainted. */
[class^='el-icon-'], [class*=' el-icon-'], .el-select__caret,
[class^='el-icon-']::before, [class*=' el-icon-']::before {
  font-family: element-icons !important;
}
.iconfont, .iconfont::before { font-family: iconfont !important; }
.iconfont-next, .iconfont-next::before { font-family: iconfont-next !important; }
.iconfont-shouye, .iconfont-shouye::before { font-family: iconfont-shouye !important; }
.iconfont-diy, .iconfont-diy::before { font-family: iconfont-diy !important; }

/* Tabular figures wherever digits are stacked in a column — the serif's default
   proportional numerals make order totals and stat tiles hard to scan. */
td, th, .el-table td, .el-table th,
.el-statistic, .el-input__inner[type='number'] {
  font-variant-numeric: tabular-nums;
}
