/* reviews.css — ReviewBadge (the hero's live Google figures) + ReviewSection
 * (a grid of Hub reviews) + the /reviews/ page (approved change 4, on Cherry
 * Town's assumptions). Live had no review widget: every rule here styles a
 * NEW surface, on this kit's tokens (tokens.css: Poppins headings, Raleway
 * body, the red accent, the charcoal). Real content, so the section and the
 * badge carry data-gate-mask — the set and the count change on every rebuild.
 *
 * Phase 1: linked AFTER live's stylesheet stack (Base.astro), so a rule that
 * meets an Elementor rule of the same specificity wins by order.
 */

/* ReviewBadge — STYLE CONTRACT (CLAUDE.md): this block is the only place
 * the badge is styled; colours/fonts are kit tokens plus --shadow-soft;
 * exactly two sizes (desktop, < 768px); a change here = re-freeze every
 * page that carries one (rebaseline.mjs --all). */

/* The `rating` variant: the hero's "4.9" image on home and the office pages
 * (Google-Rating-AOE.webp, drawn 200 x 70.3125 at every width — the browser
 * takes the 1024x360 srcset candidate's ratio — inline-block, centred in its
 * widget) becomes this. Same box, same place, white on the hero photo: the
 * Google G at the left, five stars, "N.N Rating" and the count at the right.
 * Element-qualified at (0,1,1) and linked after the stack: it has to beat
 * both Elementor's `.elementor-widget-image a` (inline-block) and the pill's
 * own `.review-badge` box below, at every width. inline-flex, vertical-align
 * top: an inline box like the image, so the widget's height is the box's. */
a.review-badge--rating {
  display: inline-flex;
  vertical-align: top;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  box-sizing: border-box;
  width: 200px;
  max-width: 200px;
  height: 70.3125px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  color: var(--color-secondary);
  text-decoration: none;
  font-family: var(--font-body);
  line-height: 1;
}
/* Colour at (0,2,1): this badge is a `.review-badge` too, and the pill's own
 * colour rule below (`a.review-badge`, (0,1,1), written to beat the kit's red
 * links) comes later in this file and painted the figures BLACK on the hero
 * photo (found in the before/after crops, 2026-10-13). White, as the image
 * live had, on hover and focus as well. */
a.review-badge.review-badge--rating,
a.review-badge.review-badge--rating:hover,
a.review-badge.review-badge--rating:focus { color: var(--color-secondary); }
a.review-badge--rating .review-badge__logo { width: 56px; height: 56px; flex: none; fill: var(--color-secondary); }
a.review-badge--rating .review-badge__figures { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
a.review-badge--rating .review-badge__stars { display: flex; gap: 1px; }
a.review-badge--rating .review-badge__star { width: 20px; height: 20px; fill: var(--color-secondary); }
a.review-badge--rating .review-badge__caption { font-family: var(--font-heading); font-size: 17px; font-weight: 400; white-space: nowrap; }
/* the figure in the caption's own size and weight, as the image had it (the
 * pill's `.review-badge__rating` is bold and larger) */
a.review-badge--rating .review-badge__rating { font-size: inherit; font-weight: inherit; }
a.review-badge--rating .review-badge__count { font-size: 12px; font-weight: 500; white-space: nowrap; }
@media (max-width: 767px) {
  /* the same box on a phone: the pill's phone rules below must not reach it */
  a.review-badge--rating { width: 200px; max-width: 200px; height: 70.3125px; justify-content: flex-start; gap: 10px; padding: 0; }
  a.review-badge--rating .review-badge__star { width: 20px; height: 20px; }
}

/* The pill: above the hero's button on the other pages. It is a widget in an
 * Elementor flex container (the slot wrapper carries `elementor-widget`, so
 * the kit's 20px inter-widget gap applies); the anchor is inline so it
 * follows the button's alignment: the container's text-align, or the
 * button widget's own `elementor-align-*` class (`:has()`, Chrome 105+ /
 * Safari 15.4+ / Firefox 121+; an older browser left-aligns the pill). */
.review-badge-slot { line-height: 0; }
.review-badge-slot:has(+ .elementor-align-center) { text-align: center; }
.review-badge-slot:has(+ .elementor-align-right) { text-align: right; }
.review-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-sizing: border-box;
  height: 64px;
  padding: 0 22px 0 14px;
  border: 1px solid var(--color-surface);
  border-radius: 999px;
  background: var(--color-secondary);
  color: var(--color-text);
  text-decoration: none;
  font-family: var(--font-body);
  line-height: 1;
  box-shadow: var(--shadow-soft);
}
/* Colour only, element-qualified to (0,1,1): `.elementor-kit-6 a` is (0,1,1)
 * and paints every link red; the pill's text is the kit's black and stays
 * black on hover, the kit's link colour notwithstanding. */
