/* 博客专用样式（叠加在 site.css 之上，只有 /blog 下的页面引用） */

.blog-wrap { max-width: 1120px; padding-bottom: 72px; }
.blog-head { border-bottom: 0; padding-bottom: 48px; }
.blog-head h1 { font-size: clamp(34px, 5vw, 56px); }

/* ---------- 进场动画 ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(18px); filter: blur(6px); } }
.js .blog-head > *, .js .article-head > *, .js .crumbs { animation: rise .9s cubic-bezier(.2, .8, .2, 1) both; }
.js .blog-head > :nth-child(2), .js .article-head > :nth-child(2) { animation-delay: .08s; }
.js .blog-head > :nth-child(3), .js .article-head > :nth-child(3) { animation-delay: .16s; }
.js .article-head > :nth-child(4) { animation-delay: .24s; }
.js .rv { opacity: 0; translate: 0 22px; filter: blur(4px); transition: opacity .8s cubic-bezier(.2, .8, .2, 1) var(--d, 0s), translate .8s cubic-bezier(.2, .8, .2, 1) var(--d, 0s), filter .8s ease var(--d, 0s), transform .5s cubic-bezier(.2, .8, .2, 1), box-shadow .5s ease; }
.js .rv.in { opacity: 1; translate: 0 0; filter: none; }

/* ---------- 阅读进度 ---------- */
.read-progress { position: fixed; left: 0; right: 0; top: 0; z-index: 60; height: 2px; pointer-events: none; }
.read-progress i { display: block; height: 100%; transform-origin: 0 50%; transform: scaleX(var(--p, 0)); background: linear-gradient(90deg, #5b8cff, #a58cff, #f2b84b); box-shadow: 0 0 12px rgba(122, 162, 255, .8); }

/* ---------- 文章卡片 ---------- */
.post-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.post-card {
  position: relative; display: flex; flex-direction: column; min-width: 0; color: inherit;
  border-radius: 4px 16px 16px 16px; overflow: hidden; isolation: isolate;
  background: linear-gradient(180deg, #10131a, #0b0d12) padding-box, linear-gradient(160deg, rgba(255, 255, 255, .14), rgba(255, 255, 255, .03) 50%, rgba(122, 150, 255, .18)) border-box;
  border: 1px solid transparent;
  transition: transform .5s cubic-bezier(.2, .8, .2, 1), box-shadow .5s ease;
}
.post-card::after { content: ""; position: absolute; inset: 0; z-index: -1; opacity: 0; transition: opacity .4s; background: radial-gradient(500px circle at var(--x, 50%) var(--y, 0%), rgba(110, 145, 255, .12), transparent 60%); }
.post-card:hover { transform: translateY(-6px); box-shadow: 0 30px 60px -28px rgba(70, 100, 230, .55); }
.post-card:hover::after { opacity: 1; }
.pc-cover { display: block; aspect-ratio: 2 / 1; overflow: hidden; border-bottom: 1px solid rgba(255, 255, 255, .06); }
.pc-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .9s cubic-bezier(.2, .8, .2, 1); }
.post-card:hover .pc-cover img { transform: scale(1.06); }
.pc-body { display: flex; flex-direction: column; flex: 1; padding: 20px 22px 20px; }
.pc-tags { display: flex; gap: 8px; font: 12px var(--mono); color: var(--accent); }
.pc-tags span + span::before { content: "/"; margin-right: 8px; color: var(--faint); }
.post-card h3 { margin: 10px 0 8px; font-size: 18px; line-height: 1.4; letter-spacing: -.015em; font-weight: 660; }
.post-card p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.7; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pc-meta { display: flex; align-items: center; gap: 12px; margin-top: auto; padding-top: 18px; font: 12.5px var(--mono); color: var(--faint); }
.pc-go { margin-left: auto; color: var(--muted); transition: transform .4s cubic-bezier(.2, .8, .2, 1), color .3s; }
.post-card:hover .pc-go { transform: translateX(5px); color: var(--accent); }
/* 置顶的最新一篇：横排大卡片 */
.post-card.featured { grid-column: 1 / -1; flex-direction: row; }
.post-card.featured .pc-cover { flex: 1.25; aspect-ratio: auto; min-height: 320px; border-bottom: 0; border-right: 1px solid rgba(255, 255, 255, .06); }
.post-card.featured .pc-body { flex: 1; padding: 34px 34px 30px; justify-content: center; }
.post-card.featured h3 { font-size: clamp(22px, 2.6vw, 30px); line-height: 1.3; margin: 14px 0 12px; }
.post-card.featured p { -webkit-line-clamp: 3; font-size: 15px; }
@media (max-width: 960px) { .post-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 720px) {
  .post-grid { grid-template-columns: 1fr; gap: 16px; }
  .post-card.featured { flex-direction: column; }
  .post-card.featured .pc-cover { min-height: 0; aspect-ratio: 2 / 1; border-right: 0; border-bottom: 1px solid rgba(255, 255, 255, .06); }
  .post-card.featured .pc-body { padding: 22px; }
}
.related .post-grid { margin-top: 18px; }

/* ---------- 文章页 ---------- */
.article-head { padding-bottom: 28px; }
.article-cover { margin: 0 0 40px; border-radius: 4px 20px 20px 20px; overflow: hidden; border: 1px solid rgba(255, 255, 255, .1); box-shadow: 0 40px 90px -40px rgba(60, 90, 220, .5); background: #0a0c11; }
.article-cover img { width: 100%; height: auto; transform: translateY(var(--py, 0)) scale(1.04); transition: transform .2s linear; }
.js .article-cover { animation: coverIn 1.2s cubic-bezier(.2, .8, .2, 1) .2s both; }
@keyframes coverIn { from { opacity: 0; transform: translateY(24px) scale(.98); filter: blur(10px); } }
.article-grid { border-top: 0; padding-top: 0; }

/* 要点 */
.keypoints {
  position: relative; margin: 0 0 40px; padding: 22px 24px 20px;
  border-radius: 4px 16px 16px 16px;
  background: linear-gradient(180deg, rgba(91, 140, 255, .09), rgba(91, 140, 255, .02)) padding-box,
              linear-gradient(150deg, rgba(122, 162, 255, .6), rgba(255, 255, 255, .06) 45%, rgba(165, 140, 255, .4)) border-box;
  border: 1px solid transparent;
}
.kp-title { display: inline-flex; align-items: center; gap: 8px; font: 600 12.5px var(--mono); letter-spacing: .12em; color: #c3d2ff; }
.kp-title::before { content: ""; width: 8px; height: 8px; border-radius: 2px; rotate: 45deg; background: linear-gradient(135deg, #8fb0ff, #a58cff); box-shadow: 0 0 10px rgba(122, 162, 255, .9); }
.keypoints ol { list-style: none; counter-reset: kp; margin: 14px 0 0; padding: 0; display: grid; gap: 10px; }
.keypoints li { counter-increment: kp; position: relative; padding-left: 36px; margin: 0; color: #dfe4ef; font-size: 15px; line-height: 1.7; }
.keypoints li::before { content: counter(kp, decimal-leading-zero); position: absolute; left: 0; top: 2px; font: 600 12px/22px var(--mono); color: #9db6ff; }

/* 荧光笔高亮：进入视口时从左往右刷上去 */
.prose mark {
  color: #f3f6ff; padding: 0 2px; border-radius: 2px;
  background:
    linear-gradient(90deg, #8fb0ff, #b9a6ff) no-repeat 0 100% / 100% 2px,
    linear-gradient(90deg, rgba(122, 162, 255, .2), rgba(165, 140, 255, .16)) no-repeat 0 0 / 100% 100%;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
.js .prose mark { background-size: 0% 2px, 0% 100%; transition: background-size 1.1s cubic-bezier(.6, 0, .2, 1) .2s; }
.js .prose mark.in { background-size: 100% 2px, 100% 100%; }

/* 提示框 */
.prose .callout {
  position: relative; display: block; margin: 24px 0; padding: 16px 18px 16px 54px; border: 0;
  border-radius: 4px 14px 14px 14px; font-size: 14.5px; line-height: 1.8; color: #cfd6e6;
  background: linear-gradient(90deg, rgba(122, 162, 255, .12), rgba(122, 162, 255, .03));
  box-shadow: inset 2px 0 0 #7aa2ff;
}
.prose .callout b { display: block; margin-bottom: 2px; font-size: 14.5px; color: #e6ecff; }
.prose .callout::before {
  content: "i"; position: absolute; left: 18px; top: 18px; width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center; font: 700 12px var(--mono); color: #0b0d12; background: #7aa2ff; box-shadow: 0 0 14px rgba(122, 162, 255, .6);
}
.prose .callout.warn { background: linear-gradient(90deg, rgba(242, 184, 75, .12), rgba(242, 184, 75, .03)); box-shadow: inset 2px 0 0 #f2b84b; }
.prose .callout.warn b { color: #fbe2b3; }
.prose .callout.warn::before { content: "!"; background: #f2b84b; box-shadow: 0 0 14px rgba(242, 184, 75, .55); }
.prose .callout.tip { background: linear-gradient(90deg, rgba(60, 207, 142, .11), rgba(60, 207, 142, .03)); box-shadow: inset 2px 0 0 #3ccf8e; }
.prose .callout.tip b { color: #bff3d9; }
.prose .callout.tip::before { content: "✓"; background: #3ccf8e; box-shadow: 0 0 14px rgba(60, 207, 142, .5); }
.prose .callout code { font-size: 12.5px; }

/* 图解 */
.prose .figure { margin: 30px 0; }
.prose .figure img { width: 100%; height: auto; border-radius: 4px 16px 16px 16px; border: 1px solid rgba(255, 255, 255, .08); }
.prose .figure figcaption { margin-top: 10px; text-align: center; font-size: 13px; color: var(--faint); }

/* 表格：宽屏铺满，窄屏可以横向滚动 */
.prose thead th { background: rgba(255, 255, 255, .03); }
@media (min-width: 721px) { .prose table { display: table; } }

/* 目录：跟着当前章节高亮 */
.toc a.active { color: var(--text); border-left-color: var(--accent); }
.toc a { transition: color .3s, border-color .3s; }

/* 文末 */
.article-cta {
  border: 0; border-radius: 4px 18px 18px 18px; padding: 30px 32px;
  background: radial-gradient(ellipse 60% 120% at 0% 0%, rgba(91, 140, 255, .18), transparent 70%) padding-box,
              linear-gradient(#0d1016, #0d1016) padding-box,
              linear-gradient(150deg, rgba(122, 162, 255, .5), rgba(255, 255, 255, .06) 50%, rgba(165, 140, 255, .35)) border-box;
  border: 1px solid transparent;
}

@media (prefers-reduced-motion: reduce) {
  .js .blog-head > *, .js .article-head > *, .js .crumbs, .js .article-cover { animation: none; }
  .js .rv { opacity: 1; translate: none; filter: none; transition: none; }
  .js .prose mark { background-size: 100% 2px, 100% 100%; transition: none; }
  .article-cover img { transform: none; }
  .post-card, .pc-cover img { transition: none; }
}
