/* ===== 主题变量 ===== */
:root {
  --bg: #f7f6f2;
  --card: #ffffff;
  --text: #26292e;
  --muted: #7a828c;
  --border: #e7e4dc;
  --accent: #0f766e;
  --accent-ink: #ffffff;
  --accent-soft: #e3f0ee;
  --code-bg: #f2f0ea;
  --shadow: 0 2px 12px rgba(30, 30, 20, .05);
  --shadow-hover: 0 6px 18px rgba(30, 30, 20, .09);
}

:root[data-theme="dark"] {
  --bg: #0f1317;
  --card: #151b21;
  --text: #dfe3e8;
  --muted: #8b949e;
  --border: #242b33;
  --accent: #2fd0bd;
  --accent-ink: #06231f;
  --accent-soft: #123a36;
  --code-bg: #1a2129;
  --shadow: 0 2px 12px rgba(0, 0, 0, .35);
  --shadow-hover: 0 6px 18px rgba(0, 0, 0, .45);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1317;
    --card: #151b21;
    --text: #dfe3e8;
    --muted: #8b949e;
    --border: #242b33;
    --accent: #2fd0bd;
    --accent-ink: #06231f;
    --accent-soft: #123a36;
    --code-bg: #1a2129;
    --shadow: 0 2px 12px rgba(0, 0, 0, .35);
    --shadow-hover: 0 6px 18px rgba(0, 0, 0, .45);
  }
}

/* ===== 基础 ===== */
* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  font-size: 16px;
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
}

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

.wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 20px;
}

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

code {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: .1em .4em;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: .88em;
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.2em 0;
}

/* ===== 头部 ===== */
.site-header {
  padding: 52px 0 28px;
  position: relative;
}

.site-title {
  display: inline-block;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--text);
}
.site-title:hover { text-decoration: none; color: var(--accent); }

.site-subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
  letter-spacing: .06em;
}

.theme-toggle {
  position: absolute;
  right: 20px;
  top: 56px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--card);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  transition: transform .15s ease;
}
.theme-toggle:hover { transform: rotate(15deg) scale(1.06); }

/* ===== 首页 ===== */
.hero {
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  padding: 16px 20px;
  margin: 8px 0 26px;
  color: var(--muted);
  font-size: 15px;
  box-shadow: var(--shadow);
}
.hero p { margin: 0; }

.tagbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 22px;
}

.tag {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted);
  border-radius: 999px;
  padding: 3px 13px;
  font-size: 13px;
  cursor: pointer;
  transition: all .15s ease;
}
.tag:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }
.tag.active {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

.post-list { display: grid; gap: 16px; padding-bottom: 48px; }

.post-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 24px;
  box-shadow: var(--shadow);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.post-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
  border-color: var(--accent);
}

.post-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}
.post-meta .dot { opacity: .6; }
.post-meta .tag { padding: 1px 10px; font-size: 12px; cursor: pointer; }

.post-title {
  margin: 8px 0 6px;
  font-size: 20px;
  line-height: 1.4;
}
.post-title a { color: var(--text); }
.post-title a:hover { color: var(--accent); text-decoration: none; }

.post-summary {
  margin: 0;
  color: var(--muted);
  font-size: 14.5px;
}

.notice {
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: 10px;
  padding: 14px 18px;
  font-size: 14px;
  margin-bottom: 20px;
}

.empty-tip { color: var(--muted); text-align: center; padding: 40px 0; }

/* ===== 文章页 ===== */
.back-link {
  display: inline-block;
  margin: 6px 0 18px;
  color: var(--muted);
  font-size: 14px;
}
.back-link:hover { color: var(--accent); }

.post-body {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 36px 40px 44px;
  box-shadow: var(--shadow);
  margin-bottom: 56px;
}

.post-header { margin-bottom: 8px; }
.post-header h1 {
  margin: 0 0 10px;
  font-size: 26px;
  line-height: 1.4;
}

/* 正文排版 */
.post-body h2 {
  margin: 2em 0 .8em;
  padding-left: .55em;
  border-left: 4px solid var(--accent);
  font-size: 20px;
  line-height: 1.5;
}
.post-body h3 { margin: 1.6em 0 .6em; font-size: 17.5px; }
.post-body h4 { margin: 1.4em 0 .5em; font-size: 16px; color: var(--muted); }

.post-body p { margin: .9em 0; }

.post-body img {
  max-width: 100%;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.post-body blockquote {
  margin: 1.2em 0;
  padding: 10px 18px;
  border-left: 4px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 8px 8px 0;
  color: var(--muted);
}
.post-body blockquote p { margin: .3em 0; }

.post-body ul, .post-body ol { padding-left: 1.6em; margin: .8em 0; }
.post-body li { margin: .3em 0; }
.post-body li input[type="checkbox"] { margin-right: .5em; accent-color: var(--accent); }

.table-wrap {
  overflow-x: auto;
  margin: 1.2em 0;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.post-body table {
  border-collapse: collapse;
  width: 100%;
  font-size: 14.5px;
}
.post-body th, .post-body td {
  border-bottom: 1px solid var(--border);
  padding: 8px 14px;
  text-align: left;
  white-space: nowrap;
}
.post-body th { background: var(--code-bg); font-weight: 600; }
.post-body tr:last-child td { border-bottom: none; }

/* 代码块 */
.codeblock {
  margin: 1.2em 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--code-bg);
}
.code-lang {
  font-size: 12px;
  color: var(--muted);
  padding: 5px 14px;
  border-bottom: 1px solid var(--border);
  font-family: ui-monospace, Consolas, monospace;
  letter-spacing: .05em;
}
.codeblock pre {
  margin: 0;
  padding: 14px 16px;
  overflow-x: auto;
}
.codeblock code {
  background: none;
  border: none;
  padding: 0;
  font-size: 13.5px;
  line-height: 1.7;
}

/* ===== 页脚 ===== */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 26px 0 40px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

/* ===== 移动端 ===== */
@media (max-width: 640px) {
  .site-header { padding: 36px 0 20px; }
  .site-title { font-size: 25px; }
  .theme-toggle { top: 40px; right: 16px; }
  .post-body { padding: 24px 20px 30px; }
}
