/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text",
               "PingFang SC", "Microsoft YaHei", "Helvetica Neue",
               Arial, sans-serif;
  font-size: 17px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.3s ease, color 0.3s ease;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; cursor: pointer; }

/* ===== 颜色变量 - 浅色 ===== */
:root {
  --bg: #ffffff;
  --bg-soft: #f5f5f7;
  --text: #1d1d1f;
  --text-soft: #86868b;
  --accent: #0071e3;
  --accent-2: #8e44ff;
  --border: rgba(0, 0, 0, 0.08);
  --card: #ffffff;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
  --nav-bg: rgba(255, 255, 255, 0.72);
  --code-bg: #1d1d1f;
  --code-text: #f5f5f7;
}

/* ===== 颜色变量 - 暗色 ===== */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --bg-soft: #1d1d1f;
    --text: #f5f5f7;
    --text-soft: #86868b;
    --accent: #2997ff;
    --accent-2: #a970ff;
    --border: rgba(255, 255, 255, 0.1);
    --card: #1d1d1f;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
    --nav-bg: rgba(0, 0, 0, 0.72);
    --code-bg: #000000;
    --code-text: #f5f5f7;
  }
}

/* ===== 排版 ===== */
h1, h2, h3, h4 {
  margin: 0 0 0.5em;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
h1 { font-size: 56px; }
h2 { font-size: 40px; }
h3 { font-size: 24px; }
h4 { font-size: 20px; }
p { margin: 0 0 1em; }
small, .text-small { font-size: 14px; color: var(--text-soft); }

@media (max-width: 768px) {
  body { font-size: 16px; }
  h1 { font-size: 36px; }
  h2 { font-size: 28px; }
  h3 { font-size: 20px; }
}

/* ===== 工具类 ===== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}
.text-gradient {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: transparent;
}
.text-center { text-align: center; }
.text-soft { color: var(--text-soft); }
