/* ============================================================
   前台样式 · 博克园
============================================================ */
:root {
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-light: #eef2ff;
  --accent: #7c3aed;
  --pink: #ec4899;
  --grad: linear-gradient(135deg, #4f46e5 0%, #7c3aed 55%, #ec4899 100%);
  --text: #1f2937;
  --text-2: #4b5563;
  --muted: #8a94a6;
  --border: #e9edf3;
  --bg: #f5f6fa;
  --card: #ffffff;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(30, 40, 90, .06);
  --shadow-lg: 0 10px 30px rgba(50, 60, 120, .12);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", -apple-system, 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 .15s; }
a:hover { color: var(--primary-dark); }
.container { max-width: 1140px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); font-size: 13px; }
.small { font-size: 12px; }
input, select, textarea, button { font-family: inherit; }

/* ---------- 顶栏 ---------- */
.site-header {
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}
.header-inner { display: flex; align-items: center; gap: 18px; height: 62px; }
.logo {
  font-size: 21px; font-weight: 800; white-space: nowrap;
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.main-nav { display: flex; align-items: center; gap: 6px; flex: 1; justify-content: flex-end; flex-wrap: wrap; }
.main-nav > a:not(.btn) {
  color: var(--text-2); font-size: 14px; padding: 6px 12px; border-radius: 9px;
}
.main-nav > a:not(.btn):hover { background: var(--primary-light); color: var(--primary); text-decoration: none; }
.nav-search input {
  border: 1px solid var(--border); border-radius: 22px;
  padding: 7px 16px; width: 190px; font-size: 13px; outline: none;
  background: var(--bg); transition: box-shadow .15s, border-color .15s;
}
.nav-search input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79, 70, 229, .12); background: #fff; }
.nav-link { color: var(--text-2); }

/* ---------- 首页 Hero ---------- */
.hero {
  background: var(--grad);
  border-radius: 0 0 28px 28px;
  color: #fff;
  padding: 52px 20px 46px;
  text-align: center;
  margin-bottom: 30px;
  position: relative;
  overflow: hidden;
}
.hero::before, .hero::after {
  content: ''; position: absolute; border-radius: 50%;
  background: rgba(255, 255, 255, .12);
}
.hero::before { width: 300px; height: 300px; top: -120px; right: -60px; }
.hero::after { width: 200px; height: 200px; bottom: -90px; left: 6%; }
.hero h1 { margin: 0 0 10px; font-size: 32px; letter-spacing: 1px; position: relative; }
.hero p { margin: 0 auto 22px; color: rgba(255, 255, 255, .88); max-width: 560px; font-size: 15px; position: relative; }
.hero-actions { display: flex; gap: 12px; justify-content: center; position: relative; flex-wrap: wrap; }
.hero-actions .btn-ghost {
  background: rgba(255, 255, 255, .16); border-color: rgba(255, 255, 255, .5); color: #fff;
}
.hero-actions .btn-ghost:hover { background: rgba(255, 255, 255, .28); color: #fff; border-color: #fff; }
.hero-actions .btn-white { background: #fff; border-color: #fff; color: var(--primary); font-weight: 600; }
.hero-actions .btn-white:hover { background: #f1f0ff; color: var(--primary-dark); }
@media (max-width: 640px) { .hero h1 { font-size: 24px; } .hero { padding: 38px 16px 34px; } }

/* ---------- 提示条 ---------- */
.alert { padding: 11px 16px; border-radius: 10px; margin: 14px 0; font-size: 14px; }
.alert-success { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.alert-danger  { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.alert-warning { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }
.alert-info    { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }

/* ---------- 布局 ---------- */
.layout-2col { display: grid; grid-template-columns: 1fr 300px; gap: 26px; padding: 6px 0 44px; }
@media (max-width: 880px) { .layout-2col { grid-template-columns: 1fr; } }
.section-title {
  font-size: 19px; margin: 0 0 16px; display: flex; align-items: center; gap: 8px;
}
.section-title::before {
  content: ''; width: 4px; height: 18px; border-radius: 3px; background: var(--grad);
}

/* ---------- 文章卡片 ---------- */
.post-card {
  background: var(--card); border-radius: var(--radius); padding: 20px 22px;
  margin-bottom: 16px; border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: transform .18s ease, box-shadow .18s ease;
}
.post-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.post-card h3 { margin: 0 0 10px; font-size: 17.5px; line-height: 1.5; }
.post-card h3 a { color: var(--text); }
.post-card h3 a:hover { color: var(--primary); }
.post-meta { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.post-meta span { display: inline-flex; align-items: center; gap: 3px; }
.post-excerpt { margin: 0; color: #556; font-size: 14px; }
.blog-badge {
  background: var(--primary-light); color: var(--primary);
  border-radius: 999px; padding: 2px 11px; font-size: 12.5px; font-weight: 500;
}
.blog-badge:hover { background: #e0e7ff; text-decoration: none; }
.cat-badge {
  background: #f0fdf4; color: #16a34a;
  border-radius: 999px; padding: 2px 11px; font-size: 12.5px;
}

/* ---------- 侧栏 ---------- */
.side-card {
  background: var(--card); border-radius: var(--radius); padding: 18px 20px;
  margin-bottom: 16px; border: 1px solid var(--border); box-shadow: var(--shadow);
}
.side-card h3 { margin: 0 0 12px; font-size: 15px; }
.side-list { list-style: none; margin: 0; padding: 0; }
.side-list li {
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
  padding: 8px 0; border-bottom: 1px dashed var(--border); font-size: 13px;
}
.side-list li:last-child { border-bottom: 0; }
.side-list a { color: var(--text-2); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-list a:hover { color: var(--primary); }
.side-list .muted { white-space: nowrap; }
.cta-card {
  background: var(--grad); color: #fff; border: 0;
}
.cta-card h3 { color: #fff; }
.cta-card p { color: rgba(255, 255, 255, .88); font-size: 13px; margin: 0 0 14px; }
.cta-card .btn-white { background: #fff; border-color: #fff; color: var(--primary); font-weight: 600; }
.cta-card .btn-white:hover { background: #f1f0ff; color: var(--primary-dark); }

/* ---------- 博客目录 ---------- */
.blog-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px; margin-bottom: 26px;
}
.blog-item {
  display: block; background: var(--card); border-radius: var(--radius);
  padding: 20px; border: 1px solid var(--border); color: inherit;
  box-shadow: var(--shadow); transition: transform .18s, box-shadow .18s;
}
.blog-item:hover { text-decoration: none; transform: translateY(-3px); box-shadow: var(--shadow-lg); color: inherit; }
.blog-item-name { font-weight: 700; font-size: 16.5px; color: var(--text); margin-bottom: 6px; }
.blog-item-desc {
  font-size: 13px; color: #667; min-height: 40px; margin-bottom: 12px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.blog-item-meta {
  display: flex; justify-content: space-between; font-size: 12px; color: var(--muted);
  border-top: 1px dashed var(--border); padding-top: 10px;
}

/* ---------- 博客主页 ---------- */
.blog-hero {
  background: var(--grad); border-radius: 20px; padding: 34px 30px;
  margin: 26px 0 18px; color: #fff; position: relative; overflow: hidden;
}
.blog-hero::after {
  content: ''; position: absolute; width: 220px; height: 220px; border-radius: 50%;
  background: rgba(255, 255, 255, .12); top: -80px; right: -40px;
}
.blog-hero h1 { margin: 0 0 8px; font-size: 25px; position: relative; }
.blog-hero p { margin: 4px 0; color: rgba(255, 255, 255, .9); font-size: 14px; position: relative; }
.blog-hero .muted { color: rgba(255, 255, 255, .75); }
.cat-bar { display: flex; gap: 9px; flex-wrap: wrap; margin-bottom: 18px; }
.cat-chip {
  background: #fff; border: 1px solid var(--border); border-radius: 999px;
  padding: 5px 16px; font-size: 13px; color: var(--text-2);
  transition: all .15s;
}
.cat-chip:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.cat-chip.on { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---------- 文章详情 ---------- */
.post-full {
  background: var(--card); border-radius: 18px; padding: 38px 40px;
  margin: 26px 0; border: 1px solid var(--border); box-shadow: var(--shadow);
}
@media (max-width: 640px) { .post-full { padding: 24px 20px; } }
.post-title { margin: 0 0 14px; font-size: 27px; line-height: 1.4; }
.post-meta { margin-bottom: 0; padding-bottom: 18px; border-bottom: 1px solid var(--border); }
.post-content {
  font-size: 15.8px; color: #333; line-height: 2.0; margin-top: 24px;
  word-break: break-word; letter-spacing: .3px;
}
.badge-draft {
  background: #fef3c7; color: #92400e; border-radius: 999px;
  padding: 2px 11px; font-size: 12px; font-weight: 500;
}

/* ---------- 评论 ---------- */
.comment-area {
  background: var(--card); border-radius: 18px; padding: 26px 30px;
  margin-bottom: 44px; border: 1px solid var(--border); box-shadow: var(--shadow);
}
.comment-area h3 { margin: 0 0 6px; font-size: 17px; }
.comment { display: flex; gap: 12px; padding: 16px 0; border-bottom: 1px dashed var(--border); }
.comment:last-of-type { border-bottom: 0; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 16px;
  background: var(--grad);
}
.comment:nth-child(4n+1) .avatar { background: linear-gradient(135deg, #f59e0b, #f97316); }
.comment:nth-child(4n+2) .avatar { background: linear-gradient(135deg, #10b981, #059669); }
.comment:nth-child(4n+3) .avatar { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.comment-body-c { flex: 1; min-width: 0; }
.comment-head { display: flex; gap: 10px; align-items: baseline; }
.comment-body { margin-top: 3px; color: #444; font-size: 14px; }
.comment-form { margin-top: 20px; display: flex; flex-direction: column; gap: 10px; }
.comment-form textarea, .comment-form input {
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px;
  font-size: 14px; background: var(--bg); transition: border-color .15s, box-shadow .15s;
}
.comment-form textarea:focus, .comment-form input:focus {
  border-color: var(--primary); outline: none; background: #fff;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, .12);
}
.comment-form .btn { align-self: flex-start; }

/* ---------- 表单 ---------- */
.auth-card {
  max-width: 420px; background: var(--card); border-radius: 18px;
  padding: 32px; margin: 50px auto; border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}
.auth-card h2 { margin: 0 0 4px; font-size: 22px; }
.auth-card label { display: block; font-size: 13px; color: var(--text-2); margin: 14px 0 5px; font-weight: 500; }
.auth-card input {
  width: 100%; border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 13px; font-size: 14px; background: var(--bg);
  transition: border-color .15s, box-shadow .15s;
}
.auth-card input:focus {
  border-color: var(--primary); outline: none; background: #fff;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, .12);
}
.auth-card button { margin-top: 20px; }
.auth-tip { text-align: center; font-size: 13px; color: var(--muted); margin-top: 16px; }
.empty-card {
  background: var(--card); border: 1px dashed #cdd4e0; border-radius: var(--radius);
  padding: 34px; color: #667; text-align: center; margin: 16px 0;
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-block; border: 1px solid var(--border); background: #fff; color: var(--text-2);
  border-radius: 10px; padding: 8px 18px; font-size: 14px; cursor: pointer;
  transition: all .15s; font-weight: 500;
}
.btn:hover { text-decoration: none; border-color: var(--primary); color: var(--primary); box-shadow: var(--shadow); }
.btn-primary {
  background: var(--grad); border-color: transparent; color: #fff; font-weight: 600;
}
.btn-primary:hover { color: #fff; filter: brightness(1.08); box-shadow: 0 6px 18px rgba(99, 82, 226, .35); }
.btn-block { display: block; width: 100%; text-align: center; }

/* ---------- 分页 ---------- */
.pager { display: flex; gap: 7px; justify-content: center; margin: 26px 0; flex-wrap: wrap; }
.pager a, .pager span {
  padding: 6px 14px; border: 1px solid var(--border); border-radius: 10px;
  font-size: 13px; color: var(--text-2); background: #fff; transition: all .15s;
}
.pager a:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.pager .cur { background: var(--grad); border-color: transparent; color: #fff; font-weight: 600; }
.pager .dots { border: 0; background: none; }

/* ---------- 搜索页 ---------- */
.search-page-form { display: flex; gap: 10px; margin-bottom: 18px; }
.search-page-form input {
  flex: 1; border: 1px solid var(--border); border-radius: 12px;
  padding: 11px 16px; font-size: 14px; background: #fff;
}
.search-page-form input:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px rgba(79, 70, 229, .12); }

/* ---------- 页脚 ---------- */
.site-footer {
  border-top: 1px solid var(--border); background: #fff;
  padding: 22px 0; margin-top: 20px;
}
.site-footer p { margin: 0; color: var(--muted); font-size: 13px; text-align: center; }
