/* News cards and grid (home, Nieuws page, single "Meer nieuws"). */

@layer components {
  /* Category pills in the page header (template-parts/page-header.php). */
  .news-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
  }

  .news-filters__pill {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    height: 46px;
    padding: 0 8px 0 20px;
    border: 1.5px solid rgb(255 255 255 / 40%);
    border-radius: 999px;
    background: transparent;
    color: var(--theme-color-inverse-text);
    font: inherit;
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition:
      background-color 0.25s,
      color 0.25s,
      border-color 0.25s;
  }

  .news-filters__pill:hover {
    border-color: var(--theme-color-contrast);
  }

  .news-filters__pill b {
    display: inline-grid;
    place-items: center;
    min-width: 30px;
    height: 30px;
    padding-inline: 6px;
    border-radius: 15px;
    background: rgb(255 255 255 / 14%);
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
  }

  .news-filters__pill[aria-pressed='true'] {
    border-color: var(--theme-color-contrast);
    background: var(--theme-color-contrast);
    color: var(--theme-color-primary);
  }

  .news-filters__pill[aria-pressed='true'] b {
    background: var(--theme-color-primary);
    color: var(--theme-color-primary-foreground);
  }

  /* List: "Uitgelicht" label, wide feature card, then the card grid. */
  .news-list {
    padding-block: 72px clamp(96px, 10vw, 140px);
  }

  .news-list__label {
    margin-bottom: 22px;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--theme-color-text-muted);
  }

  .news-feature {
    display: grid;
    overflow: hidden;
    border-radius: 8px;
    background: var(--theme-color-surface);
    color: var(--theme-color-text);
    text-decoration: none;
  }

  @media (width >= 68.75rem) {
    .news-feature {
      grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    }
  }

  .news-feature__media {
    position: relative;
    min-height: clamp(240px, 32vw, 460px);
    overflow: hidden;
    background: var(--theme-color-border);
  }

  .news-feature__media img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: scale 0.9s cubic-bezier(0.2, 0.7, 0.2, 1);
  }

  .news-feature:hover .news-feature__media img {
    scale: 1.04;
  }

  /* No photo: the P mark, white and faint on the green. */
  .news-feature__media:has(.news-feature__placeholder) {
    background: var(--theme-color-inverse);
  }

  .news-feature .news-feature__placeholder {
    inset: 0;
    width: 30%;
    margin: auto;
    object-fit: contain;
    opacity: 0.35;
    filter: brightness(0) invert(1);
  }

  .news-feature:hover .news-feature__placeholder {
    scale: 1;
  }

  .news-feature__body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    padding: clamp(28px, 4vw, 56px) clamp(24px, 4vw, 56px);
  }

  .news-feature__title {
    margin-block: 18px;
    font-size: clamp(1.375rem, 2vw, 1.875rem);
    font-weight: 500;
    line-height: 1.15;
    letter-spacing: -0.02em;
  }

  .news-feature__excerpt {
    margin-bottom: 30px;
    font-size: 1.0625rem;
    line-height: 1.65;
    color: var(--theme-color-text-muted);
  }

  .news-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 44px;
  }

  .news-feature-wrap + .news-grid {
    margin-top: 72px;
  }

  @media (width >= 37.5rem) {
    .news-grid {
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 56px 32px;
    }
  }

  @media (width >= 68.75rem) {
    .news-grid {
      grid-template-columns: repeat(3, minmax(0, 1fr));
    }
  }

  /* Nieuws page on wide screens: four cards per row (twelve per "load more"
     still fills whole rows). Not under a single post, which shows three. */
  @media (width >= 100rem) {
    [data-news-grid] {
      grid-template-columns: repeat(4, minmax(0, 1fr));
    }
  }

  .news-list__more {
    display: flex;
    justify-content: center;
    margin-top: 88px;
  }

  .news-list__more[hidden] {
    display: none;
  }

  /* Card: photo with label, date, title, three-line excerpt, "Lees verder". */
  .news-card[hidden] {
    display: none;
  }

  .news-card__link {
    display: flex;
    flex-direction: column;
    height: 100%;
    color: var(--theme-color-text);
    text-decoration: none;
  }

  .news-card__media {
    position: relative;
    display: block;
    aspect-ratio: 3 / 2;
    margin-bottom: 22px;
    overflow: hidden;
    border-radius: 6px;
    background: var(--theme-color-inverse);
  }

  .news-card__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: scale 0.8s cubic-bezier(0.2, 0.7, 0.2, 1);
  }

  .news-card__link:hover .news-card__image {
    scale: 1.06;
  }

  /* No photo: the P mark, white and faint on the green. */
  .news-card__image--placeholder {
    width: 30%;
    margin-inline: auto;
    object-fit: contain;
    opacity: 0.35;
    filter: brightness(0) invert(1);
  }

  .news-card__link:hover .news-card__image--placeholder {
    scale: 1;
  }

  .news-card__title {
    margin-block: 12px 10px;
    font-size: 1.3125rem;
    font-weight: 500;
    line-height: 1.3;
    letter-spacing: -0.01em;
  }

  .news-card__link:hover .news-card__title {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 5px;
  }

  .news-card__excerpt {
    display: -webkit-box;
    margin-bottom: 18px;
    overflow: hidden;
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--theme-color-text-muted);
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
  }

  .news-card .news-more {
    margin-top: auto;
    font-size: var(--theme-font-size-sm);
  }

  /* Single article (single.php): the large page header with a smaller title
     and a label/date row, the photo overlapping the header, a narrow
     reading column. */
  .page-header--article .page-header__title {
    max-width: 22ch;
    margin-top: 18px;
    font-size: clamp(1.875rem, 3.3vw, 2.875rem);
    line-height: 1.08;
    letter-spacing: -0.025em;
  }

  .article__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-top: 28px;
    font-size: var(--theme-font-size-sm);
    color: rgb(255 255 255 / 75%);
  }

  /* With a photo: extra green under the title, the photo pulled up over it. */
  .article--photo .page-header__inner {
    padding-bottom: clamp(120px, 14vw, 200px);
  }

  .article__media {
    position: relative;
    margin-top: calc(-1 * clamp(80px, 10vw, 150px));
  }

  .article__image {
    width: 100%;
    height: auto;
    max-height: 640px;
    object-fit: cover;
    border-radius: 8px;
  }

  .article__body .classic-content {
    font-size: 1.125rem;
    line-height: 1.75;
  }

  .article__body .classic-content p {
    color: var(--theme-color-text-muted);
  }

  .article__body .classic-content > :first-child {
    font-size: clamp(1.125rem, 1.45vw, 1.3125rem);
    line-height: 1.55;
    color: var(--theme-color-text);
  }

  .article__footer {
    margin-top: 56px;
    padding-top: 32px;
    border-top: 1px solid var(--theme-color-border);
  }
}

