/* ===== 毛选知识库 - 字体与全局 ===== */
@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;600;700;900&family=Noto+Sans+SC:wght@300;400;500;700&display=swap');

:root {
  --bg: #faf6ee;
  --bg-card: #fffef9;
  --text: #2c2416;
  --text-dim: #6b5e4a;
  --accent: #c43a31;
  --accent-light: #e8c4a0;
  --gold: #b8860b;
  --gold-light: #f5deb3;
  --border: #e0d5c1;
  --shadow: 0 2px 12px rgba(44, 36, 22, 0.06);
  --radius: 8px;
  --max-width: 800px;
  --sidebar-width: 280px;
}

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

body {
  font-family: 'Noto Serif SC', 'Songti SC', serif;
  font-size: 17px;
  line-height: 1.88;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; color: #a12e26; }

/* ===== Layout ===== */
.layout { display: flex; min-height: 100vh; }

/* ===== Sidebar ===== */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
  box-shadow: var(--shadow);
}

.sidebar-inner { padding: 24px 20px; }

.sidebar-logo {
  display: block;
  font-size: 22px;
  font-weight: 900;
  color: var(--accent);
  letter-spacing: 2px;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--gold-light);
  padding-bottom: 12px;
}

.sidebar-search { position: relative; margin-bottom: 20px; }

.sidebar-search input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
}
.sidebar-search input:focus { border-color: var(--accent); }

.search-results {
  display: none;
  position: absolute;
  top: 100%;
  left: 0; right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-height: 400px;
  overflow-y: auto;
  box-shadow: var(--shadow);
  z-index: 200;
}
.search-results.active { display: block; }

.search-result-item {
  display: block;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  color: var(--text);
  transition: background 0.15s;
}
.search-result-item:hover { background: var(--accent-light); text-decoration: none; }
.search-result-item .sr-type { font-size: 11px; color: var(--text-dim); margin-left: 6px; }
.search-result-item .sr-title {
  display: block;
  font-weight: 600;
  color: var(--text);
}
.search-result-item .sr-snippet {
  display: block;
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 3px;
  line-height: 1.5;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
/* 搜索关键词高亮 */
mark {
  background: #fde68a;
  color: var(--text);
  padding: 0 2px;
  border-radius: 2px;
  font-weight: 600;
}
/* 搜索结果弹窗滚动 */
.search-results {
  max-height: 420px;
  overflow-y: auto;
}

/* Nav */
.sidebar-nav { margin-top: 8px; }
.nav-title {
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  margin: 16px 0 6px;
  cursor: pointer;
  user-select: none;
  padding: 4px 6px;
  border-radius: 4px;
  transition: background 0.15s;
}
.nav-title:hover { background: var(--accent-light); color: var(--accent); }
.nav-arrow { display: inline-block; transition: transform 0.2s; margin-right: 2px; }
.nav-list { list-style: none; }
.nav-list li { margin: 1px 0; }
.nav-list a {
  display: flex; justify-content: space-between; align-items: center;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 14px;
  color: var(--text);
  transition: background 0.15s;
}
.nav-list a:hover { background: var(--accent-light); text-decoration: none; }
.nav-list .count {
  font-size: 11px;
  color: var(--text-dim);
  background: var(--bg);
  padding: 1px 6px;
  border-radius: 10px;
}

.sidebar-footer {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex; gap: 16px;
}
.sidebar-footer a { font-size: 13px; color: var(--text-dim); }

.sidebar-toggle {
  display: none;
  position: fixed;
  top: 12px; left: 12px;
  z-index: 300;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 10px;
  font-size: 18px;
  cursor: pointer;
  color: var(--text);
}

/* ===== Main Content ===== */
.main-content {
  flex: 1;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 48px 32px 96px;
  width: 100%;
}

/* Breadcrumbs */
.breadcrumbs {
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 32px;
}
.breadcrumbs a { color: var(--text-dim); }
.breadcrumbs a:hover { color: var(--accent); }
.bc-sep { margin: 0 6px; color: var(--border); }

/* ===== Hero (首页) ===== */
.hero { text-align: center; padding: 60px 0 40px; }
.hero-eyebrow {
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 12px;
  letter-spacing: 6px;
  color: var(--text-dim);
  margin-bottom: 16px;
  text-transform: uppercase;
}
.hero-title {
  font-size: 52px;
  font-weight: 900;
  letter-spacing: 4px;
  color: var(--accent);
  line-height: 1.3;
}
.hero-sub { display: block; font-size: 28px; font-weight: 600; color: var(--gold); margin-top: 4px; }

.hero-stats {
  display: flex; justify-content: center; gap: 48px;
  margin: 36px 0 28px;
}
.stat-item { text-align: center; }
.stat-number { display: block; font-size: 36px; font-weight: 900; color: var(--accent); }
.stat-label { font-size: 13px; color: var(--text-dim); }

.hero-desc {
  font-size: 16px;
  color: var(--text-dim);
  max-width: 540px;
  margin: 0 auto 32px;
  line-height: 1.8;
}

.hero-nav { display: flex; justify-content: center; gap: 16px; flex-wrap: wrap; }
.btn-primary {
  display: inline-block;
  padding: 10px 28px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius);
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 15px;
  font-weight: 600;
  transition: background 0.2s;
}
.btn-primary:hover { background: #a12e26; text-decoration: none; color: #fff; }
.btn-secondary {
  display: inline-block;
  padding: 10px 28px;
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: var(--radius);
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 15px;
  font-weight: 600;
  transition: all 0.2s;
}
.btn-secondary:hover { background: var(--accent); color: #fff; text-decoration: none; }

/* ===== Home Sections ===== */
.home-section { margin-top: 48px; }
.home-section h2 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 20px;
  border-bottom: 2px solid var(--gold-light);
  padding-bottom: 8px;
}
.section-hint {
  font-size: 13px; font-weight: 400; color: var(--text-dim); margin-left: 8px;
}

/* Tag Cloud */
.tag-cloud { display: flex; flex-wrap: wrap; gap: 10px; }
.tag-item {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text);
  transition: all 0.2s;
}
.tag-item:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.tag-count { font-size: 11px; color: var(--text-dim); }

