/* Customer reviews: the badge under a product title and the reviews section.
   Tokens only; stars are text, so there is nothing to load. */

.rating-badge {
  margin: 0 0 var(--space-sm);
  font-size: var(--text-sm);
  color: var(--ink-2);
}
.rating-badge a {
  color: inherit;
  text-decoration: none;
}
.rating-badge a:hover { text-decoration: underline; }
.rating-badge__star { color: var(--accent); }

.reviews {
  max-width: var(--measure);
  margin: var(--space-2xl) auto 0;
  padding: 0 var(--space-md);
}

.reviews__summary {
  display: grid;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}
.reviews__average {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-xs);
  margin: 0;
  color: var(--ink-2);
}
.reviews__average strong {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  color: var(--ink);
}
.reviews__stars,
.review__stars { color: var(--accent-deep); letter-spacing: 0.08em; }
/* How many of the counted reviews were given the review bonus (Task 27). */
.reviews__bonused {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--ink-2);
}

.reviews__bars {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-2xs);
  font-size: var(--text-sm);
}
.reviews__bars li {
  display: grid;
  grid-template-columns: 4.5rem 1fr 2rem;
  align-items: center;
  gap: var(--space-xs);
}
.reviews__bar {
  height: 0.5rem;
  background: var(--paper-2);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.reviews__bar-fill {
  display: block;
  height: 100%;
  background: var(--accent);
}
.reviews__bar-count { text-align: right; color: var(--ink-3); }

.reviews__list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.review {
  padding: var(--space-md) 0;
  border-top: 1px solid var(--line);
}
.review__stars { margin: 0 0 var(--space-2xs); }
.review .review__title { margin: 0 0 var(--space-2xs); }
.review__body {
  margin: 0 0 var(--space-xs);
  /* Customer line breaks are kept; the text is still escaped text. */
  white-space: pre-line;
  overflow-wrap: anywhere;
}
.review__meta {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--ink-3);
}
.review__verified { color: var(--ink-2); }
/* The review bonus's disclosure, under the stars and before the words: never fainter than the meta line. */
.review__bonus {
  margin: 0 0 var(--space-xs);
  font-size: var(--text-sm);
  color: var(--ink-2);
}
.review__reply {
  margin-top: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--paper-2);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
}
.review__reply p { margin: 0; white-space: pre-line; overflow-wrap: anywhere; }
.review__reply .review__reply-label {
  margin-bottom: var(--space-2xs);
  font-weight: 600;
  color: var(--ink-2);
}

/* A review's published photos, under its words (photo reviews, Task 9):
   up to three square thumbnails, each a link to the photo. Cropped here,
   never in the file. Three in a row need 256px, which a 360px phone has
   inside the page's and the section's padding (about 280px; 265px with a
   desktop scrollbar); a narrower screen wraps them, never scrolls. The box
   is fixed, so nothing moves when a lazy one arrives, and it is well over
   44px to tap. ReviewPhotos.astro's `sizes` is this width. */
.review-photos {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin: 0 0 var(--space-xs);
  padding: 0;
}
.review-photos__link {
  display: block;
  width: 5rem;
  height: 5rem;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--paper-2);
}
.review-photos__link img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* The strip of customer photos above the review list (Task 10): its
   thumbnails are the `.review-photos` ones, so only the heading is new. */
.customer-photos { margin: 0 0 var(--space-lg); }
.customer-photos__heading {
  margin: 0 0 var(--space-xs);
  font-size: var(--text-md);
}

/* The lightbox: one native dialog, never wider than the screen. The photo
   fits inside it at its own shape (never enlarged past its stored size),
   with the close bar, caption and buttons kept on screen beneath. */
.lightbox {
  box-sizing: border-box;
  /* 100% of the viewport less any scrollbar, which 100vw would sit under. */
  width: min(100%, 64rem);
  max-width: 100vw;
  max-height: 100vh;
  max-height: 100dvh;
  margin: auto;
  padding: var(--space-xs);
  border: 0;
  border-radius: var(--radius-md);
  background: var(--paper-3);
  color: var(--ink);
  overflow-x: hidden;
  overflow-y: auto;
}
.lightbox::backdrop { background: rgba(26, 23, 21, 0.85); }
.lightbox__bar {
  display: flex;
  justify-content: flex-end;
}
.lightbox__img {
  display: block;
  max-width: 100%;
  height: auto;
  max-height: calc(100vh - 10rem);
  max-height: calc(100dvh - 10rem);
  margin: var(--space-xs) auto;
  object-fit: contain;
  /* The stage while the photo loads, as behind a thumbnail. */
  background: var(--paper-2);
}
.lightbox__caption {
  margin: 0 0 var(--space-xs);
  text-align: center;
  font-size: var(--text-sm);
  color: var(--ink-2);
}
.lightbox__nav {
  display: flex;
  justify-content: space-between;
  gap: var(--space-xs);
}
.lightbox__button {
  min-height: 44px;
  min-width: 44px;
}
/* `.btn` sets a display, which would otherwise outrank `hidden`. */
.lightbox__button[hidden] { display: none; }

.reviews__pages {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  padding-top: var(--space-md);
  border-top: 1px solid var(--line);
  font-size: var(--text-sm);
}
