/* Blog-specific styles */

/* Blog Hero */
.blog-hero {
  padding: 180px 0 0;
  background: linear-gradient(135deg, #f8f9fc 0%, #ffffff 100%);
  text-align: center;
}

.blog-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(40px, 5vw, 64px);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.03em;
  margin-bottom: 16px;
  color: var(--color-text);
  text-wrap: balance;
}

.blog-hero-subtitle {
  font-size: 20px;
  color: var(--color-text-light);
  max-width: 600px;
  margin: 0 auto;
}

/* Featured Article */
.featured-article {
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.05), rgba(124, 58, 237, 0.05));
  border: 2px solid rgba(79, 70, 229, 0.1);
  border-radius: 16px;
  padding: 48px;
  position: relative;
}

.featured-article .article-tag {
  margin-bottom: 1em;
  display: inline-block;
}

.featured-badge {
  display: inline-block;
  padding: 8px 16px;
  background: var(--color-accent);
  color: white;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 24px;
}

.featured-article h2 {
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 16px;
  text-wrap: balance;
}

.featured-article h2 a {
  color: var(--color-text);
  text-decoration: none;
  transition: color 0.2s;
}

.featured-article h2 a:hover {
  color: var(--color-accent);
}

.article-excerpt {
  font-size: 18px;
  line-height: 1.7;
  color: var(--color-text-light);
  margin-bottom: 24px;
}

.article-meta {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 24px;
  font-size: 14px;
  color: var(--color-text-light);
}

.reading-time {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.article-category {
  padding: 4px 12px;
  background: rgba(79, 70, 229, 0.1);
  color: var(--color-accent);
  border-radius: 999px;
  font-weight: 600;
}

/* Articles Grid */
.articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 32px;
}

.article-card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 32px;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
}

.article-card:hover {
  transform: translateY(-4px);
  border-color: var(--color-accent);
}

.article-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.article-tag {
  padding: 4px 12px;
  background: rgba(79, 70, 229, 0.08);
  color: var(--color-accent);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.article-card h3 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 12px;
  text-wrap: balance;
}

.article-card h3 a {
  color: var(--color-text);
  text-decoration: none;
  transition: color 0.2s;
}

.article-card h3 a:hover {
  color: var(--color-accent);
}

.article-card .article-excerpt {
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-text-light);
  margin-bottom: 20px;
  flex-grow: 1;
  text-wrap: pretty;
}

.article-link {
  color: var(--color-accent);
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: gap 0.2s;
}

.article-link:hover {
  gap: 8px;
}

/* Blog CTA */
.blog-cta {
  text-align: center;
  padding: 64px 32px;
}

.blog-cta h2 {
  font-family: var(--font-display);
  font-size: clamp(32px, 4vw, 48px);
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--color-text);
  text-wrap: balance;
}

.blog-cta p {
  font-size: 20px;
  color: var(--color-text-light);
  max-width: 600px;
  margin: 0 auto;
}

/* Blog Post Styles */
.blog-post {
  padding: 140px 0 80px;
}

.breadcrumb {
  font-size: 14px;
  color: var(--color-text-light);
  margin-bottom: 32px;
}

.breadcrumb a {
  color: var(--color-accent);
  text-decoration: none;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

.post-header {
  max-width: 800px;
  margin: 0 auto 48px;
  text-align: center;
}

.post-header h1 {
  font-family: var(--font-display);
  font-size: clamp(36px, 5vw, 56px);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.03em;
  margin-bottom: 24px;
  color: var(--color-text);
  text-wrap: balance;
}

.post-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  font-size: 14px;
  color: var(--color-text-light);
}

.post-meta time {
  font-weight: 600;
}

/* Post Content */
.post-content {
  max-width: 800px;
  margin: 0 auto;
  font-size: 18px;
  line-height: 1.8;
  color: var(--color-text);
}

.post-content .lead {
  font-size: 22px;
  line-height: 1.7;
  color: var(--color-text-light);
  margin-bottom: 40px;
  font-weight: 500;
}