/* Homepage news, after the Prime design artifact: the latest post large on
   the left (7/12), the next three as rows with a small photo (5/12). */
@layer components {
  .home-news__grid {
    display: grid;
    gap: 48px;
  }

  @media (width >= 60rem) {
    .home-news__grid {
      grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    }
  }

  .news-big,
  .news-row {
    color: var(--theme-color-text);
    text-decoration: none;
  }

  .news-big {
    display: block;
  }

  .news-big__media {
    position: relative;
    display: block;
    aspect-ratio: 16 / 10;
    margin-bottom: 24px;
    overflow: hidden;
    border-radius: 6px;
    background: var(--theme-color-border);
  }

  .news-big__media img,
  .news-row__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .news-big__media img {
    transition: scale 0.9s cubic-bezier(0.2, 0.7, 0.2, 1);
  }

  .news-big:hover .news-big__media img {
    scale: 1.05;
  }

  .news-big__title {
    margin-block: 12px;
    font-size: clamp(1.1875rem, 1.5vw, 1.375rem);
    font-weight: 500;
    line-height: 1.22;
    letter-spacing: -0.015em;
  }

  .news-big__excerpt {
    max-width: 62ch;
    margin-bottom: 20px;
    color: var(--theme-color-text-muted);
    line-height: 1.6;
  }

  .news-rows {
    display: flex;
    flex-direction: column;
  }

  .news-row {
    display: grid;
    grid-template-columns: 110px minmax(0, 1fr);
    gap: 16px;
    margin-bottom: 26px;
    padding-bottom: 26px;
    border-bottom: 1px solid var(--theme-color-border);
  }

  @media (width >= 37.5rem) {
    .news-row {
      grid-template-columns: 168px minmax(0, 1fr);
      gap: 22px;
    }
  }

  .news-row:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: 0;
  }

  .news-row__media {
    display: block;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border-radius: 5px;
    background: var(--theme-color-border);
  }

  .news-row__media img {
    transition: scale 0.8s;
  }

  .news-row:hover .news-row__media img {
    scale: 1.06;
  }

  .news-row .news-meta {
    margin-bottom: 8px;
    font-size: 0.8125rem;
  }

  .news-row__title {
    margin-bottom: 10px;
    font-size: 1.125rem;
    font-weight: 500;
    line-height: 1.35;
  }

  .news-row:hover .news-row__title {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 5px;
  }

  .news-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    font-size: var(--theme-font-size-sm);
    color: var(--theme-color-text-muted);
  }

  .news-more {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--theme-color-primary);
    font-size: 0.9375rem;
    font-weight: 500;
  }

  .news-row .news-more {
    font-size: var(--theme-font-size-sm);
  }

  .news-more svg {
    transition: translate 0.3s;
  }

  a:hover .news-more svg {
    translate: 4px 0;
  }

  /* Category label (shown once posts get a category other than the default). */
  .news-tag {
    display: inline-flex;
    align-items: center;
    height: 24px;
    padding: 0 10px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--theme-color-accent) 22%, #fff);
    color: var(--theme-color-primary);
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
  }

  .news-tag--light {
    background: var(--theme-color-background);
  }

  .news-tag--on-image {
    position: absolute;
    top: 18px;
    left: 18px;
    height: 28px;
    padding: 0 12px;
    background: var(--theme-color-background);
    font-size: 0.75rem;
  }
}
