/* ============================================================
   危文祥的个人网站 — 设计系统
   风格：安静工艺 (Quiet Craft)
   原则：排版承载层级，色彩克制，内容为先
   ============================================================ */

:root {
  /* 色彩 */
  --bg: #faf9f7;            /* 暖白背景 */
  --bg-soft: #f2f0ec;       /* 次级背景 */
  --ink: #201f1c;           /* 主文字（近黑） */
  --ink-soft: #5b5a55;      /* 次级文字 */
  --ink-mute: #9a9892;      /* 弱化文字 */
  --line: #e4e1da;          /* 分隔线 */
  --accent: #b4532a;        /* 强调色（陶土橙） */
  --accent-soft: #e8d5c8;   /* 强调色浅底 */
  --white: #ffffff;

  /* 排版 */
  --font-sans: "PingFang SC", "Microsoft YaHei", "Source Han Sans SC",
               "Noto Sans SC", -apple-system, "Segoe UI", sans-serif;
  --font-serif: "Songti SC", "SimSun", "Source Han Serif SC", Georgia, serif;

  --fs-hero: clamp(2.4rem, 6vw, 4rem);
  --fs-title: clamp(1.6rem, 3.5vw, 2.4rem);
  --fs-section: 1.35rem;
  --fs-body: 1.05rem;
  --fs-small: 0.92rem;

  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2.5rem;
  --space-5: 4rem;
  --space-6: 6rem;

  --radius: 10px;
  --maxw: 1000px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.04);
}

/* ---------- 基础 ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  font-size: var(--fs-body);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

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

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

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

/* ---------- 导航 ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(250, 249, 247, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--ink);
  letter-spacing: 0.02em;
}
.brand:hover { text-decoration: none; }
.brand .dot { color: var(--accent); }

.nav-links {
  display: flex;
  gap: var(--space-3);
  list-style: none;
}

.nav-links a {
  color: var(--ink-soft);
  font-size: var(--fs-small);
  font-weight: 500;
  transition: color .15s;
}
.nav-links a:hover { color: var(--accent); text-decoration: none; }
.nav-links a.active { color: var(--ink); }

/* 移动端菜单开关 */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  width: 40px;
  height: 40px;
  position: relative;
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--ink);
  margin: 5px auto;
  transition: .2s;
}

/* ---------- 首页 Hero ---------- */
.hero {
  padding: var(--space-6) 0 var(--space-5);
}
.hero .eyebrow {
  font-size: var(--fs-small);
  color: var(--ink-mute);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: var(--space-2);
}
.hero h1 {
  font-size: var(--fs-hero);
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: var(--space-3);
}
.hero h1 .accent { color: var(--accent); }
.hero .lead {
  font-size: 1.2rem;
  color: var(--ink-soft);
  max-width: 60ch;
  margin-bottom: var(--space-4);
}
.hero .actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-block;
  padding: 0.7rem 1.6rem;
  border-radius: 999px;
  font-size: var(--fs-small);
  font-weight: 600;
  transition: all .2s;
  cursor: pointer;
}
.btn-primary { background: var(--ink); color: var(--white); }
.btn-primary:hover { background: var(--accent); text-decoration: none; }
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn-ghost:hover { border-color: var(--ink); text-decoration: none; }

/* ---------- 区块 ---------- */
.section { padding: var(--space-5) 0; }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}
.section-head h2 {
  font-size: var(--fs-section);
  font-weight: 700;
}
.section-head .more { font-size: var(--fs-small); color: var(--ink-mute); }

/* ---------- 卡片网格 ---------- */
.grid {
  display: grid;
  gap: var(--space-3);
}
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }

.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--space-3);
  transition: transform .2s, box-shadow .2s;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}
.card .tag {
  font-size: 0.78rem;
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-1);
  display: inline-block;
}
.card h3 { font-size: 1.15rem; margin-bottom: var(--space-1); }
.card h3 a { color: var(--ink); }
.card h3 a:hover { color: var(--accent); }
.card p { color: var(--ink-soft); font-size: var(--fs-small); }
.card .meta {
  margin-top: var(--space-2);
  font-size: 0.85rem;
  color: var(--ink-mute);
}

