/* The news section: the overview and the article page. */

.news {
  padding: 4rem 0 8rem;
}

.news-article {
  padding: 3rem 0 8rem;
}

/* The heading of the overview: a navy band over the full width, like the header. */
.news-hero {
  padding: 5rem 0 4rem;
  background: var(--navy);
  color: var(--white);
}

.news-hero .page-title {
  color: var(--white);
}

.news-hero__text {
  max-width: 80rem;
  margin: 2rem auto 0;
  font-size: 1.8rem;
  line-height: 2.8rem;
  text-align: center;
}

.news-hero__text p + p {
  margin-top: 1.2rem;
}

.news-labels,
.news-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.news-tags {
  justify-content: center;
  margin-top: 3rem;
}

.news-tags a,
.news-labels a {
  display: block;
  padding: 0.7rem 1.6rem;
  border: 0.1rem solid var(--grey);
  border-radius: 5rem;
  font: 1.4rem/normal var(--font-ui);
}

.news-tags a {
  border-color: rgb(255 255 255 / 45%);
}

/* The tags of the articles on the overview. */
.news-featured .news-labels a,
.news-card .news-labels a {
  font-size: 1rem;
}

.news-labels a {
  padding: 0.4rem 1.2rem;
  font-size: 1.2rem;
  text-transform: uppercase;
}

.news-labels a:hover {
  border-color: var(--navy);
}

.news-tags a:hover {
  border-color: var(--white);
}

.news-tags a[aria-current] {
  border-color: var(--white);
  background: var(--white);
  color: var(--navy);
}

.news-meta {
  color: #5b6b8f;
  font-size: 1.4rem;
}

.news-empty {
  padding: 6rem 0;
  text-align: center;
}

/* Overview: the newest article big, with the image on the left. */

.news-featured {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-bottom: 4rem;
  border: 0.1rem solid var(--grey);
  border-radius: 1.2rem;
  overflow: hidden;
}

/* The image fills its half of the card completely; it is cropped, not stretched. */
.news-featured__image {
  position: relative;
  min-height: 32rem;
}

.news-featured__image img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.news-featured__body {
  display: flex;
  flex-direction: column;
  gap: 1.6rem;
  justify-content: center;
  padding: 4rem;
  font-size: 1.6rem;
  line-height: 2.4rem;
}

.news-featured__title {
  font: 700 2.4rem/3.2rem var(--font-display);
}

.news-featured__link {
  color: var(--red);
  font-weight: 700;
}

/* Overview: the other articles, three on a row. */

.news-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3rem;
}

.news-card {
  position: relative;
  display: flex;
  flex-direction: column;
  border: 0.1rem solid var(--grey);
  border-radius: 1.2rem;
  overflow: hidden;
}

/* A box of 300px high; the image fills it and is cropped, not stretched. */
.news-card__image {
  height: 30rem;
}

.news-card__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.news-card__body {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  padding: 2.4rem;
  font-size: 1.5rem;
  line-height: 2.2rem;
}

.news-card__title {
  font: 700 1.8rem/2.4rem var(--font-display);
}

/* The date and reading time of the cards on a row line up at the bottom. */
.news-card__body .news-meta {
  margin-top: auto;
}

/* The whole article is the link: the link of the title is stretched over the card.
   The tags stay separate links on top of it. */
.news-featured__title a::after,
.news-card__title a::after {
  content: "";
  position: absolute;
  inset: 0;
}

.news-featured .news-labels a,
.news-card .news-labels a {
  position: relative;
  z-index: 1;
}

.news-featured,
.news-card {
  transition: box-shadow 0.2s;
}

.news-featured:hover,
.news-card:hover {
  box-shadow: 0 0.4rem 1.6rem rgb(0 31 96 / 15%);
}

.news-featured:hover .news-featured__title a,
.news-card:hover .news-card__title a {
  text-decoration: underline;
}

.news-featured:focus-within,
.news-card:focus-within {
  outline: 0.2rem solid #5b9dff;
}

/* Article page */

.news-article__header {
  max-width: 80rem;
  margin: 2rem auto 4rem;
  text-align: center;
}

.news-article__header .news-labels {
  justify-content: center;
  margin-top: 2rem;
}

.news-back {
  color: var(--red);
  font-size: 1.4rem;
}

.news-article__title {
  margin: 2rem 0;
  font: 700 3rem/4rem var(--font-display);
}

.news-article__image img {
  width: 100%;
  max-height: 56rem;
  aspect-ratio: 16 / 9;
  border-radius: 1.2rem;
  object-fit: cover;
}

.news-preview {
  margin-top: 2rem;
  padding: 1rem 1.6rem;
  background: var(--field);
  font-size: 1.4rem;
}

.news-body {
  max-width: 76rem;
  margin: 5rem auto 0;
}

@media (max-width: 640px) {
  .news {
    padding: 2rem 0 4rem;
  }

  .news-article {
    padding: 1rem 0 4rem;
  }

  .news-hero {
    padding: 2.4rem 0 2rem;
  }

  .news-hero .container,
  .news .container,
  .news-article .container {
    padding: 0 2rem;
  }

  .news-hero__text {
    margin-top: 1.2rem;
    font-size: 1.3rem;
    line-height: 2rem;
  }

  .news-tags {
    gap: 0.6rem;
    margin-top: 2rem;
  }

  .news-tags a {
    padding: 0.5rem 1.2rem;
    font-size: 1.1rem;
  }

  .news-labels a {
    font-size: 1rem;
  }

  .news-meta {
    font-size: 1.1rem;
  }

  .news-featured,
  .news-grid {
    grid-template-columns: 1fr;
  }

  .news-featured__image {
    min-height: 0;
    aspect-ratio: 16 / 9;
  }

  .news-card__image {
    height: auto;
    aspect-ratio: 16 / 9;
  }

  .news-featured {
    margin-bottom: 2rem;
  }

  .news-grid {
    gap: 2rem;
  }

  .news-featured__body,
  .news-card__body {
    padding: 1.8rem;
    font-size: 1.2rem;
    line-height: 1.8rem;
  }

  .news-featured__title,
  .news-card__title {
    font-size: 1.5rem;
    line-height: 2rem;
  }

  .news-article__header {
    margin: 1rem auto 2rem;
  }

  .news-back {
    font-size: 1.1rem;
  }

  .news-article__title {
    margin: 1.2rem 0;
    font-size: 1.8rem;
    line-height: 2.4rem;
  }

  .news-body {
    margin-top: 2.4rem;
  }

  /* The header image of an article uses the whole width of the screen too. */
  .news-article__image img {
    display: block;
    width: 100vw;
    max-width: none;
    height: auto;
    margin: 0 calc(50% - 50vw);
    border-radius: 0;
  }

}