/* Person Cards */
.person-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.person-card {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all 0.2s;
  color: var(--text);
}
.person-card:hover { border-color: var(--accent); text-decoration: none; box-shadow: var(--shadow); }
.person-avatar {
  width: 40px; height: 40px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700;
  flex-shrink: 0;
}
.person-info { display: flex; flex-direction: column; }
.person-name { font-weight: 600; font-size: 15px; }
.person-card-role { font-size: 12px; color: var(--text-dim); }
.person-refs { font-size: 11px; color: var(--gold); }

/* Event List */
.event-item {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 15px;
}
.event-item:hover { color: var(--accent); text-decoration: none; }
.event-date-badge {
  font-size: 11px;
  background: var(--gold-light);
  color: var(--gold);
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
  font-family: 'Noto Sans SC', sans-serif;
}
.event-title { flex: 1; }
.event-refs { font-size: 12px; color: var(--text-dim); }

/* Volume Grid */
.volume-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.volume-card {
  display: block;
  padding: 20px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: all 0.2s;
}
.volume-card:hover { border-color: var(--accent); box-shadow: var(--shadow); text-decoration: none; }

/* ===== Article Pages ===== */
.article-title {
  font-size: 32px;
  font-weight: 900;
  color: var(--accent);
  margin-bottom: 16px;
  line-height: 1.4;
}

