/* GemKnowledge 前台样式 - 干净专业阅读风 */
:root {
  --accent: #1B4332;
  --accent-light: #2D6A4F;
  --accent-bg: #F0F4F1;
  --text: #2D2D2D;
  --text-light: #6B6B6B;
  --text-muted: #999;
  --border: #E5E5E5;
  --bg: #FFFFFF;
  --bg-soft: #F8F9FA;
  --radius: 6px;
  --content-width: 720px;
  --max-width: 1200px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.8;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: "Source Serif Pro", "Noto Serif SC", Georgia, "Times New Roman", serif;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
}

a { color: var(--accent); text-decoration: none; transition: color .2s; }
a:hover { color: var(--accent-light); }

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

/* 顶部导航 */
.site-header {
  border-bottom: 1px solid var(--border);
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.site-logo {
  font-family: "Source Serif Pro", Georgia, serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.5px;
}
.site-logo span { color: var(--text); font-weight: 400; }
.main-nav { display: flex; gap: 28px; align-items: center; }
.main-nav a {
  font-size: 15px;
  color: var(--text-light);
  font-weight: 500;
}
.main-nav a:hover, .main-nav a.active { color: var(--accent); }
.header-search {
  display: flex;
  align-items: center;
  gap: 8px;
}
.header-search input {
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 7px 16px;
  font-size: 14px;
  width: 200px;
  outline: none;
  transition: border-color .2s;
}
.header-search input:focus { border-color: var(--accent); }
.header-search button {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-light);
  padding: 4px;
}

/* 阅读进度条 */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: var(--accent);
  z-index: 200;
  width: 0;
  transition: width .1s;
}

/* Hero 区 */
.hero {
  background: var(--accent-bg);
  padding: 60px 24px 50px;
  text-align: center;
}
.hero h1 {
  font-size: 38px;
  margin-bottom: 12px;
  color: var(--accent);
}
.hero p {
  font-size: 18px;
  color: var(--text-light);
  max-width: 600px;
  margin: 0 auto 28px;
}
.hero-search {
  max-width: 520px;
  margin: 0 auto;
  display: flex;
  gap: 0;
}
.hero-search input {
  flex: 1;
  border: 2px solid var(--accent);
  border-right: none;
  border-radius: var(--radius) 0 0 var(--radius);
  padding: 14px 20px;
  font-size: 16px;
  outline: none;
}
.hero-search button {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 14px 28px;
  font-size: 16px;
  cursor: pointer;
  font-weight: 500;
}
.hero-search button:hover { background: var(--accent-light); }

/* 容器 */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}
.content-narrow {
  max-width: var(--content-width);
  margin: 0 auto;
}

/* 区块标题 */
.section-title {
  font-size: 24px;
  margin: 48px 0 24px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--accent);
  display: inline-block;
}

/* 精选文章 */
.featured-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-bottom: 40px;
}
.featured-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: box-shadow .2s, transform .2s;
}
.featured-card:hover {
  box-shadow: 0 4px 20px rgba(0,0,0,.08);
  transform: translateY(-2px);
}
.featured-card .cover {
  height: 180px;
  background: var(--accent-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.featured-card .cover img { width: 100%; height: 100%; object-fit: cover; }
.featured-card .body { padding: 20px; }
.featured-card .cat-tag {
  display: inline-block;
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 8px;
}
.featured-card h3 {
  font-size: 18px;
  margin-bottom: 8px;
  line-height: 1.4;
}
.featured-card h3 a { color: var(--text); }
.featured-card h3 a:hover { color: var(--accent); }
.featured-card .meta {
  font-size: 13px;
  color: var(--text-muted);
}

/* 文章列表 */
.article-list { display: flex; flex-direction: column; gap: 28px; }
.article-item {
  display: flex;
  gap: 24px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border);
}
.article-item .thumb {
  width: 220px;
  min-width: 220px;
  height: 140px;
  background: var(--accent-bg);
  border-radius: var(--radius);
  overflow: hidden;
}
.article-item .thumb img { width: 100%; height: 100%; object-fit: cover; }
.article-item .info { flex: 1; }
.article-item .cat-tag {
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 6px;
  display: inline-block;
}
.article-item h2 {
  font-size: 20px;
  margin-bottom: 8px;
  line-height: 1.4;
}
.article-item h2 a { color: var(--text); }
.article-item h2 a:hover { color: var(--accent); }
.article-item .excerpt {
  font-size: 15px;
  color: var(--text-light);
  margin-bottom: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.article-item .meta {
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  gap: 16px;
}

/* 分类入口 */
.category-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-bottom: 40px;
}
.category-card {
  text-align: center;
  padding: 24px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color .2s, background .2s;
}
.category-card:hover {
  border-color: var(--accent);
  background: var(--accent-bg);
}
.category-card .icon {
  width: 40px;
  height: 40px;
  margin: 0 auto 10px;
  color: var(--accent);
}
.category-card .name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.category-card .count {
  font-size: 12px;
  color: var(--text-muted);
}

/* 标签云 */
.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 40px;
}
.tag-cloud a {
  display: inline-block;
  padding: 6px 14px;
  background: var(--bg-soft);
  border-radius: 20px;
  font-size: 14px;
  color: var(--text-light);
  transition: all .2s;
}
.tag-cloud a:hover {
  background: var(--accent);
  color: #fff;
}

