/*
 * News and Blog. Loaded after site.css by /news/, /blog/, and every article
 * page beneath them.
 *
 * One stylesheet rather than three, because the card that ends a blog index row
 * is the same card that fills the "More From" rail at the foot of an article.
 * Splitting them would mean duplicating it.
 */

/* ---------------------------------------------------------- index heroes */

.index-hero__lede {
  max-width: 680px;
}

/* ------------------------------------------------------------ thumbnails */

/* The 16:9 band that opens a news row and tops a blog card. A background-image
 * on a span rather than an <img>: the adjacent title carries the meaning, so
 * the picture is decorative framing and gets aria-hidden, not alt text. The
 * per-post URL is the one-off value that rides in a style attribute. */
.thumb {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--radius);
  background-color: var(--grey-100);
  background-size: cover;
  background-position: center;
}

/* Present only when the post has no hero: the shield sitting on the empty
 * grey band, rather than a band that reads as a failed image. */
.thumb__mark {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

.thumb__mark img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 100%;
  opacity: 0.5;
}

.thumb--news {
  border: 1px solid var(--border-subtle);
}

.thumb--news .thumb__mark {
  padding: 12px;
}

.thumb--featured .thumb__mark {
  padding: 34px;
}

/* The card clips its own corners, so the band must not round its own.
 *
 * Shorter than the shared 16:9, which trims the card without touching the art.
 * These files are all 16:9 navy panels with a photo inset, and the navy above
 * and below that inset is not the same on every one - measured across the set
 * it runs from 84px/85px to 190px/277px on a 576px file. At 16:9 the box
 * matches the source exactly, so every one of those differences shows at full
 * size. 2:1 crops 32px off each end under background-size:cover, which cuts the
 * uneven margin down rather than framing it, and takes 23px off the card. */
.thumb--card {
  border-radius: 0;
  aspect-ratio: 2 / 1;
}

.thumb--card .thumb__mark {
  padding: 28px;
}

.thumb--featured .thumb__mark img,
.thumb--card .thumb__mark img {
  width: 50%;
}

/* --------------------------------------------------------------- avatars */

/* The circle before a blog byline. Three states, in order of preference: the
 * author's photograph, the gold shield for posts published by TPN itself, and
 * the author's initials when neither exists. */
.byline-avatar {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 50%;
  background-color: var(--navy-700);
  background-size: cover;
  background-position: center top;
  box-shadow: var(--shadow-avatar);
}

/* A neutral field behind a photograph, so a transparent edge is not navy. */
.byline-avatar--photo {
  background-color: var(--grey-200);
}

.byline-avatar--tpn {
  background-color: var(--navy-800);
}

.byline-avatar .material-icons {
  font-size: 16px;
  color: var(--gold-500);
}

.byline-avatar__initials {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #fff;
}

.byline-avatar--featured {
  width: 30px;
  height: 30px;
}

.byline-avatar--featured .material-icons {
  font-size: 17px;
}

.byline-avatar--featured .byline-avatar__initials {
  font-size: 12px;
  letter-spacing: 0;
}

/* ------------------------------------------------------------ news index */

.news {
  max-width: 1040px;
  margin: 0 auto;
  padding-left: 32px;
  padding-right: 32px;
}

/* Date / title / kind, the same three cells as the shared .row in site.css.
 * Restated here only to widen the gutter and the row's own padding: this list
 * is long, and the extra vertical space is what keeps it scannable. */
.news .row {
  grid-template-columns: 150px minmax(0, 1fr) auto;
  gap: 24px;
  align-items: center;
  padding: 22px 8px;
}

/* The third cell of .row. A pill rather than a bare label so the icon has
 * something to sit in, and so the row still reads as three parts once it
 * collapses to one column. */
