/* ═══════════════════════════════════════════════════════════
   blog.css — Blog listing + detail shared styles
   ProjectsHub Design System
═══════════════════════════════════════════════════════════ */

/* ── Blog Page Header ─────────────────────────────────── */
.blog-page-header {
  text-align: center;
  padding: 6rem 1.5rem 3rem;
  max-width: 800px;
  margin: 0 auto;
}

.blog-page-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.8rem;
  font-weight: 600;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 1.25rem;
}

.blog-page-badge__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #3b82f6;
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.8);
  animation: blogDotPulse 2s ease-in-out infinite;
}

@keyframes blogDotPulse {
  0%, 100% { box-shadow: 0 0 6px rgba(59, 130, 246, 0.8); transform: scale(1); }
  50%       { box-shadow: 0 0 14px rgba(59, 130, 246, 1), 0 0 28px rgba(59, 130, 246, 0.4); transform: scale(1.3); }
}

.blog-page-title {
  font-size: clamp(2.2rem, 5.5vw, 3.6rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: #f1f5f9;
  margin-bottom: 1rem;
}

.blog-page-title__gradient {
  background: linear-gradient(135deg, #3b82f6, #a855f7 60%, #ec4899);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.blog-page-subtitle {
  font-size: 1.05rem;
  color: #9ca3af;
  line-height: 1.7;
  max-width: 560px;
  margin: 0 auto;
}

body.light .blog-page-badge {
  border-color: rgba(0,0,0,0.1);
  background: rgba(0,0,0,0.03);
  color: #64748b;
}
body.light .blog-page-title { color: #0f172a; }
body.light .blog-page-subtitle { color: #64748b; }

/* ── Blog Category Filter ─────────────────────────────── */
.blog-filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  padding: 0 1.5rem 2.5rem;
  max-width: 1000px;
  margin: 0 auto;
}

.blog-filter-btn {
  padding: 7px 18px;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: transparent;
  color: #9ca3af;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.blog-filter-btn:hover {
  color: #f1f5f9;
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.2);
}

.blog-filter-btn.active {
  background: linear-gradient(135deg, #3b82f6, #a855f7);
  border-color: transparent;
  color: #fff;
}

body.light .blog-filter-btn {
  border-color: rgba(0,0,0,0.1);
  color: #64748b;
}
body.light .blog-filter-btn:hover {
  color: #2563eb;
  background: #eff6ff;
  border-color: rgba(59, 130, 246, 0.4);
  transform: translateY(-1px);
}
body.light .blog-filter-btn.active { color: #fff; }

/* ── Blog Search ──────────────────────────────────────── */
.blog-search-wrap {
  max-width: 480px;
  margin: 0 auto 2rem;
  padding: 0 1.5rem;
  position: relative;
}

.blog-search-input {
  width: 100%;
  padding: 12px 20px 12px 46px;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: #f1f5f9;
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
  backdrop-filter: blur(8px);
}

.blog-search-input::placeholder { color: #6b7280; }

.blog-search-input:focus {
  border-color: rgba(59, 130, 246, 0.5);
  background: rgba(255, 255, 255, 0.07);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.blog-search-icon {
  position: absolute;
  left: calc(1.5rem + 16px);
  top: 50%;
  transform: translateY(-50%);
  color: #6b7280;
  pointer-events: none;
}

body.light .blog-search-input {
  border-color: rgba(0,0,0,0.12);
  background: #fff;
  color: #0f172a;
  box-shadow: 0 1px 6px rgba(0,0,0,0.06);
}
body.light .blog-search-input:focus {
  border-color: rgba(59,130,246,0.5);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}

/* ── Blog Grid ────────────────────────────────────────── */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.75rem;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 5% 6rem;
  align-items: stretch;
}

@media (max-width: 640px) {
  .blog-grid { grid-template-columns: 1fr; gap: 1.25rem; }
}

/* ── Blog Card ────────────────────────────────────────── */
.blog-card {
  height: 100%;
  border-radius: 20px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.025);
  transition: transform 0.3s var(--ease-out-expo, cubic-bezier(0.23, 1, 0.32, 1)),
              box-shadow 0.3s ease,
              border-color 0.3s ease;
  position: relative;
}

.blog-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(59, 130, 246, 0.2);
  border-color: rgba(59, 130, 246, 0.25);
}

.blog-card--featured {
  border-color: rgba(59, 130, 246, 0.4);
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.2), 0 8px 28px rgba(59, 130, 246, 0.12);
}

.blog-card--featured:hover {
  box-shadow: 0 20px 48px rgba(59, 130, 246, 0.25), 0 0 0 1px rgba(59, 130, 246, 0.4);
}

body.light .blog-card {
  border-color: rgba(0,0,0,0.08);
  background: #fff;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}
body.light .blog-card:hover {
  box-shadow: 0 16px 40px rgba(0,0,0,0.12), 0 0 0 1px rgba(59,130,246,0.2);
}
body.light .blog-card--featured {
  border-color: rgba(59,130,246,0.3);
  box-shadow: 0 4px 20px rgba(59,130,246,0.1);
}

/* Card image area */
.blog-card__img {
  height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.blog-card__img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.blog-card:hover .blog-card__img img {
  transform: scale(1.04);
}

.blog-card__img-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.45) 0%, transparent 55%);
}

/* Badges inside image */
.blog-card__badge {
  position: absolute;
  top: 1rem;
  left: 1rem;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  color: #fff;
  padding: 0.3rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  z-index: 2;
}

.blog-card__featured-badge {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  color: #fff;
  padding: 0.3rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Card body */
.blog-card__body {
  padding: 1.4rem 1.5rem 1.6rem;
  background: #1a2236;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
}

body.light .blog-card__body { background: #fff; }

.blog-card__meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: #9ca3af;
  margin-bottom: 0.65rem;
  flex-wrap: wrap;
  flex-shrink: 0;
}

body.light .blog-card__meta { color: #64748b; }

.blog-card__meta-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.5;
  flex-shrink: 0;
}

.blog-card__read-time {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.blog-card__title {
  margin: 0 0 0.7rem;
  font-size: 1.1rem;
  line-height: 1.45;
  font-weight: 700;
  color: #f1f5f9;
  flex-shrink: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.9em;
}

body.light .blog-card__title { color: #0f172a; }

.blog-card__desc {
  color: #94a3b8;
  font-size: 0.9rem;
  line-height: 1.65;
  margin-bottom: 1.25rem;
  flex: 1 1 auto;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 4.95em;
}

body.light .blog-card__desc { color: #475569; }

.blog-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255,255,255,0.06);
  gap: 0.5rem;
  flex-shrink: 0;
}

body.light .blog-card__footer { border-top-color: rgba(0,0,0,0.07); }

.blog-card__read {
  color: #3b82f6;
  font-weight: 600;
  font-size: 0.88rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: gap 0.2s;
}

.blog-card:hover .blog-card__read { gap: 0.65rem; }

body.light .blog-card__read { color: #2563eb; }

.blog-card__read-arrow {
  transition: transform 0.2s;
}

.blog-card:hover .blog-card__read-arrow { transform: translateX(3px); }

/* ── Blog Card Author ── */
.blog-card__author {
  font-size: 0.78rem;
  color: #94a3b8;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

body.light .blog-card__author {
  color: #64748b;
}

.blog-card__avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #3b82f6;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 0.65rem;
  font-weight: 700;
  flex-shrink: 0;
}

.blog-card__author-name {
  white-space: nowrap;
}

/* ── Blog Empty State ─────────────────────────────────── */
.blog-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 5rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.blog-empty__icon {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #3b82f6;
}

.blog-empty__title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #f1f5f9;
}

.blog-empty__desc {
  font-size: 0.95rem;
  color: #9ca3af;
  max-width: 400px;
}

body.light .blog-empty__title { color: #0f172a; }
body.light .blog-empty__desc  { color: #64748b; }

/* ── Blog Detail ──────────────────────────────────────── */
.bd-wrap {
  max-width: 820px;
  margin: 0 auto;
  padding: 140px 5% 80px;
  min-height: 80vh;
  color: #e2e8f0;
}

.bd-back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: #3b82f6;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 2rem;
  transition: gap 0.2s, color 0.2s;
}

.bd-back-link:hover {
  color: #60a5fa;
  gap: 0.75rem;
}

.bd-back-link svg { transition: transform 0.2s; }
.bd-back-link:hover svg { transform: translateX(-3px); }

body.light .bd-back-link { color: #2563eb; }
body.light .bd-back-link:hover { color: #1d4ed8; }

/* Meta row */
.bd-meta {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.bd-tag {
  padding: 0.35rem 1rem;
  border-radius: 9999px;
  font-weight: 700;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: rgba(59, 130, 246, 0.12);
  color: #3b82f6;
}

.bd-muted {
  color: #9ca3af;
  font-size: 0.9rem;
}

.bd-meta-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #9ca3af;
}

body.light .bd-muted { color: #64748b; }

/* Headings */
.bd-wrap h1 {
  color: #f1f5f9;
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 800;
  line-height: 1.18;
  margin-bottom: 2rem;
  letter-spacing: -0.025em;
}

.bd-wrap h2 {
  color: #f1f5f9;
  font-size: clamp(1.35rem, 3vw, 1.7rem);
  font-weight: 700;
  margin: 2.75rem 0 1.1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.bd-wrap h3 {
  color: #e2e8f0;
  font-size: 1.2rem;
  font-weight: 700;
  margin: 2rem 0 0.75rem;
}

.bd-wrap p {
  margin-bottom: 1.35rem;
  line-height: 1.85;
  color: #cbd5e1;
  font-size: 1.02rem;
}

body.light .bd-wrap { color: #374151; }
body.light .bd-wrap h1 { color: #0f172a; }
body.light .bd-wrap h2 { color: #1e293b; border-bottom-color: rgba(0,0,0,0.08); }
body.light .bd-wrap h3 { color: #1e293b; }
body.light .bd-wrap p  { color: #374151; }

/* Lead paragraph */
.bd-lead {
  color: #e2e8f0;
  font-size: 1.2rem;
  font-weight: 500;
  line-height: 1.75;
  margin-bottom: 2.25rem;
  padding: 1.25rem 1.5rem;
  border-left: 3px solid #3b82f6;
  background: rgba(59, 130, 246, 0.06);
  border-radius: 0 10px 10px 0;
}

body.light .bd-lead {
  color: #1e293b;
  background: rgba(59,130,246,0.05);
}

/* Hero image/gradient */
.bd-hero {
  width: 100%;
  height: 380px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 6rem;
  margin-bottom: 2.5rem;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.4);
}

body.light .bd-hero {
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(226, 232, 240, 0.95);
  background: #f8fafc;
}

.bd-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Code blocks */
.bd-code {
  background: #0d1526;
  color: #e2e8f0;
  padding: 1.5rem 1.75rem;
  border-radius: 14px;
  font-family: "Fira Code", "Cascadia Code", "Consolas", monospace;
  font-size: 0.9rem;
  line-height: 1.75;
  margin: 1.75rem 0;
  overflow-x: auto;
  border: 1px solid rgba(255, 255, 255, 0.07);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  position: relative;
}

.bd-code::before {
  content: "";
  display: block;
  width: 52px;
  height: 8px;
  background: linear-gradient(90deg, #ef4444 0 8px, transparent 8px 18px, #fbbf24 18px 26px, transparent 26px 36px, #22c55e 36px 44px);
  background-size: 44px 8px;
  background-repeat: no-repeat;
  margin-bottom: 1rem;
  opacity: 0.8;
}

.bd-code pre {
  margin: 0;
  font: inherit;
  white-space: pre-wrap;
  word-break: break-word;
}

body.light .bd-code {
  background: #f8fafc;
  color: #1e293b;
  border-color: rgba(0,0,0,0.1);
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

/* Author section */
.bd-author {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 3.5rem;
  padding-top: 2rem;
  border-top: 1px solid rgba(255,255,255,0.08);
}

body.light .bd-author { border-top-color: rgba(0,0,0,0.08); }

.bd-author-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 1.15rem;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(0,0,0,0.3);
  background: #3b82f6;
}

.bd-author-name {
  font-weight: 700;
  color: #f1f5f9;
  font-size: 1rem;
}

.bd-author-role {
  font-size: 0.88rem;
  color: #9ca3af;
  margin-top: 2px;
}

body.light .bd-author-name { color: #0f172a; }
body.light .bd-author-role { color: #64748b; }

/* Divider */
.bd-divider {
  border-top: 1px solid rgba(255,255,255,0.08);
}

body.light .bd-divider { border-top-color: rgba(0,0,0,0.08); }

/* Related posts section */
.bd-related-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #f1f5f9;
  margin-bottom: 1.25rem;
  margin-top: 0;
}

.bd-related-img {
  height: 130px;
  font-size: 2.5rem;
}

.bd-related-img--has-img {
  padding: 0;
}

body.light .bd-related-title { color: #0f172a; }

/* Share buttons */
.bd-share {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 2.5rem;
  padding: 1.25rem 1.5rem;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  flex-wrap: wrap;
}

body.light .bd-share {
  background: #f8fafc;
  border-color: rgba(0,0,0,0.08);
}

.bd-share__label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-right: 0.25rem;
}

body.light .bd-share__label { color: #64748b; }

.bd-share__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04);
  color: #9ca3af;
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.bd-share__btn:hover {
  color: #f1f5f9;
  background: rgba(255,255,255,0.09);
  border-color: rgba(255,255,255,0.2);
  transform: translateY(-1px);
}

body.light .bd-share__btn {
  border-color: rgba(0,0,0,0.1);
  background: #fff;
  color: #64748b;
}

body.light .bd-share__btn:hover {
  background: #f1f5f9;
  color: #0f172a;
  border-color: rgba(0,0,0,0.2);
}

/* Table of contents */
.bd-toc {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-left: 3px solid #a855f7;
  border-radius: 0 14px 14px 0;
  padding: 1.25rem 1.5rem;
  margin-bottom: 2.25rem;
}

body.light .bd-toc {
  background: rgba(168,85,247,0.04);
  border-color: rgba(0,0,0,0.08);
  border-left-color: #a855f7;
}

.bd-toc__title {
  font-size: 0.78rem;
  font-weight: 700;
  color: #a855f7;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.75rem;
}

.bd-toc__list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.bd-toc__link {
  font-size: 0.9rem;
  color: #94a3b8;
  text-decoration: none;
  transition: color 0.2s, padding-left 0.2s;
  display: block;
  padding: 0.1rem 0;
}

.bd-toc__link:hover {
  color: #f1f5f9;
  padding-left: 4px;
}

body.light .bd-toc__link { color: #64748b; }
body.light .bd-toc__link:hover { color: #0f172a; }

/* ── Blog hidden (filter) ─────────────────────────────── */
.blog-card.hidden { display: none; }

@media (max-width: 480px) {
  .bd-hero { height: 240px; font-size: 4rem; margin-bottom: 2rem; }
  .bd-code { padding: 1rem 1.25rem; font-size: 0.85rem; }
  .bd-lead { font-size: 1.05rem; padding: 1rem 1.15rem; }
  .blog-page-header { padding: 5rem 1.25rem 2rem; }
}
