/* ============================================================
   博客模板 - 样式（原生 CSS，无外部依赖，响应式）
   聚焦：文章列表 + 文章详情的清爽阅读体验
   ============================================================ */
:root {
  --bg: #ffffff;
  --surface: #f7f9fc;
  --text: #1f2933;
  --muted: #5b6b7b;
  --border: #e5e9f0;
  --accent: #2f6fed;
  --accent-weak: #eaf1ff;
  --maxw: 1080px;
  --radius: 12px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.7;
  font-size: 15px;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.container-narrow { max-width: 760px; }

/* ---------- 顶部导航 ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--border);
}
.site-header .container { display: flex; align-items: center; height: 72px; }
.logo { display: flex; align-items: center; gap: 10px; color: var(--text); }
.logo:hover { text-decoration: none; }
.logo-img { width: 34px; height: 34px; object-fit: contain; border-radius: 8px; }
.logo-text { font-size: 18px; font-weight: 600; }
.site-name {
  position: relative;
  font-size: 26px; font-weight: 800; letter-spacing: -0.5px;
  background: linear-gradient(120deg, #2f6fed, #7c3aed 55%, #db2777);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  margin-right: 4px; padding: 4px 0;
}
.site-name::after {
  content: ""; position: absolute; left: 0; bottom: 2px; width: 100%; height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, #2f6fed, #db2777);
  transform: scaleX(0.55); transform-origin: left;
  transition: transform .25s ease;
  opacity: .85;
}
.site-name:hover { text-decoration: none; }
.site-name:hover::after { transform: scaleX(1); }
.main-nav { margin-left: auto; }
.nav-list { display: flex; gap: 8px; list-style: none; margin: 0; padding: 0; }
.nav-item a {
  display: block; padding: 8px 14px; border-radius: 8px;
  color: var(--muted); font-size: 15px;
}
.nav-item a:hover { background: var(--surface); text-decoration: none; color: var(--text); }
.nav-item.active a { color: var(--accent); background: var(--accent-weak); font-weight: 600; }
.mobile-toggle {
  display: none; margin-left: auto; border: 0; background: transparent;
  padding: 8px; cursor: pointer; color: var(--text);
}
.mobile-menu {
  display: none; position: fixed; inset: 0; background: rgba(15, 23, 42, 0.45); z-index: 60;
}
.mobile-menu.open { display: block; }
.mobile-menu .panel {
  position: absolute; top: 0; right: 0; height: 100%; width: 260px;
  background: #fff; padding: 20px; box-shadow: -8px 0 24px rgba(0,0,0,.12);
}
.mobile-menu .close { border: 0; background: transparent; cursor: pointer; margin-left: auto; display: block; color: var(--muted); }
.mobile-menu .nav-list { flex-direction: column; margin-top: 16px; }
.mobile-menu .nav-item a { padding: 12px 14px; }


/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden; padding: 88px 0 104px;
  background:
    radial-gradient(1100px 420px at 50% -12%, rgba(47,111,237,.20), transparent 60%),
    linear-gradient(135deg, #eaf1ff 0%, #f7f9fc 52%, #fdeef7 100%);
  border-bottom: 1px solid var(--border);
  animation: heroIn .6s ease both;
}
.hero-inner { position: relative; z-index: 2; text-align: center; max-width: 720px; margin: 0 auto; }
.hero-badge {
  display: inline-block; margin-bottom: 18px; padding: 5px 14px; border-radius: 999px;
  background: rgba(47,111,237,.12); color: var(--accent);
  font-size: 12px; font-weight: 700; letter-spacing: 2px;
}
.hero-title {
  margin: 0 0 14px; font-size: 50px; font-weight: 800; line-height: 1.5;
  background: linear-gradient(120deg, #2f6fed, #7c3aed 55%, #db2777);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: floatY 4.5s ease-in-out infinite;
}
.hero-sub { margin: 0 auto 26px; color: var(--muted); font-size: 17px; max-width: 520px; }
.hero-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.hero-wave {
  position: absolute; left: 0; right: 0; bottom: 0; height: 90px; z-index: 1;
  background: linear-gradient(to top, var(--bg), transparent);
  pointer-events: none;
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 44px; padding: 0 26px; border-radius: 999px;
  font-size: 15px; font-weight: 600; cursor: pointer; border: 0;
  transition: transform .15s ease, box-shadow .2s ease, background .2s ease, color .2s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-2px); }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 10px 24px rgba(47,111,237,.28); }
.btn-primary:hover { box-shadow: 0 14px 30px rgba(47,111,237,.36); }
.btn-ghost { background: #fff; color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- 页内 Banner ---------- */
.page-hero {
  position: relative; overflow: hidden; text-align: center; padding: 58px 0;
  background:
    radial-gradient(900px 300px at 50% -20%, rgba(47,111,237,.14), transparent 60%),
    linear-gradient(135deg, #eaf1ff, #f7f9fc 58%, #fdeef7);
  border-bottom: 1px solid var(--border);
  animation: heroIn .5s ease both;
}
.page-hero .crumbs { justify-content: center; margin-bottom: 12px; }
.page-hero-title { margin: 0 0 8px; font-size: 34px; font-weight: 800; }
.page-hero-sub { margin: 0; color: var(--muted); font-size: 15px; }

/* ---------- 区块通用 ---------- */
.section { padding: 36px 0 56px; }
.page-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 22px; }
.page-title { margin: 0; font-size: 24px; font-weight: 700; }
.more-link { font-size: 14px; }

/* ---------- 文章列表 ---------- */
.post-list {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px;
}
.post-card {
  border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; background: #fff; transition: box-shadow .2s, transform .2s;
}
.post-card:hover { box-shadow: 0 8px 24px rgba(31,41,51,.08); transform: translateY(-2px); }
.post-card:hover .post-img { transform: scale(1.06); }
.post-link { display: flex; flex-direction: column; color: inherit; }
.post-link:hover { text-decoration: none; }
.post-thumb { aspect-ratio: 16 / 9; background: var(--surface); overflow: hidden; border-radius: var(--radius) var(--radius) 0 0; }
.post-img { width: 100%; height: 100%; object-fit: cover; transition: transform .45s ease; }
.post-body { padding: 16px 18px 18px; }
.post-title { margin: 0 0 8px; font-size: 18px; font-weight: 600; line-height: 1.45; transition: color .2s ease; word-break: break-word; overflow-wrap: anywhere; }
.post-card:hover .post-title { color: var(--accent); }
.post-meta { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.post-readtime { color: var(--muted); }
.post-intro {
  margin: 0; color: var(--muted); font-size: 14px; line-height: 1.6;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  word-break: break-word; overflow-wrap: anywhere;
}

.empty-tip { text-align: center; color: var(--muted); padding: 48px 0; }

/* ---------- 分页 ---------- */
.pagination { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 36px; }
.page-link, .page-current, .page-disabled, .page-ellipsis {
  min-width: 38px; height: 38px; padding: 0 12px; display: inline-flex;
  align-items: center; justify-content: center; border-radius: 8px; font-size: 14px;
}
.page-link { border: 1px solid var(--border); color: var(--text); background: #fff; }
.page-link:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.page-current { background: var(--accent); color: #fff; font-weight: 600; }
.page-disabled, .page-ellipsis { color: var(--muted); }
.page-disabled { border: 1px solid var(--border); }

/* ---------- 文章详情 ---------- */
.article { padding-top: 8px; }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.crumbs a { color: var(--muted); }
.article-title { margin: 0 0 12px; font-size: 30px; font-weight: 700; line-height: 1.3; }
.article-meta { font-size: 13px; color: var(--muted); display: flex; gap: 16px; margin-bottom: 20px; }
.article-cover { margin: 0 0 24px; border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.article-cover .article-img { width: 100%; max-height: 460px; object-fit: cover; }
.article-content { font-size: 16px; line-height: 1.9; color: #2b3742; }
.article-content p { margin: 0 0 18px; }
.article-content img { border-radius: 8px; margin: 18px 0; }
.article-content h2, .article-content h3 { margin: 28px 0 12px; line-height: 1.4; }
.article-content a { text-decoration: underline; }
.article-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 15px;
  line-height: 1.6;
  background: #fff;
}
.article-content th,
.article-content td {
  border: 1px solid #e1e4e8;
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}
.article-content th {
  background: #f6f8fa;
  font-weight: 600;
  color: #1f2937;
}
.article-content tr:nth-child(even) td { background: #fafbfc; }
.article-content tr:hover td { background: #f3f6fb; }

/* 上一篇 / 下一篇 */
.pager-nav { display: flex; justify-content: space-between; gap: 16px; margin: 36px 0; }
.pager-nav a {
  flex: 1; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); font-size: 14px; background: #fff;
}
.pager-nav a:hover { border-color: var(--accent); text-decoration: none; }
.pager-next { text-align: right; }

/* 相关文章 */
.related { margin-top: 40px; padding-top: 28px; border-top: 1px solid var(--border); }
.related-title { font-size: 20px; font-weight: 700; margin: 0 0 18px; }
.related-list { grid-template-columns: repeat(3, 1fr); }

/* ---------- 页脚 ---------- */
.site-footer { background: var(--surface); border-top: 1px solid var(--border); padding: 40px 0 28px; margin-top: 40px; }
.footer-cols { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 28px; }
.f-logo { font-size: 16px; font-weight: 600; margin-bottom: 10px; }
.footer-col h4 { font-size: 14px; margin: 0 0 12px; color: var(--text); }
.footer-col p { margin: 0 0 8px; color: var(--muted); font-size: 14px; }
.friend-links { display: flex; flex-wrap: wrap; gap: 10px; }
.friend-links a { font-size: 14px; color: var(--muted); }
.copyright { margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--border); font-size: 13px; color: var(--muted); }

/* ---------- 响应式 ---------- */
@media (max-width: 768px) {
  .site-header .container { height: 64px; }
  .site-name { font-size: 22px; }
  .main-nav { display: none; }
  .mobile-toggle { display: block; }
  .hero { padding: 56px 0 64px; }
  .hero-title { font-size: 38px; }
  .page-hero { padding: 40px 0; }
  .page-hero-title { font-size: 26px; }
  .post-list, .related-list { grid-template-columns: 1fr; }
  .footer-cols { grid-template-columns: 1fr; gap: 20px; }
  .article-title { font-size: 24px; }
  .article-content { font-size: 15px; }
}

/* ---------- 动效与细节 ---------- */
html { scroll-behavior: smooth; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #cdd6e4; border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: #b3c0d6; }

/* 文章卡片入场（按列错峰淡入） */
.post-card { animation: fadeUp .5s ease both; }
.post-list .post-card:nth-child(1) { animation-delay: .04s; }
.post-list .post-card:nth-child(2) { animation-delay: .10s; }
.post-list .post-card:nth-child(3) { animation-delay: .16s; }
.post-list .post-card:nth-child(4) { animation-delay: .22s; }
.post-list .post-card:nth-child(5) { animation-delay: .28s; }
.post-list .post-card:nth-child(6) { animation-delay: .34s; }

/* 详情页文章头部彩色装饰条 */
.article { position: relative; padding-top: 4px; }
.article::before {
  content: ""; display: block; width: 56px; height: 4px; border-radius: 999px;
  background: linear-gradient(90deg, #2f6fed, #db2777); margin-bottom: 18px;
}
.related { position: relative; }

@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes heroIn { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: none; } }
@keyframes floatY { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

@media (prefers-reduced-motion: reduce) {
  .hero, .hero-title, .page-hero, .post-card { animation: none !important; }
  .hero-title { transform: none !important; }
  html { scroll-behavior: auto; }
}