a.review-badge, a.review-badge:hover, a.review-badge:focus { color: var(--color-text); }
.review-badge__avatars { display: inline-flex; margin-right: 4px; }
.review-badge__avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin-left: -10px;
  border: 2px solid var(--color-secondary);
  border-radius: 50%;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  color: var(--color-secondary);
}
.review-badge__avatar:first-child { margin-left: 0; }
.review-badge__avatar--0 { background: var(--color-red); }
.review-badge__avatar--1 { background: var(--color-sky); }
.review-badge__avatar--2 { background: var(--color-lime); }
.review-badge__avatar--3 { background: var(--color-red); }
.review-badge .review-badge__star { width: 22px; height: 22px; flex: none; fill: var(--color-red); }
.review-badge .review-badge__rating { font-size: 20px; font-weight: 700; }
.review-badge__source { font-size: 16px; font-weight: 500; }
.review-badge__divider { width: 1px; height: 24px; margin: 0 4px; background: var(--color-surface); }
.review-badge .review-badge__count { font-size: 16px; white-space: nowrap; }
@media (max-width: 767px) {
  .review-badge { width: 100%; max-width: 350px; height: 56px; justify-content: center; gap: 6px; padding: 0 14px 0 10px; }
  .review-badge__avatar { width: 30px; height: 30px; margin-left: -8px; font-size: 12px; }
  .review-badge .review-badge__star { width: 18px; height: 18px; }
  .review-badge .review-badge__rating { font-size: 18px; }
  .review-badge__source, .review-badge .review-badge__count { font-size: 14px; }
  .review-badge__divider { height: 20px; }
}

/* ReviewSection — closes the page's own content, before the "Latest
 * Electrical Tips" block, whose rhythm it follows: 100px of padding and the
 * kit's Primary heading (Poppins 700, 45px / 36px on a phone, capitalized,
 * black, centred). White cards with a hairline border on the white page;
 * four cards fill one row inside the 1140px container (minmax 250px), two
 * at tablet, one on a phone. Fixed-height text (6-line clamp + min-height)
 * so a row of four reads level. */
.reviews {
  padding: 100px 20px;
  font-family: var(--font-body);
  background: var(--color-secondary);
}
.reviews__inner {
  max-width: min(100%, var(--container-max));
  margin: 0 auto;
}
.reviews__heading {
  margin: 0 0 40px;
  font-family: var(--font-display);
  font-size: var(--font-size-primary);
  font-weight: 700;
  line-height: 1.2em;
  text-transform: capitalize;
  text-align: center;
  color: var(--color-text);
}
.reviews__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.reviews__card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--color-secondary);
  border: 1px solid var(--color-surface);
  border-radius: var(--button-radius);
  padding: 24px;
}
.reviews__stars { display: flex; gap: 2px; }
.reviews__star { width: 18px; height: 18px; fill: var(--color-surface); }
.reviews__star.is-on { fill: var(--color-red); }
.reviews__text {
  margin: 0;
  font-size: 16px;
  line-height: 1.5;
  color: var(--color-text);
  display: -webkit-box;
  -webkit-line-clamp: 6;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 9em;
}
.reviews__meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
}
.reviews__meta strong { font-size: 16px; font-weight: 700; }
.reviews__meta span { font-size: 14px; color: var(--color-text); }
/* THE SECTION'S HEIGHT MUST NOT DEPEND ON WHICH REVIEWS WERE PICKED. Its
 * content changes with every Hub refresh (data-gate-mask blanks it for the
 * pixel gate), but the "Latest Electrical Tips" block and the footer stand
 * below it: a section one line taller moves them and fails the page's gate on
 * a rebuild that changed nothing else. The text is a fixed six lines
 * (min-height above). The line under the name is one line in every layout but
 * one: four cards in four columns (a 1100px viewport and wider, cards 250 to
 * 270px), where "Campbell · Google · September 2026" takes two lines and
 * "Campbell · Google · May 2025" one — 19 of 231 such pages were 19.2px
 * shorter than the rest (scripts/qa-review-heights.mjs, 2026-10-13). There
 * the line is always two lines high (19.2px each: the paragraph's 1.2em of
 * 16px), and never three. `:first-child:nth-last-child(4)` is "a grid of
 * exactly four cards". */
