/* === Blog Styles === */

/* --- Blog Grid (index page) --- */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  margin-top: 48px;
}

/* --- Blog Card --- */
.blog-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
  text-decoration: none;
  display: flex;
  flex-direction: column;
}
.blog-card:hover {
  border-color: rgba(99, 102, 241, 0.4);
  transform: translateY(-3px);
  box-shadow: 0 8px 32px rgba(99, 102, 241, 0.1);
  text-decoration: none;
}
.blog-card-image {
  width: 100%;
  height: 200px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(139, 92, 246, 0.1));
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.blog-card-image .card-icon {
  font-size: 3rem;
  opacity: 0.6;
}
.blog-card-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.blog-card-body h2 {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.4;
  color: var(--text-primary);
  margin-bottom: 10px;
}
.blog-card-body p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.6;
  flex: 1;
  margin-bottom: 16px;
}
.blog-card-body .read-more {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent-solid);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: gap 0.2s;
}
.blog-card:hover .read-more {
  gap: 10px;
}

/* --- Blog Meta --- */
.blog-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.blog-meta span {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}
.blog-meta .tag {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--accent-glow);
  color: var(--accent-solid);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.blog-meta .separator {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}

/* --- Article Header --- */
.article-header {
  max-width: 720px;
  margin: 0 auto;
  padding: 140px 24px 48px;
  text-align: center;
}
.article-header .breadcrumb {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 24px;
}
.article-header .breadcrumb a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s;
}
.article-header .breadcrumb a:hover {
  color: var(--accent-solid);
}
.article-header h1 {
  font-family: var(--font-mono);
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 20px;
  color: var(--text-primary);
}
.article-header .article-description {
  font-size: 1.1rem;
  color: var(--text-secondary);
  line-height: 1.7;
  max-width: 600px;
  margin: 0 auto 24px;
}

/* --- Article Author --- */
.article-author {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding-top: 20px;
  border-top: 1px solid var(--border-subtle);
}
.article-author .author-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-start), var(--accent-end));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  color: #fff;
  font-weight: 700;
}
.article-author .author-info {
  text-align: left;
}
.article-author .author-name {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
}
.article-author .author-date {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* --- Article Content (long-form typography) --- */
.article-content {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 24px 80px;
  line-height: 1.8;
  color: var(--text-secondary);
  font-size: 1rem;
}
.article-content h2 {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 48px;
  margin-bottom: 16px;
  line-height: 1.3;
}
.article-content h3 {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 36px;
  margin-bottom: 12px;
  line-height: 1.35;
}
.article-content p {
  margin-bottom: 20px;
}
.article-content a {
  color: var(--accent-solid);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(124, 110, 246, 0.3);
  transition: text-decoration-color 0.2s;
}
.article-content a:hover {
  text-decoration-color: var(--accent-solid);
}
.article-content strong {
  color: var(--text-primary);
  font-weight: 600;
}
.article-content ul,
.article-content ol {
  margin-bottom: 20px;
  padding-left: 24px;
}
.article-content ul {
  list-style: none;
  padding-left: 0;
}
.article-content ul li {
  position: relative;
  padding-left: 20px;
  margin-bottom: 10px;
}
.article-content ul li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 10px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-solid);
}
.article-content ol li {
  margin-bottom: 10px;
  padding-left: 4px;
}
.article-content ol li::marker {
  color: var(--accent-solid);
  font-family: var(--font-mono);
  font-weight: 600;
}
.article-content blockquote {
  margin: 28px 0;
  padding: 20px 24px;
  border-left: 3px solid var(--accent-solid);
  background: var(--bg-surface);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-style: italic;
  color: var(--text-secondary);
}
.article-content blockquote p:last-child {
  margin-bottom: 0;
}
.article-content code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--bg-surface);
  padding: 2px 6px;
  border-radius: 3px;
  color: var(--accent-solid);
}
.article-content pre {
  margin: 24px 0;
  overflow: hidden;
  border-radius: var(--radius-md);
}
.article-content pre code {
  display: block;
  padding: 20px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.7;
  color: var(--text-secondary);
}
.article-content img {
  width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  margin: 28px 0;
}
.article-content hr {
  border: none;
  height: 1px;
  background: var(--border-color);
  margin: 40px 0;
}

/* --- Comparison Table in Articles --- */
.article-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 28px 0;
  font-size: 0.88rem;
}
.article-content table thead th {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-primary);
  text-align: left;
  padding: 12px 16px;
  background: var(--bg-elevated);
  border-bottom: 2px solid var(--border-color);
  white-space: nowrap;
}
.article-content table tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  vertical-align: top;
}
.article-content table tbody tr:hover {
  background: rgba(99, 102, 241, 0.03);
}
.article-content .table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 28px 0;
}
.article-content .table-wrapper table {
  margin: 0;
  min-width: 600px;
}

/* --- Related Articles --- */
.related-articles {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 24px 80px;
}
.related-articles h2 {
  font-family: var(--font-mono);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 24px;
  padding-top: 40px;
  border-top: 1px solid var(--border-color);
}
.related-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}
.related-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  text-decoration: none;
  transition: border-color 0.2s, transform 0.2s;
  display: block;
}
.related-card:hover {
  border-color: rgba(99, 102, 241, 0.4);
  transform: translateY(-2px);
  text-decoration: none;
}
.related-card h3 {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
  line-height: 1.4;
}
.related-card p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 10px;
}
.related-card .related-meta {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* --- Article Bottom CTA --- */
.article-cta {
  max-width: 720px;
  margin: 0 auto 80px;
  padding: 0 24px;
}
.article-cta-card {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(139, 92, 246, 0.08));
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: var(--radius-lg);
  padding: 40px;
  text-align: center;
}
.article-cta-card h2 {
  font-family: var(--font-mono);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
}
.article-cta-card p {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 24px;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}
.article-cta-card .btn-primary {
  display: inline-block;
  padding: 14px 32px;
  font-size: 1rem;
  text-decoration: none;
  color: #fff;
}
.article-cta-card .btn-primary:hover {
  text-decoration: none;
}

/* --- Blog index: 3-card layout (span full row for odd last card) --- */
.blog-grid .blog-card:only-child,
.blog-grid .blog-card:last-child:nth-child(odd) {
  grid-column: 1 / -1;
  max-width: 540px;
  margin: 0 auto;
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .blog-grid {
    grid-template-columns: 1fr;
  }
  .blog-grid .blog-card:last-child:nth-child(odd) {
    max-width: 100%;
  }
  .article-header {
    padding: 110px 16px 32px;
  }
  .article-header h1 {
    font-size: 1.4rem;
  }
  .article-content {
    padding: 0 16px 60px;
  }
  .article-content h2 {
    font-size: 1.2rem;
    margin-top: 36px;
  }
  .article-content h3 {
    font-size: 1rem;
    margin-top: 28px;
  }
  .related-articles {
    padding: 0 16px 60px;
  }
  .related-grid {
    grid-template-columns: 1fr;
  }
  .article-cta {
    padding: 0 16px;
    margin-bottom: 60px;
  }
  .article-cta-card {
    padding: 28px 20px;
  }
  .blog-card-image {
    height: 160px;
  }
  .blog-meta {
    gap: 8px;
  }
}

@media (max-width: 480px) {
  .article-header {
    padding-top: 100px;
  }
  .article-content pre code {
    font-size: 0.78rem;
    padding: 14px;
  }
}
