/* LearnPage · Direction B (Dark Terminal) global theme.
   - 自托管 woff2: Inter / JetBrains Mono / Space Grotesk
   - B token: --b-bg-* / --b-fg-* / --b-line* / accents / 字体族
   - 老 token (--bg-0 等) 暂留在各页内联 :root 里, 改皮过程中再切换到 --b-*. */

/* ---- 字体: 9 个 woff2, latin 子集. 中文用 PingFang SC 系统字体 ---- */
@font-face {
  font-family: "Inter";
  font-style: normal; font-weight: 400; font-display: swap;
  src: url("/vendor/fonts/inter-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal; font-weight: 600; font-display: swap;
  src: url("/vendor/fonts/inter-latin-600-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal; font-weight: 700; font-display: swap;
  src: url("/vendor/fonts/inter-latin-700-normal.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal; font-weight: 400; font-display: swap;
  src: url("/vendor/fonts/jetbrains-mono-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal; font-weight: 600; font-display: swap;
  src: url("/vendor/fonts/jetbrains-mono-latin-600-normal.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal; font-weight: 700; font-display: swap;
  src: url("/vendor/fonts/jetbrains-mono-latin-700-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Space Grotesk";
  font-style: normal; font-weight: 400; font-display: swap;
  src: url("/vendor/fonts/space-grotesk-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Space Grotesk";
  font-style: normal; font-weight: 600; font-display: swap;
  src: url("/vendor/fonts/space-grotesk-latin-600-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Space Grotesk";
  font-style: normal; font-weight: 700; font-display: swap;
  src: url("/vendor/fonts/space-grotesk-latin-700-normal.woff2") format("woff2");
}

/* ---- B Direction tokens ---- */
:root {
  color-scheme: dark;

  --b-bg-0: #06070a;
  --b-bg-1: #0d1016;
  --b-bg-2: #161b25;
  --b-bg-3: #1c2330;
  --b-line: #1d2532;
  --b-line-hi: #2a3344;
  --b-grid-line: #0a0c12;

  --b-fg-0: #e8eef5;
  --b-fg-1: #8b96ad;
  --b-fg-2: #7a849f;   /* 原 #4d5670 在 bg-1 上仅 2.6:1; 现 ≥4.5:1 (WCAG AA 小字) */
  --b-fg-3: #2f3648;

  --b-cyan: #5ef3ff;
  --b-cyan-dim: #3aa6b3;
  --b-magenta: #ff4ad6;
  --b-magenta-dim: #a83388;
  --b-amber: #ffb84a;
  --b-good: #5ef3a8;
  --b-bad: #ff5577;
  --b-purple: #9d7cff;

  --b-mono: "JetBrains Mono", "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --b-sans: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC",
            "Microsoft YaHei", system-ui, sans-serif;
  --b-display: "Space Grotesk", "Inter", system-ui, sans-serif;
}
/* ---- Light Direction tokens: 霓虹 accent 降饱和到 AA 可读 (≥4.5:1 on --b-bg-0).
   切换由 /static/theme.js 驱动 (localStorage 'lp-theme' + prefers-color-scheme). ---- */
:root[data-theme="light"] {
  color-scheme: light;

  --b-bg-0: #f7f8fc;
  --b-bg-1: #ffffff;
  --b-bg-2: #eef1f8;
  --b-bg-3: #e3e8f1;
  --b-line: #e2e6ef;
  --b-line-hi: #c6cdde;
  --b-grid-line: #edf0f7;

  --b-fg-0: #171a21;
  --b-fg-1: #4d5566;
  --b-fg-2: #6b7285;
  --b-fg-3: #a5abbd;

  --b-cyan: #0a7ca8;
  --b-cyan-dim: #0c6e8f;
  --b-magenta: #bf1fa8;
  --b-magenta-dim: #a11c8d;
  --b-amber: #b45309;
  --b-good: #15803d;
  --b-bad: #d81e4f;
  --b-purple: #7c3aed;
}

/* ---- scrollbar: B 配色 ---- */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--b-line-hi) var(--b-bg-0);
}
:root[data-theme="light"] * {
  scrollbar-color: #d0d4e0 #fafafe;
}
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--b-bg-0); }
::-webkit-scrollbar-thumb {
  background: var(--b-line); border-radius: 999px;
  border: 2px solid var(--b-bg-0);
}
::-webkit-scrollbar-thumb:hover { background: var(--b-line-hi); }
::-webkit-scrollbar-corner { background: var(--b-bg-0); }

:root[data-theme="light"] ::-webkit-scrollbar-track,
:root[data-theme="light"] ::-webkit-scrollbar-corner { background: #fafafe; }
:root[data-theme="light"] ::-webkit-scrollbar-thumb {
  background: #d0d4e0; border: 2px solid #fafafe;
}
:root[data-theme="light"] ::-webkit-scrollbar-thumb:hover { background: #b8bdcc; }

/* ---- 键盘焦点环 (全站统一; 仅键盘导航时出现, 鼠标点击不触发).
   页面自定义 :focus 样式 (如输入框 border 高亮) 优先级更高, 不受影响. ---- */
:focus-visible {
  outline: 2px solid var(--b-cyan);
  outline-offset: 2px;
}

/* ---- 浅色主题: 去掉暗色扫描线 (各页 body::after 是 rgba(255,255,255) 细线,
   浅底上无意义); 霓虹辉光靠 color-mix 自动随 accent 变深, 无需覆盖. ---- */
:root[data-theme="light"] body::after { display: none; }

/* ---- 跟随系统"减少动态"设置: 光标闪烁 / live dot / 骨架屏 / 过渡全停 ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
