/* ==========================================
   污水处理十万个为什么 - 主样式表
   配色：水蓝色系 | 专业 | 简洁 | 响应式
   ========================================== */

/* === 变量 === */
:root {
  --primary: #0d6e7e;
  --primary-dark: #095560;
  --primary-light: #e0f4f7;
  --primary-lighter: #f0f9fb;
  --accent: #0284c7;
  --accent-light: #e0f2fe;
  --text: #1a1a2e;
  --text-secondary: #555;
  --text-muted: #888;
  --bg: #ffffff;
  --bg-alt: #f8fafb;
  --bg-card: #ffffff;
  --border: #e5e7eb;
  --border-light: #f0f0f0;
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.1);
  --max-width: 1200px;
  --header-height: 60px;
}

/* === 基础重置 === */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg-alt);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

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

/* === 顶部导航 === */
.site-header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

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

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary);
  white-space: nowrap;
  flex-shrink: 0;
}
.logo:hover { color: var(--primary-dark); }
.logo-icon { font-size: 1.4rem; }

.main-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: center;
}
.main-nav a {
  padding: 6px 12px;
  font-size: 0.875rem;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  white-space: nowrap;
  transition: all 0.2s;
}
.main-nav a:hover {
  background: var(--primary-lighter);
  color: var(--primary);
}

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

.search-toggle, .menu-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px;
  cursor: pointer;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.search-toggle:hover, .menu-toggle:hover {
  background: var(--primary-lighter);
  color: var(--primary);
}
.menu-toggle { display: none; }

/* 搜索栏 */
.search-bar {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
}
.search-bar.open {
  max-height: 100px;
}
.search-bar-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 12px 20px;
  position: relative;
}
.search-form {
  display: flex;
  gap: 10px;
}
.search-input {
  flex: 1;
  padding: 10px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}
.search-input:focus {
  border-color: var(--primary);
}
.search-btn {
  padding: 10px 24px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s;
}
.search-btn:hover { background: var(--primary-dark); }

.search-suggestions {
  display: none;
  position: absolute;
  top: 100%;
  left: 20px;
  right: 20px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  max-height: 320px;
  overflow-y: auto;
}
.search-suggestions.show { display: block; }
.suggestion-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-light);
  transition: background 0.15s;
}
.suggestion-item:last-child { border-bottom: none; }
.suggestion-item:hover { background: var(--primary-lighter); }
.suggestion-title { color: var(--text); font-size: 0.95rem; flex: 1; }
.suggestion-cat { color: var(--text-muted); font-size: 0.8rem; margin-left: 12px; white-space: nowrap; }

/* === 主体区域 === */
.site-main {
  flex: 1;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px 60px;
  width: 100%;
}

/* === Hero 区域 === */
.hero {
  background: linear-gradient(135deg, #063c48 0%, #0d6e7e 40%, #0a8fa0 100%);
  color: #fff;
  padding: 60px 20px;
  text-align: center;
  margin: 0 -20px;
}

.hero-inner {
  max-width: 700px;
  margin: 0 auto;
}

.hero h1 {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 12px;
  letter-spacing: -0.5px;
}

.hero-subtitle {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 8px;
  opacity: 0.95;
}

.hero-desc {
  font-size: 0.95rem;
  opacity: 0.8;
  margin-bottom: 28px;
  line-height: 1.6;
}

.hero-search form {
  display: flex;
  gap: 10px;
  max-width: 520px;
  margin: 0 auto;
}
.hero-search input {
  flex: 1;
  padding: 14px 20px;
  border: none;
  border-radius: var(--radius);
  font-size: 1.05rem;
  outline: none;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}
.hero-search button {
  padding: 14px 28px;
  background: #fff;
  color: var(--primary);
  border: none;
  border-radius: var(--radius);
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  transition: all 0.2s;
}
.hero-search button:hover {
  background: var(--primary-lighter);
  transform: translateY(-1px);
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin-top: 28px;
  font-size: 0.9rem;
  opacity: 0.85;
}
.hero-stats strong { color: #fff; }

/* === 区块标题 === */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.section-header h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
}
.view-all {
  font-size: 0.9rem;
  color: var(--text);
  font-weight: 500;
}
.view-all:hover { text-decoration: underline; }

/* === 分类卡片网格 === */
.categories-grid {
  padding: 48px 0;
}
.grid-6 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.cat-card {
  display: block;
  padding: 28px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all 0.25s;
  box-shadow: var(--shadow);
}
.cat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}
.cat-icon {
  font-size: 2rem;
  display: block;
  margin-bottom: 12px;
}
.cat-card h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}
.cat-count {
  font-size: 0.85rem;
  color: var(--primary);
  margin-bottom: 8px;
  font-weight: 600;
}
.cat-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* === 问答列表 === */
.latest-section, .hot-section {
  padding: 32px 0;
}
.qa-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.qa-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  transition: all 0.2s;
  gap: 16px;
}
.qa-list-item:hover {
  border-color: var(--primary);
  background: var(--primary-lighter);
  transform: translateX(4px);
}

