/* ===== caadb.cc 个人技术博客 - 全局样式 ===== */

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --text: #1e293b;
  --text-light: #64748b;
  --bg: #f8fafc;
  --bg-card: #ffffff;
  --border: #e2e8f0;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-lg: 0 10px 30px rgba(0,0,0,.08);
  --radius: 12px;
  --max-width: 960px;
}

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

html { scroll-behavior: smooth; }

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

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

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

/* ===== 导航栏 ===== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-logo {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.5px;
}
.nav-logo span { color: var(--primary); }
.nav-links { display: flex; gap: 8px; align-items: center; }
.nav-links a {
  color: var(--text-light);
  font-size: 15px;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 8px;
  transition: all .2s;
}
.nav-links a:hover,
.nav-links a.active {
  color: var(--primary);
  background: var(--primary-light);
}
.nav-toggle { display: none; font-size: 24px; background: none; border: none; cursor: pointer; color: var(--text); }

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

/* ===== 首页 Hero ===== */
.hero {
  background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
  color: #fff;
  padding: 80px 0 70px;
  text-align: center;
}
.hero h1 {
  font-size: 40px;
  font-weight: 800;
  letter-spacing: -1px;
  margin-bottom: 16px;
}
.hero p {
  font-size: 18px;
  opacity: .9;
  max-width: 560px;
  margin: 0 auto 28px;
}
.hero-tags {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.hero-tags span {
  background: rgba(255,255,255,.18);
  border: 1px solid rgba(255,255,255,.25);
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 14px;
}

/* ===== 区块标题 ===== */
.section { padding: 56px 0; }
.section-title {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -.5px;
}
.section-desc { color: var(--text-light); margin-bottom: 32px; font-size: 15px; }

/* ===== 文章卡片网格 ===== */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform .2s, box-shadow .2s;
  display: flex;
  flex-direction: column;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}
.card-banner {
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
}
.card-body { padding: 20px; flex: 1; display: flex; flex-direction: column; }
.card-tag {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-light);
  padding: 3px 10px;
  border-radius: 999px;
  margin-bottom: 10px;
  align-self: flex-start;
}
.card-body h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
  line-height: 1.5;
}
.card-body h3 a { color: var(--text); }
.card-body h3 a:hover { color: var(--primary); }
.card-body p { color: var(--text-light); font-size: 14px; flex: 1; }
.card-meta {
  margin-top: 14px;
  font-size: 13px;
  color: var(--text-light);
  display: flex;
  gap: 14px;
}

/* ===== 关于页 ===== */
.about-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px;
  box-shadow: var(--shadow);
}
.about-wrap h2 {
  font-size: 22px;
  margin: 28px 0 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--primary-light);
}
.about-wrap h2:first-child { margin-top: 0; }
.about-wrap p, .about-wrap li { color: var(--text); font-size: 15px; margin-bottom: 10px; }
.about-wrap ul { padding-left: 22px; }
.about-wrap strong { color: var(--primary-dark); }

/* ===== 文章详情页 ===== */
.article-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 48px 0 36px;
}
.article-header h1 {
  font-size: 30px;
  font-weight: 700;
  margin-bottom: 14px;
  letter-spacing: -.5px;
}
.article-meta {
  font-size: 14px;
  color: var(--text-light);
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.article-body {
  background: var(--bg-card);
  padding: 40px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-top: 24px;
}
.article-body h2 {
  font-size: 22px;
  margin: 32px 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.article-body h2:first-child { margin-top: 0; }
.article-body h3 { font-size: 18px; margin: 24px 0 10px; }
.article-body p { margin-bottom: 14px; color: var(--text); }
.article-body ul, .article-body ol { padding-left: 24px; margin-bottom: 14px; }
.article-body li { margin-bottom: 6px; }
.article-body code {
  background: #f1f5f9;
  color: #db2777;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 14px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}
.article-body pre {
  background: #1e293b;
  color: #e2e8f0;
  padding: 20px;
  border-radius: 10px;
  overflow-x: auto;
  margin: 16px 0;
  font-size: 14px;
  line-height: 1.6;
}
.article-body pre code { background: none; color: inherit; padding: 0; }
.article-body blockquote {
  border-left: 4px solid var(--primary);
  background: var(--primary-light);
  padding: 14px 20px;
  margin: 16px 0;
  border-radius: 0 8px 8px 0;
  color: var(--text);
}

/* ===== 页脚 ===== */
.footer {
  background: #0f172a;
  color: #94a3b8;
  padding: 40px 0 28px;
  margin-top: 60px;
  text-align: center;
}
.footer p { font-size: 14px; margin-bottom: 8px; }
.footer a { color: #94a3b8; }
.footer a:hover { color: #fff; }
.footer .icp {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  margin-top: 8px;
}
.footer .icp img { width: 16px; height: 16px; }

/* ===== 响应式 ===== */
@media (max-width: 768px) {
  .hero h1 { font-size: 28px; }
  .hero p { font-size: 16px; }
  .nav-toggle { display: block; }
  .nav-links {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: #fff;
    flex-direction: column;
    padding: 12px;
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
  }
  .nav-links.show { display: flex; }
  .nav-links a { padding: 12px 16px; }
  .section-title { font-size: 22px; }
  .article-body { padding: 24px; }
  .article-header h1 { font-size: 24px; }
  .about-wrap { padding: 24px; }
}