/* ---------- 工具入口 ---------- */
.tool-card {
  display: flex;
  flex-direction: column;
}
.tool-card .go {
  margin-top: auto;
  padding-top: var(--space-2);
  font-weight: 600;
  font-size: var(--fs-small);
}

/* ---------- 页脚 ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  padding: var(--space-4) 0;
  margin-top: var(--space-5);
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  color: var(--ink-mute);
  font-size: var(--fs-small);
}
.footer-links { display: flex; gap: var(--space-3); }
.footer-links a { color: var(--ink-mute); }
.footer-links a:hover { color: var(--accent); }

/* ---------- 页面头 ---------- */
.page-head { padding: var(--space-5) 0 var(--space-3); }
.page-head h1 { font-size: var(--fs-title); margin-bottom: var(--space-1); }
.page-head .desc { color: var(--ink-soft); max-width: 60ch; }

/* ---------- 关于 ---------- */
.about-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: var(--space-5);
}
.about-grid p { margin-bottom: var(--space-2); color: var(--ink-soft); }
.about-grid strong { color: var(--ink); }
.side-card {
  background: var(--bg-soft);
  border-radius: var(--radius);
  padding: var(--space-3);
  align-self: start;
}
.side-card h3 { font-size: var(--fs-small); margin-bottom: var(--space-2); color: var(--ink-soft); }
.skill-row {
  display: flex;
  justify-content: space-between;
  padding: 0.4rem 0;
  border-bottom: 1px dashed var(--line);
  font-size: var(--fs-small);
}
.skill-row:last-child { border-bottom: none; }
.skill-row .bar { width: 120px; height: 6px; background: var(--line); border-radius: 3px; align-self: center; }
.skill-row .bar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }

/* ---------- 博客文章 ---------- */
.post-list { list-style: none; }
.post-list li {
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--line);
}
.post-list li:first-child { padding-top: 0; }
.post-list .date { font-size: var(--fs-small); color: var(--ink-mute); }
.post-list h3 { font-size: 1.2rem; margin: 0.2rem 0 0.3rem; }
.post-list h3 a { color: var(--ink); }
.post-list h3 a:hover { color: var(--accent); }
.post-list p { color: var(--ink-soft); font-size: var(--fs-small); }

/* 文章正文 */
.article { max-width: 720px; }
.article .article-meta {
  color: var(--ink-mute);
  font-size: var(--fs-small);
  margin-bottom: var(--space-4);
}
.article h2 { font-size: 1.5rem; margin: var(--space-4) 0 var(--space-2); }
.article p { margin-bottom: var(--space-3); color: var(--ink-soft); }
.article ul, .article ol { margin: 0 0 var(--space-3) var(--space-3); color: var(--ink-soft); }
.article blockquote {
  border-left: 3px solid var(--accent);
  padding-left: var(--space-2);
  color: var(--ink-soft);
  font-style: italic;
  margin: var(--space-3) 0;
}
.article code {
  background: var(--bg-soft);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.9em;
}
.article pre {
  background: var(--ink);
  color: var(--bg);
  padding: var(--space-3);
  border-radius: var(--radius);
  overflow-x: auto;
  margin: var(--space-3) 0;
}
.article pre code { background: none; color: inherit; padding: 0; }

/* ---------- 联系方式 ---------- */
.contact-list { list-style: none; }
.contact-list li {
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.contact-list .label { color: var(--ink-soft); }
.contact-list .value { font-weight: 600; }

/* ---------- 响应式 ---------- */
@media (max-width: 768px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .about-grid { grid-template-columns: 1fr; gap: var(--space-4); }

  .nav-toggle { display: block; }
  .nav-links {
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--bg);
    flex-direction: column;
    gap: 0;
    border-bottom: 1px solid var(--line);
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-links a {
    padding: var(--space-2) var(--space-4);
    border-bottom: 1px solid var(--line);
  }
  .hero { padding-top: var(--space-5); }
}

/* 无障碍：尊重减少动效偏好 */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  html { scroll-behavior: auto; }
}