/* ===== Reset & Base ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #fafaf8;
  --bg-card: #ffffff;
  --text: #1a1a1a;
  --text-secondary: #6b6b6b;
  --text-tertiary: #9b9b9b;
  --border: #e8e8e4;
  --accent: #2c7a4e;
  --accent-hover: #1e5e3a;
  --header-bg: rgba(250, 250, 248, 0.85);
  --radius: 8px;
  --max-width: 720px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-serif: "Noto Serif SC", "Source Han Serif SC", "STSong", "SimSun", Georgia, serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1a1a;
    --bg-card: #242424;
    --text: #e6e6e6;
    --text-secondary: #a0a0a0;
    --text-tertiary: #6b6b6b;
    --border: #333333;
    --accent: #4ecc7a;
    --accent-hover: #3ba362;
    --header-bg: rgba(26, 26, 26, 0.85);
  }
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

/* ===== Header ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.site-header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 56px;
}

.site-logo {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.5px;
}

.site-nav {
  display: flex;
  gap: 24px;
}

.site-nav a {
  font-size: 14px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s;
}

.site-nav a:hover,
.site-nav a.active {
  color: var(--accent);
}

/* ===== Hero ===== */
.hero {
  padding: 64px 0 32px;
}

.hero h1 {
  font-family: var(--font-serif);
  font-size: 32px;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 12px;
}

.hero-sub {
  font-size: 16px;
  color: var(--text-secondary);
}

/* ===== Post List ===== */
.post-list {
  padding: 0 0 48px;
}

.loading {
  color: var(--text-tertiary);
  font-size: 14px;
  text-align: center;
  padding: 40px 0;
}

.post-item {
  display: block;
  text-decoration: none;
  color: inherit;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
  transition: opacity 0.2s;
}

.post-item:hover {
  opacity: 0.7;
}

.post-item:first-of-type {
  border-top: 1px solid var(--border);
}

.post-date {
  font-size: 13px;
  color: var(--text-tertiary);
  margin-bottom: 4px;
}

.post-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}

.post-excerpt {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-tags {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.post-tag {
  font-size: 12px;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  padding: 2px 8px;
  border-radius: 4px;
}

/* ===== About ===== */
.about-section {
  padding: 48px 0 64px;
  border-top: 1px solid var(--border);
}

.about-section h2 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 16px;
}

.about-section p {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 12px;
  max-width: 560px;
}

/* ===== Article Page ===== */
.article-header {
  padding: 48px 0 16px;
}

.article-header .post-date {
  font-size: 14px;
}

.article-header h1 {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 700;
  line-height: 1.45;
  margin: 8px 0 16px;
}

.article-header .post-tags {
  margin-top: 0;
}

.article-body {
  padding: 16px 0 64px;
  font-family: var(--font-serif);
  font-size: 16px;
  line-height: 1.85;
  color: var(--text);
}

.article-body h1 { font-size: 24px; margin: 32px 0 12px; font-family: var(--font-sans); }
.article-body h2 { font-size: 20px; margin: 28px 0 10px; font-family: var(--font-sans); }
.article-body h3 { font-size: 17px; margin: 24px 0 8px; font-family: var(--font-sans); }
.article-body p { margin-bottom: 16px; }
.article-body a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.article-body a:hover { color: var(--accent-hover); }
.article-body ul, .article-body ol { margin-bottom: 16px; padding-left: 24px; }
.article-body li { margin-bottom: 6px; }
.article-body blockquote {
  border-left: 3px solid var(--accent);
  padding: 4px 0 4px 16px;
  margin: 20px 0;
  color: var(--text-secondary);
  font-style: italic;
}
.article-body code {
  font-family: "Fira Code", "Cascadia Code", "Consolas", monospace;
  font-size: 14px;
  background: var(--bg-card);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
}
.article-body pre {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  overflow-x: auto;
  margin: 20px 0;
  font-size: 14px;
  line-height: 1.6;
}
.article-body pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
}
.article-body img {
  max-width: 100%;
  border-radius: var(--radius);
  margin: 20px 0;
}
.article-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 32px 0;
}
.article-body strong { font-weight: 600; }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 24px 0 0;
  transition: color 0.2s;
}

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

/* ===== Footer ===== */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 24px 0;
}

.site-footer p {
  font-size: 13px;
  color: var(--text-tertiary);
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
  .hero { padding: 40px 0 24px; }
  .hero h1 { font-size: 26px; }
  .article-header h1 { font-size: 24px; }
  .article-body { font-size: 15px; }
}