.qa-list-main {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex: 1;
  min-width: 0;
}
.qa-list-main h3 {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.5;
}
.qa-list-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* === 难度标签 === */
.level-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 22px;
  padding: 0 8px;
  border-radius: 11px;
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
}
.level-L1 { background: #e0f2fe; color: #0369a1; }
.level-L2 { background: #dcfce7; color: #15803d; }
.level-L3 { background: #fef3c7; color: #b45309; }
.level-L4 { background: #fce7f3; color: #be185d; }

/* === 专题卡片 === */
.topics-preview {
  padding: 40px 0;
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.topic-card, .topic-card-large {
  display: block;
  padding: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all 0.25s;
  box-shadow: var(--shadow);
}
.topic-card:hover, .topic-card-large:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}
.topic-card h4, .topic-card-large h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}
.topic-card p, .topic-card-large p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}
.topic-icon { font-size: 2rem; display: block; margin-bottom: 12px; }
.topic-status {
  display: inline-block;
  margin-top: 12px;
  padding: 3px 10px;
  background: var(--primary-lighter);
  color: var(--primary);
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* === 面包屑 === */
.breadcrumb {
  padding: 16px 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.breadcrumb a {
  color: var(--text-secondary);
}
.breadcrumb a:hover {
  color: var(--primary);
}
.breadcrumb span {
  margin: 0 6px;
  color: var(--border);
}

/* === 页面标题 === */
.page-header {
  padding: 20px 0 32px;
}
.page-header h1 {
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 8px;
  color: var(--text);
}
.page-header p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* === 分类页 === */
.category-page {
  padding-bottom: 40px;
}

.cat-header {
  padding: 20px 0 12px;
}
.cat-header h1 {
  font-size: 1.7rem;
  font-weight: 800;
}
.cat-header p {
  color: var(--text-muted);
  margin-top: 4px;
}

.subcat-nav {
  padding: 12px 0 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.subcat-chip {
  display: inline-block;
  padding: 6px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  transition: all 0.2s;
}
.subcat-chip:hover, .subcat-chip.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* === 问答详情 === */
.qa-detail-page {
  padding-bottom: 60px;
}

.qa-article {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 40px;
  box-shadow: var(--shadow);
}

.qa-article-header {
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 2px solid var(--border-light);
}

.qa-meta-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.qa-meta-cat {
  font-size: 0.8rem;
  color: var(--primary);
  background: var(--primary-lighter);
  padding: 3px 10px;
  border-radius: 12px;
  font-weight: 600;
}
.qa-meta-date {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.qa-article-header h1 {
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1.4;
  color: var(--text);
  margin-bottom: 16px;
}

.qa-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tag {
  display: inline-block;
  padding: 4px 12px;
  background: var(--accent-light);
  color: var(--text);
  border-radius: 14px;
  font-size: 0.78rem;
  font-weight: 500;
  transition: all 0.2s;
}
.tag:hover {
  background: var(--accent);
  color: #fff;
}

/* 问答内容排版 */
.qa-content {
  font-size: 1rem;
  line-height: 1.85;
  color: var(--text);
}
.qa-content h2 {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 32px 0 12px;
  padding-left: 14px;
  border-left: 4px solid var(--primary);
  color: var(--primary-dark);
}
.qa-content h2:first-child {
  margin-top: 0;
}
.qa-content h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 20px 0 8px;
  color: var(--text);
}
.qa-content p {
  margin-bottom: 12px;
}
.qa-content ul, .qa-content ol {
  margin: 8px 0 16px 20px;
}
.qa-content li {
  margin-bottom: 6px;
}
.qa-content strong {
  color: var(--primary-dark);
}
.qa-content code {
  background: var(--bg-alt);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
  color: var(--text);
}
.qa-content a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* 难度说明 */
.level-info {
  margin-top: 24px;
  padding: 20px 24px;
  background: var(--bg-alt);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.level-info h4 {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--text-secondary);
}
.level-info ul {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}
.level-info li {
  font-size: 0.82rem;
  color: var(--text-muted);
}
.level-info li strong {
  color: var(--text);
}

/* 相关问答 */
.related-section {
  margin-top: 40px;
}
.related-section h2 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 16px;
}

/* === 标签云 === */
.tags-page {
  padding-bottom: 40px;
}
.tags-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 20px 0;
}
.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-secondary);
  transition: all 0.2s;
}
.tag-chip:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.tag-chip-count {
  font-size: 0.75rem;
  opacity: 0.7;
}

/* === 搜索页 === */
.search-page {
  padding-bottom: 40px;
}
.search-page-header {
  padding: 32px 0 24px;
}
.search-page-header h1 {
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 16px;
}
.search-page-form {
  display: flex;
  gap: 10px;
  max-width: 600px;
}
.search-page-form input {
  flex: 1;
  padding: 12px 18px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  outline: none;
}
.search-page-form input:focus { border-color: var(--primary); }
.search-page-form button {
  padding: 12px 28px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}
.search-page-form button:hover { background: var(--primary-dark); }

.search-result-info {
  padding: 8px 0 20px;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* === 关于页 === */
.about-page {
  padding-bottom: 40px;
}
.about-content {
  max-width: 760px;
}
.about-section {
  margin-bottom: 32px;
}
.about-section h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--primary-dark);
}
.about-section p {
  margin-bottom: 10px;
  font-size: 0.95rem;
  color: var(--text);
  line-height: 1.8;
}
.about-section ul {
  list-style: disc;
  margin-left: 20px;
}
.about-section li {
  margin-bottom: 8px;
  font-size: 0.95rem;
  line-height: 1.6;
}
.btn-link {
  display: inline-block;
  padding: 10px 20px;
  background: var(--primary);
  color: #fff !important;
  border-radius: var(--radius);
  font-weight: 600;
  transition: background 0.2s;
}
.btn-link:hover { background: var(--primary-dark); }

