/* ============================================================
   Adrian Teo · 极简文档风（受 Apple 设计语言启发）
   浅色为主，支持暗色；克制配色、大量留白、精致排版
   ============================================================ */

:root {
  --bg: #ffffff;
  --bg-elev: #fbfbfd;
  --fg: #1d1d1f;
  --fg-soft: #424245;
  --muted: #6e6e73;
  --accent: #0a84ff;
  --accent-soft: rgba(10, 132, 255, 0.10);
  --border: #e8e8ed;
  --code-bg: #f5f5f7;
  --shadow: 0 1px 2px rgba(0,0,0,0.04), 0 8px 24px rgba(0,0,0,0.04);
  --max: 760px;
  --radius: 14px;
}

[data-theme="dark"] {
  --bg: #000000;
  --bg-elev: #0a0a0a;
  --fg: #f5f5f7;
  --fg-soft: #d0d0d2;
  --muted: #98989d;
  --accent: #0a84ff;
  --accent-soft: rgba(10, 132, 255, 0.18);
  --border: #1f1f21;
  --code-bg: #161618;
  --shadow: 0 1px 2px rgba(0,0,0,0.3), 0 8px 30px rgba(0,0,0,0.45);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
  color: var(--fg);
  background: var(--bg);
  line-height: 1.75;
  font-size: 17px;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.4s ease, color 0.4s ease;
}

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

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

