/* ============================================================
   base.css — 中文排版基础
   杂志感的根基在这里，不在组件里。
   ============================================================ */

html {
  scroll-behavior: smooth;
  /* 禁止伪粗伪斜：中文字重少，浏览器合成会糊 */
  font-synthesis: none;
}

body {
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  letter-spacing: var(--ls-body);
  color: var(--c-text);
  background: var(--c-paper);
  overflow-x: hidden;
}

body.is-menu-open {
  overflow: hidden;
}

::selection {
  background: var(--c-brand);
  color: #fff;
}

/* ── 标题族 ──────────────────────────────────────── */

.t-serif {
  font-family: var(--font-serif);
  font-weight: 500;
}

.t-display {
  font-family: var(--font-serif);
  font-weight: 500;
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-title);
}

/* 深色块上的中文标题改用无衬线中粗——衬线反白细横画会被吞 */
.t-display-inv {
  font-family: var(--font-sans);
  font-weight: 600;
  line-height: var(--lh-title);
  letter-spacing: var(--ls-title);
}

/* ── 节奏元素：中文缺失的小写字母节奏由它们补足 ──── */

/* 拉丁大写小标签 */
.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--fs-3xs);
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: var(--ls-en-caps);
  text-transform: uppercase;
  color: var(--c-text-mute);
}

.eyebrow--inv {
  color: var(--c-text-inv-mute);
}

.eyebrow--accent {
  color: var(--c-accent);
}

/* 章节序号 */
.sec-no {
  font-family: var(--font-num);
  font-weight: 400;
  line-height: var(--lh-none);
  letter-spacing: var(--ls-num);
  font-variant-numeric: tabular-nums;
}

/* 四字中文标题拉开字距，从「文字」变成「版面元素」 */
.label-cn {
  font-family: var(--font-sans);
  font-weight: 500;
  letter-spacing: var(--ls-cn-wide);
  /* 字距会在右侧留出多余空白，用负 margin 视觉回正 */
  margin-right: calc(var(--ls-cn-wide) * -1);
}

/* 数字：等宽防抖动 */
.num,
.stat__value,
.impact__value {
  font-variant-numeric: tabular-nums;
  letter-spacing: var(--ls-num);
}

/* ── 正文排版 ────────────────────────────────────── */

.prose {
  max-width: var(--measure);
}

.prose p {
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  letter-spacing: var(--ls-body);
  /* 中文两端对齐没有西文的「空白河流」问题，是中文独有的优势 */
  text-align: justify;
  text-justify: inter-ideograph;
  hanging-punctuation: allow-end;
}

.prose p + p {
  margin-top: 1.15em;
}

.prose--lead p {
  font-size: var(--fs-md);
  line-height: var(--lh-lead);
  color: var(--c-text);
}

.prose--inv p {
  color: var(--c-text-inv);
}

.prose--mute p {
  color: var(--c-text-mute);
}

/* 首字下沉：汉字有效，中文杂志常见手法 */
.prose--drop > p:first-of-type::first-letter {
  float: left;
  font-family: var(--font-serif);
  font-size: 3.4em;
  line-height: 0.86;
  margin: 0.06em 0.14em 0 0;
  color: var(--c-brand);
  font-weight: 500;
}

/* 窄栏下 justify 会产生难看的大字距 */
@media (max-width: 767px) {
  .prose p {
    text-align: start;
  }

  .prose--drop > p:first-of-type::first-letter {
    font-size: 2.8em;
  }
}

/* ── 链接 ────────────────────────────────────────── */

.link {
  display: inline;
  background-image: linear-gradient(currentColor, currentColor);
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 0% 1px;
  transition: background-size var(--dur) var(--ease), color var(--dur) var(--ease);
  padding-bottom: 2px;
}

.link:hover,
.link:focus-visible {
  background-size: 100% 1px;
}

/* 箭头链接 */
.link-arrow {
  display: inline-flex;
  align-items: baseline;
  gap: 0.6em;
  font-family: var(--font-mono);
  font-size: var(--fs-2xs);
  letter-spacing: var(--ls-en-caps);
  text-transform: uppercase;
  color: var(--c-accent);
  transition: gap var(--dur) var(--ease);
}

.link-arrow::after {
  content: '→';
  transition: transform var(--dur) var(--ease);
}

.link-arrow:hover::after,
.link-arrow:focus-visible::after {
  transform: translateX(4px);
}

/* ── 无障碍 ──────────────────────────────────────── */

:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: var(--sp-4);
  z-index: 999;
  padding: var(--sp-3) var(--sp-5);
  background: var(--c-ink);
  color: #fff;
  font-size: var(--fs-sm);
  transition: top var(--dur) var(--ease);
}

.skip-link:focus {
  top: var(--sp-4);
}

.u-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;
}

/* ── 滚动进场 ────────────────────────────────────── */
/* 关键：必须挂在 html.js 下。JS 未执行时内容照常可见，绝不白屏。 */

html.js .reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity var(--dur-slow) var(--ease-io),
    transform var(--dur-slow) var(--ease-io);
  transition-delay: calc(var(--i, 0) * 70ms);
}

html.js .reveal.is-in {
  opacity: 1;
  transform: none;
}

/* hero 逐行揭起 */
html.js .line-mask {
  overflow: hidden;
  display: block;
}

html.js .line-mask > span {
  display: block;
  transform: translateY(105%);
  transition: transform 1s var(--ease-io);
  transition-delay: calc(var(--i, 0) * 90ms + 120ms);
}

html.js .is-loaded .line-mask > span {
  transform: none;
}

@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;
  }

  html.js .reveal {
    opacity: 1 !important;
    transform: none !important;
  }

  html.js .line-mask > span {
    transform: none !important;
  }
}
