/* Editorial cover integrity. Scope: story cards and composed article covers only.
   Keep each site's masthead, hero photography, type, colors and navigation. */

/* Composed covers contain typography: never crop or stretch them. */
.card .media img.elx-composed-cover,
.article-cover img.elx-composed-cover {
  object-fit: contain !important;
  object-position: center !important;
  transform: none !important;
}

/* Equal-width homepage and related-story cards share one landscape frame. */
body .production-stories .archive-grid > .card,
body .article-page .trio > .card {
  display: flex !important;
  flex-direction: column;
  align-items: stretch;
  grid-column: auto !important;
  min-width: 0;
  padding: 22px 0 0 !important;
  margin-top: 0 !important;
  align-self: stretch;
}
body .production-stories .archive-grid > .card > .media,
body .article-page .trio > .card > .media {
  display: block;
  width: 100%;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  aspect-ratio: 16 / 9 !important;
  flex: 0 0 auto;
  overflow: hidden;
}
body .production-stories .archive-grid > .card > .media img,
body .article-page .trio > .card > .media img {
  display: block;
  width: 100%;
  height: 100%;
  max-height: none;
}
body .production-stories .archive-grid > .card > .card-body,
body .article-page .trio > .card > .card-body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  flex: 1 1 auto;
  min-width: 0;
  padding: 18px 0 0 !important;
}
body .production-stories .card .card-meta,
body .article-page .trio .card .card-meta {
  margin-top: auto;
  padding-top: 18px;
}

/* Move the Curious highlight inside the text panel, not around the image. */
body.s-curious .production-stories .archive-grid > .card:nth-child(3n+1) {
  background: transparent;
}
body.s-curious .production-stories .archive-grid > .card > .card-body {
  padding: 18px 16px 16px !important;
}
body.s-curious .production-stories .archive-grid > .card:nth-child(3n+1) > .card-body {
  background: #eeeaf7;
}

/* At tablet widths, long English headlines need two usable columns, not three narrow ones. */
@media (min-width: 681px) and (max-width: 1000px) {
  body .production-stories .archive-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Archive art may keep its editorial hierarchy; composed images use an uncropped frame.
   Remove staggered padding only for composed covers, not for art-directed photo stories. */
body .listing-page .archive-grid > .card:has(img.elx-composed-cover) {
  padding-top: 0 !important;
}
body .listing-page .archive-grid > .card > .media:has(img.elx-composed-cover),
body .card > .media:has(img.elx-composed-cover) {
  aspect-ratio: 16 / 9 !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
}
body .card > .media:has(img.elx-composed-cover) > img {
  display: block;
  width: 100%;
  height: 100% !important;
  min-height: 0 !important;
  max-height: none !important;
}

/* In article openings, do not force a text-bearing cover into a tall photo crop. */
body .article-opening .article-cover:has(img.elx-composed-cover) {
  align-self: center;
  height: auto !important;
  min-height: 0 !important;
}
body .article-opening .article-cover img.elx-composed-cover {
  display: block;
  width: 100%;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  aspect-ratio: auto !important;
}

@media (max-width: 680px) {
  /* Tiny square archive thumbnails make cover text unreadable on phones. */
  html body[class*="s-"] .listing-page .archive-grid > article.card:has(img.elx-composed-cover) {
    display: flex !important;
    flex-direction: column;
    gap: 0;
    padding: 0 0 28px !important;
  }
  html body[class*="s-"] .listing-page .archive-grid > article.card:has(img.elx-composed-cover) > a.media {
    width: 100%;
    aspect-ratio: 16 / 9 !important;
  }
  html body[class*="s-"] .listing-page .archive-grid > article.card:has(img.elx-composed-cover) > div.card-body {
    padding: 17px 0 0 !important;
  }
  body.s-curious .production-stories .archive-grid > .card > div.card-body {
    padding: 17px 14px 14px !important;
  }
}
