/* ============================================================
   BLOG — Modern Design System
   Listing, Post Cards, Article Pages, Interactive Features
   ============================================================ */

/* --- Blog Hero / Header --- */
.blog-hero {
  background: linear-gradient(135deg, #0d1b2a 0%, #1a2744 50%, #1e3a5f 100%);
  border-radius: 1rem;
  padding: 2.5rem 2rem;
  margin-bottom: 2rem;
  position: relative;
  overflow: hidden;
}
.blog-hero::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.15) 0%, transparent 70%);
  pointer-events: none;
}
.blog-hero h1 {
  color: #fff;
  font-size: 2rem;
  margin-bottom: 0.5rem;
  position: relative;
}
.blog-hero .blog-intro {
  color: #94a3b8;
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
  max-width: 600px;
  line-height: 1.6;
  position: relative;
}
.blog-hero .blog-stats {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  position: relative;
}
.blog-hero .blog-stat {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: #cbd5e1;
  font-size: 0.85rem;
  font-weight: 500;
}
.blog-hero .blog-stat strong {
  color: #fff;
  font-size: 1.1rem;
}

/* --- Search Bar (inside hero) --- */
.blog-search-bar {
  position: relative;
}
.search-input-wrapper {
  position: relative;
  margin-bottom: 1rem;
}
.search-input-wrapper .search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: #64748b;
  pointer-events: none;
}
#blog-search {
  width: 100%;
  padding: 0.875rem 1rem 0.875rem 3rem;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-radius: 0.75rem;
  font-size: 1rem;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  backdrop-filter: blur(4px);
  font-family: inherit;
}
#blog-search:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
  background: rgba(255, 255, 255, 0.12);
}
#blog-search::placeholder {
  color: #64748b;
}

/* --- Category Filter Pills --- */
.blog-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.cat-btn {
  padding: 0.35rem 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 2rem;
  background: rgba(255, 255, 255, 0.06);
  color: #94a3b8;
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  font-weight: 500;
}
.cat-btn:hover {
  border-color: rgba(59, 130, 246, 0.4);
  color: #93c5fd;
  background: rgba(59, 130, 246, 0.1);
}
.cat-btn.active {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
}
.search-count {
  font-size: 0.82rem;
  color: #64748b;
  margin: 0;
}