.news-kind {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  gap: 8px;
  padding: 4px 12px 4px 9px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  background: #fff;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}

.news-kind .material-icons {
  font-size: 16px;
  color: var(--text-muted);
}

.news-kind--release .material-icons {
  color: var(--primary);
}

.news-kind--pdf .material-icons {
  color: var(--error);
}

/* ------------------------------------------------------------ blog index */

.blog {
  display: grid;
  gap: 32px;
  max-width: var(--page-max);
  margin: 0 auto;
  padding-left: 32px;
  padding-right: 32px;
}

.blog-featured {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  align-items: center;
  gap: 48px;
  padding: 44px;
  background: var(--grey-100);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  color: var(--text-body);
  transition: box-shadow var(--dur-micro) ease;
}

.blog-featured:hover {
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.1);
  text-decoration: none;
}

.blog-featured__text {
  display: grid;
  gap: 16px;
}

.blog-featured__eyebrow {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  /* --primary is only 4.22:1 on the pale canvas this card sits on;
   * --text-link is the darker text-safe blue (5.27:1). */
  color: var(--text-link);
}

.blog-featured__title {
  font-family: var(--font-display);
  font-size: 38px;
  font-weight: 300;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--navy-800);
  text-wrap: pretty;
}

.blog-featured__meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: var(--text-secondary);
}

/* --------------------------------------------------------------- cards */

.post-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr));
  gap: 20px;
}

.post-cards--rail {
  grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
}

.post-card {
  display: grid;
  align-content: start;
  gap: 12px;
  height: 100%;
  padding: 28px;
  background: #fff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  color: var(--text-body);
  transition: box-shadow var(--dur-micro) ease;
}

.post-card:hover {
  box-shadow: var(--shadow-card-hover);
  text-decoration: none;
}

.post-cards--rail .post-card {
  padding: 26px;
}

/* Only the index cards carry a thumbnail; the "More From" rail at the foot of
 * an article keeps the plain padded card above. The band runs to the card
 * edge, so the padding moves inward onto __text and the card clips it. */
.blog .post-card {
  grid-template-rows: auto 1fr;
  gap: 0;
  padding: 0;
  overflow: hidden;
}

/* date / title / byline. The middle row takes the slack, so the byline lands on
 * the bottom edge of the text block whether the title runs to one line or four.
 * No align-content here - it would collapse the rows to their content and undo
 * exactly that. */
.post-card__text {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 12px;
  min-height: 0;
  height: 100%;
  padding: 24px 26px 22px;
}

.post-card__date {
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.post-card__title {
  font-size: 19px;
  line-height: 1.4;
  color: var(--navy-800);
  text-wrap: pretty;
}

.post-card__foot {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
  font-size: 13px;
  color: var(--text-secondary);
}

.blog .post-card__foot {
  align-self: end;
}

/* --------------------------------------------------------- article head */

.article__head {
  position: relative;
  isolation: isolate;
  overflow: hidden; /* clips the oversized shield watermark */
  background: var(--grey-100);
  border-bottom: 1px solid var(--border-subtle);
}

.article__head-inner {
  position: relative;
  display: grid;
  gap: 20px;
  max-width: var(--measure);
  margin: 0 auto;
  padding-left: 32px;
  padding-right: 32px;
}

.article__kind {
  justify-self: start;
}

.article__date {
  font-size: 14px;
  color: var(--text-secondary);
}

.article__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  font-size: 14px;
  color: var(--text-secondary);
}

.article__meta-sep {
  width: 1px;
  height: 14px;
  background: var(--border-default);
}

/* A background-image div, not an <img>: the handoff specifies the role/aria-label
 * semantics here, and the image is decorative framing rather than content. */
.article__figure {
  max-width: 1040px;
  margin: 0 auto;
  padding: 40px 32px 0;
}

.article__hero {
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  background-color: var(--navy-900);
  background-size: cover;
  background-position: center;
}

/* --------------------------------------------------------- article body */

.article__body {
  display: grid;
  gap: 24px;
  max-width: var(--measure);
  margin: 0 auto;
  padding-left: 32px;
  padding-right: 32px;
}

.article__lead {
  font-family: var(--font-display);
  font-size: 21px;
  font-style: italic;
  line-height: 1.5;
  color: var(--navy-800);
  text-wrap: pretty;
}

