/* base.css — reset + 全局排版 + 受控富文本 */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* 锚点预留固定导航高度，不遮挡模块标题 */
  scroll-padding-top: calc(var(--nav-height) + var(--space-sm));
}

html, body { overflow-x: clip; }   /* 非 hidden，杜绝横向滚动 */

body {
  background: var(--color-paper);
  color: var(--color-ink-2);
  font-family: var(--font-body);
  font-weight: 400;
  font-size: var(--text-base);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
}

img, picture, svg, video { display: block; max-width: 100%; height: auto; }
img { -webkit-user-drag: none; }

a { color: var(--color-link); text-decoration: none; transition: color var(--dur-micro) var(--ease-out); }
a:hover { color: var(--color-accent-hover); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }

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

ul, ol { padding-left: 1.25em; }

/* ── 标题排版 ─────────────────────────────────────────────── */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--color-ink);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.025em;
  text-wrap: balance;
  overflow-wrap: anywhere;   /* 长词/英文品牌名可在任意处断行，避免溢出视口 */
  min-width: 0;
}
h1 { font-size: var(--text-display); font-weight: 600; letter-spacing: -0.03em; }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-md); }
p { max-width: 70ch; }
strong { color: var(--color-ink); font-weight: 600; }

/* 焦点环 — 即时显现，不动画，≥3:1 对比 */
:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
:focus:not(:focus-visible) { outline: none; }

::selection { background: var(--color-accent); color: var(--color-accent-ink); }

/* ── 受控富文本（关于我们 / 文章弹窗正文）────────────────── */
/* 与全站风格一致；不允许覆盖全局，外部链接由后端加 rel，禁 JS */
.rich-text { color: var(--color-ink-2); font-size: var(--text-md); line-height: 1.75; }
.rich-text > * + * { margin-top: var(--space-md); }
.rich-text h2 { margin-top: var(--space-xl); font-size: var(--text-2xl); }
.rich-text h3 { margin-top: var(--space-lg); }
.rich-text h4 { margin-top: var(--space-md); }
.rich-text p { max-width: none; }
.rich-text img { width: 100%; border-radius: var(--radius-md); border: var(--rule-w) solid var(--color-rule); }
.rich-text ul, .rich-text ol { padding-left: 1.4em; }
.rich-text li + li { margin-top: var(--space-2xs); }
.rich-text blockquote {
  border-left: 2px solid var(--color-accent);
  padding-left: var(--space-md);
  color: var(--color-ink-3);
  font-style: normal;
}
.rich-text a { color: var(--color-accent); text-decoration: underline; text-underline-offset: 3px; }
.rich-text code { font-family: var(--font-mono); font-size: 0.9em; background: var(--color-paper-3); padding: 0.1em 0.4em; border-radius: var(--radius-sm); }
.rich-text pre { background: var(--color-graphite); color: var(--color-graphite-ink); padding: var(--space-md); border-radius: var(--radius-md); overflow-x: auto; }
.rich-text pre code { background: none; padding: 0; }
.rich-text table { width: 100%; border-collapse: collapse; }
.rich-text th, .rich-text td { border-bottom: var(--rule-w) solid var(--color-rule); padding: var(--space-2xs) var(--space-sm); text-align: left; }

/* ── 无障碍：仅动画/转场降级，内容保持可见 ───────────────── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 150ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 150ms !important;
    scroll-behavior: auto !important;
  }
}

/* 屏幕阅读器专用文本 */
.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; left: var(--space-sm); top: -100%; z-index: 200;
  background: var(--color-ink); color: var(--color-accent-ink);
  padding: var(--space-2xs) var(--space-md); border-radius: var(--radius-sm);
  font-family: var(--font-mono); font-size: var(--text-sm);
  transition: top var(--dur-short) var(--ease-out);
}
.skip-link:focus { top: var(--space-sm); }

/* ── 编辑式工具类（杂志刊头 / 元信息）────────────────────── */
.dek {
  font-family: var(--font-body); font-size: var(--text-md);
  line-height: 1.7; color: var(--color-ink-3); max-width: 54ch;
}
.rule { border: 0; border-top: var(--rule-w) solid var(--color-rule-2); width: 100%; }
