/* components/spotlight.css — layout for spotlight-items.hbs (Spotlight,
   Guides, Featured 1 and Featured 2 sections). Stacks below --bp-lg.
   ONE TO THREE: one auto column per item; .spotlight__item:only-child
   becomes the image | text layout (text | image with --media-end), two or
   three stay image over text.
   Stays inside home.hbs's container (no bleed), so its edges line up with
   the sections around it; the image/text separation is a column-gap for the
   same reason.
   .guides wraps it under a section header: drop the doubled top rule and
   outer margin. */

.spotlight {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  /* Between a stacked pair. */
  row-gap: var(--space-10);
  border-block: var(--border-width) solid var(--color-border-soft);
  padding-block: var(--space-8);
  margin-block: var(--space-10);
}

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

.guides .spotlight {
  border-block-start: 0;
  margin-block: 0;
  /* Under the header rule — same gap as .news__body. */
  padding-block-start: var(--space-6);
}

/* align-content: start — an item stretched to a taller neighbour's height
   would otherwise share the spare space between its image and text rows,
   pushing its text below the neighbour's. */
.spotlight__item {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
}

.spotlight__media {
  display: block;
}

/* Fixed crop so side-by-side photos and titles line up. */
.spotlight__image {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: var(--media-ratio-stacked);
  object-fit: cover;
}

.spotlight__body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  padding-top: var(--space-3);
  padding-bottom: var(--space-4);
  text-align: center;
}

.spotlight__label {
  font-family: var(--font-ui);
  font-size: var(--text-md);
  text-decoration: none;
  color: var(--color-fg-tone);
}

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

/* One story, stacked: the Featured 1-2-5 lead's sizes (post-card.css). Its
   48px is in the --bp-lg block below. */
.spotlight__item:only-child .spotlight__title {
  font-size: var(--lead-title-mobile-size);
}

@media (width >= 48rem) {
  .spotlight__item:only-child .spotlight__title {
    font-size: var(--post-title-mobile-size);
  }
}

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

.spotlight__dek {
  max-width: var(--container-content);
  font-size: var(--text-lg);
  line-height: var(--leading-normal);
  color: var(--color-fg-tone);
}

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

/* HOVER — per item, so only the story being pointed at dims. */
.spotlight__body {
  transition: opacity var(--transition);
}

@media (hover: hover) {
  .spotlight__item:hover .spotlight__body {
    opacity: var(--card-hover-opacity);
  }
}

@media (width >= 64rem) {
  /* One column per item. */
  .spotlight {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    column-gap: var(--space-10);
  }

  /* One story: image | text */

  .spotlight__item:only-child {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    column-gap: var(--space-10);
  }

  /* Top-aligned; the text centres beside it. */
  .spotlight__item:only-child .spotlight__media {
    align-self: start;
  }

  .spotlight__item:only-child .spotlight__image {
    aspect-ratio: var(--media-ratio-beside);
  }

  .spotlight__item:only-child .spotlight__body {
    justify-content: center;
    padding-block: var(--space-10);
  }

  .spotlight__item:only-child .spotlight__title {
    font-size: var(--text-4xl);
  }

  /* --media-end: text | image. The body auto-places into column 1. */
  .spotlight--media-end .spotlight__item:only-child .spotlight__media {
    grid-column: 2;
    grid-row: 1;
  }
}
