/*
 * .mosaic — centred head + 2 × 2 tiles of text and photos
 * (template-parts/flexible/mosaic.php).
 * Figma: Plastics D 337:16073 / M 337:15542, 337:15549.
 *
 * Phones: one column, the bottom row swapped (text, photo, text, photo).
 * From 768 px: two columns in the editor's order. Tiles 238 → 300 px.
 */

/* .mosaic — the decision-makers block follows inside the same Figma frame: tiles → 50 → 75 px → its head */
.mosaic {
  padding-top: var(--nv-section-y);
  padding-bottom: clamp(3.125rem, 2.5696rem + 2.3697vw, 4.6875rem);
}

/* .mosaic + .what-matters — no padding of its own after the tiles */
.mosaic + .what-matters {
  padding-top: 0;
}

/* .mosaic__container — head → tiles (40 → 100 px) */
.mosaic__container {
  display: flex;
  flex-direction: column;
  gap: clamp(2.5rem, 1.1670rem + 5.6872vw, 6.25rem);
}

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

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

/* .mosaic__eyebrow */
.mosaic__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(0.875rem, 0.7417rem + 0.5687vw, 1.25rem);
  line-height: 1;
  letter-spacing: 0.05em;
  text-transform: uppercase;

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

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

/* .mosaic__title — trimmed to cap / baseline */
.mosaic__title {
  max-width: 81.875rem;
  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;
  }
}

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

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

/* .mosaic__tile — 238 → 300 px, no border (Figma phase 2); 16 px corners on phones (Figma 1-5), 10 px from 768 */
.mosaic__tile {
  position: relative;
  min-width: 0;
  min-height: clamp(14.875rem, 13.4976rem + 5.8768vw, 18.75rem);
  border-radius: 1rem;
  overflow: hidden;

  /* @media (width >= 48em) .mosaic__tile */
  @media (width >= 48em) {
    border-radius: var(--nv-radius-s);
  }
}

/* .mosaic__tile:nth-child(3) — phones: bottom row swapped, text and photos alternate */
.mosaic__tile:nth-child(3) {
  order: 1;

  /* @media (width >= 48em) .mosaic__tile:nth-child(3) */
  @media (width >= 48em) {
    order: 0;
  }
}

/* .mosaic__tile--text — blue gradient, title on top, text at the bottom; 20 → 30 px from the outer edge */
.mosaic__tile--text {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 3.125rem;
  padding: clamp(1.25rem, 1.0299rem + 0.939vw, 1.875rem);
  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);
}

/* .mosaic__tile--image — photo with a 20 % blue tint */
.mosaic__tile--image {
  background-color: var(--nv-mist);

  /* .mosaic__tile--image::after — tint */
  &::after {
    content: "";
    position: absolute;
    inset: 0;
    background-color: rgba(26, 121, 191, 0.2);
    pointer-events: none;
  }
}

/* .mosaic__image */
.mosaic__image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* .mosaic__top — title | icon */
.mosaic__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.25rem;
}

/* .mosaic__name — 32 → 50 px; the phone frame trims the line box, the desktop one
   keeps the font's own leading (cap 13 px under the padding edge) */
.mosaic__name {
  min-width: 0;
  margin-top: -0.14em;
  font-weight: 500;
  font-size: clamp(2rem, 1.6001rem + 1.7061vw, 3.125rem);
  line-height: 1;
  letter-spacing: -0.04em;
  overflow-wrap: break-word;

  /* @media (width >= 48em) .mosaic__name */
  @media (width >= 48em) {
    margin-top: 0;
    line-height: normal;
  }
}

/* .mosaic__icon — dark glass square */
.mosaic__icon {
  background-color: rgba(19, 33, 50, 0.1);
}

/* .mosaic__text — 16 → 23 px at 120 %, last line 20 → 30 px above the tile edge (screenshots); from 768 px the first tile's text
   is 423 px wide, the last one's spans the tile (Figma phase 2 industries, 4 lines each) */
.mosaic__text {
  color: var(--nv-white);
  font-size: clamp(1rem, 0.8445rem + 0.6635vw, 1.4375rem);
  line-height: 1.2;
  letter-spacing: -0.03em;

  /* @media (width >= 48em) .mosaic__text */
  @media (width >= 48em) {
    letter-spacing: -0.02em;
  }
}

/* .mosaic__tile:first-child .mosaic__text — only in a two-row mosaic; a single row's text spans the tile
   (Figma Chemicals / Process / Industrial "Profitable growth": 630 px, 5 lines) */
.mosaic__list:has(> .mosaic__tile:nth-child(3)) > .mosaic__tile:first-child .mosaic__text {
  /* @media (width >= 48em) .mosaic__tile:first-child .mosaic__text */
  @media (width >= 48em) {
    max-width: 26.4375rem;
  }
}

/* .mosaic__picture — optional phone source around the photo (inc/template-tags.php naviona_image_with_mobile());
   the <img> keeps its own box */
.mosaic__picture {
  display: contents;
}

/* :is(phase 2 industry pages) .mosaic__tile--text — Figma phase 2 (1:11680, 1:16413 …): the gradient layer
   is at 70 % over the blue, the tile text at 80 % (white on desktop, #ccdbe8 on phones); the title stays white.
   Plastics keeps the sprint 2 tile */
:is(.postid-78, .postid-79, .postid-80, .postid-81) .mosaic__tile--text {
  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);

  /* :is(phase 2 industry pages) .mosaic__text */
  & .mosaic__text {
    color: rgba(204, 219, 232, 0.8);

    /* @media (width >= 48em) :is(phase 2 industry pages) .mosaic__text */
    @media (width >= 48em) {
      color: rgba(255, 255, 255, 0.8);
    }
  }
}
