/*
 * .icon-grid — centred head + grid of white cards with an icon
 * (template-parts/flexible/icon-grid.php).
 * Figma: Plastics D 337:15939 (intro 337:15955, cards 337:15971…) / M 337:15408.
 *
 * Grid: 1 column → 2 from 768 px → 3 from 1025 px → 4 from 1430 px.
 * Phones: cards as tall as their content. Desktop: 320 px cards, icon at the
 * top, title and text at the bottom. The blue intro card is optional.
 */

.icon-grid {
  padding-top: var(--nv-section-y);
  padding-bottom: var(--nv-section-y);
  background-color: var(--nv-mist);
}

/* .icon-grid__container — head → cards (50 → 75 px) */
.icon-grid__container {
  display: flex;
  flex-direction: column;
  gap: clamp(3.125rem, 2.5696rem + 2.3697vw, 4.6875rem);
}

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

/* .icon-grid__head--center */
.icon-grid__head--center {
  align-items: center;
  text-align: center;
}

/* .icon-grid__eyebrow — label without fill: 10 px around the cap height (Figma Frame 20, no fill in phase 2 frames) */
.icon-grid__eyebrow {
  display: inline-flex;
  align-items: flex-start;
  gap: 0.3125rem;
  border-radius: 3.125rem;
  padding: calc(0.625rem - 0.14em) 0.625rem;
  color: var(--nv-green);
  font-weight: 500;
  font-size: clamp(0.875rem, 0.7417rem + 0.5687vw, 1.25rem);
  line-height: 1;
  letter-spacing: 0.1em;
  text-transform: uppercase;

  /* .icon-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;
  }
}

/* .icon-grid__title — section heading, 1160 px, line box trimmed to cap / baseline */
.icon-grid__title {
  max-width: 72.5rem;
  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;
  }
}

/* .icon-grid__subtitle — 1029 px (widest Figma box, Specialty Metals); h2 → subtitle 50 → 75 px (head gap 30 → 50 + 20 → 25).
   Figma boxes are trimmed cap → baseline: phones 120 %, paragraphs 50 px apart; from 768 px 140 %, 20 px apart */
.icon-grid__subtitle {
  --icon-grid-trim: 0.24em;
  max-width: 64.3125rem;
  margin-top: calc(clamp(1.25rem, 1.14rem + 0.4695vw, 1.5625rem) - var(--icon-grid-trim));
  margin-bottom: calc(-1 * var(--icon-grid-trim));
  color: var(--nv-navy);
  font-size: clamp(1.25rem, 1.1833rem + 0.2844vw, 1.4375rem);
  line-height: 1.2;
  letter-spacing: -0.03em;

  & > * + * {
    margin-top: calc(3.125rem - 2 * var(--icon-grid-trim));
  }

  /* @media (width >= 48em) .icon-grid__subtitle */
  @media (width >= 48em) {
    --icon-grid-trim: 0.34em;
    line-height: 1.4;

    & > * + * {
      margin-top: calc(1.25rem - 2 * var(--icon-grid-trim));
    }
  }
}

/* :is(.postid-79, .postid-80, .postid-81) .icon-grid__subtitle — Chemicals, Process and Industrial frames
   have a 926 px box (only Specialty Metals is 1029): the last lines carry 3–4 words, not one (Vlad 2026-11-18) */