/* --- Featured Post (first/latest) --- */
.featured-post {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 1rem;
  overflow: hidden;
  margin-bottom: 2rem;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.2s ease;
}
.featured-post:hover {
  border-color: #93c5fd;
  box-shadow: 0 8px 30px rgba(37, 99, 235, 0.1);
  transform: translateY(-2px);
  text-decoration: none;
}
.featured-post-img {
  width: 100%;
  height: 100%;
  min-height: 280px;
  object-fit: cover;
}
.featured-post-body {
  padding: 2rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.featured-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: 2rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
  width: fit-content;
}
.featured-post h2 {
  font-size: 1.5rem;
  margin: 0 0 0.75rem;
  color: #0d1b2a;
  line-height: 1.3;
  transition: color 0.2s ease;
}
.featured-post:hover h2 {
  color: #2563eb;
}
.featured-post p {
  font-size: 0.9rem;
  color: #64748b;
  line-height: 1.6;
  margin: 0 0 1rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.featured-post-meta {
  display: flex;
  gap: 1rem;
  font-size: 0.78rem;
  color: #94a3b8;
  flex-wrap: wrap;
}

@media (max-width: 768px) {
  .featured-post {
    grid-template-columns: 1fr;
  }
  .featured-post-img {
    min-height: 200px;
    max-height: 220px;
  }
  .featured-post-body {
    padding: 1.25rem;
  }
  .featured-post h2 {
    font-size: 1.2rem;
  }
}

/* --- Post Cards Grid --- */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
}
.post-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 0.875rem;
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.2s ease;
  opacity: 0;
  transform: translateY(16px);
  animation: cardFadeIn 0.4s ease forwards;
}
.post-card:hover {
  border-color: #93c5fd;
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.08);
  transform: translateY(-3px);
  text-decoration: none;
}
.post-card img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  transition: transform 0.3s ease;
}
.post-card:hover img {
  transform: scale(1.03);
}
.post-card-img-wrapper {
  overflow: hidden;
  position: relative;
}
.post-card-body {
  padding: 1.25rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.post-card-category {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.5rem;
  border-radius: 0.25rem;
  margin-bottom: 0.6rem;
  width: fit-content;
}
.post-card h3 {
  font-size: 0.95rem;
  margin: 0 0 0.5rem;
  color: #1a2744;
  transition: color 0.2s ease;
  line-height: 1.4;
}
.post-card:hover h3 {
  color: #2563eb;
}
.post-card p {
  font-size: 0.82rem;
  color: #64748b;
  margin: 0 0 0.75rem;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.6;
}
.post-card-meta {
  font-size: 0.72rem;
  color: #94a3b8;
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding-top: 0.75rem;
  border-top: 1px solid #f1f5f9;
}

@keyframes cardFadeIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Stagger animation for cards */
.post-card:nth-child(1) { animation-delay: 0.05s; }
.post-card:nth-child(2) { animation-delay: 0.1s; }
.post-card:nth-child(3) { animation-delay: 0.15s; }
.post-card:nth-child(4) { animation-delay: 0.2s; }
.post-card:nth-child(5) { animation-delay: 0.25s; }
.post-card:nth-child(6) { animation-delay: 0.3s; }
.post-card:nth-child(7) { animation-delay: 0.35s; }
.post-card:nth-child(8) { animation-delay: 0.4s; }
.post-card:nth-child(9) { animation-delay: 0.45s; }

/* Load More Button */
.load-more-wrapper {
  text-align: center;
  margin-top: 2rem;
}
.load-more-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 2rem;
  background: #fff;
  border: 2px solid #e2e8f0;
  border-radius: 0.75rem;
  color: #1a2744;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}
.load-more-btn:hover {
  border-color: #2563eb;
  color: #2563eb;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.1);
}
.load-more-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

@media (max-width: 768px) {
  .posts-grid {
    grid-template-columns: 1fr;
  }
  .blog-hero {
    padding: 1.5rem 1.25rem;
  }
  .blog-hero h1 {
    font-size: 1.5rem;
  }
}

/* --- Simplified Author Card --- */
.author-card-simple {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  margin: 2rem 0;
}
.author-card-simple .author-name {
  font-weight: 700;
  color: #1a2744;
  font-size: 1rem;
  margin: 0;
}

/* ============================================================
   ARTICLE PAGE — Reading Experience
   ============================================================ */

/* --- Reading Progress Bar --- */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: linear-gradient(90deg, #2563eb, #3b82f6, #60a5fa);
  z-index: 200;
  transition: width 0.1s linear;
  box-shadow: 0 0 8px rgba(37, 99, 235, 0.3);
}

/* --- Article Header --- */
.article-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #e2e8f0;
}
.article-header h1 {
  font-size: 2.2rem;
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
}
.article-subtitle {
  font-size: 1.1rem;
  color: #64748b;
  line-height: 1.6;
  margin-bottom: 1rem;
}
.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.82rem;
  color: #64748b;
  align-items: center;
}
.article-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.article-meta-item svg {
  width: 14px;
  height: 14px;
  color: #94a3b8;
}
.article-category-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.6rem;
  border-radius: 0.25rem;
  color: #fff;
}

/* --- Article Hero Image --- */
.article-hero {
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  border-radius: 1rem;
  margin: 1.5rem 0 2rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

/* --- Article Layout with TOC --- */
.article-layout {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 3rem;
  align-items: start;
}
@media (max-width: 1024px) {
  .article-layout {
    grid-template-columns: 1fr;
  }
}

/* --- Table of Contents (Sticky Sidebar) --- */
.toc-sidebar {
  position: sticky;
  top: 5rem;
  max-height: calc(100vh - 6rem);
  overflow-y: auto;
}
.toc-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  padding: 1.25rem;
}
.toc-card h4 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #94a3b8;
  margin: 0 0 0.75rem;
  font-weight: 700;
}
.toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.toc-list li {
  margin-bottom: 0.1rem;
}
.toc-list a {
  display: block;
  padding: 0.35rem 0.6rem;
  font-size: 0.8rem;
  color: #64748b;
  text-decoration: none;
  border-left: 2px solid transparent;
  border-radius: 0 0.25rem 0.25rem 0;
  transition: all 0.2s ease;
  line-height: 1.4;
}
.toc-list a:hover {
  color: #2563eb;
  background: rgba(37, 99, 235, 0.05);
  text-decoration: none;
}
.toc-list a.active {
  color: #2563eb;
  border-left-color: #2563eb;
  background: rgba(37, 99, 235, 0.06);
  font-weight: 600;
}

