/* --- Shared / Index Styles --- */
.blog-page {
  background: #ffffff;
  color: #111827;
}

.blog-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.blog-section-lead {
  margin: -0.5rem 0 1.25rem;
  padding: 1rem 1.25rem;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
}

.blog-section-lead__title {
  margin: 0 0 0.5rem;
  font-weight: 700;
  color: #111827;
}

.blog-title-list {
  margin: 0;
  padding-left: 1.25rem;
  color: #374151;
}

.blog-title-list li {
  margin: 0.25rem 0;
}

.blog-title-list a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Section Titles */
.blog-section-title {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 3rem 0 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #f3f4f6;
  color: #111;
}

/* Index Hero (Dark Card) */
.blog-hero {
  position: relative;
  border-radius: 24px;
  overflow: hidden;
  margin-bottom: 3rem;
  box-shadow: 0 20px 40px rgba(0,0,0,0.15);
  background: #111;
  color: #fff;
  display: block; /* for anchor */
}

.blog-hero__link {
  display: block;
  position: relative;
  color: inherit;
}

.blog-hero__image {
  display: block;
  width: 100%;
  height: 480px;
  object-fit: cover;
  transition: transform 0.5s ease;
  opacity: 0.8;
}

.blog-hero:hover .blog-hero__image {
  transform: scale(1.02);
  opacity: 0.6;
}

.blog-hero__overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 3rem;
  background: linear-gradient(to top, rgba(0,0,0,0.9), transparent);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  pointer-events: none;
}

.blog-hero__meta {
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  opacity: 0.9;
}

.blog-hero__title {
  font-size: clamp(2rem, 4vw, 3.5rem);
  line-height: 1.1;
  margin: 0;
  font-weight: 800;
}

.blog-hero__summary {
  font-size: 1.125rem;
  max-width: 700px;
  margin: 0;
  opacity: 0.9;
  line-height: 1.6;
}

/* Blog Grid & Cards */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 2.5rem;
  margin-bottom: 4rem;
}

.blog-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  height: 100%;
  border: 1px solid #e5e7eb;
}

.blog-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(0,0,0,0.08);
  border-color: #d1d5db;
}

.blog-card__image-wrapper {
  aspect-ratio: 16/10;
  overflow: hidden;
  background: #f3f4f6;
}

.blog-card__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.blog-card:hover .blog-card__image {
  transform: scale(1.05);
}

.blog-card__body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.blog-card__meta {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6b7280;
  margin-bottom: 0.75rem;
  font-weight: 600;
}

.blog-card__title {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.4;
  margin: 0 0 0.75rem;
}

.blog-card__title a {
  color: inherit;
}

.blog-card__summary {
  font-size: 0.95rem;
  color: #4b5563;
  line-height: 1.6;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* --- Article Page Styles --- */

.blog-page--article {
  background: #fff;
}

.article-header {
  padding-top: 2rem;
  margin-bottom: 3rem;
  text-align: center;
}

.article-header__container {
  max-width: 800px;
  margin: 0 auto 2.5rem;
  padding: 0 1.5rem;
}

/* Back Button Styling - IMPROVED */
.article-header__back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1.2rem;
  background-color: #f3f4f6;
  color: #374151;
  font-weight: 600;
  font-size: 0.875rem;
  border-radius: 9999px;
  text-decoration: none;
  transition: all 0.2s ease;
  border: 1px solid transparent;
  margin-bottom: 1.5rem;
}

.article-header__back:hover {
  background-color: #111827;
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px -2px rgba(0, 0, 0, 0.1);
}

.article-header__meta {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  margin-bottom: 1rem;
}

.article-header__title {
  font-size: clamp(2rem, 5vw, 3.5rem);
  line-height: 1.15;
  font-weight: 800;
  color: #111;
  margin: 0 0 1rem;
  letter-spacing: -0.02em;
}

.article-header__summary {
  font-size: 1.25rem;
  line-height: 1.6;
  color: #4b5563;
  margin: 0 auto;
}

