/* blog.css — Blog listing & article styles */

/* ── Hero ── */
.blog-hero {
  background: var(--dark, #0d1117);
  padding: 100px 0 48px;
  text-align: center;
}
.blog-hero h1 {
  color: #fff;
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 800;
  margin: 0;
}

/* ── Container ── */
.blog-container {
  padding: 48px 24px 80px;
  max-width: 1200px;
  margin: 0 auto;
}

/* ── Grid ── */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
}
@media (max-width: 960px) { .blog-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .blog-grid { grid-template-columns: 1fr; } }

/* ── Card ── */
.blog-card {
  background: #fff;
  border-radius: 14px;
  border: 1px solid var(--border, #e5e7eb);
  overflow: hidden;
  transition: transform .2s, box-shadow .2s;
}
.blog-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0,0,0,.08);
}
.blog-card a {
  text-decoration: none;
  color: inherit;
  display: block;
}
.blog-card-img {
  aspect-ratio: 16/9;
  overflow: hidden;
  background: var(--bg2, #f8f9fb);
}
.blog-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.blog-card-img-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
}
.blog-card-body {
  padding: 20px;
}
.blog-card-body h2 {
  font-size: 18px;
  font-weight: 700;
  margin: 8px 0;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.blog-card-body p {
  font-size: 14px;
  color: var(--muted, #6b7280);
  line-height: 1.6;
  margin: 0 0 12px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.blog-card-meta {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--muted, #6b7280);
}
.blog-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.tag {
  display: inline-block;
  padding: 3px 10px;
  background: var(--blue-l, #eff6ff);
  color: var(--blue, #2563eb);
  font-size: 12px;
  font-weight: 500;
  border-radius: 20px;
  text-decoration: none;
}
.tag:hover { background: #dbeafe; }
.blog-read-more {
  font-size: 14px;
  font-weight: 600;
  color: var(--blue, #2563eb);
}

/* ── CTA Card in Grid ── */
.blog-card-cta {
  background: linear-gradient(135deg, #1e40af 0%, #2563eb 100%);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.blog-card-cta:hover { transform: translateY(-4px); }
.blog-card-cta-inner {
  padding: 32px 24px;
  text-align: center;
  color: #fff;
}
.blog-card-cta-inner h3 {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 12px;
}
.blog-card-cta-inner p {
  font-size: 14px;
  opacity: .9;
  margin: 0 0 20px;
  line-height: 1.5;
}
.blog-card-cta-inner .btn {
  background: #fff;
  color: var(--blue, #2563eb);
  font-weight: 600;
}
.blog-card-cta-inner .btn:hover {
  background: #f0f4ff;
}

/* ── Pagination ── */
.blog-pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 48px;
}
.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--border, #e5e7eb);
  color: var(--text, #1a1f2e);
  font-weight: 500;
  text-decoration: none;
  transition: all .15s;
}
.page-btn:hover { border-color: var(--blue, #2563eb); color: var(--blue); }
.page-btn.active {
  background: var(--blue, #2563eb);
  color: #fff;
  border-color: var(--blue);
}

/* ── Empty State ── */
.blog-empty {
  padding: 100px 24px;
  text-align: center;
}
.empty-state svg { margin-bottom: 24px; opacity: .5; }
.empty-state h2 { font-size: 24px; margin: 0 0 8px; }
.empty-state p { color: var(--muted); }

/* ── Loading ── */
.blog-loading {
  display: flex;
  justify-content: center;
  padding: 120px 0;
}
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border, #e5e7eb);
  border-top-color: var(--blue, #2563eb);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══════════════════════════════════════ */
/*  SINGLE POST                           */
/* ═══════════════════════════════════════ */

.blog-post { padding-bottom: 80px; }

.post-header {
  background: var(--dark, #0d1117);
  padding: 100px 0 40px;
  color: #fff;
}
.post-header h1 {
  font-size: clamp(26px, 4vw, 40px);
  font-weight: 800;
  margin: 16px 0 12px;
  line-height: 1.25;
}
.post-meta {
  display: flex;
  gap: 16px;
  font-size: 14px;
  color: #94a3b8;
}
.post-tags {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.post-tags .tag {
  background: rgba(255,255,255,.12);
  color: #fff;
}
.post-tags .tag:hover { background: rgba(255,255,255,.2); }

/* Breadcrumbs */
.breadcrumbs {
  font-size: 13px;
  color: #94a3b8;
}
.breadcrumbs a {
  color: #94a3b8;
  text-decoration: none;
}
.breadcrumbs a:hover { color: #fff; }

/* Hero image */
.post-hero-img {
  width: 100%;
  max-height: 480px;
  object-fit: cover;
  border-radius: 14px;
  margin: 32px 0;
}

/* Layout: content + sidebar */
.post-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 48px;
  align-items: start;
  padding-top: 32px;
}
@media (max-width: 960px) {
  .post-layout {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  .post-sidebar { order: -1; }
}

/* TOC */
.post-toc {
  background: var(--bg2, #f8f9fb);
  border-radius: 12px;
  padding: 20px 24px;
  margin-bottom: 32px;
  border: 1px solid var(--border, #e5e7eb);
}
.post-toc h3 {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--muted);
  margin: 0 0 12px;
}
.post-toc ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.post-toc li {
  margin: 6px 0;
}
.post-toc li.h3 {
  padding-left: 16px;
}
.post-toc a {
  color: var(--text, #1a1f2e);
  text-decoration: none;
  font-size: 14px;
  line-height: 1.5;
}
.post-toc a:hover { color: var(--blue, #2563eb); }

/* Content typography */
.post-content {
  font-size: 17px;
  line-height: 1.8;
  color: var(--text, #1a1f2e);
}
.post-content h2 {
  font-size: 26px;
  font-weight: 700;
  margin: 40px 0 16px;
  scroll-margin-top: 100px;
}
.post-content h3 {
  font-size: 20px;
  font-weight: 600;
  margin: 32px 0 12px;
  scroll-margin-top: 100px;
}
.post-content p {
  margin: 0 0 20px;
}
.post-content img {
  max-width: 100%;
  border-radius: 10px;
  margin: 24px 0;
}
.post-content ul, .post-content ol {
  margin: 0 0 20px;
  padding-left: 24px;
}
.post-content li {
  margin: 8px 0;
}
.post-content blockquote {
  border-left: 4px solid var(--blue, #2563eb);
  margin: 24px 0;
  padding: 16px 24px;
  background: var(--blue-l, #eff6ff);
  border-radius: 0 10px 10px 0;
  font-style: italic;
}
.post-content pre {
  background: #0d1117;
  color: #e6edf3;
  padding: 20px 24px;
  border-radius: 10px;
  overflow-x: auto;
  margin: 24px 0;
  font-family: 'DM Mono', monospace;
  font-size: 14px;
  line-height: 1.6;
}
.post-content code {
  background: var(--bg2, #f1f5f9);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'DM Mono', monospace;
  font-size: 0.9em;
}
.post-content pre code {
  background: none;
  padding: 0;
}
.post-content a {
  color: var(--blue, #2563eb);
  text-decoration: underline;
}
.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  font-size: 15px;
}
.post-content th, .post-content td {
  padding: 12px 16px;
  border: 1px solid var(--border, #e5e7eb);
  text-align: left;
}
.post-content th {
  background: var(--bg2, #f8f9fb);
  font-weight: 600;
}

/* Share */
.post-share {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--border, #e5e7eb);
}
.post-share span {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}
.share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--bg2, #f8f9fb);
  color: var(--text, #1a1f2e);
  transition: all .15s;
}
.share-btn:hover {
  background: var(--blue, #2563eb);
  color: #fff;
}

/* Sidebar CTA */
.sidebar-cta {
  background: linear-gradient(135deg, #1e40af 0%, #2563eb 100%);
  border-radius: 14px;
  padding: 28px 24px;
  color: #fff;
  position: sticky;
  top: 100px;
}
.sidebar-cta h3 {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 10px;
}
.sidebar-cta p {
  font-size: 14px;
  color: rgba(255,255,255,.95);
  line-height: 1.6;
  margin: 0 0 20px;
}
.btn-block { display: block; width: 100%; text-align: center; }
.sidebar-cta .btn {
  background: #fff;
  color: var(--blue, #2563eb);
}
.sidebar-cta .btn:hover { background: #f0f4ff; }

/* Related posts */
.post-related {
  margin-top: 64px;
  padding: 48px 0 0;
  border-top: 1px solid var(--border, #e5e7eb);
  max-width: 1080px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 24px;
  padding-right: 24px;
}
.post-related h2 {
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 24px;
}
.related-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
@media (max-width: 768px) { .related-grid { grid-template-columns: 1fr; } }
.related-card {
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px;
  overflow: hidden;
  transition: transform .2s, box-shadow .2s;
}
.related-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,.06);
}
.related-card img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
}
.related-card h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 12px 16px 6px;
  line-height: 1.4;
}
.related-card time {
  display: block;
  font-size: 12px;
  color: var(--muted);
  padding: 0 16px 16px;
}

/* ── CTA Section ── */
.blog-cta-section {
  padding: 60px 0;
  background: var(--bg2, #f8f9fb);
}
.blog-cta-card {
  background: linear-gradient(135deg, #1e40af 0%, #2563eb 100%);
  border-radius: 16px;
  padding: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  color: #fff;
}
@media (max-width: 768px) {
  .blog-cta-card {
    flex-direction: column;
    text-align: center;
    padding: 36px 24px;
  }
}
.blog-cta-text h2 {
  font-size: 28px;
  font-weight: 800;
  margin: 0 0 8px;
}
.blog-cta-text p {
  font-size: 16px;
  color: rgba(255,255,255,.95);
  margin: 0;
  line-height: 1.5;
}
.blog-cta-card .btn-lg {
  white-space: nowrap;
  padding: 16px 32px;
  font-size: 16px;
  font-weight: 700;
  background: #fff;
  color: var(--blue, #2563eb);
  border-radius: 12px;
  text-decoration: none;
}
.blog-cta-card .btn-lg:hover { background: #f0f4ff; }

/* ── Common btn styles (from main site) ── */
.btn {
  display: inline-block;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
  transition: all .15s;
  border: none;
}
.btn-primary {
  background: var(--blue, #2563eb);
  color: #fff;
}
.btn-primary:hover { background: var(--blue-d, #1d4ed8); }
.btn-sm { padding: 8px 16px; font-size: 13px; }

/* ── Footer (compact) ── */
.footer {
  background: var(--dark2, #161b22);
  color: #94a3b8;
  padding: 40px 0;
}
.footer .container { max-width: 1080px; margin: 0 auto; padding: 0 24px; }
.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 24px;
}
.footer-brand .nav-logo { color: #fff; text-decoration: none; font-weight: 700; }
.footer-brand .nav-logo span { color: var(--blue); }
.footer-desc { font-size: 13px; margin: 6px 0 0; }
.footer-links { display: flex; gap: 20px; flex-wrap: wrap; }
.footer-links a { color: #94a3b8; text-decoration: none; font-size: 13px; }
.footer-links a:hover { color: #fff; }
.footer-bottom { margin-top: 24px; padding-top: 20px; border-top: 1px solid #21262d; }
.footer-bottom p { font-size: 12px; margin: 0; }

/* ── Nav active link ── */
.nav-links a.active { color: var(--blue, #2563eb); }