.post-content h2 {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 600;
  line-height: 1.3;
  margin-top: 64px;
  margin-bottom: 24px;
  color: var(--color-text);
  scroll-margin-top: 144px;
  text-wrap: balance;
}

.post-content h3 {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 600;
  line-height: 1.4;
  margin-top: 48px;
  margin-bottom: 16px;
  color: var(--color-text);
  scroll-margin-top: 144px;
  text-wrap: balance;
}

.post-content h4 {
  font-size: 22px;
  font-weight: 600;
  margin-top: 32px;
  margin-bottom: 12px;
  color: var(--color-text);
}

.post-content p {
  margin-bottom: 24px;
  max-width: 70ch;
  text-wrap: pretty;
}

.post-content ul,
.post-content ol {
  margin-bottom: 24px;
  padding-left: 24px;
}

.post-content li {
  margin-bottom: 12px;
}

.post-content strong {
  font-weight: 700;
  color: var(--color-text);
}

.post-content a {
  text-decoration: underline;
  text-decoration-color: rgba(79, 70, 229, 0.3);
  text-underline-offset: 3px;
  transition: all 0.2s;
}

.post-content a:hover {
  text-decoration-color: var(--color-accent);
}

.post-content blockquote {
  border-left: 4px solid var(--color-accent);
  padding-left: 24px;
  margin: 32px 0;
  font-style: italic;
  color: var(--color-text-light);
  font-size: 20px;
}

/* Inline CTA */
.cta-inline {
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.05), rgba(124, 58, 237, 0.05));
  border: 2px solid rgba(79, 70, 229, 0.2);
  border-radius: 16px;
  padding: 32px;
  text-align: center;
  margin: 48px 0;
}

.cta-inline p {
  font-size: 20px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 16px;
}

/* Related Posts */
.related-posts {
  background: #f8f9fc;
  border-radius: 16px;
  padding: 32px;
  margin: 48px 0;
}

.related-posts h3 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 16px;
  margin-top: 0 !important;
}

.related-posts ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.related-posts li {
  margin-bottom: 12px;
}

.related-posts a {
  color: var(--color-accent);
  text-decoration: none;
  font-weight: 600;
}

.related-posts a:hover {
  text-decoration: underline;
}

/* Post CTA */
.post-cta {
  max-width: 800px;
  margin: 64px auto 0;
  background: linear-gradient(135deg, var(--color-primary) 0%, #1e293b 100%);
  border-radius: 16px;
  padding: 48px;
  text-align: center;
}

.post-cta h3 {
  color: white;
  font-size: 32px;
  font-weight: 600;
  margin-bottom: 24px;
  text-wrap: balance;
}

.post-cta .btn {
  background: white;
  color: var(--color-primary);
}

.post-cta .btn:hover {
  background: rgba(255, 255, 255, 0.9);
  transform: translateY(-2px);
}

/* Table of Contents */
.toc {
  background: #f8f9fc;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 48px;
}

.toc-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-accent);
  margin-bottom: 16px;
  margin-top: 0;
}

/* Legacy: posts com <h4> estático ainda funcionam */
.toc h4 {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-accent);
  margin-bottom: 16px;
  margin-top: 0 !important;
}

.toc ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.toc li {
  margin-bottom: 8px;
}

.toc-h2>a {
  color: var(--color-text);
  text-decoration: none;
  font-weight: 500;
  font-size: 15px;
  transition: color 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.toc-h2>a::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-accent);
  flex-shrink: 0;
}

.toc-sub {
  padding-left: 20px;
}

.toc-sub>a {
  color: var(--color-text-light);
  text-decoration: none;
  font-weight: 400;
  font-size: 14px;
  transition: color 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.toc-sub>a::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
  opacity: 0.5;
}

.toc a:hover,
.toc-h2>a:hover,
.toc-sub>a:hover {
  color: var(--color-accent);
  text-decoration: none;
}


/* Highlight Box */
.highlight-box {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.05), rgba(16, 185, 129, 0.05));
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: 12px;
  padding: 24px;
  margin: 32px 0;
}

