/* ==========================================================================
   Latest Articles Block
   (padding from the shared .mb-block utility; white-text-on-color from the
   shared rule in shared.css — no per-block white CSS here)
   ========================================================================== */

.latest-articles {
  width: 100%;
  margin-left: auto;
  margin-right: auto;
}

/* --- Optional intro header: heading left, intro + button right ------------- */
.latest-articles__header {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 2rem;
  align-items: start;
  padding-bottom:3rem;
  max-width: 1920px;
  margin: 0 auto;
}
.latest-articles__header-heading {
  margin: 0;
}
.latest-articles__header-content > :first-child {
  margin-top: 0;
}

/* --- Card grid: 2 or 3 per row on desktop --------------------------------- */
.latest-articles__grid {
  display: grid;
  gap: 2rem;
  max-width: 1920px;
  margin: 0 auto;
}
.latest-articles__grid.is-cols-2 {
  grid-template-columns: repeat(2, 1fr);
}
.latest-articles__grid.is-cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

/* --- Card --------------------------------------------------------------- */
.latest-articles__card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit; /* theme default on none; shared rule whitens on color */
}

/* overflow:hidden so the hover-scaled image is clipped to the frame. */
.latest-articles__card-media {
  overflow: hidden;
  aspect-ratio: 2 / 1;
  margin-bottom: 1rem;
}
.latest-articles__card-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Fill the remaining card height so the button can sit at the bottom and
   buttons line up across cards of uneven text length. */
.latest-articles__card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.latest-articles__card-title {
  margin: 0 0 0.5rem;
}
.latest-articles__card-excerpt {
  margin: 0 0 1rem;
}

.mb-bg-none .latest-articles__card:hover,.custom-archive-loop-item .latest-articles__card:hover, .mb-bg-none .latest-articles__card-excerpt:hover {
  color: var(--global-palette4);
}

/* Card button is a visual span (no nested anchor) reusing .mb-btn-arrow. */
.latest-articles__card-btn {
  margin-top: auto; /* push the button to the bottom of an uneven card */
}

/* --- Hover (pointer-capable only): image zooms, body nudges right --------- */
@media (hover: hover) {
  .latest-articles__card-media img {
    transition: transform 0.4s ease-in-out;
  }
  .latest-articles__card-body {
    transition: transform 0.4s ease-in-out;
  }
  .latest-articles__card:hover .latest-articles__card-media img {
    transform: scale(1.1);
  }
  .latest-articles__card:hover .latest-articles__card-body {
    transform: translateX(1rem);
  }
}

/* --- Tablet (≤1024px): always 2 per row. ---------------------------------- */
@media (max-width: 1024px) {
  .latest-articles__grid.is-cols-2,
  .latest-articles__grid.is-cols-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* --- Mobile (≤768px): single column; intro header stacks. ----------------- */
@media (max-width: 768px) {
  .latest-articles__header {
    grid-template-columns: 1fr;
    gap: 1rem;
    padding-bottom:1rem;
  }
  .latest-articles__grid.is-cols-2,
  .latest-articles__grid.is-cols-3 {
    grid-template-columns: 1fr;
  }
}
