/* ============================================================
   个人网站 · 全局样式
   结构：设计变量 → 基础重置 → 布局 → 组件 → 页面 → 响应式
   ============================================================ */

/* ---------- 设计变量 ---------- */
:root {
  /* 颜色（浅色主题） */
  --bg: #f7f7f8;
  --bg-elevated: #ffffff;
  --text: #18181b;
  --text-muted: #71717a;
  --border: #e4e4e7;
  --accent: #6366f1;
  --accent-strong: #4f46e5;
  --accent-soft: rgba(99, 102, 241, 0.12);
  --card-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.05);

  /* 排版 */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;

  /* 尺寸 */
  --max-width: 1200px;
  --radius: 12px;
  --radius-sm: 8px;
  --header-height: 64px;
}

/* 深色主题变量 */
[data-theme="dark"] {
  --bg: #0f1115;
  --bg-elevated: #17191f;
  --text: #eceef1;
  --text-muted: #9ca3af;
  --border: #26282f;
  --accent: #818cf8;
  --accent-strong: #6366f1;
  --accent-soft: rgba(129, 140, 248, 0.14);
  --card-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.3);
}

/* ---------- 基础重置 ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  transition: background 0.25s ease, color 0.25s ease;
}

a {
  color: var(--accent);
  text-decoration: none;
}

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

img {
  max-width: 100%;
  display: block;
}

ul {
  list-style: none;
}

/* ---------- 布局 ---------- */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- 顶部导航 ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
}

.brand {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

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

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-links a {
  color: var(--text-muted);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 500;
  transition: color 0.15s ease, background 0.15s ease;
}

.nav-links a:hover {
  color: var(--text);
  background: var(--accent-soft);
}

.nav-links a.active {
  color: var(--accent);
  background: var(--accent-soft);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 主题切换按钮 */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text);
  cursor: pointer;
  font-size: 1.05rem;
  transition: background 0.15s ease, border-color 0.15s ease;
}

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

/* ---------- 页面标题区 ---------- */
.page-head {
  padding: 72px 0 40px;
}

.page-head .kicker {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}

.page-head h1 {
  font-size: clamp(2rem, 5vw, 2.8rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.page-head .lede {
  max-width: 640px;
  margin-top: 16px;
  color: var(--text-muted);
  font-size: 1.1rem;
}

/* ---------- 首页 Hero ---------- */
.hero {
  padding: 96px 0 72px;
}

.hero h1 {
  font-size: clamp(2.4rem, 6vw, 3.6rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.1;
  margin-bottom: 20px;
}

.hero h1 .accent {
  color: var(--accent);
}

.hero .tagline {
  max-width: 600px;
  color: var(--text-muted);
  font-size: 1.2rem;
  margin-bottom: 32px;
}

.hero .cta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-strong);
  color: #fff;
  transform: translateY(-1px);
}

.btn-ghost {
  background: var(--bg-elevated);
  color: var(--text);
  border-color: var(--border);
}

.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--text);
  transform: translateY(-1px);
}

/* ---------- 章节 ---------- */
.section {
  padding: 48px 0;
}

.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 24px;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 24px;
}

.section-head .more {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
}

.section-head .more:hover {
  color: var(--accent);
}

/* ---------- 项目卡片网格 ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.card {
  display: flex;
  flex-direction: column;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--card-shadow);
  border-color: var(--accent);
}

.card-cover {
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, var(--accent-soft), transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-size: 2.2rem;
}

.card-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.card-body h3 {
  font-size: 1.1rem;
  font-weight: 700;
}

.card-body h3 a {
  color: var(--text);
}

.card-body h3 a:hover {
  color: var(--accent);
}

.card-body p {
  color: var(--text-muted);
  font-size: 0.92rem;
  flex: 1;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 3px 10px;
  border-radius: 999px;
}

/* ---------- 文章列表 ---------- */
.article-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.article-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.article-item:hover {
  border-color: var(--accent);
  transform: translateX(3px);
}

.article-item .meta {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.article-item h3 {
  font-size: 1.15rem;
  font-weight: 700;
}

.article-item h3 a {
  color: var(--text);
}

.article-item h3 a:hover {
  color: var(--accent);
}

.article-item p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ---------- 关于页 ---------- */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 40px;
  align-items: start;
}

.about-avatar {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--accent-soft), transparent);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-size: 4rem;
}

.about-info h2 {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.about-info .role {
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 16px;
}

.about-info p {
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* 时间线 */
.timeline {
  margin-top: 40px;
  border-left: 2px solid var(--border);
  padding-left: 24px;
}

.timeline-item {
  position: relative;
  padding-bottom: 32px;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -31px;
  top: 6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--bg);
}

.timeline-item .period {
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 600;
}

.timeline-item h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 4px 0;
}

.timeline-item p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* 技能标签云 */
.skill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.skill-list .tag {
  font-size: 0.85rem;
  padding: 6px 14px;
}

/* ---------- 页脚 ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 40px 0;
  margin-top: 64px;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-inner .copyright {
  color: var(--text-muted);
  font-size: 0.88rem;
}

.social-links {
  display: flex;
  gap: 16px;
}

.social-links a {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
}

.social-links a:hover {
  color: var(--accent);
}