.highlight-box p:last-child {
  margin-bottom: 0;
}

/* Warning Box */
.warning-box {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.05), rgba(245, 158, 11, 0.05));
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: 12px;
  padding: 24px;
  margin: 32px 0;
}

.warning-box p:last-child {
  margin-bottom: 0;
}

/* Comparison Table */
.comparison-table {
  width: 100%;
  border-collapse: collapse;
  margin: 32px 0;
  font-size: 16px;
}

.comparison-table th,
.comparison-table td {
  border: 1px solid #e5e7eb;
  padding: 16px;
  text-align: left;
}

.comparison-table th {
  background: #f8f9fc;
  font-weight: 600;
  color: var(--color-text);
}

.comparison-table tr:nth-child(even) {
  background: #fafafa;
}

/* Author Bio */
.author-bio {
  background: #f8f9fc;
  padding: 24px;
  border-radius: 12px;
  margin-bottom: 48px;
  border: 1px solid #e5e7eb;
}

.author-bio strong {
  display: block;
  font-size: 18px;
  margin-bottom: 8px;
  color: var(--color-text);
}

.author-bio p {
  margin: 0;
  font-size: 15px;
  color: var(--color-text-light);
}

/* Social Proof Badge */
.social-proof-badge {
  display: inline-block;
  background: #fff;
  border: 1px solid #e5e7eb;
  padding: 12px 20px;
  border-radius: 8px;
  margin-top: 16px;
  font-size: 14px;
  color: var(--color-text);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  text-align: center;
}

.social-proof-badge span {
  display: block;
  font-weight: 700;
  color: #f59e0b;
  margin-bottom: 4px;
  font-size: 16px;
}

.social-proof-badge p {
  margin: 0;
  color: var(--color-text-light);
}

/* Responsive */
@media (max-width: 768px) {
  .blog-hero {
    padding: 100px 0 60px;
  }

  .featured-article {
    padding: 32px 24px;
  }

  .articles-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .article-card {
    padding: 24px;
  }

  .blog-post {
    padding: 100px 0 60px;
  }

  .post-content {
    font-size: 17px;
  }

  .post-content h2 {
    font-size: 28px;
    margin-top: 48px;
  }

  .post-content h3 {
    font-size: 24px;
    margin-top: 32px;
  }

  .cta-inline {
    padding: 24px;
  }

  .post-cta {
    padding: 32px 24px;
  }

  .post-cta h3 {
    font-size: 24px;
  }
}

/* Back to Top button — injetado via toc.js */
#back-to-top {
  position: fixed;
  bottom: 32px;
  right: 32px;
  z-index: 999;
  height: 40px;
  padding: 0 16px 0 12px;
  border-radius: 999px;
  border: none;
  background: var(--color-accent, #4f46e5);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-body, 'Nunito', sans-serif);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: 0 4px 16px rgba(79, 70, 229, 0.35);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.25s ease, transform 0.25s ease, background 0.2s;
  pointer-events: none;
}

#back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

#back-to-top:hover {
  background: #4338ca;
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.45);
}

@media (max-width: 768px) {
  #back-to-top {
    bottom: 20px;
    right: 20px;
  }
}

/* ==========================================
   Filtros e Busca do Blog
   ========================================== */

.blog-controls {
  max-width: 800px;
  margin: -24px auto 48px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  align-items: center;
}

.search-box {
  position: relative;
  width: 100%;
  max-width: 600px;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 20px;
  color: #9ca3af;
  pointer-events: none;
  transition: color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

#blog-search-input {
  width: 100%;
  padding: 16px 20px 16px 52px;
  font-size: 16px;
  font-family: var(--font-body, 'Nunito', sans-serif);
  color: var(--color-text);
  background: #f8f9fc;
  border: 2px solid #e5e7eb;
  border-radius: 999px;
  outline: none;
  transition: all 0.2s ease-in-out;
}

