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

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* 响应式字号:移动端基准 16px,大屏略大,用 clamp 限幅 */
  font-size: clamp(15px, 2.6vw, 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;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: var(--font-weight-semibold);
  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); }

/* 工具类:层叠文字层级 */
.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; }
