/* ==========================================================================
   03 / What we do (full bleed bento)
   Dark, edge to edge. Each pillar gets a different tile size, paired with
   an image tile. No decorative shapes: visuals are real images only.
   1px grid lines, sharp corners.
   ========================================================================== */

.wwd {
  --wwd-line: var(--color-gray-900);

  background: var(--color-pitch-black);
  color: var(--color-white);
}

/* Heading highlight: same marker as the hero, drawn in on reveal */
.wwd__mark,
.bento__mark {
  background-image: linear-gradient(var(--mark-color), var(--mark-color));
  background-repeat: no-repeat;
  background-position: 0 90%;
  background-size: 100% 0.22em;
  transition: background-size 900ms var(--ease-out);
}

.wwd__mark {
  --mark-color: var(--color-brand-orange);
  transition-delay: 200ms;
}

.js .wwd:not(.is-inview) .wwd__mark,
.js .wwd:not(.is-inview) .bento__mark {
  background-size: 0% 0.22em;
}

/* ---- Head ---- */
.wwd__head {
  align-items: end;
  row-gap: var(--space-5);
  padding-block: var(--bleed-pad) var(--space-10);
}

.wwd__eyebrow {
  grid-column: 1 / -1;
  color: var(--color-gray-500);
}

.wwd__title {
  grid-column: 1 / span 7;
  max-width: 16ch;
}

.wwd__intro {
  grid-column: 9 / span 4;
  color: var(--color-gray-300);
}

/* ---- Bento ---- */
.bento {
  --bento-row: clamp(300px, 24vw, 360px);

  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(var(--bento-row), auto));
  grid-template-areas:
    "s1 s1 s1-img s2"
    "s1 s1 s2-img s2"
    "s3 s3 s3-img s3-img";
  gap: 1px;
  background: var(--wwd-line);
  border-top: 1px solid var(--wwd-line);
}

.bento__tile {
  position: relative;
  overflow: hidden;
  background: var(--color-pitch-black);
}

/* Slots by position: 1 = large 2x2, 2 = tall 1x2, 3 = wide 2x1 */
.bento__pillar--1 { grid-area: s1; }
.bento__pillar--2 { grid-area: s2; }
.bento__pillar--3 { grid-area: s3; }
.bento__media--1  { grid-area: s1-img; }
.bento__media--2  { grid-area: s2-img; }
.bento__media--3  { grid-area: s3-img; }

/* ---- Pillar tiles ---- */
/* Each pillar carries the brand colour set on its Service (accent field).
   --pillar-on is the text colour used on top of that colour. */
.accent--red    { --pillar-color: var(--color-brand-red);    --pillar-on: var(--color-white); }
.accent--orange { --pillar-color: var(--color-brand-orange); --pillar-on: var(--color-black); }
.accent--blue   { --pillar-color: var(--color-brand-blue);   --pillar-on: var(--color-white); }

.bento__pillar {
  --mark-color: var(--pillar-color);

  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--space-8);
  padding: var(--space-8);
}

/* Colour bar along the top edge */
.bento__pillar::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--pillar-color);
  transform-origin: left;
  transition: transform 900ms var(--ease-out);
  transition-delay: calc(var(--i) * 140ms + 200ms);
}

.js .wwd:not(.is-inview) .bento__pillar::before {
  transform: scaleX(0);
}

.bento__pillar .bento__mark {
  transition-delay: calc(var(--i) * 140ms + 350ms);
}

.bento__pillar-head {
  position: relative;
  z-index: 1;
  max-width: 30ch;
}

/* Number chip in the pillar colour */
.bento__index {
  display: inline-block;
  padding: var(--space-1) var(--space-2);
  background: var(--pillar-color);
  color: var(--pillar-on);
  border-radius: var(--radius-sm);
  font-variant-numeric: tabular-nums;
}

.bento__name {
  margin-top: var(--space-4);
  font-family: var(--font-display);
  font-size: var(--fs-h2);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-h2);
  letter-spacing: -0.02em;
}