#blog-search-input:focus {
  background: white;
  border-color: var(--color-accent, #4f46e5);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

#blog-search-input:focus + .search-icon {
  color: var(--color-accent, #4f46e5);
}

#blog-search-clear {
  position: absolute;
  right: 18px;
  background: none;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s;
}

#blog-search-clear:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--color-text);
}

.categories-container {
  width: 100%;
  overflow: hidden;
  position: relative;
}

.categories-list {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.category-btn {
  background: #f1f5f9;
  border: none;
  color: #4b5563;
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  font-family: var(--font-body, 'Nunito', sans-serif);
  display: inline-block;
  text-decoration: none;
}

.category-btn:hover {
  background: #e2e8f0;
  color: #1f2937;
  transform: translateY(-1px);
}

.category-btn.active {
  background: var(--color-accent, #4f46e5);
  color: white;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

/* No Results Card */
.no-results-card {
  text-align: center;
  padding: 60px 40px;
  background: #f8f9fc;
  border-radius: 24px;
  border: 2px dashed #e5e7eb;
  max-width: 500px;
  margin: 40px auto;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.no-results-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.no-results-card h3 {
  font-family: var(--font-display);
  font-size: 24px;
  margin-bottom: 12px;
  color: var(--color-text);
}

.no-results-card p {
  color: var(--color-text-light);
  font-size: 16px;
  line-height: 1.6;
  margin-bottom: 24px;
}

/* CSS dynamic transition for article cards */
.article-card {
  transition: opacity 0.25s ease, transform 0.25s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.article-card.hidden {
  opacity: 0;
  transform: scale(0.95);
  position: absolute;
  pointer-events: none;
  visibility: hidden;
  height: 0;
  width: 0;
  padding: 0;
  margin: 0;
  border: none;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .blog-controls {
    margin-top: -12px;
    margin-bottom: 32px;
    gap: 16px;
  }
  
  .categories-container {
    margin: 0 -16px;
    padding: 0 16px;
    width: calc(100% + 32px);
  }
  
  .categories-list {
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 12px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
  }
  
  .categories-list::-webkit-scrollbar {
    display: none; /* Safari and Chrome */
  }
  
  .category-btn {
    padding: 8px 16px;
    font-size: 13px;
  }
}

/* Screen-reader only utility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Layout shift prevention: reserve min-height for articles grid */
.articles-grid {
  min-height: 250px;
}

/* Post Header Category Badge */
.post-category-wrapper {
  margin-top: 16px;
  margin-bottom: 8px;
  display: flex;
  justify-content: center;
}

.post-category-badge {
  display: inline-block;
  padding: 6px 14px;
  background: rgba(79, 70, 229, 0.08);
  color: var(--color-accent, #4f46e5);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-decoration: none !important;
  transition: all 0.2s ease-in-out;
}

.post-category-badge:hover {
  background: var(--color-accent, #4f46e5);
  color: white !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(79, 70, 229, 0.2);
}

/* Load More Section Styles */
.load-more-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 48px;
  gap: 20px;
  width: 100%;
}

.load-more-progress-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 280px;
}

.load-more-status {
  font-size: 14px;
  color: var(--color-text-light, #6b7280);
  font-weight: 600;
}

.load-more-bar-bg {
  width: 100%;
  height: 6px;
  background-color: #f3f4f6;
  border-radius: 999px;
  overflow: hidden;
}

.load-more-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-accent, #4f46e5) 0%, #7c3aed 100%);
  border-radius: 999px;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-load-more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 32px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 12px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  background: white;
  border: 2px solid var(--color-accent, #4f46e5);
  color: var(--color-accent, #4f46e5);
  cursor: pointer;
}

.btn-load-more:hover {
  background: var(--color-accent, #4f46e5);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(79, 70, 229, 0.15);
}

.btn-load-more:hover svg {
  transform: translateY(2px);
}

.btn-load-more:active {
  transform: translateY(0);
}

/* Fade-in Animation for newly revealed posts */
@keyframes articleFadeIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.article-card.animated-fade-in {
  animation: articleFadeIn 0.45s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
