/* 
   BLOG CSS — AI Tools Directory
   Separate stylesheet for blog index and single pages.
*/

:root {
  --blog-primary: #6366f1;
  --blog-bg: #fdfdfd;
  --blog-card-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.08);
  --blog-card-hover-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.12);
}

/* Blog Hero Section */
.blog-hero {
  padding: 140px 0 80px;
  background: linear-gradient(to bottom, #fffcfd, #fff);
  text-align: center;
  border-bottom: 1px solid rgba(0, 0, 0, 0.03);
}

.blog-hero-title {
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 800;
  color: #111827;
  letter-spacing: -0.04em;
  margin-bottom: 20px;
}

.blog-hero-subtitle {
  font-size: 1.125rem;
  color: #64748b;
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.6;
}

/* Featured Post Section */
.featured-post-section {
  padding: 0 0 80px;
  margin-top: -30px;
}

.featured-card {
  display: flex;
  background: #fff;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: var(--blog-card-shadow);
  border: 1px solid rgba(0, 0, 0, 0.04);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.featured-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--blog-card-hover-shadow);
}

.featured-image-wrap {
  flex: 1.2;
  position: relative;
  min-height: 400px;
}

.featured-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.featured-content {
  flex: 1;
  padding: 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.category-tag {
  background: rgba(99, 102, 241, 0.1);
  color: #6366f1;
  padding: 4px 12px;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.read-time {
  font-size: 0.8125rem;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 4px;
}

.featured-title {
  font-size: 2.25rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.2;
  margin-bottom: 20px;
  letter-spacing: -0.02em;
}

.featured-excerpt {
  color: #475569;
  font-size: 1rem;
  line-height: 1.6;
  margin-bottom: 30px;
}

.post-author-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 30px;
}

.author-info {
  display: flex;
  flex-direction: column;
}

.author-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: #334155;
}

.post-date {
  font-size: 0.75rem;
  color: #94a3b8;
}

.read-more-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #6366f1;
  font-weight: 600;
  font-size: 0.9375rem;
  transition: all 0.2s ease;
}

.read-more-link:hover {
  gap: 12px;
}

.blog-card .read-more-link::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
}

/* Articles Grid Section */
.articles-section {
  padding-bottom: 100px;
}

.section-title-wrap {
  margin-bottom: 40px;
  border-bottom: 1px solid rgba(0,0,0,0.05);
  padding-bottom: 20px;
}

.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #0f172a;
}

.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 32px;
}

.blog-card {
  position: relative;
  background: #fff;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0,0,0,0.04);
  border: 1px solid rgba(0,0,0,0.04);
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
}

.blog-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 20px 40px rgba(0,0,0,0.08);
}

.blog-card-image-wrap {
  position: relative;
  aspect-ratio: 16/9;
  overflow: hidden;
}

.blog-card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.blog-card:hover .blog-card-image {
  transform: scale(1.05);
}

.blog-card-content {
  padding: 24px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.blog-card-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.4;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.blog-card-excerpt {
  font-size: 0.9375rem;
  color: #64748b;
  line-height: 1.5;
  margin-bottom: 20px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.blog-card-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 20px;
  border-top: 1px solid rgba(0,0,0,0.03);
}

/* Single Blog Page Styles */
.single-post-header {
  padding: 100px 0 60px;
  background: #fff;
}

.post-header-content {
  max-width: 800px;
  margin: 0 auto;
  text-align: center;
}

.single-post-title {
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-weight: 800;
  color: #0f172a;
  line-height: 1.1;
  margin: 20px 0 30px;
  letter-spacing: -0.03em;
}

.single-post-image-wrap {
  max-width: 1000px;
  margin: 0 auto 60px;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 40px 80px rgba(0,0,0,0.1);
}

/* Layout for Sidebar/TOC */
.post-header-full {
  padding: 160px 0 80px;
  background: #f8fafd;
  border-bottom: 1px solid rgba(0,0,0,0.03);
}

.post-header-inner {
  display: flex;
  align-items: center;
  gap: 60px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

.post-header-left {
  flex: 1;
}

.post-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  color: #6366f1;
  font-weight: 600;
  margin-bottom: 32px;
  text-decoration: none;
}

.post-breadcrumb span {
  color: var(--muted);
  font-weight: 400;
}

.single-post-title {
  font-size: 3rem;
  font-weight: 800;
  line-height: 1.2;
  color: #0f172a;
  margin-bottom: 32px;
  text-align: left;
}

.post-author-box {
  display: flex;
  align-items: center;
  gap: 16px;
}

.author-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
}

.author-info-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.author-name {
  font-weight: 700;
  color: #0f172a;
  font-size: 1rem;
}

.post-meta-details {
  font-size: 0.875rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.post-header-right {
  flex: 1;
}

.hero-featured-image {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  border-radius: 24px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.08);
}

.post-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 80px 24px;
  display: flex;
  gap: 80px;
}

.post-sidebar-toc {
  width: 280px;
  flex-shrink: 0;
  position: sticky;
  top: 100px;
  height: fit-content;
}

.toc-card {
  padding: 24px;
  background: #f8fafc;
  border-radius: 16px;
  border: 1px solid rgba(0,0,0,0.04);
}

.toc-card h4 {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 16px;
}

.toc-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.toc-link {
  font-size: 0.9375rem;
  color: var(--muted);
  transition: all 0.2s ease;
  line-height: 1.4;
}

.toc-link:hover {
  color: var(--primary);
}

.toc-link.active {
  color: var(--primary);
  font-weight: 600;
}

.post-main-content {
  flex: 1;
  min-width: 0;
}

.single-post-content {
  font-size: 1.125rem;
  line-height: 1.8;
  color: #334155;
}

