/* ===================================================================
 * base.css · 基础层 (reset + 基础元素)
 * 所有具体值引用 tokens.css 的 CSS 变量,换肤时本文件不动
 * =================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* 移动端基准字号:设计稿 375 宽,根字号随屏宽缩放 */
  font-size: clamp(15px, 4.267vw, 17px);
}

body {
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: var(--line-height-normal);
  letter-spacing: var(--letter-spacing-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  /* iOS 安全区底部留白 */
  padding-bottom: env(safe-area-inset-bottom);
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: var(--font-weight-regular);   /* 圆体字本身较粗,用 regular */
  line-height: var(--line-height-tight);
  letter-spacing: var(--letter-spacing-tight);
  color: var(--color-text);
}

h1 { font-size: var(--font-size-3xl); }
h2 { font-size: var(--font-size-2xl); }
h3 { font-size: var(--font-size-xl); }
h4 { font-size: var(--font-size-lg); }

p { line-height: var(--line-height-relaxed); }

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: opacity var(--motion-duration-fast) var(--motion-easing-standard);
}
a:hover { opacity: 0.75; }

ul, ol { list-style: none; }

img {
  max-width: 100%;
  display: block;
  height: auto;
}

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

code, pre { font-family: var(--font-mono); }

/* 滚动渐显:配合 data-reveal + IntersectionObserver */
[data-reveal] {
  opacity: 0;
  transform: translateY(20px);
  transition:
    opacity var(--motion-duration-slow) var(--motion-easing-decelerate),
    transform var(--motion-duration-slow) var(--motion-easing-decelerate);
}
[data-reveal].is-visible {
  opacity: 1;
  transform: translateY(0);
}
@media (prefers-reduced-motion: reduce) {
  [data-reveal] { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}

/* 容器:内容居中 + 最大宽度 */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--space-page-x);
}

/* 区块间距 */
.section { padding-block: var(--space-section); }

/* 1px 描边:高 DPI 屏用 scaleY(0.5) 实现真正的 0.5px */
.hairline-top    { position: relative; }
.hairline-top::before {
  content: ""; position: absolute; left: 0; top: 0;
  width: 100%; height: 1px; transform: scaleY(0.5); transform-origin: top;
  background: var(--color-border);
}
.hairline-bottom { position: relative; }
.hairline-bottom::after {
  content: ""; position: absolute; left: 0; bottom: 0;
  width: 100%; height: 1px; transform: scaleY(0.5); transform-origin: bottom;
  background: var(--color-border);
}

/* 工具类 */
.text-secondary { color: var(--color-text-secondary); }
.text-muted { color: var(--color-text-muted); }
.text-inverse { color: var(--color-text-inverse); }
.text-center { text-align: center; }
