/**
 * Related Posts - Cards section for post-optimizer grid + Bootstrap row layouts
 * Brand: #1EB7E6 primary, #004E89 secondary
 */

/* ========== Section container ========== */
.related-posts-section,
[data-post-optimizer="related-posts"] {
  box-sizing: border-box;
  margin: 4rem 0 2rem;
  padding: 3rem 0 1rem;
  border-top: 1px solid #e0e0e0;
}

.related-posts-header {
  text-align: center;
  margin-bottom: 2rem;
}

.related-posts-title,
.related-posts-section > .container > h2 {
  font-size: 1.75rem;
  font-weight: 700;
  color: #1a1a1a;
  margin: 0 0 0.5rem;
}

/* ========== Structure A: post-optimizer grid ========== */
.related-posts-list {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

@media (min-width: 992px) {
  .related-posts-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 768px) and (max-width: 991.98px) {
  .related-posts-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 767.98px) {
  .related-posts-list {
    grid-template-columns: 1fr;
  }
}

/* ========== Cards (both structures share look) ========== */
.related-posts-card,
.related-post-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  background: #fff;
  border: 1px solid #e9ecef;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.related-posts-card:hover,
.related-post-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.1);
}

/* ========== Media / image ========== */
.related-posts-card-media {
  display: block;
  overflow: hidden;
  background: #f4f1ea;
}

.related-posts-card-image,
.related-post-image {
  display: block;
  width: 100%;
  height: 200px;
  object-fit: cover;
  object-position: center;
  flex-shrink: 0;
  transition: transform 0.4s ease;
}

.related-posts-card:hover .related-posts-card-image,
.related-post-card:hover .related-post-image {
  transform: scale(1.05);
}

/* ========== Content / body ========== */
.related-posts-card-content,
.related-post-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 1.25rem 1.25rem 1.5rem;
}

/* ========== Category badge (structure B) ========== */
.related-post-category {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--brand-primary, #1EB7E6);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.5rem;
}

/* ========== Titles ========== */
.related-posts-card-title,
.related-post-title {
  font-size: 1.0625rem;
  font-weight: 700;
  line-height: 1.4;
  color: #1a1a1a;
  margin: 0 0 0.6rem;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}

.related-posts-card-link,
.related-post-title a {
  color: inherit;
  text-decoration: none;
  transition: color 0.25s ease;
}

.related-posts-card-link:hover,
.related-post-title a:hover {
  color: var(--brand-primary, #1EB7E6);
  text-decoration: none;
}

/* ========== Excerpt ========== */
.related-posts-card-excerpt,
.related-post-excerpt {
  flex: 1;
  font-size: 0.9375rem;
  line-height: 1.6;
  color: #666;
  margin: 0;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
}

/* Bootstrap row equal-height support */
.related-posts-section .row.g-4 > [class*="col-"] {
  display: flex;
}