.single-post-content h2 {
  font-size: 2rem;
  font-weight: 800;
  color: #0f172a;
  margin: 64px 0 24px;
  scroll-margin-top: 120px;
}

.single-post-content h3 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #0f172a;
  margin: 40px 0 16px;
}

.single-post-content p {
  margin-bottom: 28px;
}

.single-post-content ul, .single-post-content ol {
  margin-bottom: 32px;
  padding-left: 24px;
}

.single-post-content li {
  margin-bottom: 16px;
}

.single-post-content blockquote {
  border-left: 4px solid var(--primary);
  padding: 32px;
  background: #f8fafc;
  font-style: italic;
  font-size: 1.25rem;
  color: #475569;
  margin: 48px 0;
  border-radius: 0 16px 16px 0;
}

.single-post-content img {
  width: 100%;
  border-radius: 20px;
  margin: 48px 0;
}

.single-post-content strong {
  color: #0f172a;
  font-weight: 700;
}

.highlight-box {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 16px;
  padding: 32px;
  margin: 48px 0;
}

.highlight-box h4 {
  color: #1e40af;
  margin-top: 0;
  margin-bottom: 12px;
  font-size: 1.125rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.highlight-box p {
  color: #1e3a8a;
  margin-bottom: 0;
  font-size: 1rem;
  line-height: 1.6;
}

.highlight-box ul {
  margin-top: 16px;
  margin-bottom: 0;
}

.highlight-box li {
  color: #1e3a8a;
  margin-bottom: 8px;
}

.category-tag {
  display: inline-block;
  padding: 6px 12px;
  background: rgba(99, 102, 241, 0.1);
  color: var(--primary);
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: 16px;
}

/* Responsive */
@media (max-width: 1024px) {
  .post-header-inner {
    flex-direction: column;
    text-align: center;
    gap: 40px;
  }
  .post-header-left {
    width: 100%;
    order: 2;
  }
  .post-header-right {
    width: 100%;
    order: 1;
  }
  .single-post-title {
    text-align: center;
    font-size: 2.5rem;
  }
  .post-author-box {
    justify-content: center;
  }
  .post-breadcrumb {
    justify-content: center;
  }
  .post-container {
    flex-direction: column;
    gap: 40px;
    padding: 40px 24px;
  }
  .post-sidebar-toc {
    width: 100%;
    position: static;
  }
  .featured-card {
    flex-direction: column;
  }
  .featured-image-wrap {
    min-height: 300px;
  }
  .featured-content {
    padding: 32px;
  }
}

@media (max-width: 768px) {
  .post-header-full {
    padding: 110px 0 40px;
  }
  .blog-grid {
    grid-template-columns: 1fr;
  }
  .featured-title {
    font-size: 1.75rem;
  }
  .blog-hero-title {
    font-size: 2.25rem;
  }
  .single-post-title {
    font-size: 2rem;
  }
  .single-post-content {
    font-size: 1rem;
  }
  .single-post-content h2 {
    font-size: 1.625rem;
    margin: 40px 0 16px;
  }
  .single-post-content blockquote {
    padding: 24px;
    font-size: 1.125rem;
  }
}

@media (max-width: 480px) {
  .blog-hero-title {
    font-size: 1.75rem;
  }
  .single-post-title {
    font-size: 1.75rem;
  }
  .post-breadcrumb {
    font-size: 0.75rem;
  }
}

/* Blog Search Box */
.blog-search-container {
  max-width: 580px;
  margin: 32px auto 0;
  position: relative;
  width: 100%;
}

.blog-search-box {
  position: relative;
  display: flex;
  align-items: center;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 50px;
  padding: 6px 16px 6px 20px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.blog-search-box:focus-within {
  border-color: var(--blog-primary, #6366f1);
  box-shadow: 0 12px 30px -8px rgba(99, 102, 241, 0.25), 0 0 0 4px rgba(99, 102, 241, 0.12);
  transform: translateY(-2px);
}

.blog-search-icon {
  color: #94a3b8;
  flex-shrink: 0;
  margin-right: 12px;
  transition: color 0.2s ease;
}

.blog-search-box:focus-within .blog-search-icon {
  color: var(--blog-primary, #6366f1);
}

.blog-search-input {
  width: 100%;
  border: none;
  background: transparent;
  padding: 10px 0;
  font-size: 1.05rem;
  color: #1e293b;
  font-family: inherit;
  outline: none;
}

.blog-search-input::placeholder {
  color: #94a3b8;
  font-weight: 400;
}

.blog-search-clear {
  background: #f1f5f9;
  border: none;
  color: #64748b;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  margin-left: 8px;
  transition: all 0.2s ease;
}

.blog-search-clear:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.blog-search-stats {
  margin-top: 12px;
  font-size: 0.875rem;
  color: #64748b;
  font-weight: 500;
  min-height: 20px;
  text-align: center;
}

/* Dark theme support for Blog Search */
[data-theme="dark"] .blog-search-box {
  background: #1e293b;
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .blog-search-box:focus-within {
  border-color: #818cf8;
  box-shadow: 0 12px 30px -8px rgba(129, 140, 248, 0.3), 0 0 0 4px rgba(129, 140, 248, 0.15);
}

[data-theme="dark"] .blog-search-input {
  color: #f8fafc;
}

[data-theme="dark"] .blog-search-input::placeholder {
  color: #64748b;
}

[data-theme="dark"] .blog-search-clear {
  background: #334155;
  color: #94a3b8;
}

[data-theme="dark"] .blog-search-clear:hover {
  background: #475569;
  color: #f8fafc;
}

[data-theme="dark"] .blog-search-stats {
  color: #94a3b8;
}

