/* components/news.css — layout for partials/news-body.hbs (homepage News
   section): lead story (text | image) beside a compact list.
   From --bp-lg it's a flat 3 : 5 : 4 of 12 columns — .news__lead goes
   display: contents so its children join .news__body's grid with one set
   of gaps. From --bp-md to --bp-lg the lead is its own 3fr/5fr grid above
   the list. */

.news {
  margin-block: var(--space-10);
}

/* Clears the section-header rule (which has no bottom margin). */
.news__body {
  display: grid;
  gap: var(--space-10);
  margin-block-start: var(--space-6);
}

.news__lead {
  display: grid;
  gap: var(--space-6);
}

@media (width >= 48rem) {
  .news__lead {
    grid-template-columns: minmax(0, 3fr) minmax(0, 5fr);
    align-items: stretch;
  }

  /* Media comes first in source order; place columns explicitly. */
  .news__lead-body {
    grid-column: 1;
    grid-row: 1;
  }

  /* Hugs the image's crop rather than stretching to the row; the text
     centres beside it. */
  .news__lead-media {
    grid-column: 2;
    grid-row: 1;
    align-self: start;
  }
}

@media (width >= 64rem) {
  .news__body {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    align-items: start;
  }

  /* Hand the lead's children to .news__body's 12-column grid. */
  .news__lead {
    display: contents;
  }

  /* Text 1–3, image 4–8, list 9–12. */
  .news__lead-body {
    grid-column: 1 / span 3;
    grid-row: 1;
  }

  .news__lead-media {
    grid-column: span 5;
    grid-row: 1;
  }

  /* Column rule. */
  .news__list {
    grid-column: span 4;
    grid-row: 1;
    padding-inline-start: var(--space-8);
    border-inline-start: var(--border-width) solid var(--color-border-soft);
  }
}

.news__lead-media {
  display: block;
  line-height: 0;
}

.news__lead-image {
  display: block;
  width: 100%;
  height: auto;
  /* 3 / 2 even when stacked on phones (the --media-ratio-lead exception). */
  aspect-ratio: var(--media-ratio-lead);
  object-fit: cover;
}

.news__lead-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  justify-content: center;
}

.news__lead-title {
  font-family: var(--font-heading);
  font-size: var(--text-3xl);
  line-height: var(--leading-tight);
}

.news__lead-link {
  color: inherit;
  text-decoration: none;
}

.news__lead-dek {
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-fg-tone);
}

.news__lead-byline {
  font-family: var(--font-ui);
  font-size: var(--text-sm);
}

/* HOVER — see post-card.css. Still matches when .news__lead is
   display: contents (hover follows the element tree). */
.news__lead-body {
  transition: opacity var(--transition);
}

@media (hover: hover) {
  .news__lead:hover .news__lead-body {
    opacity: var(--card-hover-opacity);
  }
}

.news__list {
  display: flex;
  flex-direction: column;
}

.news__list .post-card {
  padding-block: var(--space-4);
  border-block-end: var(--border-width) solid var(--color-border-soft);
}

/* First card aligns with the top of the lead image. */
.news__list .post-card:first-child {
  padding-block-start: 0;
}

.news__list .post-card:last-child {
  border-block-end: none;
}
