:root {
  --bg: #f7f3ea;
  --bg-elev: #fffdf7;
  --ink: #1c1914;
  --muted: #5c564c;
  --faint: #8a8376;
  --line: #d9d0c0;
  --accent: #8b3a2a;
  --accent-hover: #6e2d21;
  --mark: #f0e2b8;
  --shadow: 0 1px 2px rgba(28, 25, 20, 0.05);
  --radius: 12px;
  --font-sans: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", "Source Han Sans SC", system-ui, sans-serif;
  --font-serif: "Songti SC", "Noto Serif SC", "Source Han Serif SC", "STSong", "SimSun", Georgia, serif;
  --font-mono: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  color-scheme: light;
}

html[data-theme="dark"] {
  --bg: #161410;
  --bg-elev: #1f1b16;
  --ink: #efe8dc;
  --muted: #b4ab9c;
  --faint: #8a8173;
  --line: #3a342c;
  --accent: #e09a7a;
  --accent-hover: #f0b89a;
  --mark: #3a2e18;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) {
    --bg: #161410;
    --bg-elev: #1f1b16;
    --ink: #efe8dc;
    --muted: #b4ab9c;
    --faint: #8a8173;
    --line: #3a342c;
    --accent: #e09a7a;
    --accent-hover: #f0b89a;
    --mark: #3a2e18;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.8;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

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

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

.wrap {
  width: min(740px, calc(100% - 40px));
  margin: 0 auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 28px 0 20px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand:hover { color: inherit; }

.seal {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--accent);
  color: #f7f3ea;
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.brand-name {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.brand-sub {
  color: var(--faint);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
}

.nav {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 0.95rem;
}

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

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

.theme-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--ink);
  width: 36px;
  height: 36px;
  border-radius: 999px;
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: var(--shadow);
}

.theme-btn:hover { border-color: var(--faint); }

.theme-btn svg { width: 18px; height: 18px; }

.icon-sun { display: none; }
html[data-theme="dark"] .icon-moon { display: none; }
html[data-theme="dark"] .icon-sun { display: block; }
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .icon-moon { display: none; }
  html:not([data-theme="light"]) .icon-sun { display: block; }
}

main { padding: 36px 0 64px; }

.hero {
  margin: 8px 0 36px;
}

.hero h1 {
  margin: 0 0 8px;
  font-family: var(--font-serif);
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.3;
}

.hero p {
  margin: 0;
  color: var(--muted);
}

.post-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 14px;
}

.post-card {
  display: block;
  padding: 18px 20px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.post-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  color: inherit;
}

.post-card h2 {
  margin: 0 0 6px;
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  color: var(--faint);
  font-size: 0.88rem;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  display: inline-block;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  text-decoration: none;
  font-size: 0.82rem;
  line-height: 1.7;
}

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

article header {
  margin-bottom: 28px;
}

article h1 {
  margin: 0 0 12px;
  font-family: var(--font-serif);
  font-size: clamp(1.7rem, 3.6vw, 2.2rem);
  line-height: 1.35;
  letter-spacing: 0.03em;
}

.prose p { margin: 0 0 1.15em; }

.prose h2, .prose h3 {
  font-family: var(--font-serif);
  margin: 1.6em 0 0.6em;
  line-height: 1.4;
  letter-spacing: 0.03em;
}

.prose h2 { font-size: 1.35rem; }
.prose h3 { font-size: 1.15rem; }

.prose ul, .prose ol {
  margin: 0 0 1.15em;
  padding-left: 1.4em;
}

.prose li { margin: 0.2em 0; }

.prose blockquote {
  margin: 0 0 1.15em;
  padding: 0.1em 0 0.1em 1em;
  border-left: 3px solid var(--accent);
  color: var(--muted);
}

.prose code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--mark);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

.prose pre {
  overflow-x: auto;
  padding: 14px 16px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 10px;
  margin: 0 0 1.15em;
}

.prose pre code {
  background: none;
  padding: 0;
}

.prose img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}

.prose hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 2em 0;
}

.back {
  display: inline-block;
  margin-bottom: 24px;
  color: var(--muted);
  text-decoration: none;
}

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

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 32px;
}

.site-footer {
  border-top: 1px solid var(--line);
  padding: 22px 0 40px;
  color: var(--faint);
  font-size: 0.88rem;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

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

.not-found {
  text-align: center;
  padding: 48px 0;
}

.not-found h1 {
  font-family: var(--font-serif);
  font-size: 2rem;
  margin: 0 0 12px;
}

@media (max-width: 560px) {
  .wrap { width: calc(100% - 28px); }
  body { font-size: 16px; }
  .site-header { padding-top: 20px; }
  .brand-sub { display: none; }
  .nav { gap: 12px; }
}
