/* ========== CSS Variables ========== */
:root {
  --bg-primary: #faf8f5;
  --bg-secondary: #f3efe9;
  --bg-card: #ffffff;
  --text-primary: #2c2c2c;
  --text-secondary: #5a5a5a;
  --text-muted: #8a8a8a;
  --accent: #c0392b;
  --accent-light: #e8d5c4;
  --accent-hover: #a5311f;
  --teal: #2c5f6e;
  --teal-light: #e0ecee;
  --border: #e5e0d8;
  --border-light: #f0ebe4;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.08);
  --radius: 4px;
  --font-serif: 'Noto Serif SC', 'Songti SC', 'SimSun', serif;
  --font-display: 'ZCOOL XiaoWei', 'Noto Serif SC', serif;
  --max-width: 1100px;
  --header-height: 64px;
}

[data-theme="dark"] {
  --bg-primary: #1a1a1e;
  --bg-secondary: #242428;
  --bg-card: #2a2a2e;
  --text-primary: #e8e4df;
  --text-secondary: #a8a4a0;
  --text-muted: #6a6a6e;
  --accent: #e07a5f;
  --accent-light: #3a2a22;
  --accent-hover: #f09a8f;
  --teal: #6aafbe;
  --teal-light: #1e2e32;
  --border: #3a3a3e;
  --border-light: #2e2e32;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.4);
}

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

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

body {
  font-family: var(--font-serif);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.8;
  min-height: 100vh;
  transition: background 0.3s, color 0.3s;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--teal); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--accent); }
img { max-width: 100%; height: auto; }
::selection { background: var(--accent); color: #fff; }

/* ========== Scrollbar ========== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ========== Header ========== */
.header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-height);
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-light);
  z-index: 100;
  transition: background 0.3s, box-shadow 0.3s;
}

.header.scrolled { box-shadow: var(--shadow-sm); }

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

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

.logo-seal {
  width: 36px; height: 36px;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  border-radius: 2px;
  letter-spacing: 2px;
  line-height: 1;
  flex-shrink: 0;
}

.logo-text {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 2px;
}

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

.nav a {
  padding: 8px 16px;
  color: var(--text-secondary);
  font-size: 15px;
  border-radius: var(--radius);
  transition: all 0.2s;
  position: relative;
  letter-spacing: 1px;
}

.nav a:hover { color: var(--text-primary); background: var(--bg-secondary); }
.nav a.active { color: var(--accent); font-weight: 500; }
.nav a.active::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 16px; height: 2px;
  background: var(--accent);
  border-radius: 1px;
}

.header-actions { display: flex; align-items: center; gap: 8px; }

.theme-toggle {
  width: 36px; height: 36px;
  border: none;
  background: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--text-secondary);
  font-size: 18px;
  transition: all 0.2s;
}

.theme-toggle:hover { background: var(--bg-secondary); color: var(--text-primary); }

.mobile-menu-btn {
  display: none;
  width: 36px; height: 36px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 20px;
}

/* ========== Mobile Nav ========== */
.mobile-nav {
  display: none;
  position: fixed;
  top: var(--header-height);
  left: 0; right: 0; bottom: 0;
  background: var(--bg-primary);
  z-index: 99;
  padding: 24px;
  flex-direction: column;
  gap: 4px;
}

.mobile-nav.active { display: flex; }

.mobile-nav a {
  padding: 14px 16px;
  color: var(--text-secondary);
  font-size: 16px;
  border-radius: var(--radius);
  letter-spacing: 2px;
}

.mobile-nav a:hover, .mobile-nav a.active {
  background: var(--bg-secondary);
  color: var(--accent);
}

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

/* ========== Hero (Home) ========== */
.hero {
  text-align: center;
  padding: 64px 0 48px;
  position: relative;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 200px; height: 200px;
  background: radial-gradient(circle, var(--accent-light) 0%, transparent 70%);
  opacity: 0.5;
  pointer-events: none;
}

.hero-title {
  font-family: var(--font-display);
  font-size: 42px;
  font-weight: 700;
  letter-spacing: 8px;
  margin-bottom: 16px;
  color: var(--text-primary);
  position: relative;
}

.hero-subtitle {
  font-size: 16px;
  color: var(--text-muted);
  letter-spacing: 4px;
  margin-bottom: 32px;
}

.hero-desc {
  max-width: 520px;
  margin: 0 auto;
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 2;
}

.hero-divider {
  width: 40px; height: 2px;
  background: var(--accent);
  margin: 32px auto;
  border-radius: 1px;
}

/* ========== Category Cards ========== */
.category-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin: 48px 0;
}

.category-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 32px 24px;
  text-align: center;
  text-decoration: none;
  color: inherit;
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
  display: block;
}

.category-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--accent);
  transform: scaleX(0);
  transition: transform 0.3s;
}

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

.category-card:hover::before { transform: scaleX(1); }

.category-icon { font-size: 32px; margin-bottom: 12px; display: block; }

.category-name {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
  letter-spacing: 2px;
}

.category-desc {
  font-size: 13px;
  color: var(--text-muted);
}

