/* ============================================================
   RELATED POSTS GRID — mobile first, 4 cols en desktop
============================================================ */

.related-posts {
    margin: 0 0 4rem 0;
    padding-top: 2rem;
}

.related-posts-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  margin: 2rem 0 3rem 0;
}

.related-posts h2 {
    text-align: center;
    color: var(--color-gray-dark);
}

.related-post-card {
  border-radius: 12px;
  overflow: hidden;
  background: var(--color-bg);
  border: 1px solid rgba(0, 0, 0, 0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.related-post-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.related-post-card a,
.related-post-card a:visited {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  height: 100%;
}

.related-post-card a:hover,
.related-post-card a:focus {
  color: var(--color-brand-mid);
}

.related-thumb {
  aspect-ratio: 16 / 9;
  overflow: hidden;
}

.related-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.related-post-card:hover .related-thumb img {
  transform: scale(1.04);
}

.related-body {
  padding: 1rem 1rem 1.5rem;
}

.related-post-card h3 {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
  line-height: var(--line-height-snug);
  margin: 0;
  flex: 1;
}
.related-post-card a:hover h3, .related-post-card a:focus h3  {
    color: var(--color-brand-mid);
}
/* ── Tablet (≥ 640px) ── */
@media (min-width: 640px) {
  .related-posts-grid {
    grid-template-columns: 1fr 1fr;
  }

  .related-post-card h3 {
    font-size: var(--font-size-base);
  }
}

/* ── Desktop (≥ 1024px): 4 columnas ── */
@media (min-width: 1024px) {
  .related-posts-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .related-post-card h3 {
    font-size: var(--font-size-sm);
  }
}

/* ── Dark mode ── */
html[data-theme="dark"] .related-posts {
    border-top-color: rgba(255, 255, 255, 0.07);
}

html[data-theme="dark"] .related-post-card {
    background: var(--color-bg-subtle);
    border-color: rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] .related-post-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

/* ── High contrast ── */
html[data-contrast="high"] .related-post-card {
    background: #000000;
    border: 2px solid #ffffff;
}

html[data-contrast="high"] .related-post-card h3 {
    color: #ffffff !important;
}

html[data-contrast="high"] .related-post-card a:hover,
html[data-contrast="high"] .related-post-card a:focus {
    color: #ffd400;
}
