/* ---------- 主题变量 ---------- */
:root {
  --bg: #fcfbf8;
  --fg: #1b1a18;
  --muted: #6d6862;
  --line: #e6e1d8;
  --accent: #a8622a;
  --code-bg: #f2eee6;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04);
}

html[data-theme="dark"] {
  --bg: #121110;
  --fg: #e9e5de;
  --muted: #918b83;
  --line: #2a2826;
  --accent: #e0995a;
  --code-bg: #1c1a18;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.78 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background .2s ease, color .2s ease;
}

.wrap { max-width: 720px; margin: 0 auto; padding: 0 24px; }

/* ---------- 顶部 ---------- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 34px 0 0;
}

.brand {
  font-family: "Songti SC", "Noto Serif SC", Georgia, serif;
  font-size: 1.06rem;
  letter-spacing: .14em;
  color: var(--fg);
  text-decoration: none;
}
.brand:hover { color: var(--accent); }

.site-nav { display: flex; align-items: center; gap: 20px; }

.site-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: .9rem;
  letter-spacing: .04em;
  transition: color .15s ease;
}
.site-nav a:hover { color: var(--fg); }

.theme-btn {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  transition: border-color .15s ease, color .15s ease;
}
.theme-btn:hover { border-color: var(--muted); color: var(--fg); }

/* ---------- 首页引子 ---------- */
.hero {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 64px 0 44px;
}

.avatar {
  width: 96px;
  height: 96px;
  flex: none;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--line);
  box-shadow: 0 10px 26px -14px rgba(0, 0, 0, .45);
}

.hero-body { min-width: 0; }

.hero h1 {
  margin: 0 0 10px;
  font-size: 1.95rem;
  font-weight: 600;
  letter-spacing: .02em;
}
.hero p { margin: 0; color: var(--muted); max-width: 40em; font-size: .95rem; }

/* ---------- 应用入口 ---------- */
.entries { margin: 0 0 48px; display: flex; flex-direction: column; gap: 12px; }

.entry-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--code-bg);
  color: inherit;
  text-decoration: none;
  transition: border-color .16s ease, transform .16s ease, box-shadow .16s ease;
}
.entry-card:hover {
  border-color: var(--muted);
  transform: translateY(-2px);
  box-shadow: 0 12px 26px -18px rgba(0, 0, 0, .5);
}

.entry-icon {
  font-size: 24px;
  line-height: 1;
  flex: none;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--line);
}

.entry-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.entry-body strong { font-weight: 600; font-size: 1rem; letter-spacing: .01em; }
.entry-body em {
  font-style: normal;
  color: var(--muted);
  font-size: .84rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entry-arrow { margin-left: auto; color: var(--muted); font-size: 1.05rem; flex: none; }
.entry-card:hover .entry-arrow { color: var(--accent); }

/* ---------- 分区标题 ---------- */
.section-title {
  margin: 0 0 2px;
  font-size: .74rem;
  font-weight: 500;
  letter-spacing: .16em;
  color: var(--muted);
  text-transform: uppercase;
}

/* ---------- 文章列表 ---------- */
.post-list { list-style: none; margin: 0; padding: 0; }

.post-list li { border-top: 1px solid var(--line); }
.post-list li:last-child { border-bottom: 1px solid var(--line); }

.post-list a {
  display: block;
  padding: 24px 4px;
  text-decoration: none;
  color: inherit;
  transition: background .15s ease;
}
.post-list a:hover { background: linear-gradient(90deg, transparent, var(--code-bg), transparent); }
.post-list a:hover h2 { color: var(--accent); }

.post-list h2 {
  margin: 0 0 6px;
  font-size: 1.12rem;
  font-weight: 600;
  letter-spacing: .01em;
  transition: color .15s ease;
}

.post-list time {
  display: block;
  font-size: .78rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  letter-spacing: .06em;
}

.post-list p {
  margin: 10px 0 0;
  font-size: .92rem;
  color: var(--muted);
  line-height: 1.7;
}

/* ---------- 文章页 ---------- */
article { padding: 52px 0 90px; }

article h1 {
  margin: 0 0 12px;
  font-size: 1.85rem;
  line-height: 1.35;
  font-weight: 600;
  letter-spacing: .01em;
}

article .meta {
  margin: 0 0 44px;
  font-size: .82rem;
  color: var(--muted);
  letter-spacing: .05em;
}

article h2 {
  margin: 2.3em 0 .65em;
  font-size: 1.22rem;
  font-weight: 600;
}

article p { margin: 0 0 1.25em; }

article a { color: var(--accent); text-underline-offset: 3px; }

article blockquote {
  margin: 1.7em 0;
  padding: 2px 0 2px 18px;
  border-left: 2px solid var(--accent);
  color: var(--muted);
}

article ul, article ol { margin: 0 0 1.25em; padding-left: 1.4em; }
article li { margin: .35em 0; }

article code {
  background: var(--code-bg);
  padding: .15em .42em;
  border-radius: 4px;
  font-size: .88em;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

article pre {
  background: var(--code-bg);
  padding: 16px 18px;
  border-radius: 8px;
  overflow-x: auto;
  line-height: 1.6;
  font-size: .86rem;
}
article pre code { background: none; padding: 0; }

.back {
  display: inline-block;
  margin-bottom: 32px;
  font-size: .86rem;
  color: var(--muted);
  text-decoration: none;
}
.back:hover { color: var(--accent); }

/* ---------- 页脚 ---------- */
footer {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding: 26px 0 64px;
  color: var(--muted);
  font-size: .8rem;
  letter-spacing: .04em;
}
footer a { color: var(--muted); text-decoration: none; }
footer a:hover { color: var(--accent); }

/* ---------- 表格与图片 ---------- */
article table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.7em 0;
  font-size: .9rem;
}
article thead th {
  text-align: left;
  font-weight: 600;
  font-size: .76rem;
  letter-spacing: .09em;
  color: var(--muted);
  padding: 8px 12px;
  border-bottom: 1px solid var(--muted);
}
article tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
article tbody tr:last-child td { border-bottom: none; }

article img { max-width: 100%; height: auto; border-radius: 6px; }

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

/* ---------- 响应式 ---------- */
@media (max-width: 560px) {
  .wrap { padding: 0 20px; }
  .site-header { padding-top: 26px; }
  .hero {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    padding: 42px 0 32px;
  }
  .avatar { width: 78px; height: 78px; }
  .hero h1 { font-size: 1.6rem; }
  .entry-card { padding: 15px 16px; gap: 13px; }
  .entry-body em { white-space: normal; }
  article { padding: 38px 0 70px; }
  article h1 { font-size: 1.45rem; }
  .site-nav { gap: 14px; }
}