.article-meta {
  display: flex; gap: 16px; flex-wrap: wrap;
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 32px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.article-content { margin-top: 24px; }

.article-content h2 {
  font-size: 22px; font-weight: 700;
  color: var(--text);
  margin: 40px 0 16px;
  padding-left: 12px;
  border-left: 4px solid var(--accent);
}

.article-content h3 {
  font-size: 19px; font-weight: 700;
  color: var(--text);
  margin: 32px 0 12px;
}

.article-content h4 {
  font-size: 17px; font-weight: 600;
  color: var(--text-dim);
  margin: 24px 0 8px;
}

.article-content p { margin: 12px 0; text-indent: 2em; }
.article-content ul, .article-content ol { margin: 12px 0; padding-left: 2em; }
.article-content li { margin: 6px 0; }
.article-content blockquote {
  margin: 16px 0;
  padding: 12px 20px;
  border-left: 4px solid var(--gold);
  background: var(--accent-light);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-style: italic;
}
.article-content hr { border: none; border-top: 1px solid var(--border); margin: 32px 0; }

/* Internal Links */
.internal-link {
  color: var(--accent);
  border-bottom: 1px dashed var(--accent);
  transition: all 0.15s;
}
.internal-link:hover { border-bottom-style: solid; text-decoration: none; }
.internal-link.broken { color: var(--text-dim); border-bottom-color: var(--text-dim); }

/* ===== Card Pages ===== */
.concept-category, .person-role, .event-date {
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 20px;
  display: inline-block;
  padding: 4px 12px;
  background: var(--accent-light);
  border-radius: 20px;
}

.card-body h2 {
  font-size: 20px; font-weight: 700;
  color: var(--text);
  margin: 28px 0 12px;
}

/* ===== Index Pages ===== */
.index-desc {
  font-size: 15px;
  color: var(--text-dim);
  margin-bottom: 28px;
}

.index-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}

.index-card {
  display: block;
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all 0.2s;
  color: var(--text);
}
.index-card:hover { border-color: var(--accent); text-decoration: none; box-shadow: var(--shadow); }
.index-card-title { display: block; font-weight: 600; font-size: 16px; margin-bottom: 4px; }
.index-card-meta { display: block; font-size: 12px; color: var(--text-dim); }

/* Article list */
.article-list-full { margin-top: 8px; }
.article-list-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  transition: background 0.15s;
}
.article-list-item:hover { background: var(--accent-light); text-decoration: none; }
.article-list-title { font-weight: 500; font-size: 15px; }
.article-list-meta { font-size: 12px; color: var(--text-dim); white-space: nowrap; }

/* ===== Backlinks ===== */
.backlinks-panel {
  margin-top: 48px;
  padding: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.backlinks-panel h3 { font-size: 16px; font-weight: 700; margin-bottom: 12px; }
.backlinks-panel ul { list-style: none; }
.backlinks-panel li { margin: 6px 0; }
.backlink-type {
  font-size: 11px;
  color: var(--text-dim);
  background: var(--bg);
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 6px;
}

/* ===== Graph ===== */
.graph-controls {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-bottom: 16px;
}
.graph-filter {
  padding: 6px 16px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--bg-card);
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 13px;
  cursor: pointer;
  color: var(--text);
  transition: all 0.2s;
}
.graph-filter.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.graph-filter:hover:not(.active) { border-color: var(--accent); }

/* ===== About ===== */
.about-section { margin-top: 32px; }
.about-section h2 { font-size: 20px; font-weight: 700; margin-bottom: 12px; }
.about-section p { margin: 8px 0; }
.about-section ul { margin: 12px 0; padding-left: 2em; list-style: none; }
.about-section li { margin: 6px 0; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .sidebar { display: none; position: fixed; z-index: 200; }
  .sidebar.open { display: block; }
  .sidebar-toggle { display: block; }
  .main-content { padding: 24px 16px 64px; }
  .hero-title { font-size: 36px; }
  .hero-sub { font-size: 22px; }
  .hero-stats { gap: 24px; }
  .stat-number { font-size: 28px; }
  .person-cards { grid-template-columns: 1fr; }
  .volume-grid { grid-template-columns: 1fr 1fr; }
}

/* ===== Print ===== */
@media print {
  .sidebar, .sidebar-toggle, .backlinks-panel { display: none; }
  .main-content { max-width: 100%; padding: 0; }
}
