/* ==================== CSS Variables ==================== */
:root {
  --color-bg: #fafafa;
  --color-surface: #ffffff;
  --color-text: #2c2c2c;
  --color-text-secondary: #6b6b6b;
  --color-text-muted: #999999;
  --color-primary: #c47a3d;
  --color-primary-light: #e09b5f;
  --color-primary-dark: #a8632f;
  --color-accent: #8b6f47;
  --color-border: #e8e8e8;
  --color-tag-bg: #f5f0eb;
  --color-tag-text: #8b6f47;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.10);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --max-width: 800px;
  --font-sans: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "SimSun", serif;
  --font-mono: "JetBrains Mono", "Fira Code", "Consolas", monospace;
  --transition: 0.3s ease;
}

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

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

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

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

a:hover {
  color: var(--color-primary-dark);
}

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

/* ==================== Header ==================== */
.site-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.site-header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-logo {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.site-logo .logo-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 700;
}

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

.site-nav a {
  color: var(--color-text-secondary);
  font-size: 0.95rem;
  font-weight: 500;
  position: relative;
  padding: 4px 0;
}

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

.site-nav a.active::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--color-primary);
  border-radius: 2px;
}

/* ==================== Main Content ==================== */
.main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 48px 24px;
  min-height: calc(100vh - 64px - 200px);
}

/* ==================== Hero Section ==================== */
.hero {
  text-align: center;
  padding: 60px 0 48px;
}

.hero h1 {
  font-size: 2.4rem;
  font-weight: 700;
  letter-spacing: -1px;
  margin-bottom: 16px;
  color: var(--color-text);
}

.hero .subtitle {
  font-size: 1.1rem;
  color: var(--color-text-secondary);
  max-width: 500px;
  margin: 0 auto;
  line-height: 1.7;
}

.hero .hero-decoration {
  width: 48px;
  height: 3px;
  background: var(--color-primary);
  border-radius: 3px;
  margin: 24px auto 0;
}

/* ==================== Post List ==================== */
.section-title {
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 24px;
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title::before {
  content: "";
  width: 4px;
  height: 20px;
  background: var(--color-primary);
  border-radius: 3px;
}

.post-list {
  list-style: none;
}

.post-card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: 28px 32px;
  margin-bottom: 20px;
  border: 1px solid var(--color-border);
  transition: all var(--transition);
  display: block;
  color: inherit;
}

.post-card:hover {
  border-color: var(--color-primary-light);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  color: inherit;
}

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

.post-card .post-meta .tag {
  background: var(--color-tag-bg);
  color: var(--color-tag-text);
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
}

.post-card h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--color-text);
  line-height: 1.5;
}

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

.post-card .read-more {
  margin-top: 12px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-primary);
}

/* ==================== Post Detail ==================== */
.post-detail {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 48px;
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
}

.post-detail .post-header {
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--color-border);
}

.post-detail .post-header h1 {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 12px;
  line-height: 1.5;
  color: var(--color-text);
}

.post-detail .post-header .post-meta {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.post-detail .post-header .post-meta .tag {
  background: var(--color-tag-bg);
  color: var(--color-tag-text);
  padding: 2px 12px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 500;
}

.post-detail .post-body {
  font-size: 1rem;
  line-height: 1.9;
  color: var(--color-text);
}

.post-detail .post-body h2 {
  font-size: 1.4rem;
  font-weight: 600;
  margin: 32px 0 16px;
  color: var(--color-text);
}

.post-detail .post-body h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 24px 0 12px;
  color: var(--color-text);
}

.post-detail .post-body p {
  margin-bottom: 16px;
}

.post-detail .post-body ul,
.post-detail .post-body ol {
  margin-bottom: 16px;
  padding-left: 24px;
}

.post-detail .post-body li {
  margin-bottom: 8px;
}

.post-detail .post-body blockquote {
  border-left: 4px solid var(--color-primary);
  padding: 12px 20px;
  margin: 20px 0;
  background: var(--color-tag-bg);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--color-text-secondary);
}

.post-detail .post-body code {
  font-family: var(--font-mono);
  background: #f4f4f4;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
}

.post-detail .post-body pre {
  background: #2d2d2d;
  color: #f8f8f2;
  padding: 20px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin: 20px 0;
}

.post-detail .post-body pre code {
  background: none;
  padding: 0;
}

.post-detail .post-body img {
  border-radius: var(--radius-sm);
  margin: 20px 0;
  box-shadow: var(--shadow-sm);
}

.post-detail .post-footer {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.post-detail .back-link {
  color: var(--color-text-secondary);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color var(--transition);
}

.post-detail .back-link:hover {
  color: var(--color-primary);
}

/* ==================== About Page ==================== */
.about-section {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 48px;
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
}

.about-section h1 {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 24px;
}

.about-section h2 {
  font-size: 1.3rem;
  font-weight: 600;
  margin: 32px 0 16px;
  color: var(--color-text);
}

.about-section p {
  margin-bottom: 16px;
  color: var(--color-text-secondary);
  line-height: 1.9;
}

.about-avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 2.5rem;
  font-weight: 700;
  margin: 0 auto 24px;
  box-shadow: var(--shadow-md);
}

.about-contact {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--color-border);
}

.about-contact a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 20px;
  font-size: 0.95rem;
}

/* ==================== Footer ==================== */
.site-footer {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  padding: 32px 24px;
  text-align: center;
}

.site-footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

.site-footer p {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-bottom: 8px;
}

.site-footer .icp {
  font-size: 0.82rem;
  color: var(--color-text-muted);
}

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

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

/* ==================== Archive ==================== */
.archive-list {
  list-style: none;
}

.archive-item {
  display: flex;
  align-items: baseline;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--color-border);
}

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

.archive-item .archive-date {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  white-space: nowrap;
  min-width: 100px;
}

.archive-item .archive-title {
  font-size: 1rem;
  color: var(--color-text);
  font-weight: 500;
}

.archive-item .archive-title:hover {
  color: var(--color-primary);
}

.archive-year {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--color-primary);
  margin: 24px 0 8px;
}

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

/* ==================== Responsive ==================== */
@media (max-width: 640px) {
  .site-header-inner {
    padding: 0 16px;
    height: 56px;
  }

  .site-nav {
    gap: 18px;
  }

  .site-nav a {
    font-size: 0.88rem;
  }

  .main {
    padding: 32px 16px;
  }

  .hero {
    padding: 40px 0 32px;
  }

  .hero h1 {
    font-size: 1.8rem;
  }

  .hero .subtitle {
    font-size: 1rem;
  }

  .post-card {
    padding: 20px;
  }

  .post-detail,
  .about-section {
    padding: 28px 20px;
  }

  .post-detail .post-header h1,
  .about-section h1 {
    font-size: 1.4rem;
  }

  .archive-item {
    flex-direction: column;
    gap: 4px;
  }

  .archive-item .archive-date {
    min-width: auto;
  }
}

/* ==================== Animations ==================== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.post-card,
.hero {
  animation: fadeInUp 0.6s ease forwards;
}

.post-card:nth-child(2) {
  animation-delay: 0.1s;
}

.post-card:nth-child(3) {
  animation-delay: 0.2s;
}