.article-header__image-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.article-header__image {
  width: 100%;
  height: auto;
  max-height: 600px;
  object-fit: cover;
  border-radius: 24px;
  box-shadow: 0 24px 48px rgba(0,0,0,0.12);
}

/* Content Layout */
.blog-post-layout {
  max-width: 800px; /* Optimal reading width */
  margin: 0 auto;
}

/* Typography for Article */
.typography {
  font-size: 1.125rem; /* 18px base */
  line-height: 1.8;
  color: #374151;
}

.typography h2, 
.typography h3 {
  color: #111;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  font-weight: 700;
  line-height: 1.3;
}

.typography h2 { font-size: 2rem; letter-spacing: -0.01em; }
.typography h3 { font-size: 1.5rem; }

.typography p { margin-bottom: 1.5rem; }

.typography ul, 
.typography ol {
  margin-bottom: 1.5rem;
  padding-left: 1.5rem;
}

.typography li { margin-bottom: 0.5rem; }

.typography a {
  color: #111;
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 500;
}

.typography a:hover {
  color: #000;
  text-decoration-thickness: 2px;
}

.typography blockquote {
  border-left: 4px solid #111;
  padding-left: 1.5rem;
  margin: 2rem 0;
  font-style: italic;
  font-size: 1.25rem;
  color: #111;
  background: transparent;
}

.typography img {
  max-width: 100%;
  border-radius: 12px;
  margin: 2rem 0;
}

/* TOC Styling - IMPROVED */
.blog-toc {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 1.5rem;
  margin-bottom: 3rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.blog-toc__header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.2rem;
}

.blog-toc__icon {
  width: 36px;
  height: 36px;
  background: #eff6ff;
  color: #2563eb;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: bold;
}

.blog-toc__eyebrow {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  color: #6b7280;
  margin-bottom: 0.1rem;
}

.blog-toc__hint {
  font-size: 1rem;
  font-weight: 700;
  color: #111827;
}

.blog-toc__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.blog-toc__chip {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 0.9rem;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 0.9rem;
  color: #374151;
  text-decoration: none;
  transition: all 0.15s ease;
  line-height: 1.4;
  font-weight: 500;
}

.blog-toc__chip:hover {
  background: #111827;
  color: #fff;
  border-color: #111827;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  text-decoration: none;
}

.blog-toc__chip--level-3 {
  font-size: 0.8rem;
  padding: 0.4rem 0.7rem;
  opacity: 0.85;
}

.blog-toc__more {
  margin-top: 1rem;
  width: 100%;
}

.blog-toc__more summary {
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  color: #6b7280;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: color 0.2s;
}

.blog-toc__more summary::-webkit-details-marker {
  display: none;
}

.blog-toc__more summary:hover {
  color: #111;
}

.blog-toc__more summary::after {
  content: "+";
  display: inline-block;
  width: 16px;
  height: 16px;
  line-height: 14px;
  text-align: center;
  border-radius: 50%;
  background: #e5e7eb;
  color: #374151;
  font-size: 12px;
  transition: all 0.2s;
}

.blog-toc__more[open] summary::after {
  content: "-";
  background: #374151;
  color: #fff;
}

.blog-toc__chips--secondary {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px dashed #e5e7eb;
}

/* Tags */
.article-tags {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid #e5e7eb;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.article-tag {
  background: #f3f4f6;
  color: #4b5563;
  padding: 0.4rem 0.8rem;
  border-radius: 99px;
  font-size: 0.875rem;
  font-weight: 500;
}

/* Related Section */
.blog-related-section {
  background: #f9fafb;
  padding: 5rem 0;
  margin-top: 5rem;
  border-top: 1px solid #e5e7eb;
}

.blog-related-section__title {
  font-size: 2rem;
  font-weight: 700;
  margin: 0 0 2.5rem;
  text-align: center;
}

@media (max-width: 768px) {
  .blog-grid {
    grid-template-columns: 1fr;
  }
  
  .article-header__title {
    font-size: 2.25rem;
  }
  
  .blog-hero__title {
    font-size: 2rem;
  }
  
  .blog-hero__overlay {
    padding: 1.5rem;
  }
}
