/* ==========================================================================
   AnyBuddy self-hosted webfonts
   --------------------------------------------------------------------------
   中国大陆访客：页面运行时不得请求任何境外 CDN。
   本文件替代原先由 Google Fonts 托管的三张样式表：
   Inter、JetBrains Mono、Material Symbols Outlined。
   重建方式见 tools/build-fonts.sh（构建期一次性下载，运行期零境外请求）。

   字体来源与体积：
     assets/fonts/inter-latin-var.woff2              Inter variable  (wght 100-900, latin 子集)  48 KB
     assets/fonts/jetbrains-mono-latin-var.woff2     JetBrains Mono variable (wght 400-800, latin) 31 KB
     assets/fonts/material-symbols-outlined.woff2    Material Symbols Outlined (pyftsubset 子集)   6 KB
   中文不内嵌，走 unicode-range 之后的系统字体兜底（PingFang SC / Microsoft YaHei ...）。
   ========================================================================== */

/* --------------------------------------------------------------------------
   Inter —— 拉丁子集可以只带一个可变字体文件覆盖 400/500/600/700/800；
   Google 对每个 wght 返回的 woff2 内容完全相同（同一变量字体），
   重复声明只会浪费体积，因此这里合并为一个 wght 100-900 的 @font-face。
   -------------------------------------------------------------------------- */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../fonts/inter-latin-var.woff2') format('woff2-variations'),
       url('../fonts/inter-latin-var.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;
}

/* --------------------------------------------------------------------------
   JetBrains Mono —— 同上，单个变量字体覆盖 400/500/600（轴范围 400-800）。
   -------------------------------------------------------------------------- */
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('../fonts/jetbrains-mono-latin-var.woff2') format('woff2-variations'),
       url('../fonts/jetbrains-mono-latin-var.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;
}

/* --------------------------------------------------------------------------
   Material Symbols Outlined —— pyftsubset 子集，保留 rlig（ligature）特性。
   子集包含的 37 个图标名见 tools/icon-ligatures.txt（重建：tools/build-fonts.sh）。
   注意：这一份是静态实例（FILL 0 / wght 400 / GRAD 0 / opsz 24），
   下方的 font-variation-settings 对静态字体无副作用，仅为与 Google 官方等价。
   -------------------------------------------------------------------------- */
@font-face {
  font-family: 'Material Symbols Outlined';
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url('../fonts/material-symbols-outlined.woff2') format('woff2');
}

/* Google 官方 .material-symbols-outlined 基础样式（等价实现）。
   --------------------------------------------------------------------------
   层叠说明（重要，改之前先读）：
   index.html 的加载顺序是 tailwind.css 在前、fonts.css 在后，两边选择器特异度
   又相同（都是 0,1,0），所以直接写 `.material-symbols-outlined { font-size: 24px }`
   会把页面上 15 种尺寸工具类（text-[18px] / text-sm / text-base / text-lg /
   text-xl / text-2xl / text-3xl …）全部压掉 —— 实测 45 个图标一律变成 24px，
   与设计稿不符。

   因此拆成两层：
   1) 字形关键属性（font-family 与 ligature 开关）用普通类选择器，特异度 0,1,0，
      任何浏览器都认，保证图标一定渲染成字形而不是 "chat" 这样的文字；
   2) 其余可被工具类覆盖的属性放进 :where()，特异度为 0，
      Tailwind 的尺寸/行高/display 工具类自然优先。
   （不用原生 @layer：Chrome 99 以下整段会被丢弃，风险比 :where() 大得多。） */
.material-symbols-outlined {
  font-family: 'Material Symbols Outlined';
  font-weight: normal;
  font-style: normal;
  font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

:where(.material-symbols-outlined) {
  font-size: 24px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
}

/* 不认 :where() 的老浏览器（Chrome < 88）上面那块整段失效。
   此时只补 display/line-height —— 故意不补 font-size：这里补 24px 会以 0,1,0
   的特异度重新压掉 Tailwind 的尺寸工具类，反而制造同一类 bug。
   字形本身由上一块（普通类选择器）保证，最坏情况只是字号跟随继承值。 */
@supports not selector(:where(a)) {
  .material-symbols-outlined {
    line-height: 1;
    display: inline-block;
  }
}
