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

:root {
  --primary: #2b5876;
  --primary-light: #4e8098;
  --accent: #e07850;
  --accent-light: #f4a261;
  --text: #333333;
  --text-light: #666666;
  --text-muted: #999999;
  --bg: #ffffff;
  --bg-secondary: #f7f8fa;
  --bg-warm: #fdfcfb;
  --border: #e8e8e8;
  --border-light: #f0f0f0;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.08);
  --radius: 8px;
  --radius-lg: 12px;
  --max-width: 1200px;
  --header-height: 64px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans SC", sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

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

a:hover {
  color: var(--accent);
}

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

ul, ol {
  list-style: none;
}

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

/* ========== 顶部导航 ========== */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-light);
  height: var(--header-height);
}

.header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.logo {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo span {
  color: var(--primary);
}

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

.nav-links a {
  color: var(--text-light);
  font-size: 15px;
  font-weight: 500;
  padding: 4px 0;
  position: relative;
}

.nav-links a::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: width 0.25s;
  border-radius: 1px;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
}

.nav-links a:hover::after,
.nav-links a.active::after {
  width: 100%;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text);
  padding: 4px;
}

/* ========== 移动端导航 ========== */
.mobile-nav {
  display: none;
  position: fixed;
  top: var(--header-height);
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(8px);
  z-index: 99;
  padding: 24px;
}

.mobile-nav.open {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mobile-nav a {
  display: block;
  padding: 14px 16px;
  color: var(--text);
  font-size: 16px;
  border-radius: var(--radius);
  transition: background 0.2s;
}

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

/* ========== Hero 区域 ========== */
.hero {
  padding: 72px 0 56px;
  text-align: center;
  background: var(--bg-warm);
  border-bottom: 1px solid var(--border-light);
}

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

.hero p {
  font-size: 17px;
  color: var(--text-light);
  max-width: 540px;
  margin: 0 auto;
  line-height: 1.8;
}

/* ========== 板块入口卡片 ========== */
.section-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.section-desc {
  font-size: 15px;
  color: var(--text-muted);
  margin-bottom: 32px;
}

.section {
  padding: 56px 0;
}

.section-alt {
  background: var(--bg-secondary);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  transition: box-shadow 0.25s, transform 0.25s;
  display: flex;
  flex-direction: column;
}

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

.card-icon {
  font-size: 32px;
  margin-bottom: 16px;
}

.card h3 {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.card p {
  font-size: 14px;
  color: var(--text-light);
  line-height: 1.7;
  flex: 1;
}

.card-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  color: var(--primary);
  margin-top: 16px;
  font-weight: 500;
}

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

/* ========== 文章列表卡片 ========== */
.article-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.article-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: box-shadow 0.25s, transform 0.25s;
}

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

.article-card .tag {
  display: inline-block;
  font-size: 12px;
  color: var(--primary);
  background: rgba(43, 88, 118, 0.08);
  padding: 3px 10px;
  border-radius: 4px;
  margin-bottom: 12px;
  font-weight: 500;
}

.article-card h3 {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
  line-height: 1.5;
}

.article-card p {
  font-size: 14px;
  color: var(--text-light);
  line-height: 1.7;
  margin-bottom: 16px;
}

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

/* ========== 工具导航卡片 ========== */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.tool-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: box-shadow 0.25s, transform 0.25s;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

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

.tool-card .tool-icon {
  font-size: 28px;
  flex-shrink: 0;
}

.tool-card h4 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.tool-card p {
  font-size: 13px;
  color: var(--text-light);
  line-height: 1.6;
}

.filter-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 6px 18px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--bg);
  color: var(--text-light);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.filter-btn:hover,
.filter-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ========== 文章正文页 ========== */
.article-header {
  padding: 48px 0 32px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 40px;
}

.article-header .breadcrumb {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.article-header .breadcrumb a {
  color: var(--text-muted);
}

.article-header .breadcrumb a:hover {
  color: var(--primary);
}

.article-header h1 {
  font-size: 30px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 12px;
}

.article-header .meta {
  font-size: 14px;
  color: var(--text-muted);
  display: flex;
  gap: 20px;
}

.article-body {
  max-width: 780px;
  margin: 0 auto;
  padding: 0 24px 64px;
}

.article-body .container {
  max-width: none;
  padding: 0;
}

.article-body h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin: 40px 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
}

.article-body h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin: 32px 0 12px;
}

.article-body p {
  margin-bottom: 16px;
  line-height: 1.85;
  color: var(--text);
}

.article-body ul,
.article-body ol {
  margin: 12px 0 20px 24px;
}

.article-body ul {
  list-style: disc;
}

.article-body ol {
  list-style: decimal;
}

.article-body li {
  margin-bottom: 8px;
  line-height: 1.75;
  color: var(--text);
}

.article-body code {
  background: var(--bg-secondary);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 14px;
  font-family: "Fira Code", "Source Code Pro", monospace;
  color: var(--accent);
}

.article-body pre {
  background: #2d3436;
  color: #dfe6e9;
  padding: 20px 24px;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 20px 0;
  font-size: 14px;
  line-height: 1.7;
}

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

.article-body blockquote {
  border-left: 3px solid var(--accent-light);
  background: var(--bg-warm);
  padding: 16px 20px;
  margin: 20px 0;
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text-light);
}

.article-body strong {
  font-weight: 600;
  color: var(--text);
}

.tip-box {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: var(--radius);
  padding: 16px 20px;
  margin: 20px 0;
  font-size: 14px;
  line-height: 1.7;
}

.tip-box .tip-title {
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 4px;
}

.warn-box {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius);
  padding: 16px 20px;
  margin: 20px 0;
  font-size: 14px;
  line-height: 1.7;
}

.warn-box .warn-title {
  font-weight: 600;
  color: #d97706;
  margin-bottom: 4px;
}

/* ========== 列表页头部 ========== */
.page-header {
  padding: 48px 0 40px;
  background: var(--bg-warm);
  border-bottom: 1px solid var(--border-light);
}

.page-header h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.page-header p {
  font-size: 15px;
  color: var(--text-light);
}

/* ========== 页脚 ========== */
.footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-light);
  padding: 40px 0;
  text-align: center;
}

.footer p {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.8;
}

.footer .footer-links {
  margin-bottom: 16px;
  display: flex;
  justify-content: center;
  gap: 24px;
}

.footer .footer-links a {
  color: var(--text-light);
  font-size: 14px;
}

/* ========== 回到顶部 ========== */
.back-to-top {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
  z-index: 50;
  color: var(--text-light);
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ========== 响应式 ========== */
@media (max-width: 1024px) {
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .tool-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  html {
    font-size: 15px;
  }

  .nav-links {
    display: none;
  }

  .menu-toggle {
    display: block;
  }

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

  .hero h1 {
    font-size: 26px;
  }

  .section {
    padding: 40px 0;
  }

  .card-grid {
    grid-template-columns: 1fr;
  }

  .article-grid {
    grid-template-columns: 1fr;
  }

  .tool-grid {
    grid-template-columns: 1fr;
  }

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

  .article-header .meta {
    flex-direction: column;
    gap: 4px;
  }

  .footer .footer-links {
    flex-direction: column;
    gap: 8px;
  }
}
