:root {
  --bg: #fbfaf7;
  --fg: #1c1c1a;
  --muted: #6f6f6b;
  --line: #e6e4df;
  --accent: #2f6f4f;
  --code-bg: #f4f2ed;
  --card-bg: #ffffff;
  --shadow: 0 1px 2px rgba(28, 28, 26, .05);
  --shadow-hover: 0 14px 34px rgba(28, 28, 26, .10);
  --max: 56rem;
  --read: 44rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14140f;
    --fg: #e9e7e1;
    --muted: #9b998f;
    --line: #2c2b25;
    --accent: #7fbf9b;
    --code-bg: #1e1d18;
    --card-bg: #1b1a15;
    --shadow: 0 1px 2px rgba(0, 0, 0, .35);
    --shadow-hover: 0 14px 34px rgba(0, 0, 0, .5);
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.75 "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  letter-spacing: .01em;
}

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

main, .site-header, .site-footer {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* 顶栏 */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 2rem;
  padding-bottom: 2rem;
}

.brand {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-weight: 600;
  letter-spacing: .06em;
}

.site-header nav a {
  margin-left: 1.5rem;
  color: var(--muted);
  font-size: .9rem;
}

.site-header nav a:hover { color: var(--fg); }

/* 首屏 */
.hero {
  padding: 2.5rem 0 3rem;
}

.hero h1 {
  margin: 0 0 1rem;
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  font-weight: 600;
  letter-spacing: -.015em;
  line-height: 1.25;
}

.hero p {
  margin: 0;
  max-width: 36rem;
  color: var(--muted);
}

/* 区块 */
section + section { margin-top: 3.5rem; }

.section-title {
  margin: 0 0 1.5rem;
  font-size: .75rem;
  font-weight: 500;
  letter-spacing: .2em;
  color: var(--muted);
  text-transform: uppercase;
}

/* 文章卡片网格 */
.post-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
  gap: 1.25rem;
}

.post-list li { min-width: 0; }

.post-list a {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 1.4rem 1.5rem 1.5rem;
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.post-list a:hover {
  color: inherit;
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: var(--shadow-hover);
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.post-list time {
  color: var(--muted);
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: .75rem;
  letter-spacing: .02em;
}

.post-list h3 {
  margin: 0 0 .55rem;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.55;
  transition: color .18s ease;
}

.post-list a:hover h3 { color: var(--accent); }

.post-list p {
  margin: 0;
  font-size: .875rem;
  line-height: 1.7;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tag {
  font-size: .72rem;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .1rem .65rem;
  white-space: nowrap;
}

/* 关于 */
#about p {
  margin: 0 0 1rem;
  color: var(--muted);
}

/* 文章页 */
.article-header,
.article {
  max-width: var(--read);
  margin-left: auto;
  margin-right: auto;
}

.article-header { padding: 1rem 0 2.5rem; border-bottom: 1px solid var(--line); }
.article-header h1 {
  margin: 0 0 1rem;
  font-size: clamp(1.5rem, 3.5vw, 2rem);
  line-height: 1.4;
  font-weight: 600;
}
.article-meta {
  display: flex;
  gap: 1rem;
  align-items: center;
  color: var(--muted);
  font-size: .85rem;
}
.article-meta time {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

.article {
  padding: 2.5rem 0 1rem;
  font-size: 1rem;
}
.article h2 {
  margin: 2.5rem 0 .75rem;
  font-size: 1.15rem;
  font-weight: 600;
}
.article p { margin: 0 0 1.25rem; }
.article ul, .article ol { margin: 0 0 1.25rem; padding-left: 1.4rem; }
.article li { margin-bottom: .4rem; }
.article code {
  background: var(--code-bg);
  padding: .1em .35em;
  border-radius: 4px;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: .88em;
}
.article pre {
  background: var(--code-bg);
  padding: 1rem 1.1rem;
  border-radius: 8px;
  overflow-x: auto;
  line-height: 1.6;
}
.article pre code { background: none; padding: 0; }
.article blockquote {
  margin: 0 0 1.25rem;
  padding-left: 1rem;
  border-left: 2px solid var(--line);
  color: var(--muted);
}

.back {
  display: inline-block;
  margin-top: 2.5rem;
  font-size: .9rem;
  color: var(--muted);
}
.back:hover { color: var(--fg); }

/* 页脚 */
.site-footer {
  padding-top: 1.5rem;
  padding-bottom: 3rem;
  border-top: 1px solid var(--line);
  margin-top: 5rem;
  color: var(--muted);
  font-size: .8rem;
}
.site-footer p { margin: 0; }
.site-footer p + p { margin-top: .35rem; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--fg); }

/* 小屏 */
@media (max-width: 34rem) {
  .post-list { grid-template-columns: 1fr; }
  .post-list a { padding: 1.25rem 1.25rem 1.35rem; }
  .site-header { padding-top: 1.5rem; padding-bottom: 1rem; }
  .hero { padding-top: 1.5rem; padding-bottom: 3rem; }
}