.bento__pillar--1 .bento__name {
  font-size: var(--fs-hero);
  line-height: var(--lh-hero);
  letter-spacing: -0.035em;
}

.bento__summary {
  margin-top: var(--space-4);
  color: var(--color-gray-300);
}

.bento__services {
  position: relative;
  z-index: 1;
  display: grid;
  border-top: 1px solid var(--wwd-line);
  transition: border-color var(--duration-base) ease;
}

.bento__services li {
  padding-block: var(--space-3);
  font-size: var(--fs-body);
  font-weight: var(--fw-semibold);
  border-bottom: 1px solid var(--wwd-line);
  transition:
    padding-left var(--duration-base) var(--ease-out),
    border-color var(--duration-base) ease;
}

.bento__pillar:hover .bento__services {
  border-top-color: var(--pillar-color);
}

.bento__services a {
  display: block;
  transition: color var(--duration-fast) ease;
}

.bento__services a:hover,
.bento__name a:hover {
  color: var(--pillar-color);
}

.bento__name a {
  transition: color var(--duration-fast) ease;
}

.bento__pillar:hover .bento__services li {
  padding-left: var(--space-2);
  border-bottom-color: var(--pillar-color);
}

.bento__pillar:hover .bento__services li:nth-child(2) { transition-delay: 40ms; }
.bento__pillar:hover .bento__services li:nth-child(3) { transition-delay: 80ms; }
.bento__pillar:hover .bento__services li:nth-child(4) { transition-delay: 120ms; }

/* Wide slot 3 tile: services in two columns */
.bento__pillar--3 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: end;
  column-gap: var(--space-8);
}

.bento__pillar--3 .bento__pillar-head {
  align-self: start;
}

/* ---- Image tiles ---- */
.bento__media {
  margin: 0;
}

/* Absolutely placed so the image never sizes the grid row */
.bento__media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 1200ms var(--ease-out);
}

.bento__media:hover img {
  transform: scale(1.04);
}

.bento__caption {
  position: absolute;
  z-index: 1;
  left: var(--space-5);
  bottom: var(--space-5);
  padding: var(--space-2) var(--space-3);
  background: var(--color-pitch-black);
  color: var(--color-white);
}

/* ---- Reveal on scroll ---- */
.js .wwd .bento__tile {
  transition:
    opacity 700ms var(--ease-out),
    transform 700ms var(--ease-out);
  transition-delay: calc(var(--i) * 140ms);
}

.js .wwd .bento__media {
  transition-delay: calc(var(--i) * 140ms + 70ms);
}

.js .wwd:not(.is-inview) .bento__tile {
  opacity: 0;
  transform: translateY(24px);
}

/* ---- Tablet ---- */
@media (max-width: 1024px) {
  .wwd__title,
  .wwd__intro {
    grid-column: 1 / -1;
  }

  .wwd__head {
    padding-bottom: var(--space-9);
  }

  .bento {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: none;
    grid-auto-rows: minmax(280px, auto);
    grid-template-areas:
      "s1     s1"
      "s1-img s2"
      "s2-img s2"
      "s3     s3"
      "s3-img s3-img";
  }

  .bento__pillar {
    padding: var(--space-7);
  }

  .bento__pillar--1 .bento__name {
    font-size: var(--fs-h1);
    line-height: var(--lh-h1);
  }

  .bento__media--3 {
    aspect-ratio: 2 / 1;
  }
}

/* ---- Mobile ---- */
@media (max-width: 640px) {
  .wwd__head {
    padding-bottom: var(--space-8);
  }

  .bento {
    grid-template-columns: minmax(0, 1fr);
    grid-auto-rows: auto;
    grid-template-areas:
      "s1"
      "s1-img"
      "s2"
      "s2-img"
      "s3"
      "s3-img";
  }

  .bento__pillar {
    padding: var(--space-6) var(--container-pad);
  }

  .bento__pillar--3 {
    grid-template-columns: minmax(0, 1fr);
    row-gap: var(--space-8);
  }

  .bento__media {
    aspect-ratio: 4 / 3;
  }

  .bento__media--3 {
    aspect-ratio: 4 / 3;
  }
}
