:root {
  --bg: #fbfaf7;
  --fg: #22201d;
  --muted: #6b6660;
  --line: #e6e1d8;
  --accent: #2f5d50;
  --accent-soft: #eef4f1;
  --code-bg: #f3f1ec;
  --max: 46rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171614;
    --fg: #e8e4dc;
    --muted: #a39d93;
    --line: #2e2b26;
    --accent: #7fb8a4;
    --accent-soft: #1e2a26;
    --code-bg: #1f1d19;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  padding: 0 1.25rem;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  font-size: 17px;
  line-height: 1.78;
  text-rendering: optimizeLegibility;
}

.wrap {
  max-width: var(--max);
  margin: 0 auto;
}

header.site {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 2.25rem 0 1.5rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 2.5rem;
}

header.site .brand {
  font-size: 1.15rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  color: var(--fg);
  text-decoration: none;
}

header.site .brand span {
  color: var(--accent);
}

nav.site a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.92rem;
  margin-left: 1.15rem;
}

nav.site a:hover,
nav.site a[aria-current="page"] {
  color: var(--accent);
}

h1 {
  font-size: 1.65rem;
  line-height: 1.35;
  letter-spacing: -0.01em;
  margin: 0 0 0.6rem;
  font-weight: 680;
}

h2 {
  font-size: 1.22rem;
  margin: 2.4rem 0 0.8rem;
  font-weight: 650;
  letter-spacing: -0.005em;
}

h3 {
  font-size: 1.03rem;
  margin: 1.8rem 0 0.5rem;
  font-weight: 650;
}

p { margin: 0 0 1.1rem; }

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

.intro {
  color: var(--muted);
  font-size: 1.02rem;
  margin-bottom: 2rem;
}

ul.posts {
  list-style: none;
  margin: 0;
  padding: 0;
}

ul.posts li {
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--line);
}

ul.posts li:last-child { border-bottom: 0; }

ul.posts .date {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.03em;
  margin-bottom: 0.15rem;
}

ul.posts .title {
  font-size: 1.06rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--fg);
}

ul.posts .title:hover { color: var(--accent); }

ul.posts .desc {
  display: block;
  color: var(--muted);
  font-size: 0.92rem;
  margin-top: 0.2rem;
}

article.post header {
  padding-bottom: 1.2rem;
  margin-bottom: 1.6rem;
  border-bottom: 1px solid var(--line);
}

article.post header .meta {
  color: var(--muted);
  font-size: 0.87rem;
}

article.post header h1 { margin-bottom: 0.35rem; }

code {
  font-family: "SFMono-Regular", "JetBrains Mono", Menlo, Consolas,
    "Liberation Mono", monospace;
  font-size: 0.87em;
  background: var(--code-bg);
  padding: 0.12em 0.38em;
  border-radius: 4px;
}

pre {
  background: var(--code-bg);
  padding: 1rem 1.15rem;
  border-radius: 8px;
  overflow-x: auto;
  line-height: 1.6;
  font-size: 0.87rem;
  border: 1px solid var(--line);
}

pre code {
  background: none;
  padding: 0;
  font-size: inherit;
}

blockquote {
  margin: 1.4rem 0;
  padding: 0.1rem 1.1rem;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  color: var(--fg);
}

blockquote p:last-child { margin-bottom: 0; }

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

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.93rem;
  margin: 1.2rem 0;
}

th, td {
  text-align: left;
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid var(--line);
}

th { font-weight: 650; }

footer.site {
  margin-top: 4rem;
  padding: 1.75rem 0 2.5rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.9;
}

footer.site a {
  color: var(--muted);
  text-decoration: none;
}

footer.site a:hover { color: var(--accent); }

footer.site .record {
  margin-top: 0.45rem;
}

.back {
  display: inline-block;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
  color: var(--muted);
  text-decoration: none;
}

.back:hover { color: var(--accent); }

.note-src {
  margin-top: 2.8rem;
  padding-top: 1.2rem;
  border-top: 1px dashed var(--line);
  color: var(--muted);
  font-size: 0.83rem;
}

@media (max-width: 560px) {
  body { font-size: 16px; }
  header.site { flex-direction: column; gap: 0.5rem; }
  nav.site a:first-child { margin-left: 0; }
  h1 { font-size: 1.4rem; }
}
