:root {
  --color-bg: #ffffff;
  --color-text: #2d2d2d;
  --color-text-secondary: #666666;
  --color-text-tertiary: #999999;
  --color-border: #e8e8e8;
  --color-link: #0066cc;
  --color-link-hover: #004499;
  --color-code-bg: #f6f8fa;
  --color-tag-bg: #f0f4f8;
  --color-tag-text: #3a6ea5;
  --color-accent: #0066cc;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --radius: 8px;
  --max-width: 720px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #1a1a2e;
    --color-text: #e0e0e0;
    --color-text-secondary: #aaaaaa;
    --color-text-tertiary: #777777;
    --color-border: #2d2d44;
    --color-link: #6aadff;
    --color-link-hover: #8dc4ff;
    --color-code-bg: #222240;
    --color-tag-bg: #222240;
    --color-tag-text: #6aadff;
    --color-accent: #6aadff;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
  }
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.8;
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--color-link);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--color-link-hover);
  text-decoration: underline;
}

img {
  max-width: 100%;
  height: auto;
}

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

/* ========== Header ========== */
.site-header {
  border-bottom: 1px solid var(--color-border);
  padding: 32px 0;
  margin-bottom: 40px;
}

.site-header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.site-title a {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-text);
  text-decoration: none;
}

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

.site-nav {
  display: flex;
  gap: 8px;
  list-style: none;
}

.site-nav a {
  color: var(--color-text-secondary);
  font-size: 0.9rem;
  padding: 6px 14px;
  border-radius: 20px;
  transition: all 0.2s;
}

.site-nav a:hover,
.site-nav a.active {
  color: var(--color-accent);
  background-color: var(--color-tag-bg);
  text-decoration: none;
}

/* ========== Post List (Homepage) ========== */
.page-title {
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 32px;
  color: var(--color-text);
}

.post-card {
  padding: 24px 0;
  border-bottom: 1px solid var(--color-border);
}

.post-card:last-child {
  border-bottom: none;
}

.post-card-title {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 6px;
}

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

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

.post-card-meta {
  font-size: 0.85rem;
  color: var(--color-text-tertiary);
  margin-bottom: 8px;
  display: flex;
  gap: 12px;
  align-items: center;
}

.post-card-excerpt {
  font-size: 0.95rem;
  color: var(--color-text-secondary);
  line-height: 1.7;
}

/* ========== Tags ========== */
.tag {
  display: inline-block;
  font-size: 0.75rem;
  color: var(--color-tag-text);
  background-color: var(--color-tag-bg);
  padding: 2px 10px;
  border-radius: 12px;
  text-decoration: none;
  transition: opacity 0.2s;
}

.tag:hover {
  opacity: 0.8;
  text-decoration: none;
}

.tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

/* ========== Post Content ========== */
.post-header {
  margin-bottom: 32px;
}

.post-header h1 {
  font-size: 1.8rem;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 12px;
}

.post-meta {
  font-size: 0.9rem;
  color: var(--color-text-tertiary);
}

.post-content {
  line-height: 1.9;
}

.post-content h2 {
  font-size: 1.4rem;
  font-weight: 600;
  margin-top: 2.5em;
  margin-bottom: 0.8em;
  padding-bottom: 0.3em;
  border-bottom: 1px solid var(--color-border);
}

.post-content h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-top: 2em;
  margin-bottom: 0.6em;
}

.post-content p {
  margin-bottom: 1.2em;
}

.post-content ul,
.post-content ol {
  margin-bottom: 1.2em;
  padding-left: 1.5em;
}

.post-content li {
  margin-bottom: 0.4em;
}

.post-content blockquote {
  border-left: 4px solid var(--color-accent);
  padding: 0.8em 1.2em;
  margin: 1.5em 0;
  color: var(--color-text-secondary);
  background-color: var(--color-code-bg);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.post-content hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 2em 0;
}

/* ========== Code ========== */
.post-content code {
  font-family: "SF Mono", "Fira Code", "Fira Mono", Menlo, Consolas, monospace;
  font-size: 0.88em;
  background-color: var(--color-code-bg);
  padding: 2px 6px;
  border-radius: 4px;
}

.post-content pre {
  background-color: var(--color-code-bg);
  padding: 16px 20px;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 1.5em 0;
  box-shadow: var(--shadow-sm);
}

.post-content pre code {
  background: none;
  padding: 0;
  font-size: 0.85rem;
  line-height: 1.6;
}

.highlight {
  background-color: var(--color-code-bg);
  border-radius: var(--radius);
  padding: 16px 20px;
  overflow-x: auto;
  margin: 1.5em 0;
  box-shadow: var(--shadow-sm);
}

.highlight pre {
  margin: 0;
  padding: 0;
  box-shadow: none;
}

/* ========== Navigation ========== */
.post-nav {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: space-between;
}

.post-nav a {
  color: var(--color-text-secondary);
  font-size: 0.9rem;
}

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

/* ========== Page Layout ========== */
.page-header {
  margin-bottom: 32px;
}

.page-header h1 {
  font-size: 1.8rem;
  font-weight: 700;
}

.page-content {
  line-height: 1.9;
}

.page-content h2 {
  font-size: 1.3rem;
  font-weight: 600;
  margin-top: 2em;
  margin-bottom: 0.8em;
}

.page-content p {
  margin-bottom: 1.2em;
}

.page-content ul {
  margin-bottom: 1.2em;
  padding-left: 1.5em;
}

/* ========== Footer ========== */
.site-footer {
  margin-top: 64px;
  padding: 24px 0;
  border-top: 1px solid var(--color-border);
  text-align: center;
  color: var(--color-text-tertiary);
  font-size: 0.85rem;
}

.site-footer a {
  color: var(--color-text-tertiary);
}

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

/* ========== 404 ========== */
.not-found {
  text-align: center;
  padding: 80px 0;
}

.not-found h1 {
  font-size: 4rem;
  font-weight: 700;
  color: var(--color-text-tertiary);
}

.not-found p {
  color: var(--color-text-secondary);
  margin: 16px 0 32px;
}

/* ========== Category Page ========== */
.category-section {
  margin-bottom: 40px;
}

.category-section h2 {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--color-border);
}

/* ========== Responsive ========== */
@media (max-width: 600px) {
  html {
    font-size: 15px;
  }

  .site-header .container {
    flex-direction: column;
    align-items: flex-start;
  }

  .site-nav {
    flex-wrap: wrap;
  }

  .post-header h1 {
    font-size: 1.5rem;
  }

  .container {
    padding: 0 16px;
  }
}
