/* ==========================================================================
   base.css — reset、排版基线、焦点样式、reduced-motion 兜底

   配色对比度速查（WCAG AA 已验算）：
     ember-400 on ink-900 ≈ 7.3:1  ✅ 深底正文/链接
     ember-500 on ink-900 ≈ 5.2:1  ✅ 深底可用
     ember-500 on white   ≈ 3.7:1  ❌ 仅限 ≥24px 大标题与图形
     ember-600 on white   ≈ 5.6:1  ✅ 浅底文字/按钮一律用 600
     steel-400 on ink-900 ≈ 6.7:1  ✅ 深底次级文字
     ink-800   on mist-100 ≈16.4:1 ✅ 浅底正文
   一句话：深底用 ember-400/500，浅底用 ember-600。
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + var(--sp-5));
}

body {
  margin: 0;
  /* 西文栈放前面：拉丁字符与数字用高质量西文字形，中文自动回落到中文栈 */
  font-family: var(--font-sans-en), var(--font-sans-zh);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--ink-800);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, p, figure, blockquote, dl, dd { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }

h1, h2, h3, h4 {
  font-weight: 800;
  line-height: var(--lh-tight);
  letter-spacing: .02em;   /* 中文标题微开字距 */
  text-wrap: balance;
}
h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); font-weight: 700; }

p { text-align: left; text-wrap: pretty; }  /* 中文不用 justify，会产生难看字距 */

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

img, svg, canvas, video { display: block; max-width: 100%; }
img { height: auto; }

button, input, select, textarea {
  font: inherit;
  color: inherit;
  margin: 0;
}
button { background: none; border: 0; cursor: pointer; }

sub, sup { font-size: .72em; line-height: 0; position: relative; }
sub { bottom: -.22em; }
sup { top: -.45em; }

strong, b { font-weight: 700; }

/* 数字、型号、参数一律等宽对齐 */
.num, table, .metric, output {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

/* 中文页内的英文术语（读屏发音与断词） */
[lang="en"] { letter-spacing: 0; }

/* ---------- 焦点：绝不 outline:none 而无替代 ---------- */
:focus-visible {
  outline: 2px solid var(--ember-400);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}
.theme-light :focus-visible { outline-color: var(--ember-600); }

/* ---------- skip-link ---------- */
.skip-link {
  position: absolute;
  left: var(--sp-4);
  top: -100px;
  z-index: calc(var(--z-toast) + 1);
  padding: var(--sp-3) var(--sp-5);
  background: var(--ember-600);
  color: var(--white);
  font-weight: 700;
  border-radius: var(--r-sm);
  transition: top var(--dur-2) var(--ease-out);
}
.skip-link:focus { top: var(--sp-4); }

/* ---------- 无 JS 降级守卫 ----------
   进场动画的初始隐藏态只在 html.js 下生效。
   没有 JS 时 .js 类不会被加上，内容直接可见。 */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(16px);
  transition:
    opacity var(--dur-4) var(--ease-expressive),
    transform var(--dur-4) var(--ease-expressive);
  transition-delay: calc(var(--i, 0) * var(--stagger));
}
.js [data-reveal].is-in {
  opacity: 1;
  transform: none;
}

/* ---------- reduced-motion 兜底（JS 侧另有短路，见 site.js） ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  html { scroll-behavior: auto; }
}

/* ---------- 选中态 ---------- */
::selection { background: var(--ember-500); color: var(--white); }

/* ---------- 打印 ---------- */
@media print {
  .site-header, .site-footer, .drawer, .to-top, canvas { display: none !important; }
  body { color: #000; background: #fff; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: .8em; }
}
