/* Blog list page specific styles */
.blog-hero { padding: 30px 0; text-align:center; background: #F3F4F6; }
.blog-hero h1 { font-size: 2.2rem; font-weight: 800; color: #111827; margin-bottom: 10px; }
.blog-hero p { color: #6B7280; }

/* Active tag display */
.blog-active-tag {
    display: flex;
    align-items: center;
    gap: 10px;
}

.blog-active-tag-label {
    font-weight: 700;
    color: #6B7280;
}

.blog-active-tag-badge {
    border: 1px solid #E5E7EB;
    padding: 6px 10px;
    border-radius: 9999px;
    font-weight: 600;
}

.blog-active-tag-reset {
    margin-left: auto;
    color: #e15c02;
    text-decoration: none;
}

/* 3-column grid layout */
.blog-grid { 
  display: grid; 
  grid-template-columns: repeat(3, 1fr); 
  gap: 24px; 
  /* Ensure proper grid item containment */
  align-items: start;
}

.blog-card { 
  background: #FFFFFF; 
  border-radius: 10px; 
  overflow: hidden; 
  box-shadow: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -1px rgba(0,0,0,.06); 
  transition: transform .2s ease, box-shadow .2s ease; 
  height: 100%; 
  display: flex; 
  flex-direction: column; 
  text-decoration: none;
  /* Ensure the card maintains its content together */
  break-inside: avoid;
  page-break-inside: avoid;
  /* Prevent content overflow and ensure proper layout */
  min-height: 0;
  isolation: isolate;
}

.blog-card:hover { 
  transform: translateY(-4px); 
  box-shadow: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -2px rgba(0,0,0,.05); 
}

.blog-cover { 
  width: 100%; 
  height: 180px; 
  object-fit: cover; 
  display: block; 
  /* Ensure image doesn't break away from text */
  flex-shrink: 0;
  /* Prevent image from causing layout shifts */
  max-width: 100%;
}

.blog-content { 
  padding: 16px 18px; 
  display: flex; 
  flex-direction: column; 
  gap: 8px; 
  flex: 1 1 auto;
  /* Ensure content doesn't separate from image */
  min-height: 0;
  /* Prevent content overflow */
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.blog-category { 
  color: #e15c02; 
  text-transform: uppercase; 
  font-weight: 700; 
  font-size: .75rem; 
}

.blog-title { 
  font-weight: 800; 
  color: #111827; 
  font-size: 1.1rem; 
  line-height: 1.4; 
  /* Prevent long titles from breaking layout */
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}

.blog-excerpt { 
  color: #6B7280; 
  font-size: .95rem; 
}

.blog-meta { 
  color: #6B7280; 
  font-size: .8rem; 
  display: flex; 
  gap: 10px; 
  align-items: center; 
}

.blog-readmore { 
  color: #e15c02; 
  font-weight: 600; 
  text-decoration: none; 
  margin-top: auto;
  display: inline-block;
}

.blog-readmore:hover {
  text-decoration: underline;
}

.blog-title a {
  color: #111827;
  text-decoration: none;
}

.blog-title a:hover {
  color: var(--primary);
}

.blog-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.blog-tag {
  display: inline-block;
  padding: 6px 12px;
  background: var(--light-gray);
  color: var(--dark);
  text-decoration: none;
  border-radius: 20px;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.blog-tag:hover {
  background: var(--primary);
  color: white;
}

.blog-cover-placeholder {
  height: 180px;
  flex-shrink: 0;
  max-width: 100%;
}

.blog-pager { 
  display: flex; 
  justify-content: center; 
  gap: 10px; 
  margin-top: 24px; 
}

.btn-page { 
  padding: 8px 12px; 
  border: 1px solid #E5E7EB; 
  border-radius: 6px; 
  background: #fff; 
  text-decoration: none; 
  color: #111827; 
  font-weight: 600; 
}

.btn-page.active { 
  background: #e15c02; 
  color: #fff; 
  border-color: #e15c02; 
}

/* Card styles */
.blog-card {
  background: #FFFFFF;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -1px rgba(0,0,0,.06);
  transition: transform .2s ease, box-shadow .2s ease;
  height: 100%;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  break-inside: avoid;
  page-break-inside: avoid;
  min-height: 0;
  isolation: isolate;
}

/* Ensure images don't cause layout shifts */
img.blog-cover[src=""], img.blog-cover:not([src]) {
  display: none;
}

/* Fix potential float clearing issues */
.blog-grid::after {
  content: "";
  display: table;
  clear: both;
}

/* Responsive design */
@media (max-width: 1024px) {
  .blog-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }
  
  .blog-cover {
    height: 160px;
  }
}

@media (max-width: 768px) {
  .blog-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  .blog-hero h1 {
    font-size: 1.8rem;
  }
  
  .blog-cover {
    height: 140px;
  }
  
  .blog-content {
    padding: 14px 16px;
    min-height: 0;
  }
}
