/*
 * .post-grid — head + featured / latest resource cards
 * (template-parts/flexible/post-grid.php).
 * Figma: Articles & Insights D 337:11296 (wide), 337:11383 + 337:11292
 * (regular, wave background) / M 337:11143, 337:11153.
 *
 * Cards: resource-card (index.css) / story-card in .post-grid__cell.
 * Regular: sideways scroll of 295 px cards below 1025 px, like the
 * inner-page sliders (CSS scroll snap, no script), then 3 in a row.
 * Wide: one under another, 2 in a row from 1025 px.
 */

.post-grid {
  position: relative;
  padding-top: var(--nv-section-y);
  padding-bottom: var(--nv-section-y);
  isolation: isolate;
}

/* .post-grid__bg — full-width background image (field "Background image") */
.post-grid__bg {
  position: absolute;
  z-index: -1;
  inset: 0;
  overflow: hidden;
}

/* .post-grid__bg-image */
.post-grid__bg-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* .post-grid__container — head → cards: 40 → 50 px */
.post-grid__container {
  /* head → cards: 30 → 50 px from the title's baseline (Figma 1574:12314 / 1574:12178) */
  display: flex;
  flex-direction: column;
  gap: clamp(1.875rem, 1.4306rem + 1.8957vw, 3.125rem);
}

/* .post-grid__head */
.post-grid__head {
  display: flex;
  flex-direction: column;
  gap: clamp(1.875rem, 1.4306rem + 1.8957vw, 3.125rem);
}

/* .post-grid__eyebrow */
.post-grid__eyebrow {
  display: inline-flex;
  align-items: flex-start;
  gap: 0.3125rem;
  padding: calc(0.625rem - 0.14em) 0.625rem;
  color: var(--nv-green);
  font-weight: 500;
  font-size: clamp(1rem, 0.9111rem + 0.3792vw, 1.25rem);
  line-height: 1;
  letter-spacing: 0.05em;
  text-transform: uppercase;

  /* @media (width >= 48em) .post-grid__eyebrow — the phone mocks track 5 %, the desktop ones 10 % */
  @media (width >= 48em) {
    letter-spacing: 0.1em;
  }

  /* .post-grid__eyebrow::before — rhomb */
  &::before {
    content: "";
    flex-shrink: 0;
    width: 0.53rem;
    height: 0.53rem;
    margin-top: calc(0.5lh - 0.265rem);
    background: url("../../img/icons/rhomb.svg") center / contain no-repeat;
  }
}

/* .post-grid__title — 40 → 90 px */
.post-grid__title {
  margin-top: -0.14em;
  margin-bottom: -0.14em;
  color: var(--nv-navy);
  font-weight: 400;
  font-size: clamp(2.5rem, 1.3892rem + 4.7393vw, 5.625rem);
  line-height: 1;
  letter-spacing: -0.02em;
  overflow-wrap: break-word;

  & strong {
    color: var(--nv-green);
    font-weight: inherit;
  }
}

/* .post-grid__list */
.post-grid__list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.25rem;
}

/* .post-grid__list--wide — two in a row from 1025 px */
.post-grid__list--wide {
  /* @media (width >= 64.0625em) .post-grid__list--wide */
  @media (width >= 64.0625em) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* .post-grid__list--regular — sideways scroll below 1025 px, edge to edge */
.post-grid__list--regular {
  display: flex;
  gap: 0.625rem;
  margin-inline: -0.9375rem;
  padding-inline: 0.9375rem;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-padding-inline: 0.9375rem;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;

  /* .post-grid__list--regular::-webkit-scrollbar */
  &::-webkit-scrollbar {
    display: none;
  }

  /* .post-grid__list--regular .post-grid__cell — 295 px cards */
  & .post-grid__cell {
    flex: 0 0 18.4375rem;
    scroll-snap-align: start;
  }

  /* @media (width >= 64.0625em) .post-grid__list--regular — three in a row, as the inner-page sliders */
  @media (width >= 64.0625em) {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.25rem;
    margin-inline: 0;
    padding-inline: 0;
    overflow: visible;

    /* .post-grid__list--regular .post-grid__cell */
    & .post-grid__cell {
      flex: none;
    }
  }
}

/* .post-grid__cell */
.post-grid__cell {
  min-width: 0;
}

/* .post-grid--image .resources__body — cards stay light on the background image
   (the body tint is translucent, made for white sections: white + tint = mist) */
.post-grid--image .resources__body {
  background-color: var(--nv-mist);
}
