:root {
  --bg: #faf9f6;
  --surface: #ffffff;
  --surface-subtle: #f3f1ec;
  --text: #1f2328;
  --text-muted: #5c646d;
  --border: #e6e3db;
  --accent: #275d8c;
  --accent-soft: #eaf2f8;
  --code-bg: #f4f2ed;
  --shadow: 0 1px 2px rgba(24, 24, 27, 0.04);
  --radius: 10px;
  --max-w: 760px;
}

[data-theme="dark"] {
  --bg: #141619;
  --surface: #1b1e23;
  --surface-subtle: #23272e;
  --text: #e6e8eb;
  --text-muted: #9aa3ad;
  --border: #2b3038;
  --accent: #6aa9df;
  --accent-soft: rgba(106, 169, 223, 0.12);
  --code-bg: #22262c;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg);
  color: var(--text);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    "Noto Sans CJK SC", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.75;
  transition: background-color 0.2s ease, color 0.2s ease;
}

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

a:hover {
  text-decoration: underline;
}

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

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  font-size: 1.08rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.02em;
}

.brand:hover {
  text-decoration: none;
  color: var(--accent);
}

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

.nav-link {
  color: var(--text-muted);
  font-size: 0.94rem;
  transition: color 0.15s ease;
}

.nav-link:hover,
.nav-link.active {
  color: var(--text);
  font-weight: 500;
  text-decoration: none;
}

.theme-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  transition: border-color 0.15s ease, color 0.15s ease;
}

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

/* Main */
.main-content {
  flex: 1;
  padding-top: 36px;
  padding-bottom: 56px;
}

/* Hero */
.hero {
  margin-bottom: 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.hero-title {
  margin: 0 0 8px;
  font-size: 1.6rem;
  font-weight: 650;
  line-height: 1.35;
  letter-spacing: -0.01em;
}

.hero-subtitle {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.96rem;
}

/* Toolbar */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 22px;
}

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

.tag-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

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

.tag-btn.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 500;
}

.search-input {
  width: 210px;
  max-width: 100%;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.88rem;
  outline: none;
}

.search-input:focus {
  border-color: var(--accent);
}

/* Post cards */
.post-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.post-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.post-card:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.post-cat {
  background: var(--surface-subtle);
  color: var(--text-muted);
  padding: 1px 8px;
  border-radius: 4px;
  font-size: 0.78rem;
}

.post-title {
  margin: 0 0 8px;
  font-size: 1.18rem;
  font-weight: 600;
  line-height: 1.45;
}

.post-title a {
  color: var(--text);
}

.post-title a:hover {
  color: var(--accent);
  text-decoration: none;
}

.post-excerpt {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.93rem;
}

.empty-state {
  text-align: center;
  padding: 48px 16px;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

/* Article detail */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

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

.article-shell {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 30px;
  box-shadow: var(--shadow);
}

.article-header {
  padding-bottom: 18px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--border);
}

.article-title {
  margin: 8px 0 0;
  font-size: 1.55rem;
  line-height: 1.38;
  font-weight: 650;
}

.article-body h2 {
  font-size: 1.16rem;
  margin: 26px 0 10px;
  line-height: 1.45;
}

.article-body p {
  margin: 0 0 14px;
}

.article-body ul {
  margin: 0 0 16px;
  padding-left: 22px;
}

.article-body li {
  margin-bottom: 6px;
}

.article-body pre {
  margin: 14px 0 18px;
  padding: 14px 16px;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow-x: auto;
  font-size: 0.86rem;
  line-height: 1.6;
}

.article-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.88em;
  background: var(--code-bg);
  padding: 1px 5px;
  border-radius: 4px;
}

.article-body pre code {
  background: transparent;
  padding: 0;
}

.article-body blockquote {
  margin: 16px 0;
  padding: 10px 16px;
  border-left: 3px solid var(--accent);
  background: var(--surface-subtle);
  color: var(--text-muted);
  border-radius: 0 6px 6px 0;
}

.article-nav {
  margin-top: 24px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 0.9rem;
}

/* Archive */
.archive-year {
  margin: 24px 0 12px;
  font-size: 1.15rem;
  font-weight: 650;
  color: var(--text);
}

.archive-year:first-child {
  margin-top: 0;
}

.archive-list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.archive-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
}

.archive-item:last-child {
  border-bottom: none;
}

.archive-date {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.84rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* About */
.about-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px 28px;
  box-shadow: var(--shadow);
}

.about-card h1 {
  margin: 0 0 14px;
  font-size: 1.4rem;
}

.about-card h2 {
  margin: 22px 0 8px;
  font-size: 1.08rem;
}

.about-card p {
  margin: 0 0 12px;
}

.notice-box {
  margin-top: 18px;
  padding: 12px 16px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 22px 0 28px;
  font-size: 0.84rem;
  color: var(--text-muted);
}

.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
}

.footer-copy {
  margin: 0;
}

.footer-beian {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.footer-beian a {
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

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

@media (max-width: 600px) {
  .main-content {
    padding-top: 24px;
  }
  .article-shell,
  .about-card {
    padding: 20px 18px;
  }
  .search-input {
    width: 100%;
  }
  .archive-item {
    flex-direction: column;
    gap: 2px;
  }
}