/* The blog leads are a source credit or a one-line standfirst, not a sentence. */
.article__lead--kicker {
  font-size: 13px;
  font-style: normal;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.article__p {
  font-size: 18px;
  line-height: 1.75;
  color: var(--text-body);
  text-wrap: pretty;
}

.article__p strong {
  font-weight: 500;
}

.article__h {
  margin-top: 16px;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--navy-800);
}

.article__list {
  display: grid;
  gap: 12px;
  list-style: none;
}

.article__item {
  display: flex;
  gap: 12px;
  font-size: 18px;
  line-height: 1.7;
  color: var(--text-body);
}

.article__item .material-icons {
  flex: 0 0 auto;
  margin-top: 5px;
  font-size: 19px;
  color: var(--gold-500);
}

.article__quote {
  display: grid;
  gap: 16px;
  margin: 14px 0;
  padding: 28px 32px;
  background: var(--grey-100);
  border-radius: var(--radius);
}

.article__quote-text {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 300;
  line-height: 1.5;
  color: var(--navy-800);
  text-wrap: pretty;
}

.article__quote-cite {
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.article__video {
  aspect-ratio: 16 / 9;
  margin: 8px 0;
  border-radius: var(--radius);
  background: var(--navy-900);
  overflow: hidden;
}

.article__video iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* --------------------------------------------------------------- share */

.share {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  max-width: var(--measure);
  margin: 0 auto;
  padding-left: 32px;
  padding-right: 32px;
  border-bottom: 1px solid var(--border-subtle);
}

.share__label {
  margin-right: 6px;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.share__link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 8px 15px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-pill);
  font-size: 13px;
  color: var(--navy-800);
  transition: background var(--dur-micro) ease;
}

.share__link:hover {
  background: var(--grey-100);
  text-decoration: none;
}

.share__link .material-icons {
  font-size: 16px;
}

/* ------------------------------------------------------------- related */

.related__inner {
  display: grid;
  gap: 32px;
  max-width: var(--page-max);
  margin: 0 auto;
  padding-left: 32px;
  padding-right: 32px;
}

.related__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
}

.related__label {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--navy-800);
}

.related__all {
  font-size: 14px;
  font-weight: 500;
}

/* --------------------------------------------------------- breakpoints */

/* The news row sheds its kind pill column first, keeping the thumbnail beside
 * a stacked date / title / kind; below 620px it stacks completely. These beat
 * the single 760px rule on .row in site.css on specificity, at every width. */
@media (max-width: 960px) {
  .news .row {
    grid-template-columns: 132px minmax(0, 1fr);
    gap: 8px 20px;
    align-items: start;
  }
}

@media (max-width: 900px) {
  .blog-featured {
    grid-template-columns: 1fr;
    gap: 32px;
  }
}

@media (max-width: 620px) {
  .news .row {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

@media (max-width: 640px) {
  .news,
  .blog,
  .article__head-inner,
  .article__figure,
  .article__body,
  .share,
  .related__inner {
    padding-left: 20px;
    padding-right: 20px;
  }

  .blog-featured {
    padding: 28px 24px;
  }

  .blog-featured__title {
    font-size: 27px;
  }

  .article__lead {
    font-size: 19px;
  }

  .article__p,
  .article__item {
    font-size: 17px;
  }

  .article__h {
    font-size: 21px;
  }

  .article__quote {
    padding: 24px;
  }

  .article__quote-text {
    font-size: 19px;
  }
}

/* ------------------------------------------------------- body figures */

/* In-body diagrams. `contain` rather than `cover`: these are wide reference
 * diagrams where cropping would cut off the labels. The box carries its own
 * min-height from the data so it reserves space before the image loads. */
/* An in-body diagram. NOT the hero: .article__figure is the hero's wrapper
 * higher up this file, and reusing that name here silently overrode its
 * `margin: 0 auto`, which left every article hero flush left instead of
 * centered. Distinct name, distinct block. */
.article__diagram {
  display: grid;
  gap: 12px;
  margin: 8px 0;
}

.article__diagram-img {
  display: block;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  background-color: var(--grey-100);
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

.article__diagram-caption {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted);
}
