/*
 * .bento-grid — head + grid of photo cards (template-parts/flexible/bento-grid.php).
 * Figma: /industries 337:17065 (M 337:16644); /solutions 337:15174
 * (M 337:14951); Business Central duo 337:14616 (M 337:14407).
 *
 * Grid: 1 column → 2 from 768 px → 3 from 1025 px; a featured item spans
 * two columns, so the first row reads 2 / 1 and the rest 1 / 1 / 1.
 * Rows fill left to right; a short last row stays on the left.
 * --duo: two equal cards (690 × 500).
 */

.bento-grid {
  padding-top: var(--nv-section-y);
  padding-bottom: var(--nv-section-y);
}

/* .bento-grid--haze — light blue band (field "Section Background"): Figma /solutions
   1574:16249 (M 1574:16026) */
.bento-grid--haze {
  position: relative;
  isolation: isolate;
  background-color: var(--nv-haze);
}

/* .bento-grid__bg — optional texture, clipped to the section */
.bento-grid__bg {
  position: absolute;
  z-index: -1;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

/* .bento-grid__bg-image — full width from the top: 375 × 457 (M), 1520 × 941 (D); the file's
   bottom edge is already the band colour, so the section runs on in plain --nv-haze */
.bento-grid__bg-image {
  display: block;
  width: 100%;
  height: auto;
}

/* .bento-grid__container — head → cards: 40 px → 75 px, as Figma (not the 50 px flow gap) */
.bento-grid__container {
  display: flex;
  flex-direction: column;
  gap: clamp(2.5rem, 1.7225rem + 3.3176vw, 4.6875rem);
}

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

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

/* .bento-grid__eyebrow — pill: 10 px around the cap height, 8.5 px rhomb, 5 px gap */
.bento-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: var(--nv-fs-eyebrow);
  line-height: 1;
  letter-spacing: 0.05em;
  text-transform: uppercase;

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

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

/* .bento-grid__title — 40 → 90 px, line box trimmed to cap / baseline */
.bento-grid__title {
  max-width: 60rem;
  margin-block: -0.14em;
  color: var(--nv-navy);
  font-weight: 400;
  font-size: var(--nv-fs-h2);
  line-height: 1;
  letter-spacing: -0.02em;
  overflow-wrap: break-word;

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

  /* @media (width < 48em) .bento-grid__title br — desktop line breaks only */
  @media (width < 48em) {
    & br {
      display: none;
    }
  }
}

/* .bento-grid__subtitle — 20 → 23 px / 120 %, 40 → 75 px under the title (10 → 25 px more than
   the head gap). Figma duo 337:14616: the phone text (120 %) is trimmed to cap / baseline, the
   desktop one (auto line height ≈ 122 %) keeps its full line boxes */
.bento-grid__subtitle {
  max-width: 65rem;
  margin-top: calc(clamp(0.625rem, 0.2917rem + 1.4219vw, 1.5625rem) - 0.24em);
  margin-bottom: -0.24em;
  color: var(--main-color);
  font-size: var(--nv-fs-lead);
  line-height: 1.2;
  letter-spacing: -0.03em;

  & p + p {
    margin-top: calc(1.25rem - 0.48em);
  }

  /* @media (width >= 48em) .bento-grid__subtitle */
  @media (width >= 48em) {
    margin-top: clamp(0.625rem, 0.2917rem + 1.4219vw, 1.5625rem);
    margin-bottom: 0;
  }
}

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

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

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

/* .bento-grid__item */
.bento-grid__item {
  display: flex;
  min-width: 0;
}

/* .bento-grid__item--featured — two columns */
.bento-grid__item--featured {
  /* @media (width >= 48em) .bento-grid__item--featured */
  @media (width >= 48em) {
    grid-column: span 2;
  }
}

/* .bento-grid--duo — two equal columns; no padding under the cards: the next section brings its own
   (Figma 337:14616 / M 337:14407 end at the card edge) */
.bento-grid--duo {
  padding-bottom: 0;

  /* .bento-grid--duo .bento-grid__title */
  & .bento-grid__title {
    max-width: 75rem;
  }

  /* .bento-grid--duo .bento-grid__list — 40 px between the two cards on phones, 20 px from 768 */
  & .bento-grid__list {
    gap: 2.5rem;

    /* @media (width >= 48em) .bento-grid--duo .bento-grid__list */
    @media (width >= 48em) {
      gap: 1.25rem;
    }
  }

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

/* .bento-grid--spotlight — one large card on the left, four compact ones in a 2 × 2 grid on the right
   (Figma About D 18:42365 / M 18:50050): four 335 px columns, the large card spans two columns and
   two 240 px rows; one column on phones, two from 768 px (the large card on top) */
.bento-grid--spotlight {
  /* the phone frame's eyebrow pill starts 5 px above the 50 px padding (pill 45 → 75, Figma M 18:50050) */
  padding-top: 2.8125rem;

  /* @media (width >= 48em) .bento-grid--spotlight */
  @media (width >= 48em) {
    padding-top: var(--nv-section-y);
  }

  /* .bento-grid--spotlight .bento-grid__title — 1080 px box */
  & .bento-grid__title {
    max-width: 67.5rem;
  }

  /* .bento-grid--spotlight .bento-grid__subtitle — 910 px, 70 % opacity: #132132 on phones, #2a3441 from 768 px;
     20 → 50 px under the title (the head gap on phones, plus 0 on desktop) */
  & .bento-grid__subtitle {
    max-width: 56.875rem;
    margin-top: calc(-0.625rem - 0.24em);
    margin-bottom: calc(0.625rem - 0.24em);
    color: var(--nv-navy);
    opacity: 0.7;

    /* .bento-grid--spotlight .bento-grid__subtitle > * + * — a blank line before the bold line (any tag) */
    & > * + * {
      margin-top: 1.2em;
    }

    /* @media (width >= 48em) .bento-grid--spotlight .bento-grid__subtitle */
    @media (width >= 48em) {
      margin-top: -0.25rem;
      margin-bottom: -0.24em;
      color: var(--nv-text);
    }
  }

  /* .bento-grid--spotlight .bento-grid__list — 20 px gaps, large card 5 px further from the next one on phones */
  & .bento-grid__list {
    gap: 1.25rem;
  }

  /* .bento-grid--spotlight .bento-grid__item--featured */
  & .bento-grid__item--featured {
    @media (width < 48em) {
      margin-bottom: 0.3125rem;
    }
  }

  /* @media (width >= 64.0625em) .bento-grid--spotlight .bento-grid__list */
  @media (width >= 64.0625em) {
    & .bento-grid__list {
      grid-template-columns: repeat(4, minmax(0, 1fr));
      grid-auto-rows: minmax(15rem, auto); /* rows grow when a card's text does not fit */
    }

    & .bento-grid__item--featured {
      grid-row: span 2;
    }
  }
}

/* .bento-grid--spotlight.bento-grid--haze — white section, the texture (a strip with the fade baked in)
   only on the right edge (Figma About D 18:42366 / M 18:50051) instead of the full-width haze band */
.bento-grid--spotlight.bento-grid--haze {
  background-color: var(--nv-white);

  /* .bento-grid--spotlight .bento-grid__bg-image */
  & .bento-grid__bg-image {
    position: absolute;
    top: 0;
    right: 0;
    width: auto;
    max-width: none;
  }
}

/* .bento-grid__closing — paragraph under the grid: 30 → 50 px / 100 %, centred, 50 px (M) / 75 px (D) under the
   cards (line box trimmed to cap / baseline) */
.bento-grid__closing {
  margin-block: calc(0.625rem - 0.14em) -0.14em;
  margin-inline: auto;
  color: var(--nv-navy);
  font-weight: 500;
  font-size: clamp(1.875rem, 1.3987rem + 2.0332vw, 3.125rem);
  line-height: 1;
  letter-spacing: -0.03em;
  text-align: center;
  overflow-wrap: break-word;

  /* @media (width >= 48em) .bento-grid__closing */
  @media (width >= 48em) {
    margin-top: -0.14em;
  }
}

/* .page-id-116 .bento-grid--duo — About only (Figma D 18:42488 / M 18:50178): 30 px between the cards on phones
   (40 px on Business Central), the lead at 140 % leading from 768 px */
.page-id-116 .bento-grid--duo {
  /* .page-id-116 .bento-grid--duo .bento-grid__container — head → cards 30 px on phones, 50 px from 768 px (box to box, as the lead's 140 % leading adds its own) */
  & .bento-grid__container {
    gap: 1.875rem;

    @media (width >= 48em) {
      gap: 2.5625rem;
    }
  }

  /* .page-id-116 .bento-grid--duo .bento-grid__list */
  & .bento-grid__list {
    gap: 1.875rem;

    /* @media (width >= 48em) .page-id-116 .bento-grid--duo .bento-grid__list */
    @media (width >= 48em) {
      gap: 1.25rem;
    }
  }

  /* .page-id-116 .bento-grid--duo .bento-grid__title — the Figma title box is not trimmed to the cap line; the
     line break after "Expertise." stays on phones (Figma M: "Microsoft / Expertise. / Global Capability.") */
  & .bento-grid__title {
    & br {
      display: inline;
    }

    @media (width >= 48em) {
      margin-top: 0;
    }
  }

  /* @media (width >= 48em) .page-id-116 .bento-grid--duo .bento-grid__subtitle */
  & .bento-grid__subtitle {
    margin-top: -0.24em;

    @media (width >= 48em) {
      margin-top: 0.3125rem;
      max-width: 60rem; /* Figma frame 960: the first line ends at "manufacturing" */
      line-height: 1.4;
    }
  }
}

/* .page-id-123 .hero + .bento-grid — Business Central only: the phone frame's hero runs 7 px into
   this section, 43 → 100 px on top (Figma 1574:15442, matched visually 2026-10-14) */
.page-id-123 .hero + .bento-grid {
  padding-top: clamp(2.6875rem, 1.4331rem + 5.3521vw, 6.25rem);
}
