.blog-cards {
  margin: 2rem 0;
}

.blog-cards .blog-cards-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px 12px;
  max-width: 1440px;
  margin: 0 auto;
}

.blog-cards .blog-card {
  display: flex;
  background: var(--background-color);
  border-radius: var(--radius-card);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: all 0.3s ease-in-out;
  padding: 1rem 0;

  @media (min-width: 768px) {
    padding: 0;
  }
}

.blog-cards .blog-card:hover {
  box-shadow: 0 6px 24px 0 rgb(0 0 0 / 20%);
  transform: scale(1.02);
  text-decoration: none;
}

.blog-cards .blog-card-image {
  position: relative;
  flex: 0 0 166px;
  height: 188px;
  background: var(--light-color);
}

.blog-cards .blog-card .blog-card-image img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ---- video posts ----
   The thumbnail is the play control (role=button; the article link wraps the
   card body instead). The badge is a white circle + dark triangle, matching the
   video block's control (blocks/video/video.css), and sits inset from the
   thumbnail's bottom-right corner by half its own size — the source listing's
   placement (an 80px badge 40px in, on its 441x248 desktop / 346x200 mobile
   thumbnail). `font-size` carries the badge size so the triangle scales with it. */
.blog-cards .blog-card-play {
  --blog-card-play-size: 48px;

  position: absolute;
  right: calc(var(--blog-card-play-size) / 2);
  bottom: calc(var(--blog-card-play-size) / 2);
  width: var(--blog-card-play-size);
  height: var(--blog-card-play-size);
  border-radius: var(--radius-circle);
  background: #fff;
  box-shadow: 0 4px 30px rgb(0 0 0 / 15%);
  font-size: var(--blog-card-play-size);
  pointer-events: none;
  z-index: 1;
}

.blog-cards .blog-card-play::after {
  content: '';
  position: absolute;
  inset: 0;
  width: 0;
  height: 0;
  margin: auto;
  border-style: solid;
  border-width: 0.22em 0 0.22em 0.34em;
  border-color: transparent transparent transparent #0d333f;
  transform: translateX(0.03em);
}

/* the source's 80px badge, wherever the thumbnail is that big: the featured card
   (16:9 at every width) and the 3-up card from 1200px (445x248) up */
.blog-cards .blog-card.featured .blog-card-play {
  --blog-card-play-size: 80px;
}

@media (min-width: 1200px) {
  .blog-cards .blog-card-play {
    --blog-card-play-size: 80px;
  }
}

.blog-cards .blog-card.has-video .blog-card-image {
  cursor: pointer;
}

/* Keyboard focus ring, drawn as an overlay inside the thumbnail: the card clips
   its overflow (an outset outline is swallowed on the three edges the thumbnail
   sits flush to) and the poster, being an absolutely positioned child, paints
   over an inset one. The white inner line keeps it visible on any poster. */
.blog-cards .blog-card.has-video .blog-card-image:focus-visible {
  outline: none;
}

.blog-cards .blog-card.has-video .blog-card-image:focus-visible::after {
  content: '';
  position: absolute;
  inset: 0;
  border: 3px solid var(--link-color, #2ca01c);
  box-shadow: inset 0 0 0 2px #fff;
  z-index: 2;
}

/* video card only: the article link wraps the body, so it stands in for the body
   as the card's flex child (layout otherwise unchanged) */
.blog-cards .blog-card-link {
  display: flex;
  flex: 1;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

/* ---- video lightbox: appended to <body>, so deliberately not scoped under
   .blog-cards. Owned by this block (its own copy of the small overlay) because a
   dynamic import of blocks/video would not bring that block's stylesheet with
   it. Backdrop dim, z-index and 8px radius match the source's modal. ---- */
.blog-card-video-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-l);
  background: rgb(0 0 0 / 40%);
}

.blog-card-video-modal {
  position: relative;
  width: min(602px, 100%);
}

.blog-card-video-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
}

.blog-card-video-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: var(--radius-m);
}

.blog-card-video-close {
  position: absolute;
  top: -40px;
  right: 0;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  background: none;
  color: #fff;
  font-size: 28px;
  line-height: var(--line-height-none);
  cursor: pointer;
}

/* click-tracking body wrapper — layout-transparent (carries the content-slot trail) */
.blog-cards .blog-card-content-slot {
  display: contents;
}

.blog-cards .blog-card-body {
  flex: 1;
  min-width: 0;
  padding: 0 var(--space-m);
  overflow: hidden;
}

