/* AI Gram Blog — Stylesheet */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f8f9fc;
  --surface: #ffffff;
  --text: #1a1d26;
  --text-secondary: #3d4255;
  --text-muted: #6b7080;
  --text-faint: #9ca3b4;
  --border: #e2e5ed;
  --primary: #802CD6;
  --primary-light: #f3ecfc;
  --primary-hover: #6a1fbf;
  --radius: 12px;
  --max-w: 760px;
  --max-w-wide: 1200px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

/* ── Header ── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}
.site-header-inner {
  max-width: var(--max-w-wide);
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.site-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}
.site-logo img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}
.site-logo span {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
}
.site-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}
.site-nav a {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  padding: 6px 14px;
  border-radius: 8px;
  transition: all 0.15s;
}
.site-nav a:hover { color: var(--text); background: #f0f1f5; }
.site-nav a.active { color: var(--primary); background: var(--primary-light); font-weight: 600; }
.cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  background: var(--primary);
  color: #fff !important;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s;
}
.cta-btn:hover { background: var(--primary-hover); }

/* ── Blog Listing ── */
.blog-hero {
  max-width: var(--max-w-wide);
  margin: 0 auto;
  padding: 56px 24px 32px;
  text-align: center;
}
.blog-hero h1 {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -1px;
  margin-bottom: 8px;
}
.blog-hero p {
  font-size: 17px;
  color: var(--text-muted);
  max-width: 540px;
  margin: 0 auto;
}

/* Category filter */
.cat-filter {
  max-width: var(--max-w-wide);
  margin: 0 auto;
  padding: 0 24px 32px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.cat-pill {
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
}
.cat-pill:hover, .cat-pill.active {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--primary-light);
}

/* Card grid */
.blog-grid {
  max-width: var(--max-w-wide);
  margin: 0 auto;
  padding: 0 24px 64px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 24px;
}
.blog-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
}
.blog-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.06);
}
.card-body { padding: 24px; flex: 1; display: flex; flex-direction: column; }
.card-cat {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--primary);
  margin-bottom: 8px;
}
.card-title {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.35;
  margin-bottom: 8px;
  letter-spacing: -0.2px;
}
.card-excerpt {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  flex: 1;
  margin-bottom: 16px;
}
.card-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--text-faint);
}
.card-meta .dot { font-size: 8px; }

/* ── Article Page ── */
.article-container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 48px 24px 80px;
}
.article-header { margin-bottom: 36px; }
.article-cat {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--primary);
  margin-bottom: 12px;
}
.article-header h1 {
  font-size: 34px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.8px;
  margin-bottom: 16px;
}
.article-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 14px;
  color: var(--text-muted);
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

/* Article body */
.article-body h2 {
  font-size: 22px;
  font-weight: 700;
  margin-top: 36px;
  margin-bottom: 14px;
  letter-spacing: -0.3px;
}
.article-body h3 {
  font-size: 18px;
  font-weight: 600;
  margin-top: 28px;
  margin-bottom: 10px;
}
.article-body p {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}
.article-body ul, .article-body ol {
  padding-left: 24px;
  margin-bottom: 16px;
}
.article-body li {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.article-body a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.article-body a:hover { opacity: 0.8; }
.article-body blockquote {
  border-left: 3px solid var(--primary);
  padding: 12px 20px;
  margin: 20px 0;
  background: var(--primary-light);
  border-radius: 0 8px 8px 0;
  font-style: italic;
  color: var(--text-secondary);
}
.article-body strong { color: var(--text); }

/* CTA box */
.article-cta {
  margin-top: 40px;
  padding: 28px;
  background: linear-gradient(135deg, var(--primary-light), #ede7f6);
  border-radius: var(--radius);
  text-align: center;
}
.article-cta h3 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
}
.article-cta p {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}
.article-cta .cta-btn { font-size: 15px; padding: 10px 24px; }

/* Related posts */
.related-posts {
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}
.related-posts h2 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 20px;
}
.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.related-card {
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  transition: transform 0.15s, box-shadow 0.15s;
}
.related-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}
.related-card .card-cat { margin-bottom: 4px; }
.related-card .card-title { font-size: 15px; margin-bottom: 6px; }
.related-card .card-meta { font-size: 11px; }

/* ── Breadcrumbs ── */
.breadcrumbs {
  margin-bottom: 24px;
  font-size: 13px;
  color: var(--text-faint);
}
.breadcrumbs a {
  color: var(--text-muted);
  text-decoration: none;
}
.breadcrumbs a:hover { color: var(--primary); }
.breadcrumbs span { margin: 0 6px; }

/* ── Footer ── */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 48px 24px;
}
.footer-inner {
  max-width: var(--max-w-wide);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
}
.footer-brand p {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 8px;
  max-width: 280px;
}
.footer-col h4 {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.footer-col a {
  display: block;
  font-size: 14px;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 4px 0;
}
.footer-col a:hover { color: var(--primary); }
.footer-bottom {
  max-width: var(--max-w-wide);
  margin: 24px auto 0;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--text-faint);
}
.footer-bottom a { color: var(--text-muted); text-decoration: none; }
.footer-bottom a:hover { color: var(--primary); }

/* ── Responsive ── */
@media (max-width: 768px) {
  .blog-hero h1 { font-size: 28px; }
  .blog-grid { grid-template-columns: 1fr; }
  .article-header h1 { font-size: 26px; }
  .footer-inner { grid-template-columns: 1fr 1fr; gap: 24px; }
  .related-grid { grid-template-columns: 1fr; }
  .site-nav { display: none; }
}
@media (max-width: 480px) {
  .footer-inner { grid-template-columns: 1fr; }
  .footer-bottom { flex-direction: column; gap: 8px; text-align: center; }
}

/* ── Table of Contents ── */
.toc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 32px;
}
.toc h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.toc ol {
  padding-left: 20px;
  margin: 0;
}
.toc li {
  font-size: 14px;
  padding: 3px 0;
}
.toc a {
  color: var(--text-secondary);
  text-decoration: none;
}
.toc a:hover { color: var(--primary); }

/* ── Pagination ── */
.pagination {
  max-width: var(--max-w-wide);
  margin: 0 auto;
  padding: 0 24px 48px;
  display: flex;
  justify-content: center;
  gap: 8px;
}
.page-btn {
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  text-decoration: none;
  transition: all 0.15s;
}
.page-btn:hover { border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ── JS filter styling ── */
.blog-card.hidden { display: none; }
