/* Homepage post layout: 3-column card grid (on top of Butterfly defaults)
   Uses high-specificity selectors so injected rules beat theme defaults */

#recent-posts .recent-post-items {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  margin: 0 -10px;
}

#recent-posts div.recent-post-item.recent-post-item {
  display: flex;
  flex-direction: column;
  width: calc((100% - 60px) / 3);
  margin: 0 10px 20px;
  height: auto;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--card-shadow);
  transition: box-shadow 0.3s ease, transform 0.3s ease;
}

#recent-posts div.recent-post-item.recent-post-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 16px 8px rgba(7, 17, 27, 0.1);
}

/* cover on top */
#recent-posts .recent-post-item div.post_cover.post_cover {
  width: 100%;
  height: 170px;
  flex: 0 0 170px;
  order: 0;
  margin: 0;
  display: block;
}

#recent-posts .recent-post-item .post_cover a,
#recent-posts .recent-post-item .post_cover img.post-bg.post-bg {
  width: 100%;
  height: 170px;
  object-fit: cover;
  display: block;
  border-radius: 0;
  margin: 0;
}

/* info below cover */
#recent-posts .recent-post-item div.recent-post-info.recent-post-info {
  order: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 16px 18px 14px;
}

#recent-posts .recent-post-info .article-title.article-title {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.5;
  height: auto;
  min-height: 1.5em;
  white-space: normal;
  margin-bottom: 6px;
}

#recent-posts .recent-post-info div.content.content {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 0.88em;
  opacity: 0.75;
  height: auto;
}

/* 2 columns on medium screens */
@media screen and (max-width: 1100px) {
  #recent-posts div.recent-post-item.recent-post-item {
    width: calc((100% - 40px) / 2);
  }
}

/* 1 column on mobile */
@media screen and (max-width: 768px) {
  #recent-posts div.recent-post-item.recent-post-item {
    width: 100%;
    margin: 0 0 20px;
  }
  #recent-posts .recent-post-items {
    margin: 0;
  }
}
