/* 基础层：主题变量、reset、导航栏、页脚 — 全站所有页面共享 */

/* 简约主题：统一小圆角、无渐变、100ms 过渡、flex 布局 */
:root {
  --bg: #f7f8fa;
  --card: #ffffff;
  --text: #24292f;
  --muted: #6a737d;
  --accent: #0969da;
  --accent-soft: #eef4fb;
  --chip: #f0f2f5;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-hover: 0 2px 8px rgba(0, 0, 0, 0.1);
  --radius: 8px;
  --gap: 16px;
  --max-width: 720px;
}

/* 深色模式：仅覆盖颜色变量，结构不变 */
html[data-theme="dark"] {
  --bg: #0d1117;
  --card: #161b22;
  --text: #e6edf3;
  --muted: #8b949e;
  --accent: #58a6ff;
  --accent-soft: #1c2a3a;
  --chip: #21262d;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-hover: 0 2px 8px rgba(0, 0, 0, 0.5);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  /* 补偿 sticky 顶栏高度，锚点跳转不被遮挡 */
  scroll-padding-top: 72px;
}

body {
  margin: 0;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--gap);
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: opacity 100ms ease;
}

a:hover {
  opacity: 0.75;
}

h1,
h2,
h3 {
  margin: 0 0 var(--gap);
  line-height: 1.3;
}

h2 {
  font-size: 1.25rem;
}

.muted {
  color: var(--muted);
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

/* 顶栏 */
.site-header {
  background: var(--card);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

.brand {
  font-weight: 700;
  color: var(--text);
}

.nav {
  display: flex;
  gap: 20px;
}

.nav a {
  color: var(--muted);
  font-size: 0.95rem;
  transition: color 100ms ease;
}

.nav a:hover {
  color: var(--text);
}

.theme-toggle {
  background: var(--chip);
  color: var(--muted);
  border: none;
  border-radius: var(--radius);
  padding: 4px 12px;
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
  transition:
    background 100ms ease,
    color 100ms ease;
}

.theme-toggle:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

main {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 24px 0 48px;
}

/* 页脚 */
.site-footer {
  padding: 24px 0;
  text-align: center;
}

.site-footer p {
  margin: 0;
  font-size: 0.85rem;
}

/* 移动端适配（基础层） */
@media (max-width: 600px) {
  .nav {
    gap: 14px;
  }

  .nav a {
    font-size: 0.9rem;
  }
}