/* 侧边栏 */
.sidebar { width: 300px; min-width: 300px; }
.sidebar-widget {
  margin-bottom: 32px;
}
.sidebar-widget h4 {
  font-size: 16px;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  font-family: inherit;
}
.sidebar-popular li {
  list-style: none;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 10px;
}
.sidebar-popular li:last-child { border-bottom: none; }
.sidebar-popular .num {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
  min-width: 28px;
  font-family: Georgia, serif;
}
.sidebar-popular a {
  font-size: 14px;
  color: var(--text);
  line-height: 1.5;
}
.sidebar-popular a:hover { color: var(--accent); }

/* 带侧边栏布局 */
.layout-with-sidebar {
  display: flex;
  gap: 40px;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 40px 24px;
}
.layout-with-sidebar .main-content { flex: 1; min-width: 0; }

/* 面包屑 */
.breadcrumb {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 24px;
  padding: 16px 0;
}
.breadcrumb a { color: var(--text-light); }
.breadcrumb span { margin: 0 8px; }

/* 文章详情 */
.article-header {
  margin-bottom: 32px;
}
.article-header h1 {
  font-size: 34px;
  line-height: 1.3;
  margin-bottom: 16px;
}
.article-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 14px;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.article-meta .author-info {
  display: flex;
  align-items: center;
  gap: 10px;
}
.article-meta .avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: var(--accent);
  font-size: 14px;
}
.article-cover {
  width: 100%;
  height: 360px;
  object-fit: cover;
  border-radius: var(--radius);
  margin-bottom: 32px;
  background: var(--accent-bg);
}

/* TOC */
.toc-box {
  background: var(--bg-soft);
  border-left: 3px solid var(--accent);
  padding: 20px 24px;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin-bottom: 32px;
}
.toc-box .toc-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--accent);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.toc-box ul { list-style: none; }
.toc-box ul ul { padding-left: 20px; }
.toc-box li { margin: 6px 0; }
.toc-box a {
  font-size: 14px;
  color: var(--text-light);
  display: block;
  padding: 2px 0;
}
.toc-box a:hover { color: var(--accent); }

/* 正文 */
.article-body {
  font-size: 17px;
  line-height: 1.9;
}
.article-body h2 {
  font-size: 26px;
  margin: 40px 0 16px;
  padding-top: 20px;
  scroll-margin-top: 80px;
}
.article-body h3 {
  font-size: 21px;
  margin: 28px 0 12px;
  scroll-margin-top: 80px;
}
.article-body p { margin-bottom: 18px; }
.article-body ul, .article-body ol {
  margin: 0 0 18px 24px;
}
.article-body li { margin-bottom: 8px; }
.article-body blockquote {
  border-left: 3px solid var(--accent);
  padding: 12px 20px;
  margin: 20px 0;
  background: var(--bg-soft);
  color: var(--text-light);
  font-style: italic;
}
.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 15px;
}
.article-body th, .article-body td {
  border: 1px solid var(--border);
  padding: 10px 14px;
  text-align: left;
}
.article-body th {
  background: var(--accent-bg);
  font-weight: 600;
  color: var(--accent);
}
.article-body img {
  border-radius: var(--radius);
  margin: 20px 0;
}
.article-body a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* FAQ */
.faq-section {
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}
.faq-section h3 {
  font-size: 22px;
  margin-bottom: 20px;
}
.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  overflow: hidden;
}
.faq-item summary {
  padding: 16px 20px;
  font-weight: 600;
  cursor: pointer;
  font-size: 16px;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: '+';
  font-size: 20px;
  color: var(--accent);
  font-weight: 400;
}
.faq-item[open] summary::after { content: '−'; }
.faq-item .faq-answer {
  padding: 0 20px 16px;
  color: var(--text-light);
  font-size: 15px;
  line-height: 1.8;
}

