/* Google review carousel.
   Markup is rendered into dist/ at build time by scripts/render-reviews.py
   from reviews.json; movement is reviews.js. Loaded after styles.css and
   svc-cards.css, which keep the card look (.rv-card and its children are
   shared with the project review card on the home page). This file owns the
   band layout: centred heading, rule, count line, and the rows.

   Layout contract with reviews.js:
   - The markup is two .rv-row elements inside one .rv-track, each review
     once. From 600px up the track is a flex line, so the two rows read as a
     single row of cards; below 600px the track is a block and the rows stack.
   - Without JS, or under prefers-reduced-motion, the rows are ordinary
     horizontal scroll containers (the viewport above 600px, each row below),
     so every card stays reachable.
   - With JS, .is-auto on .rv-carousel turns the scroll containers into
     clipped viewports and the lanes move on transform only. Widths do not
     change between the two states, so switching causes no layout shift.
   - Card width is a share of the viewport via container query units, so the
     count of visible cards is a CSS fact, not a measurement: 4, 3, then 2. */

.reviews { padding: clamp(72px, 8vw, 116px) 0; }

.rv-head {
  position: relative;
  z-index: 1;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--gutter);
  text-align: center;
  transform: none;
}
.rv-head h2 {
  margin: 0 auto;
  max-width: none;
  padding: 0;
  font-size: clamp(34px, 4.2vw, 50px);
  line-height: 1.1;
  color: var(--on-dark);
}
.rv-rule {
  display: block;
  width: 72px;
  height: 3px;
  margin: 18px auto 0;
  background: var(--accent);
}
.rv-count {
  display: inline-block;
  margin-top: 16px;
  color: var(--on-dark);
  font-size: 17px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-color: rgba(255, 255, 255, .55);
}
.rv-count:hover,
.rv-count:focus-visible {
  color: var(--on-dark);
  text-decoration-color: var(--accent);
}

.rv-carousel {
  --rv-gap: 18px;
  --rv-lines: 6;
  --rv-lh: 1.5;
  position: relative;
  z-index: 1;
  max-width: var(--maxw);
  margin: clamp(32px, 4vw, 48px) auto 0;
  padding: 0 var(--gutter);
  isolation: isolate;
}
.rv-viewport {
  container-type: inline-size;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 6px 0;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.rv-viewport::-webkit-scrollbar { display: none; }
.rv-track {
  display: flex;
  gap: var(--rv-gap);
  width: max-content;
}
.rv-row {
  position: relative;
  display: flex;
  flex: none;
  gap: var(--rv-gap);
  width: max-content;
}

/* Cards. Width is the viewport width less the gaps, divided by the visible
   count. Height is fixed by clamping the quote to a set number of lines, so
   every card in every row stands the same height. */
.rv-card {
  flex: none;
  width: calc((100cqw - 3 * var(--rv-gap)) / 4);
  min-width: 0;
  height: auto;
  margin: 0;
  padding: 22px 22px 18px;
  transition: border-color .2s ease, transform .2s ease;
}
.rv-card:hover { transform: translateY(-2px); }
.rv-card-link { min-width: 0; }
.rv-top { gap: 8px; }
.rv-quote {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: var(--rv-lines);
  overflow: hidden;
  height: calc(var(--rv-lines) * var(--rv-lh) * 1em);
  margin: 14px 0 12px;
  font-size: 15px;
  line-height: var(--rv-lh);
}
.rv-foot { padding-top: 12px; }
.rv-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* JS drift. The viewport clips, the edges fade, the lanes move on transform. */
.rv-carousel.is-auto .rv-viewport {
  overflow: hidden;
  touch-action: pan-y;
  mask-image: linear-gradient(90deg, transparent 0, #000 5%, #000 95%, transparent 100%);
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 5%, #000 95%, transparent 100%);
}
.rv-carousel.is-auto .rv-track,
.rv-carousel.is-auto .rv-row { will-change: transform; }

@media (max-width: 899.98px) {
  .rv-card { width: calc((100cqw - 2 * var(--rv-gap)) / 3); }
  .rv-card { padding: 18px 17px 15px; }
  .rv-quote { font-size: 14px; }
}

/* Two stacked rows, two cards each. Each row is its own scroll container
   without JS and its own lane with it. */
@media (max-width: 599.98px) {
  .rv-carousel { --rv-gap: 12px; --rv-lines: 7; }
  .rv-viewport { overflow: visible; padding: 0; }
  .rv-track { display: block; width: auto; }
  .rv-row {
    width: auto;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 6px 0;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .rv-row::-webkit-scrollbar { display: none; }
  .rv-row + .rv-row { margin-top: 0; }
  .rv-card {
    width: calc((100cqw - var(--rv-gap)) / 2);
    padding: 14px 13px 12px;
  }
  .rv-quote { margin: 10px 0 9px; font-size: 13px; }
  .rv-stars { font-size: 13px; letter-spacing: 1px; }
  .rv-chip { padding: 3px 6px; font-size: 10px; }
  .rv-foot { padding-top: 9px; }
  .rv-name { font-size: 13px; }
  .rv-src { font-size: 11px; }

  .rv-carousel.is-auto .rv-viewport { overflow: hidden; }
  .rv-carousel.is-auto .rv-row { width: max-content; overflow: visible; }
}

@media (prefers-reduced-motion: reduce) {
  .rv-card { transition: none; }
  .rv-card:hover { transform: none; }
}