/* ---------- 顶部导航 ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  gap: 16px;
}
.brand {
  font-weight: 600;
  font-size: 19px;
  letter-spacing: -0.01em;
  color: var(--fg);
}
.brand:hover { text-decoration: none; }
.nav {
  display: flex;
  align-items: center;
  gap: 4px;
}
.nav a {
  color: var(--muted);
  font-size: 15px;
  padding: 6px 10px;
  border-radius: 8px;
  transition: color 0.2s ease, background-color 0.2s ease;
}
.nav a:hover, .nav a.active {
  color: var(--fg);
  background: var(--accent-soft);
  text-decoration: none;
}
.header-actions { display: flex; align-items: center; gap: 4px; }
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.2s ease, background-color 0.2s ease;
}
.icon-btn:hover { color: var(--fg); background: var(--accent-soft); }
.icon-btn svg { width: 19px; height: 19px; }

main.container { padding-top: 56px; padding-bottom: 72px; min-height: 62vh; }

/* ---------- 首页 Hero ---------- */
.hero {
  padding: 72px 0 56px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 56px;
}
.hero h1 {
  font-size: 52px;
  line-height: 1.08;
  letter-spacing: -0.02em;
  font-weight: 700;
  margin: 0 0 18px;
  background: linear-gradient(120deg, var(--fg), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero .tagline {
  font-size: 21px;
  line-height: 1.5;
  color: var(--fg-soft);
  margin: 0 0 14px;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.hero .lede {
  font-size: 17px;
  color: var(--muted);
  margin: 0;
  max-width: 600px;
}
.hero .hero-links { margin-top: 26px; display: flex; gap: 14px; flex-wrap: wrap; }
.hero .hero-links a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border: 1px solid var(--border);
  border-radius: 980px;
  color: var(--fg);
  font-size: 15px;
  background: var(--bg-elev);
  transition: transform 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}
.hero .hero-links a:hover { text-decoration: none; transform: translateY(-1px); border-color: var(--accent); }
.hero .hero-links svg { width: 17px; height: 17px; }

/* ---------- 区块标题 ---------- */
.section-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 22px;
}

/* ---------- 文章列表 ---------- */
.post-list { list-style: none; padding: 0; margin: 0; }
.post-list li {
  padding: 22px 0;
  border-bottom: 1px solid var(--border);
}
.post-list li:last-child { border-bottom: none; }
.post-title {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--fg);
  display: inline-block;
}
.post-title:hover { color: var(--accent); text-decoration: none; }
.post-meta {
  font-size: 13px;
  color: var(--muted);
  margin-top: 6px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.post-meta a { color: var(--muted); }
.post-meta a:hover { color: var(--accent); }
.post-summary { color: var(--muted); font-size: 15px; margin: 8px 0 0; line-height: 1.65; }
.more { margin-top: 28px; font-size: 15px; }

/* ---------- 文章详情 ---------- */
.post { animation: fade-up 0.5s ease both; }
.post-header { margin-bottom: 14px; }
.post h1 {
  font-size: 38px;
  line-height: 1.18;
  letter-spacing: -0.02em;
  font-weight: 700;
  margin: 0 0 14px;
}
.post-meta-top {
  font-size: 14px;
  color: var(--muted);
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}
.post-content { margin-top: 30px; }
.post-content h2 {
  font-size: 25px;
  letter-spacing: -0.01em;
  margin: 44px 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.post-content h3 { font-size: 20px; margin: 32px 0 10px; letter-spacing: -0.01em; }
.post-content h4, .post-content h5, .post-content h6 {
  font-size: 17px;
  margin: 26px 0 8px;
  color: var(--fg-soft);
}
.post-content img {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin: 18px 0;
  box-shadow: var(--shadow);
}
.post-content p { margin: 16px 0; }
.post-content ul, .post-content ol { padding-left: 26px; }
.post-content li { margin: 8px 0; }

.post-content pre {
  background: var(--code-bg);
  padding: 18px 20px;
  border-radius: 12px;
  overflow: auto;
  border: 1px solid var(--border);
  font-size: 14px;
  line-height: 1.65;
  margin: 18px 0;
}
.post-content code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.9em;
}
.post-content p code, .post-content li code {
  background: var(--code-bg);
  padding: 2px 7px;
  border-radius: 6px;
  border: 1px solid var(--border);
}
.post-content blockquote {
  margin: 20px 0;
  padding: 12px 20px;
  border-left: 3px solid var(--accent);
  color: var(--fg-soft);
  background: var(--bg-elev);
  border-radius: 0 12px 12px 0;
}
.post-content table {
  border-collapse: collapse;
  width: 100%;
  margin: 20px 0;
  font-size: 15px;
}
.post-content th, .post-content td {
  border: 1px solid var(--border);
  padding: 9px 14px;
  text-align: left;
}
.post-content th { background: var(--bg-elev); font-weight: 600; }

.toc {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 18px;
  margin: 24px 0;
  font-size: 14px;
}
.toc summary { cursor: pointer; font-weight: 600; color: var(--fg); }
.toc ul { margin: 10px 0 0; padding-left: 20px; }
.toc a { color: var(--muted); }

.post-tags {
  margin-top: 48px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 14px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.post-tags a {
  display: inline-block;
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 980px;
  color: var(--fg-soft);
  transition: border-color 0.2s ease, color 0.2s ease;
}
.post-tags a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

.post-foot {
  margin-top: 28px;
  font-size: 13px;
  color: var(--muted);
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

/* ---------- 分类 / 标签总览 ---------- */
.term-list { list-style: none; padding: 0; margin: 0; }
.term-list li {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.term-list a { font-size: 18px; font-weight: 500; color: var(--fg); }
.term-list a:hover { color: var(--accent); text-decoration: none; }
.count { color: var(--muted); font-size: 13px; }

.page-head { margin-bottom: 36px; }
.page-head h1 { font-size: 34px; letter-spacing: -0.02em; margin: 0; }

/* ---------- 关于页 ---------- */
.prose p { margin: 16px 0; }
.prose h2 { font-size: 23px; margin: 36px 0 12px; }
.prose ul { padding-left: 26px; }
.prose li { margin: 8px 0; }

/* ---------- 页脚 ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 28px 0;
  color: var(--muted);
  font-size: 13px;
  margin-top: 56px;
  background: var(--bg-elev);
}
.site-footer .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--accent); }
.site-footer .foot-links { display: flex; gap: 16px; align-items: center; }

/* ---------- 搜索覆盖层（Apple 风）---------- */
.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: none;
  padding: 0 22px;
  overflow-y: auto;
}
.search-overlay.open { display: block; animation: fade-in 0.2s ease both; }
.search-box {
  max-width: 680px;
  margin: 12vh auto 40px;
}
.search-input-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px 20px;
  box-shadow: var(--shadow);
}
.search-input-wrap svg { width: 20px; height: 20px; color: var(--muted); flex: none; }
.search-input-wrap input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  color: var(--fg);
  font-size: 19px;
  font-family: inherit;
}
.search-input-wrap input::placeholder { color: var(--muted); }
.search-hint { color: var(--muted); font-size: 13px; margin: 14px 4px 0; text-align: right; }
.search-results { list-style: none; padding: 0; margin: 8px 0 0; }
.search-results li {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 20px;
  margin-bottom: 10px;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.search-results li:hover { transform: translateY(-1px); border-color: var(--accent); }
.search-results a { color: var(--fg); font-size: 18px; font-weight: 600; }
.search-results a:hover { text-decoration: none; color: var(--accent); }
.search-results .s-meta { font-size: 13px; color: var(--muted); margin-top: 4px; }
.search-results .s-sum { font-size: 14px; color: var(--muted); margin-top: 6px; line-height: 1.6; }
.search-empty { color: var(--muted); text-align: center; padding: 30px 0; }

/* ---------- 动画 ---------- */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ---------- 响应式 ---------- */
@media (max-width: 640px) {
  body { font-size: 16px; }
  .hero { padding: 48px 0 40px; }
  .hero h1 { font-size: 38px; }
  .hero .tagline { font-size: 18px; }
  .post h1 { font-size: 30px; }
  .nav a { padding: 6px 7px; font-size: 14px; }
  .brand { font-size: 17px; }
}

::selection { background: var(--accent-soft); }
