/* ============================================================
   CiCC Platform v4.0.0 — BLOG ARCHIVE + SINGLE POST (VIP PRO)
   ============================================================ */

.blog-archive {
  --blog-accent: #2563eb;
  --blog-grad: linear-gradient(135deg, #0f172a 0%, #1e40af 50%, #2563eb 100%);
}

/* Hero */
.blog-hero {
  padding: calc(var(--header-height, 80px) + 48px) 0 56px;
  text-align: center; position: relative; overflow: hidden;
  background: var(--blog-grad); color: #fff;
}
.blog-hero .section-tag { background: rgba(255,255,255,.12); color: #fff; }
.blog-hero h1 { font-size: clamp(28px, 4vw, 44px); font-weight: 800; color: #fff; margin: 12px auto; text-shadow: 0 3px 10px rgba(0,0,0,.4); }
.blog-hero p { color: rgba(255,255,255,.85); font-size: 18px; max-width: 640px; margin: 0 auto; }

/* Posts grid */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 24px;
}
.post-card {
  display: flex; flex-direction: column; height: 100%;
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: 18px; overflow: hidden;
  transition: transform .3s cubic-bezier(.2,.8,.2,1), box-shadow .3s ease, border-color .3s;
}
.post-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 30px 60px -20px rgba(37,99,235,.38);
  border-color: transparent;
}
.post-thumb { display: block; overflow: hidden; aspect-ratio: 16/9; max-height: 200px; }
.post-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.post-card:hover .post-thumb img { transform: scale(1.06); }
.post-body { padding: 24px; flex: 1; display: flex; flex-direction: column; }
.post-meta {
  font-size: 13px; color: var(--text-secondary); display: flex; gap: 12px;
  align-items: center; margin: 0 0 10px; flex-wrap: wrap;
}
.post-meta time { display: inline-flex; align-items: center; gap: 5px; }
.post-meta .cat-badge {
  background: var(--bg-page); border: 1px solid var(--border-color);
  padding: 3px 12px; border-radius: 12px; font-weight: 500; color: var(--text-primary);
}
.post-body h3 { font-size: 20px; font-weight: 700; margin: 0 0 10px; line-height: 1.35; }
.post-body h3 a { color: var(--text-primary); text-decoration: none; transition: color .2s; }
.post-body h3 a:hover { color: var(--blog-accent); }
.post-body p.excerpt { color: var(--text-secondary); font-size: 14px; line-height: 1.6; margin: 0 0 16px; flex: 1; }
.post-readmore {
  display: inline-flex; align-items: center; gap: 6px; font-size: 14px;
  font-weight: 600; color: var(--blog-accent); text-decoration: none; margin-top: auto;
}
.post-readmore:hover { gap: 12px; }

/* Pagination */
.posts-pagination {
  justify-content: center; margin-top: 48px; display: flex; flex-wrap: wrap; gap: 6px;
}
.posts-pagination a, .posts-pagination span {
  padding: 10px 20px; border-radius: 10px; font-weight: 500; text-decoration: none;
  background: var(--bg-card); border: 1px solid var(--border-color); color: var(--text-secondary);
  transition: all .2s;
}
.posts-pagination a:hover { background: var(--blog-accent); color: #fff; border-color: var(--blog-accent); }
.posts-pagination .current { background: var(--blog-grad); color: #fff; border-color: transparent; }

/* Empty state */
.blog-empty { text-align: center; padding: 64px 0; }
.blog-empty p { font-size: 18px; color: var(--text-secondary); }

/* Single post */
.post-single {
  --ps-accent: #2563eb;
}
.post-single .page-header {
  padding: calc(var(--header-height, 80px) + 48px) 0 48px;
  background: var(--ph-grad, linear-gradient(135deg, #1a237e 0%, #2563eb 50%, #3b82f6 100%));
  color: #fff; text-align: center;
}
.post-single .page-header .section-tag { background: rgba(255,255,255,.12); color: #fff; }
.post-single .page-header h1 {
  font-size: clamp(26px, 4vw, 42px); font-weight: 800; color: #fff; margin: 16px auto;
  text-shadow: 0 3px 12px rgba(0,0,0,.4); max-width: 780px;
}
.post-single .meta-bar {
  display: flex; justify-content: center; align-items: center; gap: 16px;
  color: rgba(255,255,255,.85); font-size: 14px; flex-wrap: wrap; margin-bottom: 32px;
}
.post-single .meta-bar time { display: inline-flex; align-items: center; gap: 5px; }
.post-single .meta-bar .cat-badge { background: rgba(255,255,255,.15); color: #fff; }

/* TOC */
.post-toc {
  position: sticky; top: calc(var(--header-height,80px) + 24px); align-self: start;
}
.post-toc nav { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 16px; padding: 20px; }
.post-toc nav h4 { font-size: 14px; font-weight: 700; color: var(--text-primary); margin: 0 0 12px; }
.post-toc ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.post-toc a {
  font-size: 13px; color: var(--text-secondary); text-decoration: none;
  padding: 5px 10px; border-radius: 6px; display: block; transition: all .2s;
}
.post-toc a:hover { color: var(--ps-accent); background: rgba(37,99,235,.08); }
.post-toc a.active { color: var(--ps-accent); background: rgba(37,99,235,.12); font-weight: 600; }

/* Content flow */
.post-content {
  max-width: 760px; margin: 0 auto; font-size: 16px; line-height: 1.8; color: var(--text-secondary);
}
.post-content h1,h2,h3,h4 {
  font-size: clamp(20px, 2.5vw, 26px); font-weight: 700; margin: 36px 0 18px; color: var(--text-primary);
}
.post-content h1 { border-bottom: 2px solid var(--border-color); padding-bottom: 10px; }
.post-content p { margin-bottom: 18px; }
.post-content a { color: var(--ps-accent); }
.post-content ul, .post-content ol { padding-left: 26px; margin: 16px 0; }
.post-content li { margin-bottom: 8px; line-height: 1.8; }
.post-content blockquote {
  border-left: 4px solid var(--ps-accent); margin: 24px 0; padding: 18px 22px;
  background: var(--bg-card); border-radius: 0 8px 8px 0; font-style: italic;
}
.post-content img, .post-content .wp-block-image img {
  width: 100%; height: auto; border-radius: 14px; margin: 24px 0; box-shadow: var(--shadow-card);
}
.post-content pre, .post-content code {
  font-family: 'Fira Code', 'Roboto Mono', monospace; font-size: 14px;
}
.post-content pre {
  background: var(--bg-page); border: 1px solid var(--border-color); border-radius: 12px;
  padding: 18px; overflow-x: auto; margin: 20px 0;
}

/* Related posts */
.post-related { margin-top: 48px; }
.post-related .related-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px;
}
.post-related .rel-card {
  display: flex; gap: 12px; text-decoration: none;
}
.post-related .rel-thumb { width: 70px; height: 55px; flex: 0 0 70px; border-radius: 8px; overflow: hidden; }
.post-related .rel-thumb img { width: 100%; height: 100%; object-fit: cover; }
.post-related .rel-info h4 { font-size: 15px; font-weight: 600; margin: 0 0 4px; color: var(--text-primary); }
.post-related .rel-info { flex: 1; }
.post-related .rel-meta { font-size: 12px; color: var(--text-secondary); }

/* Back to blog */
.blog-back { margin-top: 32px; display: inline-flex; align-items: center; gap: 6px; color: var(--text-secondary); }
.blog-back:hover { color: var(--ps-accent); }

/* Responsive */
@media (max-width: 992px) {
  .post-layout { flex-direction: column !important; }
  .post-toc { position: static; margin-bottom: 32px; }
}
@media (max-width: 768px) {
  .posts-grid { grid-template-columns: 1fr; }
  .post-hero { padding-top: calc(var(--header-height, 80px) + 24px); }
}
@media (prefers-reduced-motion: reduce) {
  .post-card, .post-thumb img, .post-toc a { transition: none !important; }
  .post-card:hover { transform: none; }
}
