/* ========================================
   基础排版 · Base Typography v2.0
   暗色血金主题
   ======================================== */

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

html {
  font-size: var(--fs-body);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  color: var(--c-text);
  background: var(--c-bg);
  line-height: var(--lh-body);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* --- 纹理叠层：径向渐变 + 噪点 --- */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(ellipse at 20% 0%, rgba(179, 58, 46, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(200, 139, 44, 0.05) 0%, transparent 50%);
  pointer-events: none;
  z-index: 1;
}
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='0.9' /%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 2;
  mix-blend-mode: overlay;
}

/* 确保主内容在纹理之上 */
.nav-primary, .main-content, .site-footer {
  position: relative;
  z-index: 3;
}

/* --- 自定义滚动条 --- */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--c-bg-deep); }
::-webkit-scrollbar-thumb { background: var(--c-border-accent); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--c-blood-dim); }

/* --- 文本选中 --- */
::selection { background: var(--c-blood); color: var(--c-text); }

/* --- 标题 --- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif);
  line-height: var(--lh-heading);
  font-weight: 700;
  color: var(--c-text);
}
h1 { font-size: var(--fs-h1); margin-bottom: var(--sp-md); }
h2 { font-size: var(--fs-h2); margin-top: var(--sp-xl); margin-bottom: var(--sp-md); }
h3 { font-size: var(--fs-h3); margin-top: var(--sp-lg); margin-bottom: var(--sp-sm); }

/* --- 正文 --- */
p { margin-bottom: var(--sp-md); }

/* --- 链接 --- */
a {
  color: var(--c-link);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover { color: var(--c-link-hover); text-decoration: underline; }

/* --- 列表 --- */
ul, ol { padding-left: var(--sp-lg); margin-bottom: var(--sp-md); }
li { margin-bottom: var(--sp-xs); }

/* --- 引用 --- */
blockquote {
  border-left: 3px solid var(--c-blood);
  padding: var(--sp-sm) var(--sp-md);
  margin: var(--sp-lg) 0;
  color: var(--c-text-sec);
  background: var(--c-surface);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* --- 表格 --- */
table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--sp-lg) 0;
  font-size: var(--fs-small);
  line-height: 1.6;
}
thead th {
  background: var(--c-surface-alt);
  font-weight: 600;
  text-align: left;
  padding: var(--sp-sm) var(--sp-md);
  border-bottom: 2px solid var(--c-border-accent);
  white-space: nowrap;
}
tbody td {
  padding: var(--sp-sm) var(--sp-md);
  border-bottom: 1px solid var(--c-border);
  vertical-align: top;
}
tbody tr:hover {
  background: var(--c-surface);
}

/* --- 代码 --- */
code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--c-surface-alt);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  color: var(--c-gold);
}

/* --- 分隔线 --- */
hr {
  border: none;
  border-top: 1px solid var(--c-border);
  margin: var(--sp-xl) 0;
}

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

/* --- 工具类 --- */
.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); border: 0;
}