/* 文章标签 */
.article-tags {
  margin-top: 32px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.article-tags a {
  padding: 5px 14px;
  background: var(--bg-soft);
  border-radius: 20px;
  font-size: 13px;
  color: var(--text-light);
}
.article-tags a:hover { background: var(--accent); color: #fff; }

/* 作者卡片 */
.author-card {
  margin-top: 40px;
  padding: 24px;
  background: var(--bg-soft);
  border-radius: var(--radius);
  display: flex;
  gap: 20px;
  align-items: flex-start;
}
.author-card .avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 600;
  flex-shrink: 0;
}
.author-card .info h4 { font-size: 17px; margin-bottom: 4px; font-family: inherit; }
.author-card .info .expertise { font-size: 13px; color: var(--accent); margin-bottom: 8px; }
.author-card .info p { font-size: 14px; color: var(--text-light); line-height: 1.6; }

/* CTA */
.cta-box {
  margin-top: 40px;
  padding: 28px;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  border-radius: var(--radius);
  color: #fff;
  text-align: center;
}
.cta-box h4 {
  color: #fff;
  font-size: 20px;
  margin-bottom: 8px;
}
.cta-box p {
  font-size: 15px;
  opacity: .9;
  margin-bottom: 16px;
}
.cta-box a {
  display: inline-block;
  background: #fff;
  color: var(--accent);
  padding: 10px 28px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 15px;
}
.cta-box a:hover { background: var(--accent-bg); }

/* 相关文章 */
.related-section {
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}
.related-section h3 { font-size: 22px; margin-bottom: 20px; }
.related-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.related-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.related-card .thumb {
  height: 120px;
  background: var(--accent-bg);
}
.related-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.related-card .body { padding: 14px; }
.related-card h4 { font-size: 15px; line-height: 1.4; font-family: inherit; }
.related-card h4 a { color: var(--text); }
.related-card h4 a:hover { color: var(--accent); }

/* 上一篇下一篇 */
.post-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  gap: 20px;
}
.post-nav a {
  flex: 1;
  padding: 16px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
}
.post-nav a:hover { border-color: var(--accent); background: var(--accent-bg); }
.post-nav .label { font-size: 12px; color: var(--text-muted); display: block; margin-bottom: 4px; }
.post-nav .next { text-align: right; }

/* 分页 */
.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 40px;
  flex-wrap: wrap;
}
.pagination a, .pagination span {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--text-light);
}
.pagination .page-current {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.pagination a:hover { border-color: var(--accent); color: var(--accent); }

/* 页脚 */
.site-footer {
  margin-top: 60px;
  border-top: 1px solid var(--border);
  background: var(--bg-soft);
  padding: 40px 0 24px;
}
.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
}
.footer-col h5 {
  font-size: 15px;
  margin-bottom: 16px;
  color: var(--text);
  font-family: inherit;
}
.footer-col p, .footer-col a {
  font-size: 14px;
  color: var(--text-light);
  line-height: 2;
  display: block;
}
.footer-col a:hover { color: var(--accent); }
.footer-bottom {
  max-width: var(--max-width);
  margin: 32px auto 0;
  padding: 20px 24px 0;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}

/* 404 */
.error-page {
  text-align: center;
  padding: 80px 24px;
}
.error-page h1 { font-size: 72px; color: var(--accent); margin-bottom: 16px; }
.error-page p { font-size: 18px; color: var(--text-light); margin-bottom: 24px; }
.error-page a {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  padding: 12px 32px;
  border-radius: var(--radius);
  font-weight: 500;
}

/* 搜索高亮 */
.search-highlight { background: #FFF3CD; padding: 1px 3px; border-radius: 2px; }

/* 关于页 */
.about-section { margin-bottom: 40px; }
.about-section h2 { font-size: 26px; margin-bottom: 16px; color: var(--accent); }
.about-section p { margin-bottom: 14px; color: var(--text-light); }
.team-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 24px;
}
.team-card {
  text-align: center;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.team-card .avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 600;
  margin: 0 auto 16px;
}
.team-card h4 { font-size: 18px; margin-bottom: 4px; font-family: inherit; }
.team-card .role { font-size: 13px; color: var(--accent); margin-bottom: 10px; }
.team-card p { font-size: 14px; color: var(--text-light); line-height: 1.6; }

/* 联系表单 */
.contact-form { max-width: 600px; }
.contact-form label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text);
}
.contact-form input, .contact-form textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 15px;
  margin-bottom: 20px;
  outline: none;
  font-family: inherit;
  transition: border-color .2s;
}
.contact-form input:focus, .contact-form textarea:focus { border-color: var(--accent); }
.contact-form textarea { min-height: 150px; resize: vertical; }
.contact-form button {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 12px 36px;
  border-radius: var(--radius);
  font-size: 16px;
  cursor: pointer;
  font-weight: 500;
}
.contact-form button:hover { background: var(--accent-light); }
.form-success {
  background: #D4EDDA;
  color: #155724;
  padding: 16px 20px;
  border-radius: var(--radius);
  margin-bottom: 20px;
}

/* 分类页头部 */
.category-header {
  padding: 40px 0 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
}
.category-header h1 { font-size: 30px; margin-bottom: 8px; }
.category-header p { color: var(--text-light); font-size: 16px; }

/* 响应式 */
@media (max-width: 900px) {
  .featured-grid { grid-template-columns: 1fr; }
  .category-grid { grid-template-columns: repeat(3, 1fr); }
  .related-grid { grid-template-columns: 1fr; }
  .layout-with-sidebar { flex-direction: column; }
  .sidebar { width: 100%; min-width: unset; }
  .footer-inner { grid-template-columns: 1fr 1fr; }
  .team-grid { grid-template-columns: 1fr; }
  .article-item { flex-direction: column; }
  .article-item .thumb { width: 100%; min-width: unset; height: 180px; }
  .main-nav { display: none; }
  .hero h1 { font-size: 28px; }
  .article-header h1 { font-size: 26px; }
}