@media (max-width: 1024px) {
  .toc-sidebar {
    display: none;
  }
}

/* --- Article Content --- */
.article-content {
  font-size: 1.05rem;
  line-height: 1.85;
  color: #334155;
  max-width: 100%;
}
.article-content h2 {
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #e2e8f0;
  font-size: 1.5rem;
  color: #0d1b2a;
  scroll-margin-top: 5rem;
}
.article-content h3 {
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  color: #1a2744;
  font-size: 1.2rem;
  scroll-margin-top: 5rem;
}
.article-content h4 {
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  color: #334155;
  scroll-margin-top: 5rem;
}
.article-content p {
  margin-bottom: 1.25rem;
}
.article-content strong {
  color: #1a2744;
}
.article-content table {
  font-size: 0.875rem;
  border-radius: 0.5rem;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.article-content th {
  background: #1a2744;
  color: #fff;
  font-weight: 600;
}
.article-content td {
  background: #fff;
}
.article-content tr:nth-child(even) td {
  background: #f8fafc;
}
.article-content blockquote {
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  border-left: 4px solid #2563eb;
  background: #eff6ff;
  border-radius: 0 0.5rem 0.5rem 0;
  color: #1e40af;
  font-style: italic;
}
.article-content ul,
.article-content ol {
  margin-bottom: 1.25rem;
  padding-left: 1.5rem;
}
.article-content li {
  margin-bottom: 0.5rem;
}

/* --- Share Buttons --- */
.share-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 0;
  margin: 1.5rem 0;
  border-top: 1px solid #e2e8f0;
  border-bottom: 1px solid #e2e8f0;
}
.share-bar-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: #64748b;
  white-space: nowrap;
}
.share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #64748b;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}
.share-btn:hover {
  border-color: #2563eb;
  color: #2563eb;
  background: #eff6ff;
  text-decoration: none;
}
.share-btn svg {
  width: 16px;
  height: 16px;
}
.share-btn.copied {
  border-color: #16a34a;
  color: #16a34a;
  background: #f0fdf4;
}

/* --- Related Tool Box --- */
.related-tool {
  background: linear-gradient(135deg, #eff6ff 0%, #f0f9ff 100%);
  border: 1px solid #bfdbfe;
  border-radius: 0.875rem;
  padding: 1.5rem;
  margin: 2rem 0;
}
.related-tool h3 {
  color: #1e40af;
  font-size: 1rem;
  margin: 0 0 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.related-tool p {
  color: #334155;
  font-size: 0.9rem;
  margin: 0;
  line-height: 1.6;
}

/* --- Back to Top Button --- */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #2563eb;
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.3s ease, transform 0.3s ease, background 0.2s ease;
  z-index: 50;
  pointer-events: none;
}
.back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.back-to-top:hover {
  background: #1d4ed8;
}
.back-to-top svg {
  width: 20px;
  height: 20px;
}

/* --- Related Posts Section --- */
.related-posts-section {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid #e2e8f0;
}
.related-posts-section h2 {
  font-size: 1.3rem;
  margin-bottom: 1.25rem;
}

/* --- Article Mobile --- */
@media (max-width: 768px) {
  .article-header h1 {
    font-size: 1.6rem;
  }
  .article-subtitle {
    font-size: 0.95rem;
  }
  .article-content {
    font-size: 1rem;
  }
  .share-bar {
    flex-wrap: wrap;
  }
}
