/* ==========================================================================
   BLOG PAGES (COMPACT EDITORIAL DESIGN)
   Constrained images, clean typography, no massive banners.
   ========================================================================== */

/* ===== BLOG LISTING PAGE ===== */
.blog {
  position: relative;
  z-index: 1;
  padding: 80px 0;
  flex: 1;
}

.blog .intro {
  max-width: 500px;
  margin-inline: auto;
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 48px;
}

/* Grid: 1 col mobile, 2 col tablet, 3 col desktop */
.blog-grid {
  display: grid;
  grid-template-columns: 1fr; 
  gap: 24px;
}

/* The Card: Clean, compact, no huge images */
.blog-card {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  transition: all var(--t);
  display: flex;
  flex-direction: column;
}

.blog-card:hover {
  background-color: var(--bg-elevated);
  border-color: var(--border-hover);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

/* COMPACT IMAGE: Short banner ratio, capped height */
.blog-img {
  width: 100%;
  aspect-ratio: 16 / 7; /* Much shorter than 16/9 */
  max-height: 180px; /* Hard cap so it never gets huge on desktop */
  object-fit: cover;
  object-position: center;
  background-color: var(--bg-base);
  transition: transform 0.4s var(--ease);
}

.blog-card:hover .blog-img {
  transform: scale(1.02); /* Very subtle zoom */
}

.blog-content {
  padding: 20px 24px 24px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* Clean, subtle category tag */
.blog-content::before {
  content: "Article";
  display: inline-flex;
  width: fit-content;
  margin-bottom: 12px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  background-color: var(--accent-bg);
}


.blog-content h3 {
  font-size: 1.05rem;
  line-height: 1.35;
  margin-bottom: 8px;
  color: var(--text-primary);
  transition: color var(--t);
  
  /* 100% Error-Free Uniform Height (Exactly 2 lines) */
  max-height: 2.84em; /* 1.05rem * 1.35 line-height * 2 lines */
  overflow: hidden;
}

.blog-card:hover .blog-content h3 {
  color: var(--accent);
}

.blog-content p {
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: 16px;
  flex: 1;
  
  /* 100% Error-Free Uniform Height (Exactly 3 lines) */
  max-height: 4.2em; /* 0.875rem * 1.6 line-height * 3 lines */
  overflow: hidden;
}

/* Minimalist read more */
.read-more {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.8rem;
  transition: all 0.25s var(--ease);
  margin-top: auto;
}

.read-more i {
  font-size: 0.7rem;
  transition: transform 0.25s var(--ease);
}

.read-more:hover {
  color: var(--accent);
  gap: 10px;
}

.read-more:hover i {
  transform: translateX(3px);
}


/* ===== SINGLE BLOG / POST PAGE ===== */
.blog-post {
  position: relative;
  z-index: 1;
  padding: 80px 0;
  flex: 1;
  width: 100%;
}

.blog-post .container {
  max-width: 100%;
  margin: 0 auto;
  width: 100%;
}

/* Header: Clean, no massive background boxes */
.post-header {
  max-width: 720px; /* Keep text readable and centered */
  margin: 0 auto 32px;
  text-align: left;
  padding: 0 16px;
}

.post-header h1 {
  font-size: clamp(1.75rem, 4vw, 2.4rem);
  margin-bottom: 16px;
  line-height: 1.2;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.post-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 500;
}

.post-meta::before {
  content: '📅';
  font-size: 0.85rem;
}

/* CONSTRAINED HERO IMAGE: Never stretches full screen on desktop */
.post-img-wrapper {
  max-width: 800px; /* Hard cap for desktop */
  margin: 0 auto 48px;
  padding: 0 16px;
}

.post-img {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 8; /* Shorter, cinematic feel */
  object-fit: cover;
  border-radius: var(--radius-lg);
  background-color: var(--bg-base);
  border: 1px solid var(--border-subtle);
  display: block;
}

/* The main reading area */
.post-content {
  max-width: 720px; /* Perfect reading width */
  margin: 0 auto 48px;
  padding: 0 16px;
}

.post-content p {
  margin-bottom: 20px;
  color: var(--text-secondary);
  line-height: 1.8; 
  font-size: 1.02rem;
}

.post-content h2 {
  text-align: left;
  margin-top: 40px;
  margin-bottom: 16px;
  padding-left: 16px;
  border-left: 3px solid var(--accent);
  font-size: clamp(1.2rem, 2.5vw, 1.45rem);
  color: var(--text-primary);
}

.post-content h2:first-child {
  margin-top: 0;
}

/* Clean list items */
.post-content ul {
  list-style: none;
  margin: 24px 0;
  padding: 0;
}

.post-content ul li {
  position: relative;
  padding: 12px 16px 12px 40px;
  margin-bottom: 10px;
  color: var(--text-secondary);
  background-color: var(--bg-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  transition: all var(--t);
  line-height: 1.6;
  font-size: 0.95rem;
}

.post-content ul li:hover {
  border-color: var(--border-hover);
  transform: translateX(3px);
}

.post-content ul li::before {
  content: '✓';
  color: var(--accent);
  font-weight: 700;
  font-size: 0.85rem;
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
}

.post-content strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* Elegant blockquotes */
.post-content blockquote {
  margin: 32px 0;
  padding: 20px 24px;
  background-color: var(--bg-surface);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-md);
  font-style: italic;
  color: var(--text-primary);
}

.post-content blockquote p {
  margin-bottom: 0;
  color: inherit;
  font-size: 1.05rem;
}

/* Clean data tables */
.post-content table {
  width: 100%;
  border-collapse: collapse;
  border-radius: var(--radius-md);
  overflow: hidden;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  margin: 24px 0;
  font-size: 0.9rem;
}

.post-content th,
.post-content td {
  padding: 12px 16px;
  border: 1px solid var(--border-subtle);
  text-align: left;
}

.post-content th {
  background-color: var(--bg-elevated);
  color: var(--text-primary);
  font-weight: 600;
}

.post-content td {
  color: var(--text-secondary);
}

/* Footer / Back button */
.post-footer {
  text-align: center;
  padding: 20px 16px 0;
  margin-top: 20px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background-color: var(--bg-surface);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  transition: all var(--t);
}

.back-link:hover {
  background-color: var(--bg-elevated);
  border-color: var(--border-hover);
  transform: translateY(-2px);
}


/* ===== RESPONSIVE SCALING ===== */
@media (min-width: 640px) {
  .blog-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
  }
}

@media (min-width: 1024px) {
  .blog-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 28px;
  }
  
  /* Give desktop a bit more breathing room for text */
  .post-content p {
    font-size: 1.05rem;
  }
}

@media (max-width: 768px) {
  .blog, .blog-post {
    padding: 60px 0;
  }
  
  .blog-img {
    max-height: 160px;
  }

  .blog-content {
    padding: 16px 20px 20px;
  }
  
  .back-link {
    width: 100%;
    max-width: 300px;
  }
}