:is(.postid-79, .postid-80, .postid-81) .icon-grid__subtitle {
  max-width: 57.875rem;
}

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

  /* @media (width >= 48em) .icon-grid__list */
  @media (width >= 48em) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* @media (width >= 64.0625em) .icon-grid__list */
  @media (width >= 64.0625em) {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  /* @media (width >= 89.375em) .icon-grid__list */
  @media (width >= 89.375em) {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* .icon-grid__intro, .icon-grid__item — 335 × 320 cards, 30 px padding, no stroke (Figma Frame 37 337:15971, Vlad 2026-10-17) */
.icon-grid__intro,
.icon-grid__item {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-radius: var(--nv-radius-s);
  padding: 1.875rem;
}

/* .icon-grid__intro — blue card; text on top (cap at the padding edge), bold closing
   line at the bottom (baseline at the padding edge) */
.icon-grid__intro {
  justify-content: space-between;
  gap: 1.25rem;
  min-height: 20rem;

  /* @media (width >= 64.0625em) .icon-grid__intro */
  @media (width >= 64.0625em) {
    min-height: 19rem;
  }

  & > :first-child {
    margin-top: -0.24em;
  }
  background:
    linear-gradient(170deg, rgba(19, 33, 50, 0) 34%, rgba(19, 33, 50, 0.6) 76%, var(--nv-blue-light) 100%),
    var(--nv-blue);
  color: var(--nv-white);
  font-size: 1.125rem;
  line-height: 1.2;
  letter-spacing: -0.02em;

  & > * + * {
    margin-top: 0;
  }

  /* .icon-grid__intro > p + p — the .rich-text paragraph gap, 20 px less from 768 px */
  &.rich-text > p:not(.nv-block) + p:not(.nv-block) {
    /* @media (width >= 48em) .icon-grid__intro > p + p */
    @media (width >= 48em) {
      margin-top: calc(var(--nv-flow-gap) - 0.34em - 1.25rem);
    }
  }

  /* .icon-grid__intro .nv-bold-line — a paragraph that is only bold (class set in
     inc/wysiwyg-format.php) = larger closing line; bold inside a sentence stays inline bold */
  & .nv-bold-line strong {
    display: block;
    margin-bottom: -0.14em;
    font-weight: 700;
    font-size: 1.4375rem;
    line-height: 1;
  }
}

/* .icon-grid__intro-label — optional closing label of the intro card, 32 px Medium like
   the card titles (Figma phase 2 industries 510:67937 "Common challenges include:") */
.icon-grid__intro-label {
  margin-bottom: -0.14em;
  font-weight: 500;
  font-size: 2rem;
  line-height: 1;
  letter-spacing: -0.02em;
  overflow-wrap: break-word;
}

/* .icon-grid__item — white card, 262 → 320 px (Figma phase 2 Frame 37: fixed height, text at the bottom) */
.icon-grid__item {
  gap: 1.875rem;
  min-height: 16.375rem;
  background-color: var(--nv-white);

  /* @media (width >= 64.0625em) .icon-grid__item */
  @media (width >= 64.0625em) {
    gap: 1.25rem;
    min-height: 20rem;
  }
}

/* .icon-grid__body — pushed to the bottom, also in a card without an icon;
   title → text as on the Figma screenshots (ink gap 15 / 14 px): 25 → 28 px between the trimmed boxes */
.icon-grid__body {
  display: flex;
  margin-top: auto;
  flex-direction: column;
  gap: 1.5625rem;

  /* @media (width >= 64.0625em) .icon-grid__body */
  @media (width >= 64.0625em) {
    gap: 1.75rem;
  }
}

/* .icon-grid__name — card title, trimmed to cap / baseline; 6.75em puts each word of a
   two-word title on its own line, as in every Figma frame (longest word 6.28em, shortest pair 7.19em) */
.icon-grid__name {
  max-width: 6.75em;
  margin-top: -0.14em;
  margin-bottom: -0.14em;
  color: var(--nv-navy);
  font-weight: 500;
  font-size: 2rem;
  line-height: 1;
  letter-spacing: -0.02em;
  overflow-wrap: break-word;
}

/* .icon-grid__text — 16 → 18 px at 120 % (0.24em trims); reserved height as in Figma, where every card
   text box is 4 lines tall (texts padded with empty lines): titles of a row line up and the space under
   the text matches the screenshots (4.5em measured: title 136 px from the card top, 45–50 px below the text) */
.icon-grid__text {
  min-height: 4.5em;
  margin-top: -0.24em;
  margin-bottom: -0.24em;
  color: var(--nv-navy);
  font-size: clamp(1rem, 0.9556rem + 0.1896vw, 1.125rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

/* :is(phase 2 industry pages) .icon-grid__intro — Figma phase 2 (1:10896, 1:16298 …): the gradient layer is at
   70 % over the blue, the text at 80 %; the bold closing line and the label stay white. Plastics keeps sprint 2 */
:is(.postid-78, .postid-79, .postid-80, .postid-81) .icon-grid__intro {
  background:
    linear-gradient(170deg, rgba(19, 33, 50, 0) 34%, rgba(19, 33, 50, 0.42) 76%, rgba(26, 121, 191, 0.7) 100%),
    var(--nv-blue);
  color: rgba(255, 255, 255, 0.8);

  /* :is(phase 2 industry pages) .icon-grid__intro .nv-bold-line, .icon-grid__intro-label */
  & .nv-bold-line,
  & .icon-grid__intro-label {
    color: var(--nv-white);
  }
}
