/* ==========================================================================
   base.css — 复位、基础排版、布局原语
   只做「全局且与页面内容无关」的事：盒模型、字体、标题默认值、容器。
   ========================================================================== */

/* ---------- 字体（自托管，无外部请求） ---------- */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../assets/fonts/inter-latin.woff2') format('woff2');
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

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

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

body,
h1,
h2,
h3,
h4,
h5,
h6,
p,
figure,
blockquote,
dl,
dd,
ul,
ol,
fieldset {
  margin: 0;
}

ul[class],
ol[class] {
  padding: 0;
  list-style: none;
}

html,
body {
  height: 100%;
}

body {
  background: var(--c-bg);
  color: var(--c-body);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  letter-spacing: var(--ls-body);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

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

img {
  height: auto;
}

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

/* 断开的占位链接（目标页面尚未上线）：保留外观，但不可点击 */
a:not([href]) {
  pointer-events: none;
  cursor: default;
}

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

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

hr {
  border: 0;
  border-top: 1px solid var(--c-line);
  margin: 0;
}

table {
  border-collapse: collapse;
}

/* ---------- 排版默认值 ---------- */
h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--c-ink);
  font-weight: 500;
  text-wrap: wrap;
}

h1 {
  font-size: var(--fs-display);
  line-height: var(--lh-display);
  letter-spacing: var(--ls-display);
  font-weight: 600;
}

h2 {
  font-size: var(--fs-h2);
  line-height: var(--lh-h2);
  letter-spacing: var(--ls-h2);
}

h3 {
  font-size: var(--fs-h3);
  line-height: var(--lh-h3);
  letter-spacing: var(--ls-h3);
  font-weight: 400;
}

h4 {
  font-size: var(--fs-h4);
  line-height: var(--lh-h4);
  letter-spacing: var(--ls-h4);
}

h5 {
  font-size: var(--fs-h5);
  line-height: var(--lh-h5);
  letter-spacing: var(--ls-h5);
}

p {
  text-wrap: pretty;
}

strong {
  font-weight: 600;
  color: var(--c-ink);
}

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

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

/* ---------- 布局原语 ---------- */
.container {
  width: 100%;
  max-width: calc(var(--container) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.container--wide {
  max-width: none;
  padding-inline: var(--header-pad);
}

.section {
  padding-block: clamp(56px, 6.6vw, 100px);
}

.section--tight {
  padding-block: clamp(36px, 4vw, 60px);
}

/* 视觉隐藏但可被读屏/搜索引擎读取 */
.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: -100px;
  left: var(--sp-4);
  z-index: calc(var(--z-header) + 1);
  padding: 10px 16px;
  background: var(--c-accent);
  color: var(--c-accent-ink);
  border-radius: var(--r-sm);
  transition: top var(--dur-fast) ease;
}

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

/* ---------- 滚动揭示（JS 增强；无 JS 时内容照常可见） ---------- */
[data-reveal] {
  opacity: 1;
}

.js [data-reveal] {
  opacity: 0;
  transform: translateY(18px);
}

.js [data-reveal].is-visible {
  opacity: 1;
  transform: none;
  transition:
    opacity var(--dur-slow) var(--ease-out),
    transform var(--dur-slow) var(--ease-out);
  transition-delay: var(--reveal-delay, 0s);
}

/* ---------- 减少动效 ---------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  .js [data-reveal] {
    opacity: 1;
    transform: none;
  }
}

/* ---------- 打印 ---------- */
@media print {
  body {
    background: #fff;
    color: #000;
  }
}

/* ==========================================================================
   中文排版（仅在 <html lang="zh-CN"> 时生效）
   设计令牌的字距 / 行高是按拉丁文标定的：拉丁文需要负字距收紧，中文负字距会让笔画粘连；
   拉丁文行高 1.5 已够，中文需要更大的行距才透气。因此这里整体覆写这两组令牌，
   字号 / 颜色 / 间距完全不动 —— 版式与设计稿保持一致。
   ========================================================================== */
:root:lang(zh-CN) {
  --ls-display: 0.01em;
  --ls-h2: 0.01em;
  --ls-h3: 0.01em;
  --ls-h4: 0.01em;
  --ls-h5: 0.01em;
  --ls-lead: 0.015em;
  --ls-body: 0.015em;
  --ls-label: 0.015em;
  --ls-stat: 0;
  --ls-price: 0.01em;

  --lh-display: 1.26;
  --lh-h2: 1.3;
  --lh-h3: 1.4;
  --lh-h4: 1.4;
  --lh-h5: 1.44;
  --lh-lead: 1.72;
  --lh-body: 1.72;
}

/* 中文断行：允许 CJK 任意处换行，但不拆英文单词；中文标点不置行首 */
:root:lang(zh-CN) body {
  word-break: normal;
  overflow-wrap: break-word;
  line-break: strict;
  text-spacing-trim: space-all;
}