.blog-cards .blog-card .blog-card-body .blog-card-category {
  margin: 0;
  font-size: 12px;
  line-height: 16px;
  font-weight: var(--font-weight-medium);
  color: #dd2366;
  text-transform: uppercase;
  overflow-wrap: break-word;
}

@media (max-width: 480px) {
  .blog-cards .blog-card .blog-card-body .blog-card-category { padding-top: var(--space-2xs); }
}

.blog-cards .blog-card .blog-card-body .blog-card-title {
  margin: var(--space-2xs) 0;
  font-size: 12px;
  line-height: 16px;
  font-weight: var(--font-weight-bold);
  color: #000;
  overflow-wrap: break-word;
}

.blog-cards .blog-card .blog-card-body .blog-card-date {
  margin: var(--space-xs) 0;
  font-size: 12px;
  line-height: 18px;
  font-weight: var(--font-weight-normal);
  color: var(--dark-color);
}

.blog-cards .blog-cards-empty {
  margin: 0;
  padding: var(--space-2xl) 0;
  text-align: center;
  color: var(--text-muted);
}

/* ---- variant=paginated ---- */
.blog-cards .blog-cards-load-more {
  display: flex;
  justify-content: center;
  margin-top: var(--space-2xl);
}

.blog-cards .blog-cards-load-more[hidden] { display: none; }

/* click-tracking button wrapper — layout-transparent (carries the button trail leaf) */
.blog-cards .blog-cards-load-more-btn { display: contents; }

/* ---- filter pills ---- */
.blog-cards .blog-cards-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 28px;
}

.blog-cards .blog-cards-filter-pill {
  padding: 8px 18px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: #fff;
  color: var(--text-muted);
  font: inherit;
  font-size: 14px;
  font-weight: var(--font-weight-semibold);
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.blog-cards .blog-cards-filter-pill:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.blog-cards .blog-cards-filter-pill[aria-pressed="true"] {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}

/* ---- featured: on mobile, production renders these as full-width stacked cards
   with a ~16:9 landscape image (regular cards stay the compact side-image row). ---- */
@media (max-width: 767px) {
  .blog-cards .blog-card.featured { flex-direction: column; }

  .blog-cards .blog-card.featured .blog-card-image {
    flex: 0 0 auto;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
  }
}

.blog-cards .blog-card.featured .blog-card-body .blog-card-title {
  font-size: 24px;
  line-height: var(--line-height-s);
}

/* ---- 768px+: the vertical 3-up card (6-col grid so featured can span 3/6 = 2-up) ---- */
@media (min-width: 768px) {
  .blog-cards .blog-cards-grid { grid-template-columns: repeat(6, 1fr); }

  .blog-cards .blog-card { flex-direction: column; grid-column: span 2; }
  .blog-cards .blog-card.featured { grid-column: span 3; }

  .blog-cards .blog-card-image {
    flex: 0 0 auto;
    height: 121px;
  }

  .blog-cards .blog-card.featured .blog-card-image { height: 200px; }

  .blog-cards .blog-card-body {
    flex: 1;
    padding: var(--space-m);
  }

  .blog-cards .blog-card .blog-card-body .blog-card-category { font-weight: var(--font-weight-normal); }

  .blog-cards .blog-card .blog-card-body .blog-card-title {
    font-size: 20px;
    line-height: 28px;
  }

  .blog-cards .blog-card .blog-card-body .blog-card-date {
    margin: var(--space-s) 0;
    font-size: 16px;
    line-height: 24px;
  }
}

@media (min-width: 1200px) {
  .blog-cards .blog-card-image { height: 248px; }

  /* featured lead cards track a 16:9 ratio (matches production ~672x376),
     instead of the previous fixed 320px which rendered ~2.1:1 (letterboxed) */
  .blog-cards .blog-card.featured .blog-card-image {
    height: auto;
    aspect-ratio: 16 / 9;
  }

  /* topic/category listing pages (body.category) use a taller ~1.18 crop to match
     production (445x376); the blog hub (body.blog-home) stays 16:9 (445x248). */
  body.category .blog-cards .blog-card:not(.featured) .blog-card-image { height: 376px; }
}

/* carries the tablet type scale through 1200-1359px */
@media (min-width: 1360px) {
  .blog-cards .blog-card .blog-card-body .blog-card-category { font-size: 16px; }

  .blog-cards .blog-card .blog-card-body .blog-card-title {
    margin: var(--space-xs) 0;
    font-size: 28px;
    line-height: 36px;
  }
}

/* one more class than carousel.css's tied-specificity image rule */
.blog-cards .carousel-slide .blog-card .blog-card-image img {
  height: 100%;
}
