@import "tailwindcss";
@import "tw-animate-css";
@import "shadcn/tailwind.css";
@import "../../../packages/ui/styles/tokens.css";
@import "../../../packages/ui/styles/base.css";
@import "./custom.css";

@custom-variant dark (&:is(.dark *));

@source "../../../packages/ui/**/*.{ts,tsx}";
@source "../../../packages/core/**/*.{ts,tsx}";
@source "../../../packages/views/**/*.{ts,tsx}";

/* Font stack. `--font-inter` is the next/font Inter family (+ its synthetic
   size-adjusted fallback), set on <html> by inter.variable in app/layout.tsx.
   We compose `--font-sans` here in static CSS — rather than baking the CJK tail
   into next/font's `fallback` — so it can be overridden per `<html lang>` and
   stays CSP-safe (no inline <style>). Tailwind's `font-sans` utility resolves
   `var(--font-sans)` (see packages/ui/styles/tokens.css `@theme inline`).

   Default (en / zh / ko): Latin chars render with Inter; CJK chars fall through
   to the platform Chinese fonts, then Korean. Chinese MUST stay before Korean so
   zh users never get Korean Hanja glyph shapes (Hangul is a separate Unicode
   block, so ko users still get Korean fonts for Hangul). Kept in sync with
   apps/desktop/src/renderer/src/globals.css. */
:root {
  --font-sans: var(--font-inter), -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", "Apple SD Gothic Neo",
    "Malgun Gothic", "Noto Sans CJK KR", sans-serif;
}

/* Japanese: Kanji are Han ideographs sharing the same Unicode block as Chinese,
   and CSS font-fallback order is NOT affected by `<html lang>` — so the
   Chinese-first default above would hand Japanese users Chinese glyph shapes
   for shared ideographs. Promote a Japanese-first CJK chain only for Japanese.
   `[lang|="ja"]` is the BCP-47 language-range selector: it matches exactly `ja`
   or `ja-<region>` (layout.tsx emits `ja-JP`), never unrelated 3-letter subtags
   such as `jam`. Inter still leads for Latin; zh/ko remain as a deep fallback. */
html[lang|="ja"] {
  --font-sans: var(--font-inter), "Hiragino Sans", "Hiragino Kaku Gothic ProN",
    "Yu Gothic", "YuGothic", "Meiryo", "Noto Sans CJK JP", "Noto Sans JP",
    -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", "Noto Sans CJK SC", "Apple SD Gothic Neo", "Malgun Gothic",
    "Noto Sans CJK KR", sans-serif;
}
