/* ============================================
   基础样式 - Reset & 排版
   ============================================ */

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

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

body {
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
  color: var(--text-primary);
  background-color: var(--bg-primary);
  background-image: var(--gradient-hero);
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* === 滚动条 === */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--border-default);
  border-radius: var(--radius-full);
  border: 2px solid var(--bg-primary);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-purple);
}

/* === 选中文字 === */
::selection {
  background: rgba(163, 113, 247, 0.3);
  color: var(--text-primary);
}

/* === 链接 === */
a {
  color: var(--accent-blue);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent-cyan);
}

/* === 标题 === */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-tight);
  color: var(--text-primary);
}

h1 { font-size: var(--fs-4xl); }
h2 { font-size: var(--fs-3xl); }
h3 { font-size: var(--fs-2xl); }
h4 { font-size: var(--fs-xl); }
h5 { font-size: var(--fs-lg); }
h6 { font-size: var(--fs-base); }

/* === 段落 === */
p {
  margin-bottom: var(--space-md);
  line-height: var(--lh-relaxed);
}

p:last-child {
  margin-bottom: 0;
}

/* === 代码（行内）=== */
code {
  font-family: var(--font-code);
  font-size: 0.875em;
  background: var(--bg-tertiary);
  color: var(--accent-cyan);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-muted);
}

/* === 强调 === */
strong, b {
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
}

/* === 列表 === */
ul, ol {
  margin-bottom: var(--space-md);
  padding-left: var(--space-xl);
}

li {
  margin-bottom: var(--space-sm);
  line-height: var(--lh-relaxed);
}

/* === 引用 === */
blockquote {
  border-left: 3px solid var(--accent-purple);
  padding: var(--space-md) var(--space-lg);
  margin: var(--space-lg) 0;
  background: var(--bg-secondary);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  color: var(--text-secondary);
}

blockquote p:last-child {
  margin-bottom: 0;
}

/* === 分隔线 === */
hr {
  border: none;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-default), transparent);
  margin: var(--space-2xl) 0;
}

/* === 表格基础 === */
table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--space-lg) 0;
  font-size: var(--fs-sm);
}

th, td {
  padding: var(--space-md);
  text-align: left;
  border-bottom: 1px solid var(--border-default);
}

th {
  font-weight: var(--fw-semibold);
  color: var(--accent-cyan);
  background: var(--bg-secondary);
}

tr:hover td {
  background: var(--bg-tertiary);
}

/* === 图片 === */
img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md);
}

/* === 工具类 === */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-accent { color: var(--accent-purple); }
.text-cyan { color: var(--accent-cyan); }
.text-green { color: var(--accent-green); }
.text-red { color: var(--accent-red); }
.text-yellow { color: var(--accent-yellow); }

.font-mono { font-family: var(--font-code); }
.font-bold { font-weight: var(--fw-bold); }
.font-semibold { font-weight: var(--fw-semibold); }

.mt-xs { margin-top: var(--space-xs); }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mt-2xl { margin-top: var(--space-2xl); }

.mb-xs { margin-bottom: var(--space-xs); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }
.mb-2xl { margin-bottom: var(--space-2xl); }

.hidden { display: none !important; }
.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;
}
