/**
 * @file reviews.css
 * @brief The Google reviews section (index.php and
 *        debt-consolidation/index.php; cards and paging by js/reviews.js),
 *        ported from the Find a Loan site's review UI (review-ui/reviews.css)
 *        in this site's palette: #45050e headings and names, #003337 text,
 *        #5e9a9e buttons and avatars, #5b7a7c muted, #fff9f8 cream
 *        cards edged in #f2ded6 blush. The stars stay Google gold.
 *        Desktop: the heading on one line, then one row
 *        of three cards with the arrows above them. Tablets: two cards a
 *        row. Phones (640px and below, sized in the site's --u unit): the
 *        heading wraps and the cards are a sideways snap-scroll.
 */
.reviews {
  background: #ffffff;
}
.reviews-in {
  max-width: 1248px; /* a 1200px content box, lined up with the header */
  margin: 0 auto;
  padding: 96px 24px 104px;
  box-sizing: border-box;
}
.reviews-head {
  margin-bottom: 40px;
  text-align: center;
}
/* One line above phones: 48px where it fits, shrinking with the screen
   below that (the heading is about 22.5 times its font size wide). */
.reviews-head h2 {
  margin: 0;
  font-size: min(48px, calc((100vw - 48px) / 22.5));
  white-space: nowrap;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: #45050e;
}
.stars {
  display: inline-flex;
  gap: 2px;
  white-space: nowrap;
}
.stars svg {
  width: 17px;
  height: 17px;
  fill: #fbbc04;
}
/* The prev / next buttons over the row's right end (reviews.js hides the
   pair when one row holds every card). */
.review-nav {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-bottom: 16px;
}
.review-nav-btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1.5px solid #5e9a9e;
  border-radius: 50%;
  background: #ffffff;
  color: #003337;
  cursor: pointer;
  transition:
    background 0.15s ease,
    opacity 0.15s ease;
}
.review-nav-btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.review-nav-btn:hover:not(:disabled) {
  background: #fff9f8;
}
.review-nav-btn:disabled {
  opacity: 0.35;
  cursor: default;
}
.review-nav-btn:focus-visible {
  outline: 2px solid #003337;
  outline-offset: 2px;
}
/* One row of cards, every card the row's height. reviews.js sets data-drag
   while a finger drags the row and data-slide while it pages (out: the old
   row drifts away and fades; in: the new row parked offset, no transition,
   before easing home). --slide-dir is the offset's sign. */
.review-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  align-items: stretch;
  touch-action: pan-y; /* sideways touches are the swipe, vertical ones scroll */
  transition:
    transform 0.22s ease,
    opacity 0.22s ease;
}
.review-grid[data-drag] {
  transition: none;
  user-select: none;
  -webkit-user-select: none;
}
.review-grid[data-slide] {
  opacity: 0;
  transform: translateX(calc(var(--slide-dir, 1) * 48px));
}
.review-grid[data-slide="in"] {
  transition: none;
}
/* A card's markup runs stars, text, toggle, reviewer row (the phone order);
   desktop lifts the reviewer row to the top-left beside the stars and
   hides the avatar. */
.review-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "who stars"
    "text text"
    "more more";
  grid-template-rows: auto 1fr auto;
  align-items: start;
  gap: 20px 16px;
  padding: 32px;
  border: 1px solid #f2ded6;
  border-radius: 20px;
  background: #fff9f8;
}
.review-card > .stars {
  grid-area: stars;
}
.review-card > .review-text {
  grid-area: text;
}
.review-card > .review-more {
  grid-area: more;
}
.review-who {
  grid-area: who;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.review-avatar {
  display: none;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #5e9a9e;
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
  line-height: 32px;
  text-align: center;
}
.review-meta {
  margin: 0;
  min-width: 0;
}
.review-meta strong {
  display: block;
  font-size: 17px;
  font-weight: 700;
  color: #45050e;
}
.review-meta span {
  font-size: 13px;
  color: #5b7a7c;
}
/* Five lines of text (pre-line keeps a review's own paragraph breaks);
   reviews.js lifts the clamp on "Read more", and while a card in the row
   is open sets --review-lines on the grid so the row's other cards show
   that many lines too. */
.review-text {
  margin: 0;
  font-size: 16px;
  line-height: 1.6;
  color: #003337;
  white-space: pre-line;
  text-wrap: pretty;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: var(--review-lines, 5);
  line-clamp: var(--review-lines, 5);
  overflow: hidden;
}
.review-card[data-expanded] .review-text {
  display: block;
  -webkit-line-clamp: unset;
  line-clamp: unset;
  overflow: visible;
}
.review-more {
  justify-self: start;
  align-self: start;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  color: #5e9a9e;
  cursor: pointer;
}
.review-more:hover {
  color: #45050e;
}
.review-more:focus-visible {
  outline: 2px solid #003337;
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---- Tablets: two cards a row ---- */
@media (max-width: 980px) {
  .review-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 900px) {
  .reviews-in {
    padding: 72px 24px 80px;
  }
}

/* ---- Phones: the heading wraps (at the site's phone h2 size), then the
   cards as a sideways scroll that snaps card by card ---- */
@media (max-width: 640px) {
  .reviews-in {
    padding: calc(64 * var(--u)) calc(24 * var(--u)) calc(56 * var(--u));
  }
  .reviews-head {
    margin-bottom: calc(22 * var(--u));
  }
  .reviews-head h2 {
    white-space: normal;
  }
  /* The arrows go; the row scrolls sideways under the finger (reviews.js
     reads --review-mode and shows every card), bleeding to the screen
     edge. Each card snaps to the centre with its neighbours peeking in;
     the side padding is half the width the card leaves over, so the first
     and last cards reach the centre too. */
  .review-nav {
    display: none;
  }
  .review-grid {
    --review-mode: scroll;
    --review-card-w: min(calc(290 * var(--u)), 82vw);
    display: flex;
    gap: calc(12 * var(--u));
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    margin: -4px calc(-24 * var(--u)) -20px;
    padding: 4px calc((100vw - var(--review-card-w)) / 2) 20px;
    touch-action: pan-x pan-y;
    scrollbar-width: none;
    transition: none;
  }
  .review-grid::-webkit-scrollbar {
    display: none;
  }
  /* A card: stars, text, toggle, then a divider over the avatar beside the
     name and how long ago. */
  .review-card {
    display: flex;
    flex: 0 0 var(--review-card-w);
    flex-direction: column;
    gap: calc(12 * var(--u));
    padding: calc(18 * var(--u));
    border-radius: 14px;
    scroll-snap-align: center;
    scroll-snap-stop: always;
  }
  .review-text {
    font-size: calc(15 * var(--u));
    line-height: 1.55;
  }
  .review-card > .review-more {
    align-self: flex-start;
  }
  .review-who {
    align-self: stretch;
    margin-top: auto;
    padding-top: calc(12 * var(--u));
    border-top: 1px solid #f2ded6;
  }
  .review-avatar {
    display: block;
  }
  .review-meta strong {
    font-size: calc(14 * var(--u));
  }
  .review-meta span {
    font-size: calc(12 * var(--u));
  }
}

@media (prefers-reduced-motion: reduce) {
  .review-grid {
    transition: none;
  }
}