/* === 404 === */
.error-page {
  text-align: center;
  padding: 80px 20px;
}
.error-content h1 {
  font-size: 6rem;
  font-weight: 900;
  color: var(--primary);
  line-height: 1;
  margin-bottom: 8px;
}
.error-content h2 {
  font-size: 1.5rem;
  color: var(--text);
  margin-bottom: 12px;
}
.error-content p {
  color: var(--text-muted);
  margin-bottom: 28px;
}
.error-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
}
.btn-primary, .btn-secondary {
  display: inline-block;
  padding: 10px 24px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.2s;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-secondary {
  background: var(--bg-alt);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--border); }

/* === 空状态 === */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
  font-size: 1rem;
}
.empty-state .hint {
  font-size: 0.85rem;
  margin-top: 8px;
}

/* === 页脚 === */
.site-footer {
  background: #1a1a2e;
  color: #ccc;
  padding: 40px 20px 20px;
  margin-top: auto;
}
.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 30px;
}
.footer-col h4 {
  color: #fff;
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 12px;
}
.footer-col ul {
  list-style: none;
}
.footer-col li {
  margin-bottom: 6px;
}
.footer-col a {
  color: #aaa;
  font-size: 0.85rem;
  transition: color 0.2s;
}
.footer-col a:hover { color: #fff; }
.footer-col p {
  font-size: 0.85rem;
  line-height: 1.6;
}
.footer-bottom {
  grid-column: 1 / -1;
  text-align: center;
  padding-top: 20px;
  margin-top: 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
  font-size: 0.8rem;
  color: #888;
}
.footer-bottom a { color: #aaa; }

/* === 响应式 === */
@media (max-width: 992px) {
  .grid-6 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .qa-article { padding: 24px; }
}

@media (max-width: 768px) {
  :root { --header-height: 56px; }

  .main-nav {
    display: none;
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 2px solid var(--border);
    flex-direction: column;
    padding: 8px 16px;
    gap: 0;
    box-shadow: var(--shadow-md);
  }
  .main-nav.open { display: flex; }
  .main-nav a {
    padding: 10px 12px;
    width: 100%;
  }
  .menu-toggle { display: flex; }

  .hero { padding: 40px 16px; }
  .hero h1 { font-size: 1.8rem; }
  .hero-subtitle { font-size: 1rem; }
  .hero-search form { flex-direction: column; }
  .hero-stats { flex-direction: column; gap: 8px; }

  .grid-6 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }

  .qa-list-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 12px 16px;
  }
  .qa-list-item:hover { transform: none; }

  .qa-article { padding: 20px; }
  .qa-article-header h1 { font-size: 1.35rem; }

  .level-info ul { grid-template-columns: 1fr; }

  .footer-inner { grid-template-columns: 1fr; text-align: center; }

  .search-page-form { flex-direction: column; }
  .qa-content { font-size: 0.95rem; }
}

@media (max-width: 480px) {
  .hero h1 { font-size: 1.5rem; }
  .cat-card { padding: 20px; }
  .section-header h2 { font-size: 1.15rem; }
}
