/** base.css — 基础重置与排版（Apple 设计语言） */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* 锚点跳转时给吸顶导航留位置，否则标题会藏到导航栏下面 */
  scroll-padding-top: calc(var(--nav-total) + var(--sp-4));
  /* 与 body 同色——防止滚动条后方透出浏览器默认色，
     在深色模式下形成右侧"书页痕迹"残影 */
  background: var(--bg);
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  font-weight: var(--fw-regular);
  line-height: var(--lh-normal);
  /* Apple 全站负字距收紧——不加就不是 Apple 味道 */
  letter-spacing: 0;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-synthesis: none;
  font-optical-sizing: auto;
  overflow-x: hidden;
}

h1,
h2,
h3,
h4,
h5,
p,
figure,
blockquote,
dl,
dd {
  margin: 0;
}

/* Apple 的标题与正文同一家族，只靠字号和 500 字重分层 */
h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: var(--fw-medium);
  letter-spacing: 0;
  line-height: var(--lh-snug);
}

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

a {
  color: var(--link);
  text-decoration: none;
  transition: color var(--dur-base) var(--ease);
}
/* 无 hover 效果（用户要求统一去除） */

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
}

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

/**
 * HTML hidden 属性的兜底。
 *
 * hidden 依赖 UA 样式表的 display:none 生效，而作者样式里任何 display 声明
 * 都会把它覆盖掉——例如 .stage-pill{display:inline-flex} 会让带 hidden 的
 * 元素继续渲染成一个小色块（本项目实际踩过这个坑）。
 * 这里用一条全局规则一次性兜住，避免以后每个组件都要单独处理。
 */
[hidden] {
  display: none !important;
}

/**
 * 可见焦点环：键盘导航可达（无障碍要求）。
* Apple 的焦点表达是 box-shadow 动画，但 outline 不受祖先
* overflow:hidden 裁切，这里沿用 outline 方案、颜色换成 Action Blue。
 */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* 仅屏幕阅读器可见 */
.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: absolute;
  top: -60px;
  left: var(--sp-4);
  z-index: 999;
  padding: var(--sp-3) var(--sp-5);
  background: var(--bg-elevated);
  border-radius: var(--r-sm);
  transition: top var(--dur-base) var(--ease);
}
.skip-link:focus {
  top: var(--sp-4);
}

::selection {
  background: var(--accent-soft);
}

/* 滚动条：细窄、灰色，贴合 Apple 的克制观感 */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--fill-tertiary);
  border-radius: var(--r-xs);
}
/* 滚动条无 hover 效果 */

/* 尊重系统的"减少动态效果"设置 */
@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;
  }
}

/* Apple 字重阶梯里没有 700：b/strong 的浏览器默认 bold 统一压到 500 */
b,
strong {
  font-weight: var(--fw-medium);
}

/* 数字等宽：仪表盘数值跳动时不抖动 */
.tnum {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
}

.mono {
  font-family: var(--font-mono);
}

/* ---------- 排版工具类 ----------
* 字重只有 400 / 500（Apple 规则，极少用 600/700）。
* 标题靠字号跳变分层，颜色靠灰字体系分层。 */
.t-hero {
  font-family: var(--font-display);
  font-size: var(--fs-hero);
  font-weight: var(--fw-medium);
  line-height: var(--lh-tight);
  letter-spacing: 0;
}
.t-display {
  font-family: var(--font-display);
  font-size: var(--fs-display);
  font-weight: var(--fw-medium);
  line-height: var(--lh-display);
  letter-spacing: 0;
}
.t-title {
  font-size: var(--fs-title);
  font-weight: var(--fw-medium);
  letter-spacing: 0;
}
.t-headline {
  font-size: var(--fs-headline);
  font-weight: var(--fw-medium);
  letter-spacing: var(--ls-display);
}
/* 导语段：16px 常规字重，关键安全提示也走这一档 */
.t-subhead {
  font-size: var(--fs-subhead);
  font-weight: var(--fw-regular);
  line-height: var(--lh-snug);
}
.t-body {
  font-size: var(--fs-body);
}
.t-caption {
  font-size: var(--fs-caption);
  color: var(--text-secondary);
  letter-spacing: var(--ls-caption);
}
/* Apple 不用大写转换；micro 只是小号 + 灰色 */
.t-micro {
  font-size: var(--fs-micro);
  letter-spacing: 0;
  color: var(--text-tertiary);
  font-weight: var(--fw-medium);
}
.t-secondary {
  color: var(--text-secondary);
}
.t-tertiary {
  color: var(--text-tertiary);
}
/* （.t-center 已删：与 .ts-center 完全重复，HTML 实际用的是 .ts-center） */
.ts-center {
  text-align: center;
}
.t-balance {
  text-wrap: balance;
}
/* 正文段落避免出现孤字尾行 */
.t-pretty {
  text-wrap: pretty;
}
