.blog_preview_section {
  padding: 4rem 2rem 4rem 2rem;
  /* background: linear-gradient(180deg, #ffffff 0%, rgb(206, 206, 206) 100%); */
  margin: 2rem 0 0 0;
  background: #ffffff;
}

.blog_preview_title {
  text-align: center;
  font-size: 2.5rem;
  font-weight: bold;
  color: #2c3e50;
  margin-bottom: 2rem;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
  font-family: Arial, Helvetica, sans-serif;
}

/* Add a wrapper to handle centering when cards fit */
.blog_preview_wrapper {
  display: flex;
  justify-content: center;
  width: 100%;
}

/* Keep only ONE container definition with the correct settings */
.blog_preview_container {
  display: flex;
  gap: 1.5rem;
  padding: 1rem 0 2rem 0;
  overflow-x: auto;
  scroll-behavior: smooth;
  
  /* Start with flex-start for proper scrolling */
  justify-content: flex-start;
  
  /* Allow container to be smaller than its parent when content fits */
  width: fit-content;
  max-width: 100%;
  
  /* Custom scrollbar */
  scrollbar-width: thin;
  scrollbar-color: rgb(139, 0, 8) #ecf0f1;
}

/* Use JavaScript to handle centering when content fits */
.blog_preview_container.center-content {
  justify-content: center;
}

/* Changed from .blog_card to .blog_preview_card */
.blog_preview_card {
  font-family: Arial, Helvetica, sans-serif;
  flex: 0 0 calc((100% - 4.5rem) / 4); /* Fit 4 cards with gaps */
  min-width: 250px; /* Minimum card width */
  max-width: 350px; /* Maximum card width */
  background: white;
  border-radius: 15px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  transition: all 0.3s ease;
  cursor: pointer;
}

.blog_preview_card:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
}

.blog_preview_card:hover .blog_image {
  transform: scale(1.05);
}

/* Keep all the other styles the same, just scoped to preview cards */
.blog_image_container {
  width: 100%;
  height: 200px;
  overflow: hidden;
  position: relative;
}

.blog_image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.image_count_badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: bold;
}

.blog_image_placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(45deg, #3498db, #2980b9);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
}

.blog_content {
  padding: 1.5rem;
}

.blog_title {
  font-size: 1.25rem;
  font-weight: bold;
  color: #2c3e50;
  margin-bottom: 0.75rem;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.blog_description {
  font-size: 0.9rem;
  color: #7f8c8d;
  line-height: 1.5;
  margin-bottom: 1rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.blog_read_more {
  display: inline-block;
  background: rgb(139, 0, 8);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.3s ease;
}

.blog_read_more:hover {
  background: rgb(101, 0, 5); /*slightly darker on hover*/
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.no_blogs_message {
  text-align: center;
  font-size: 1.2rem;
  color: #2c3e50;
  margin-top: 2rem;
  font-weight: light;
  font-family: Arial, Helvetica, sans-serif;
}

/* Responsive design - only affects preview cards now */
@media (max-width: 1400px) {
  .blog_preview_card {
    flex: 0 0 calc((100% - 3rem) / 3); /* 3 cards on medium screens */
  }
}

@media (max-width: 1024px) {
  .blog_preview_card {
    flex: 0 0 calc((100% - 1.5rem) / 2); /* 2 cards on tablets */
  }
}

@media (max-width: 768px) {
  .blog_preview_section {
    padding: 2rem 1rem;
  }
  
  .blog_preview_title {
    font-size: 2rem;
  }
  
  .blog_preview_card {
    flex: 0 0 280px; /* Fixed width on mobile */
    min-width: 280px;
  }
  
  .blog_image_container {
    height: 180px;
  }
}

@media (max-width: 480px) {
  .blog_preview_card {
    flex: 0 0 250px;
    min-width: 250px;
  }
  
  .blog_image_container {
    height: 150px;
  }
  
  .blog_content {
    padding: 1rem;
  }
}