/* Main Grid Container */
.post-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(300px, 1fr)); /* Flexible columns */
  grid-auto-rows: 400px; /* Ensures all items have the same height */
  gap: 40px; /* Space between grid items */
  padding: 20px 0; /* Remove horizontal padding */
  max-width: 1800px; /* Increase the max width of the grid */
  margin: 0; /* Align grid to the left */
  margin-left: -80px; /* Align with header */
}

/* Individual Grid Item */
.post-item {
  background-color: #fff;
  border: 2px solid #292929;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.5);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  display: flex;
  flex-direction: column;
  height: 100%; /* Make the items fill the grid row height */
  width: 100%;
}

.post-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

/* Image styling - ensures the image fits without being squished */
.post-item img {
  width: 100%;
  height: 240px; /* Adjust the percentage to control image height */
  object-fit: cover; /* Maintain aspect ratio, cover the container */
  display: block;
}

.post-content {
  padding: 15px;
  display: flex;
  flex-direction: column;
  justify-content: normal;
  height: 160px; /* Fill remaining space below the image */
  box-sizing: border-box;
  overflow: hidden; /* Prevents overflow if text is long */
  background-color:#e4e4e4
}

/* Specific Title Styling */
.post-content h3.post-title {
  font-size: 1.5rem; /* Make title larger */
  font-weight: bold;
  color: #333;
  overflow: hidden;
  white-space: normal;
}

/* Specific Description Styling */
.post-content p.post-description {
  font-size: 1rem;
  color: #666;
  line-height: 1;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3; /* Limit to 3 lines */
  -webkit-box-orient: vertical;
  text-overflow: ellipsis; /* Truncate with ellipsis */
  margin-top: auto; /* Push description to the bottom */
  margin-bottom: 10px; /* Ensure no extra margin at the bottom */
}

/* Research page specific grid - 2 columns */
.research-grid {
  grid-template-columns: repeat(2, minmax(300px, 1fr));
  margin-left: 0px;
}

/* Responsive adjustments */
@media (max-width: 1200px) {
  .post-grid {
    grid-template-columns: repeat(2, minmax(300px, 1fr)); /* 2 columns on tablets */
    margin-left: -40px;
  }
}

@media (max-width: 768px) {
  .post-grid {
    grid-template-columns: 1fr; /* Single column on smaller screens */
    margin-left: 0;
  }

  .post-item {
    height: auto; /* Adjust height on smaller screens */
  }
}

/* Full-width images in articles on mobile */
@media (max-width: 600px) {
  .post-content img,
  .post-content figure {
    width: 100vw !important;
    max-width: 100vw !important;
    margin-left: -15px !important;
    margin-right: -15px !important;
    float: none !important;
  }

  .post-content figure img {
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  .post-content iframe {
    width: 100vw !important;
    max-width: 100vw !important;
    margin-left: -15px !important;
    margin-right: -15px !important;
    float: none !important;
  }
}