.category-count {
  display: inline-block;
  margin-top: 12px;
  padding: 2px 10px;
  background: var(--bg-secondary);
  border-radius: 10px;
  font-size: 12px;
  color: var(--text-muted);
}

/* ========== Section Heading ========== */
.section-heading {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.section-heading h2 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 3px;
  white-space: nowrap;
}

.section-heading::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.section-heading .more-link {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
}

.section-heading .more-link:hover { color: var(--accent); }

/* ========== Article List & Cards ========== */
.article-list { display: flex; flex-direction: column; gap: 16px; }

.article-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 24px 28px;
  transition: all 0.3s;
  display: block;
  text-decoration: none;
  color: inherit;
}

.article-card:hover {
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
  color: inherit;
}

.article-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--text-muted);
}

.article-category { color: var(--teal); font-weight: 500; }

.article-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
  letter-spacing: 1px;
  line-height: 1.6;
}

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

.article-tags {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.tag {
  display: inline-block;
  padding: 2px 10px;
  background: var(--bg-secondary);
  border-radius: 2px;
  font-size: 12px;
  color: var(--text-muted);
  transition: all 0.2s;
  cursor: pointer;
  border: none;
  font-family: var(--font-serif);
}

.tag:hover { background: var(--accent-light); color: var(--accent); }
.tag.active { background: var(--accent); color: #fff; }

/* ========== Page Header ========== */
.page-header {
  padding: 48px 0 32px;
  text-align: center;
}

.page-header h1 {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 600;
  letter-spacing: 6px;
  margin-bottom: 12px;
}

.page-header p {
  color: var(--text-muted);
  font-size: 14px;
  letter-spacing: 2px;
}

.page-header .header-line {
  width: 40px; height: 2px;
  background: var(--accent);
  margin: 20px auto 0;
  border-radius: 1px;
}

/* ========== Tag Filter ========== */
.tag-filter {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 32px;
  padding: 0 16px;
}

.tag-filter .tag { padding: 4px 14px; font-size: 13px; }

/* ========== Search ========== */
.search-bar {
  max-width: 400px;
  margin: 0 auto 32px;
  position: relative;
}

.search-bar input {
  width: 100%;
  padding: 10px 16px 10px 40px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: var(--font-serif);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.search-bar input:focus { border-color: var(--accent); }
.search-bar input::placeholder { color: var(--text-muted); }

.search-bar .search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
}

/* ========== Gallery ========== */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.gallery-item {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  aspect-ratio: 4/3;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  transition: all 0.3s;
}

.gallery-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.gallery-item img, .gallery-item .placeholder-img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.5s;
}

.gallery-item:hover img,
.gallery-item:hover .placeholder-img { transform: scale(1.05); }

.gallery-item .gallery-overlay {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 24px 16px 16px;
  background: linear-gradient(transparent, rgba(0,0,0,0.6));
  color: #fff;
  opacity: 0;
  transition: opacity 0.3s;
}

.gallery-item:hover .gallery-overlay { opacity: 1; }
.gallery-overlay h3 { font-size: 14px; font-weight: 500; letter-spacing: 1px; }
.gallery-overlay p { font-size: 12px; opacity: 0.8; margin-top: 4px; }

/* ========== Timeline ========== */
.timeline {
  position: relative;
  padding: 48px 0;
}

.timeline::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 1px; height: 100%;
  background: var(--border);
}

.timeline-year {
  position: relative;
  text-align: center;
  margin-bottom: 32px;
}

.timeline-year span {
  display: inline-block;
  padding: 4px 20px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 16px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 2px;
  position: relative;
  z-index: 1;
}

.timeline-item {
  position: relative;
  width: 50%;
  padding: 0 32px 32px;
}

.timeline-item:nth-child(odd) { left: 0; text-align: right; }
.timeline-item:nth-child(even) { left: 50%; text-align: left; }

.timeline-item::before {
  content: '';
  position: absolute;
  top: 8px;
  width: 8px; height: 8px;
  background: var(--accent);
  border-radius: 50%;
  z-index: 1;
}

.timeline-item:nth-child(odd)::before { right: -4px; }
.timeline-item:nth-child(even)::before { left: -4px; }

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

.timeline-title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--text-primary);
  text-decoration: none;
  transition: color 0.2s;
}

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

.timeline-cat { font-size: 12px; color: var(--teal); margin-top: 4px; }

/* ========== About ========== */
.about-content {
  max-width: 680px;
  margin: 0 auto;
  padding: 48px 0;
}

.about-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 40px;
  margin-bottom: 24px;
}

.about-card h3 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 3px;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
}

.about-card p {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 2;
  margin-bottom: 12px;
}

.about-card p:last-child { margin-bottom: 0; }

.about-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.about-info-item {
  padding: 16px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
}

.about-info-item .label {
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 2px;
  margin-bottom: 4px;
}

.about-info-item .value { font-size: 15px; font-weight: 500; }

/* ========== Article Detail ========== */
.article-detail {
  max-width: 720px;
  margin: 0 auto;
  padding: 48px 0;
}

