/* =============================================================================
   合流 MergePad · tokens.css — design tokens + self-hosted fonts
   Binding spec: docs/05-design-system.md §2. Components use these tokens only
   (no raw hex, no raw px outside this file except 1px hairlines and icon sizes).
   ============================================================================= */

/* 1. Fonts ------------------------------------------------------------------
   Geist / Geist Mono (variable wght 100–900, OFL, @fontsource-variable), latin + latin-ext.
   "Geist CJKP" = the same Geist latin file minus em dash, curly quotes and ellipsis, so that in
   Chinese text those punctuation marks fall through to the CJK system font (full-width). The middle
   dot U+00B7 stays in Geist on purpose: it is the UI's separator. */
@font-face { font-family: "Geist"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("../assets/fonts/geist-latin-wght.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; }
@font-face { font-family: "Geist"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("../assets/fonts/geist-latin-ext-wght.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, 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: "Geist CJKP"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("../assets/fonts/geist-latin-wght.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-2013, U+2015-2017, U+2020-2025, U+2027-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Geist CJKP"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("../assets/fonts/geist-latin-ext-wght.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, 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: "Geist Mono"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("../assets/fonts/geist-mono-latin-wght.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; }
@font-face { font-family: "Geist Mono"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("../assets/fonts/geist-mono-latin-ext-wght.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, 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; }

/* 2. Tokens ------------------------------------------------------------------ */
:root {
  color-scheme: dark;

  /* 2.1.1 Surfaces — neutral near-black, no blue cast */
  --bg-0: #0B0D10;   /* page canvas; input wells inside panels */
  --bg-1: #121519;   /* elevated panels */
  --bg-2: #1A1E23;   /* hover surfaces and controls */
  --bg-3: #242930;   /* pressed surfaces and tracks */
  --bg-4: #313740;   /* selected surfaces */

  /* 2.1.2 Hairlines (always 1px) */
  --line-1: #23272D; /* quiet dividers */
  --line-2: #2D323A; /* panel and control borders */
  --line-3: #464D58; /* hover and focus borders */

  /* 2.1.3 Text                 contrast on bg-1 / bg-3 */
  --fg-1: #F6F4EF;   /* warm white primary text */
  --fg-2: #B4B7BE;   /* secondary text */
  --fg-3: #939AA5;   /* labels, captions and units */
  --fg-4: #4A4A54;   /*  2.2         disabled, separators, decorative only */

  /* 2.1.4 Brand — the ONE accent ("合流金 / Merge Amber") */
  --accent:     #FFBA69;
  --accent-hi:  #FFD094;
  --accent-lo:  #E59A46;
  --accent-ink: #140D02;
  --accent-a08: rgb(255 186 105 / .08);
  --accent-a16: rgb(255 186 105 / .16);
  --accent-a32: rgb(255 186 105 / .32);

  /* 2.1.5 Semantic — direction only */
  --up:   #22C47F; --up-hi:   #34D68F; --up-ink:   #02140B;
  --down: #F0495E; --down-hi: #FF5D71; --down-ink: #1A0306;
  --up-a12: rgb(34 196 127 / .12);  --up-a24: rgb(34 196 127 / .24);
  --down-a12: rgb(240 73 94 / .12); --down-a24: rgb(240 73 94 / .24);

  /* 2.1.6 Stream hues — DECORATIVE IDENTITY ONLY (hero ribbons, OG art, letter-avatar tiles).
     Never in data marks, text, buttons, borders or charts. Index = (cid - 1) % 6. */
  --st-1: #9D8CFF;  /* iris */
  --st-2: #52B6FF;  /* azure */
  --st-3: #F07BCF;  /* orchid */
  --st-4: #FF9D63;  /* tangerine */
  --st-5: #62E3DA;  /* aqua */
  --st-6: #CFE36B;  /* citron */

  /* 2.1.7 Data roles (race share bar, race row bars, trade-table version dot) */
  --d-lead:  var(--accent);
  --d-mine:  var(--fg-1);
  --d-other: #4A4A54;
  --d-rest:  #2E2E35;

  /* 2.1.8 Overlays */
  --scrim: rgb(0 0 0 / .64);
  --glass: rgb(11 13 16 / .92);

  /* 2.2 Type */
  --cjk: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans SC", "Noto Sans CJK SC", "Source Han Sans SC";
  --font-sans: "Geist", var(--cjk), system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, var(--cjk), monospace;

  --t-11: 11px; --lh-11: 16px;
  --t-12: 12px; --lh-12: 16px;
  --t-13: 13px; --lh-13: 20px;
  --t-14: 14px; --lh-14: 20px;
  --t-16: 16px; --lh-16: 24px;
  --t-20: 20px; --lh-20: 28px;
  --t-24: 24px; --lh-24: 32px;
  --t-28: 28px; --lh-28: 36px;
  --t-32: 32px; --lh-32: 40px;
  --t-56: 56px; --lh-56: 64px;
  --w-4: 400; --w-5: 500; --w-6: 600;
  --track-tight: -0.02em;
  --track-caps: 0.08em;

  /* 2.3 Spacing (4px grid) */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 20px; --s-6: 24px;
  --s-8: 32px; --s-10: 40px; --s-12: 48px; --s-16: 64px; --s-20: 80px;

  /* 2.4 Radius */
  --r-1: 4px;   /* chips, tags, pills, thumbs ≤ 32, segment items, small icon buttons */
  --r-2: 10px;  /* buttons and controls */
  --r-3: 16px;  /* panels and cards */
  --r-4: 12px;  /* modals, sheets (top corners), toasts */

  /* 2.6 Elevation — floating layers only */
  --shadow-pop:   0 16px 40px rgb(0 0 0 / .60);
  --shadow-modal: 0 24px 64px rgb(0 0 0 / .70);
  --shadow-feat:  inset 0 1px 0 rgb(255 255 255 / .03), 0 24px 64px -24px rgb(0 0 0 / .80);

  /* 2.7 Z-index */
  --z-canvas: 0; --z-content: 1; --z-sticky: 20; --z-topbar: 40; --z-bottom: 50; --z-pop: 60;
  --z-toast: 70; --z-scrim: 80; --z-modal: 90; --z-tooltip: 95; --z-skip: 100;

  /* 2.8 Motion */
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-in:  cubic-bezier(.7, 0, .84, 0);
  --t-1: 120ms;
  --t-2: 180ms;
  --t-3: 240ms;

  /* 2.9 Layout */
  --page-max: 1360px;
  --gutter: 40px;
  --topbar-h: 72px;
  --ticker-h: 32px;
  --tabbar-h: 56px;
  --mbar-h: 64px;
  --ctl-sm: 28px; --ctl: 32px; --ctl-md: 40px; --ctl-lg: 48px;
  --gap-panel: 16px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
:root:lang(zh-CN) { --font-sans: "Geist CJKP", var(--cjk), system-ui, sans-serif; }

@media (max-width: 760px) {
  :root { --gutter: 20px; --topbar-h: 64px; }
}
