/* ==========================================================================
   基础层：重置、字体、排版、焦点、降级动效
   ========================================================================== */

/* ---- 本地自托管字体（无外网依赖，离线可用） ---- */
@font-face {
  font-family: "Barlow Condensed";
  src: url("../fonts/bc500.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
  unicode-range: U+0000-00FF;
}
@font-face {
  font-family: "Barlow Condensed";
  src: url("../fonts/bc600.woff2") format("woff2");
  font-weight: 600; font-style: normal; font-display: swap;
  unicode-range: U+0000-00FF;
}
@font-face {
  font-family: "Barlow Condensed";
  src: url("../fonts/bc700.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
  unicode-range: U+0000-00FF;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/jm400.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
  unicode-range: U+0000-00FF;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/jm500.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
  unicode-range: U+0000-00FF;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/jm700.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
  unicode-range: U+0000-00FF;
}

:root {
  --font-display: "Barlow Condensed", "PingFang SC", "Source Han Sans SC", "Microsoft YaHei", sans-serif;
  --font-body: "PingFang SC", "Source Han Sans SC", "HarmonyOS Sans SC", "Microsoft YaHei", sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", "Cascadia Mono", Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.75;
  letter-spacing: 0.01em;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3, h4 {
  margin: 0;
  font-weight: 600;
  line-height: 1.1;
  text-wrap: balance;
}

p { margin: 0; text-wrap: pretty; }

a { color: inherit; text-decoration: none; }

img, svg { display: block; max-width: 100%; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

ul { margin: 0; padding: 0; list-style: none; }

/* 等宽数字：所有数据表与指标 */
.num, .mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  letter-spacing: -0.01em;
}

/* 焦点圈：2px + 2px 偏移，全站可见 */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

::selection {
  background: var(--accent);
  color: #150a04;
}

/* 滚动条（暗色一致） */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: #0a0a0b; }
::-webkit-scrollbar-thumb {
  background: #2a2a2e;
  border: 2px solid #0a0a0b;
  border-radius: 6px;
}
::-webkit-scrollbar-thumb:hover { background: #3c3c42; }

/* 屏幕阅读器专用文本 */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* 跳转直达（键盘用户） */
.skip-link {
  position: fixed; top: 12px; left: 12px; z-index: 999;
  padding: 10px 18px; border-radius: var(--radius-sm);
  background: var(--accent); color: #150a04;
  font-size: var(--fs-small); font-weight: 600;
  transform: translateY(-160%);
  transition: transform var(--dur-fast) var(--ease-out);
}
.skip-link:focus { transform: none; }

/* ---- 入场动效：仅在用户允许动效时启用 ---- */
.reveal {
  opacity: 0;
  transform: translateY(22px);
}

@media (prefers-reduced-motion: no-preference) {
  .reveal.in {
    opacity: 1;
    transform: none;
    transition:
      opacity var(--dur-slow) var(--ease-out),
      transform var(--dur-slow) var(--ease-out);
    transition-delay: var(--reveal-delay, 0ms);
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