.article-detail-header {
  text-align: center;
  margin-bottom: 40px;
}

.article-detail-header h1 {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 3px;
  line-height: 1.6;
  margin-bottom: 16px;
}

.article-detail-meta {
  font-size: 14px;
  color: var(--text-muted);
}

.article-detail-meta span { margin: 0 8px; }

.article-detail-body {
  font-size: 16px;
  line-height: 2;
  color: var(--text-primary);
}

.article-detail-body p { margin-bottom: 20px; }

.article-detail-body h2 {
  font-size: 20px;
  font-weight: 600;
  margin: 36px 0 16px;
  letter-spacing: 2px;
}

.article-detail-body h3 {
  font-size: 18px;
  font-weight: 600;
  margin: 28px 0 12px;
  letter-spacing: 1px;
}

.article-detail-body blockquote {
  border-left: 3px solid var(--accent);
  padding: 12px 20px;
  margin: 20px 0;
  background: var(--bg-secondary);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text-secondary);
  font-style: italic;
}

.article-detail-body code {
  background: var(--bg-secondary);
  padding: 2px 6px;
  border-radius: 2px;
  font-size: 14px;
  font-family: 'Menlo', 'Monaco', monospace;
}

.article-detail-body pre {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 20px;
  overflow-x: auto;
  margin: 20px 0;
}

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

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 24px;
  cursor: pointer;
  transition: color 0.2s;
  text-decoration: none;
}

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

/* ========== Stats Bar ========== */
.stats-bar {
  display: flex;
  justify-content: center;
  gap: 40px;
  padding: 24px 0;
  margin-bottom: 16px;
}

.stat-item { text-align: center; }

.stat-num {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
  font-family: var(--font-display);
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 2px;
  margin-top: 4px;
}

/* ========== Footer ========== */
.footer {
  border-top: 1px solid var(--border-light);
  padding: 32px 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 2;
  margin-top: 48px;
}

.footer a { color: var(--text-muted); transition: color 0.2s; }
.footer a:hover { color: var(--accent); }

.footer .footer-seal {
  display: inline-block;
  width: 24px; height: 24px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  line-height: 24px;
  text-align: center;
  border-radius: 2px;
  margin-bottom: 8px;
}

/* ========== Lightbox ========== */
.lightbox {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.85);
  z-index: 200;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.lightbox.active { display: flex; }

.lightbox img {
  max-width: 90%;
  max-height: 85vh;
  border-radius: var(--radius);
  box-shadow: 0 0 40px rgba(0,0,0,0.5);
}

.lightbox-caption {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  font-size: 15px;
  text-align: center;
  letter-spacing: 2px;
}

.lightbox-close {
  position: absolute;
  top: 24px; right: 24px;
  width: 40px; height: 40px;
  background: rgba(255,255,255,0.1);
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ========== No Results ========== */
.no-results {
  text-align: center;
  padding: 64px 0;
  color: var(--text-muted);
}

.no-results .icon { font-size: 48px; margin-bottom: 16px; opacity: 0.5; }
.no-results p { font-size: 15px; letter-spacing: 1px; }

/* ========== Placeholder Images ========== */
.placeholder-img {
  width: 100%; height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: rgba(0,0,0,0.15);
}

.placeholder-img.p1 { background: linear-gradient(135deg, #e8d5c4, #f0e6d8); }
.placeholder-img.p2 { background: linear-gradient(135deg, #c4dde8, #d8e8f0); }
.placeholder-img.p3 { background: linear-gradient(135deg, #d4e8c4, #e0f0d8); }
.placeholder-img.p4 { background: linear-gradient(135deg, #e8c4d5, #f0d8e6); }
.placeholder-img.p5 { background: linear-gradient(135deg, #d5c4e8, #e0d8f0); }
.placeholder-img.p6 { background: linear-gradient(135deg, #e8dcc4, #f0e8d8); }

/* ========== Responsive ========== */
@media (max-width: 768px) {
  .nav { display: none; }
  .mobile-menu-btn { display: flex; align-items: center; justify-content: center; }

  .hero-title { font-size: 28px; letter-spacing: 4px; }
  .hero-subtitle { font-size: 14px; letter-spacing: 2px; }
  .hero { padding: 40px 0 32px; }

  .category-grid { grid-template-columns: 1fr; gap: 12px; }
  .gallery-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }

  .timeline::before { left: 16px; }
  .timeline-year span { font-size: 14px; }
  .timeline-item {
    width: 100%; left: 0 !important;
    padding-left: 40px; padding-right: 0;
    text-align: left !important;
  }
  .timeline-item::before { left: 12px !important; right: auto !important; }

  .about-info-grid { grid-template-columns: 1fr; }
  .about-card { padding: 24px; }

  .stats-bar { gap: 24px; }
  .stat-num { font-size: 22px; }

  .page-header h1 { font-size: 24px; }
  .article-detail-header h1 { font-size: 22px; }
}

@media (max-width: 480px) {
  .logo-text { font-size: 16px; letter-spacing: 1px; }
  .gallery-grid { grid-template-columns: 1fr 1fr; }
}