@media (min-width: 1100px) {
  .reviews__card:first-child:nth-last-child(4) .reviews__meta span,
  .reviews__card:first-child:nth-last-child(4) ~ .reviews__card .reviews__meta span {
    min-height: 38.4px;
    max-height: 38.4px;
    overflow: hidden;
  }
}
.reviews__source {
  align-self: flex-start;
  font-size: 14px;
  font-weight: 700;
  color: var(--color-red);
  text-decoration: none;
}
.reviews__source:hover { text-decoration: underline; }
/* Colour at (0,2,0): `.elementor-kit-6 a` is (0,1,1) and already says red;
 * this makes the link's colour the section's own, so it cannot move when
 * the kit rule does (the rebase). */
.reviews__card .reviews__source,
.reviews__card .reviews__source:hover { color: var(--color-red); }
.reviews__more {
  margin: 30px 0 0;
  text-align: center;
}
.reviews__more a {
  color: var(--color-red);
  font-weight: 700;
  text-decoration: none;
}
.reviews__more a:hover { text-decoration: underline; }
@media (max-width: 767px) {
  .reviews { padding: 60px 20px; }
  .reviews__heading { font-size: 36px; }
}

/* THIS SITE: ReviewCard — the one Hub review in place of Elementor's
 * one-review carousel on the town pages. It sits inside the page's own
 * column, where the widget stood: no section padding, no background of its
 * own; the card is .reviews__card's. */
.reviews--card { padding: 0; background: none; }

/* reviews-page — /reviews/, the full 5-star corpus (spec §4.4). No frozen
 * baseline (authored post-conversion): the kit's Primary heading, body
 * Raleway 16/1.5, cards share .reviews__card's border and radius, one
 * narrow column (800px) like a post; two columns from 1025px. */
.reviews-page {
  padding: 60px 20px;
  font-family: var(--font-body);
}
.reviews-page__inner {
  max-width: min(100%, 800px);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.reviews-page__heading {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--font-size-primary);
  font-weight: 700;
  line-height: 1.2em;
  text-transform: capitalize;
  text-align: center;
  color: var(--color-text);
}
.reviews-page__locations {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 24px;
  margin: 0;
  padding: 0;
  list-style: none;
  text-align: center;
}
.reviews-page__locations li {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.5;
  color: var(--color-text);
}
.reviews-page__list {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.reviews-page__item {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--color-secondary);
  border: 1px solid var(--color-surface);
  border-radius: var(--button-radius);
  padding: 24px;
}
.reviews-page__stars {
  margin: 0;
  color: var(--color-red);
  font-size: 18px;
  letter-spacing: 2px;
}
.reviews-page__text {
  margin: 0;
  font-size: 16px;
  line-height: 1.5;
  color: var(--color-text);
}
.reviews-page__meta {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--color-text);
}
.reviews-page__meta strong { font-weight: 700; }
.reviews-page__meta a {
  color: var(--color-red);
  font-weight: 700;
  text-decoration: none;
}
.reviews-page__meta a:hover { text-decoration: underline; }
.reviews-page__reply {
  margin: 0;
  padding: 4px 0 4px 16px;
  border-left: 3px solid var(--color-surface);
  font-size: 14px;
  line-height: 1.5;
  color: var(--color-text);
}
@media (max-width: 767px) {
  .reviews-page__heading { font-size: 36px; }
}
/* Desktop: two columns. Grid (not CSS columns) so the newest-first order
 * reads left-to-right, row by row; cards keep their own height. */
@media (min-width: 1025px) {
  .reviews-page__inner { max-width: min(100%, var(--container-max)); }
  .reviews-page__list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
}
