/* 25 November 2026 (Luke): the reviews show one card at a time, with the next card half showing and fading
   out to the right, and the team photo is shown whole. Before this, two cards showed at once, the first sat
   over the right-hand edge of the photo (150px at 1440px wide, and over its bottom on phones), and the photo
   was cropped at both sides, cutting people off. The carousel script is unchanged: it moves one card at a
   time, whatever the card width. */

/* The team photo at its own shape (1200x504), so nobody is cut off. */
main section.reviews-section .rv-photo img {
  height: auto;
  aspect-ratio: 1200 / 504;
  object-fit: cover;
}

/* One card, the 28px gap and half of the next card fill the row. */
main section.reviews-section .rv-card {
  flex-basis: calc((100cqw - 28px) / 1.5);
}

/* The half card fades out towards the right. The fade starts where the half card starts: 16px of side
   padding, then a third of the row after the gap. */
main section.reviews-section .rv-scroller {
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 16px - (100% - 60px) / 3), rgba(0, 0, 0, 0) 100%);
  mask-image: linear-gradient(90deg, #000 calc(100% - 16px - (100% - 60px) / 3), rgba(0, 0, 0, 0) 100%);
}

/* Wide screens (1280px and up): the photo on the left at half the content width, the cards to its right
   with a 48px gap, and the progress bars and arrows in one row under the cards. Below 1280px the cards
   would be too narrow beside the whole photo, so it sits above them instead. */
@media (min-width: 1280px) {
  main section.reviews-section {
    --rv-photo-w: calc((100cqw - 2 * var(--rv-gutter)) * 0.5);
    --rv-gap-x: 48px;
  }

  main section.reviews-section .rv-stage {
    grid-template-columns: calc(var(--rv-gutter) + var(--rv-photo-w)) minmax(0, 1fr);
    grid-template-rows: auto auto;
    align-items: center;
  }

  /* Luke, 25 November 2026: the photo is as tall as the review cards. The figure stretches to the cards'
     row; its margins match the row's 8px top and 36px bottom padding, so its edges line up with the cards. */
  main section.reviews-section .rv-photo {
    position: relative;
    grid-column: 1;
    grid-row: 1;
    align-self: stretch;
    margin: 8px 0 36px var(--rv-gutter);
  }

  /* From 1280px the picture element serves the full 3:2 frame of the original photo (everyone head to toe,
     with curtain above and floor below), so filling the taller box trims only curtain and floor: about 11%
     of the height at 1440px, mostly from the top. Nobody at either end is cut off. */
  main section.reviews-section .rv-photo img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    aspect-ratio: auto;
    object-fit: cover;
    object-position: 50% 76%;
  }

  main section.reviews-section .rv-scroller {
    grid-column: 2;
    grid-row: 1;
    margin-left: calc(var(--rv-gap-x) - 16px);
  }

  main section.reviews-section .rv-progress {
    grid-column: 2;
    grid-row: 2;
    justify-self: start;
    margin: -8px 0 0 var(--rv-gap-x);
  }

  main section.reviews-section .rv-controls {
    grid-column: 2;
    grid-row: 2;
    justify-self: end;
    margin: -8px var(--rv-gutter) 0 0;
  }
}

/* Narrower screens: the photo across the content width, the cards underneath it (no longer overlapping
   it), then the progress bars on the left and the arrows on the right. */
@media (max-width: 1279px) {
  main section.reviews-section .rv-stage {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto auto;
    align-items: center;
  }

  main section.reviews-section .rv-photo {
    grid-column: 1 / -1;
    grid-row: 1;
    margin: 0 var(--rv-gutter);
  }

  main section.reviews-section .rv-scroller {
    grid-column: 1 / -1;
    grid-row: 2;
    margin: 24px calc(var(--rv-gutter) - 16px) 0;
  }

  main section.reviews-section .rv-progress {
    grid-column: 1;
    grid-row: 3;
    justify-self: start;
    margin: -8px 0 0 var(--rv-gutter);
  }

  main section.reviews-section .rv-controls {
    display: flex;
    grid-column: 2;
    grid-row: 3;
    margin: -8px var(--rv-gutter) 0 0;
  }
}

/* Phones: the next card shows by a quarter of a card, so the one being read stays wide enough. The gap
   is 12px, and the fade starts where that card starts. */
@media (max-width: 768px) {
  main section.reviews-section .rv-scroller {
    margin-top: 16px;
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 16px - (100% - 44px) / 5), rgba(0, 0, 0, 0) 100%);
    mask-image: linear-gradient(90deg, #000 calc(100% - 16px - (100% - 44px) / 5), rgba(0, 0, 0, 0) 100%);
  }

  main section.reviews-section .rv-track {
    gap: 12px;
  }

  /* The phone progress bars are flexible, so their row keeps its full width (as before this change). */
  main section.reviews-section .rv-progress {
    justify-self: stretch;
    margin: -8px 12px 0 16px;
  }

  main section.reviews-section .rv-card {
    flex-basis: calc((100cqw - 12px) / 1.25);
  }
}

/* Small phones (up to 374px): the next card shows by 15%, so the longest reviewer name (176px) still fits on
   one line beside the avatar. Below 340px the names are 11px. */
@media (max-width: 374px) {
  main section.reviews-section .rv-scroller {
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 16px - (100% - 44px) * 3 / 23), rgba(0, 0, 0, 0) 100%);
    mask-image: linear-gradient(90deg, #000 calc(100% - 16px - (100% - 44px) * 3 / 23), rgba(0, 0, 0, 0) 100%);
  }

  main section.reviews-section .rv-card {
    flex-basis: calc((100cqw - 12px) / 1.15);
  }
}

@media (max-width: 339px) {
  main section.reviews-section .rv-name {
    font-size: 11px;
  }
}
