/* ===========================================================================
   REVIEWS + RATINGS
   Stars use the single brand accent, not a second amber hue — this system
   allows exactly one accent, and introducing gold here would break every
   other chapter's restraint.
   =========================================================================== */

/* ---- star row -------------------------------------------------------------
   Two identical layers; the fill is absolutely positioned and width-clipped,
   so fractional ratings are exact and no clip-path IDs can collide. */
.stars { position: relative; display: inline-flex; flex-shrink: 0; line-height: 0; }
.stars__track, .stars__fill { display: inline-flex; gap: 0.0625rem; }
.stars__track { color: color-mix(in oklab, var(--foreground) 16%, transparent); }
.stars__fill {
  position: absolute; inset: 0 auto 0 0; overflow: hidden;
  color: var(--brand); white-space: nowrap;
}
.stars__i { width: 1rem; height: 1rem; flex-shrink: 0; }
.stars--xs .stars__i { width: 0.75rem; height: 0.75rem; }
.stars--sm .stars__i { width: 0.875rem; height: 0.875rem; }
.stars--lg .stars__i { width: 1.375rem; height: 1.375rem; }

/* ---- buy-box rating line --------------------------------------------------- */
.ratingline {
  display: inline-flex; align-items: center; gap: 0.5rem;
  text-decoration: none; width: fit-content;
  transition: opacity 150ms var(--ease-out-quart);
}
.ratingline:hover { opacity: 0.72; }
.ratingline__avg {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.8125rem; font-weight: 600; font-variant-numeric: tabular-nums;
  color: var(--foreground);
}
.ratingline__count {
  font-size: 0.8125rem; color: var(--ink-3);
  text-decoration: underline; text-underline-offset: 2px;
  text-decoration-color: color-mix(in oklab, var(--ink-3) 35%, transparent);
}

/* ---- card rating (PLP / related) ------------------------------------------- */
.ratingmini { display: inline-flex; align-items: center; gap: 0.375rem; }
.ratingmini__n {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.6875rem; font-weight: 600; font-variant-numeric: tabular-nums;
  color: var(--ink-2);
}
.ratingmini__n span { color: var(--ink-4); font-weight: 400; }

/* ---- the chapter ----------------------------------------------------------- */
.pdp-chapter--reviews {
  border-top: 1px solid var(--border);
  background: color-mix(in oklab, var(--surface-2) 42%, var(--background));
}
.reviews__head { max-width: 44rem; margin: 0 auto 2.5rem; text-align: center; }

/* Summary band: oversized score against a distribution ladder. Centred and
   width-capped like the comparison block, so the full-bleed ragged card flow
   below it reads as a deliberate change of rhythm rather than a misalignment. */
.reviews__summary {
  /* Full width, matching the grid beneath it. It was capped at 52rem and
     centred, so it floated as a narrow island above a much wider wall of
     cards — two different measures stacked on each other. */
  display: grid; gap: 1.75rem;
  margin: 0 0 1.25rem;
  padding: 1.75rem;
  border: 1px solid var(--border); border-radius: var(--radius-xl);
  background: var(--card); box-shadow: var(--elevation-whisper);
}
@media (min-width: 860px) {
  .reviews__summary {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center; gap: 3rem; padding: 2rem 2.25rem;
  }
}
/* trigger + panel, below the band and aligned to its edges */
.reviews__act { margin: 0 0 2rem; }
.reviews__score { display: flex; flex-direction: column; gap: 0.5rem; align-items: flex-start; }
.reviews__avg {
  display: flex; align-items: baseline; gap: 0.125rem; margin: 0;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 3rem; line-height: 1; font-weight: 600;
  font-variant-numeric: tabular-nums; letter-spacing: -0.03em; color: var(--foreground);
}
.reviews__of { font-size: 1.125rem; font-weight: 400; color: var(--ink-4); }
.reviews__count {
  margin: 0; font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.6875rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3);
}

/* distribution ladder */
.reviews__dist { display: flex; flex-direction: column; gap: 0.4375rem; min-width: 0; }
.distrow { display: grid; grid-template-columns: 2.25rem minmax(0, 1fr) 2rem; align-items: center; gap: 0.75rem; }
.distrow__k {
  display: inline-flex; align-items: center; gap: 0.125rem;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.6875rem; font-variant-numeric: tabular-nums; color: var(--ink-3);
}
.distrow__k span { color: color-mix(in oklab, var(--foreground) 22%, transparent); font-size: 0.625rem; }
.distrow__track {
  position: relative; height: 0.375rem; border-radius: 999px;
  background: color-mix(in oklab, var(--foreground) 7%, transparent); overflow: hidden;
}
.distrow__bar {
  position: absolute; inset: 0 auto 0 0; border-radius: 999px; background: var(--brand);
}
.distrow__n {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.6875rem; font-variant-numeric: tabular-nums; color: var(--ink-3); text-align: right;
}

/* ---- review cards ----------------------------------------------------------
   Column flow, not a grid: reviews vary in length, and an equal-height grid
   would either clip them or leave dead space under the short ones. */
/* CSS multi-column fills DOWN each column before moving right, and balances
   heights — so four reviews landed 2/2/0 and the third column read as broken.
   A grid fills left-to-right in source order, and `align-items: start` keeps
   each card at its natural height so rows stay staggered rather than
   stretching to the tallest card. */
.reviews__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  align-items: start;
}
@media (min-width: 700px)  { .reviews__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .reviews__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.review {
  display: block; margin-bottom: 0;
  padding: 1.25rem 1.375rem;
  border: 1px solid var(--border); border-radius: var(--radius-xl);
  background: var(--card);
  transition: box-shadow 200ms var(--ease-out-quart), transform 200ms var(--ease-out-quart);
}
@media (hover: hover) and (pointer: fine) {
  .review:hover { box-shadow: var(--elevation-card); transform: translateY(-2px); }
}
.review__rating { margin-bottom: 0.75rem; }
.review__body { color: var(--ink-2); font-size: 0.9375rem; line-height: 1.6; }
.review__body p { margin: 0 0 0.625rem; }
.review__body p:last-child { margin-bottom: 0; }
.review__foot {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem;
  margin-top: 1rem; padding-top: 0.875rem; border-top: 1px solid var(--border);
}
.review__who { display: inline-flex; align-items: center; gap: 0.5rem; min-width: 0; }
.review__initial {
  display: grid; place-items: center; flex-shrink: 0;
  width: 1.625rem; height: 1.625rem; border-radius: 999px;
  background: var(--brand-muted); color: var(--brand);
  font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.02em;
}
.review__name { font-size: 0.8125rem; font-weight: 600; color: var(--foreground); }
.review__verified {
  display: inline-flex; align-items: center; gap: 0.25rem;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.5625rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--brand);
}
.review__verified svg { color: var(--brand); }
.review__date {
  display: block; margin-top: 0.5rem;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.625rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-4);
}

/* ---- empty state ------------------------------------------------------------ */
.reviews__none { max-width: 40rem; margin-inline: auto; text-align: center; }
.reviews__nonesub { margin: 0.875rem auto 1.75rem; color: var(--ink-2); max-width: 46ch; }
.reviews__none .rform { margin-inline: auto; text-align: left; }

/* ---- the write-a-review disclosure ------------------------------------------ */
.rform { max-width: 34rem; }
.rform__summary {
  display: inline-flex; align-items: center; gap: 0.4375rem; cursor: pointer;
  padding: 0.625rem 1.125rem; list-style: none;
  border: 1px solid var(--border-strong); border-radius: var(--radius-lg);
  background: var(--background);
  font-size: 0.875rem; font-weight: 600; color: var(--foreground);
  transition: border-color 160ms var(--ease-out-quart), background-color 160ms var(--ease-out-quart);
}
.rform__summary::-webkit-details-marker { display: none; }
.rform__summary:hover { border-color: color-mix(in oklab, var(--foreground) 28%, transparent); }
.rform__summary:active { transform: scale(0.98); }
.rform__chev { transition: transform 200ms var(--ease-out-quart); }
.rform[open] .rform__chev { transform: rotate(180deg); }
.reviews__act .rform { max-width: none; }
.reviews__act .rform__panel { max-width: 34rem; }
.rform__panel {
  margin-top: 1rem; padding: 1.25rem;
  border: 1px solid var(--border); border-radius: var(--radius-xl); background: var(--card);
}
.rform__row { display: flex; flex-direction: column; gap: 0.375rem; margin-bottom: 0.875rem; }
.rform__label {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.625rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3);
}
.rform__hint { font-size: 0.75rem; color: var(--ink-4); }
.rform__area { min-height: 7rem; resize: vertical; padding: 0.625rem 0.75rem; line-height: 1.55; }
.rform__panel .comment-form-cookies-consent { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.875rem; font-size: 0.8125rem; color: var(--ink-3); }
.rform__panel .form-submit { margin: 0; }
.rform__panel .logged-in-as { margin: 0 0 0.875rem; font-size: 0.8125rem; color: var(--ink-3); }

/* --- review theme filters ------------------------------------------------ */
.reviews__filters {
  display: flex; flex-wrap: wrap; gap: .5rem;
  margin: 1.25rem 0 1.5rem;
}
.reviews__chip {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .45rem .85rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-2);
  font-size: .8125rem;
  cursor: pointer;
}
.reviews__chip:hover { border-color: var(--foreground); color: var(--foreground); }
.reviews__chip:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.reviews__chip.is-on {
  background: var(--foreground); color: var(--p-neutral-0); border-color: var(--foreground);
}
.reviews__chipn {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: .6875rem; font-variant-numeric: tabular-nums; opacity: .7;
}
.review[hidden] { display: none; }

/* ===========================================================================
   REVIEW PHOTOS
   Customer images are the one thing on this page we did not write, so they get
   no frame, no caption furniture and no accent — a hairline square and the
   photograph. The card grid is already `align-items: start` with natural
   heights, so a strip simply makes its card taller and the rows stay ragged.
   =========================================================================== */

.review__shots {
  display: flex; flex-wrap: wrap; gap: .375rem;
  margin: .875rem 0 0; padding: 0; list-style: none;
}
/* Every photo is in the DOM so the viewer can page the whole set; the ones
   past the fold are hidden here rather than omitted server-side. */
.review__shots .is-overflow { display: none; }

.review__shot {
  position: relative; display: block; overflow: hidden;
  width: 3.25rem; height: 3.25rem; flex: none; padding: 0;
  border: 1px solid var(--border); border-radius: var(--radius-md);
  background: var(--surface-2); cursor: pointer;
  transition: border-color 160ms var(--ease-out-quart);
}
.review__shot img { display: block; width: 100%; height: 100%; object-fit: cover; }
/* The independent `scale` property, not `transform` — a shared reveal utility
   on an ancestor rewrites `transform` wholesale and would erase this. */
.review__shot img { transition: scale 300ms var(--ease-out-quart); }
@media (hover: hover) and (pointer: fine) {
  .review__shot:hover { border-color: var(--border-strong); }
  .review__shot:hover img { scale: 1.04; }
}
.review__shot:active { scale: .97; }
.review__shot:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.review__shotmore {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: color-mix(in oklab, var(--foreground) 62%, transparent);
  color: var(--p-neutral-0);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: .6875rem; font-weight: 600; font-variant-numeric: tabular-nums;
}

/* ---- the viewer ------------------------------------------------------------
   A native <dialog> opened with showModal(): the focus trap, the inert
   background and Escape-to-close come from the platform. Transform-origin
   stays centre — this is a modal, not a popover anchored to its trigger. */
.rlb {
  position: fixed; inset: 0;
  width: 100vw; max-width: 100vw;
  height: 100vh; max-height: 100vh;
  height: 100dvh; max-height: 100dvh;
  margin: 0; padding: 0; border: 0; overflow: hidden;
  background: transparent; color: var(--p-neutral-0);
  opacity: 0; scale: .96;
  /* Exit is quicker than entry: the visitor has already decided to leave. */
  transition:
    opacity 150ms var(--ease-out-quart),
    scale   150ms var(--ease-out-quart),
    display 150ms allow-discrete,
    overlay 150ms allow-discrete;
}
.rlb[open] { opacity: 1; scale: 1; transition-duration: 200ms; }
@starting-style { .rlb[open] { opacity: 0; scale: .96; } }

.rlb::backdrop { background: rgba(22, 25, 28, .9); }
.rlb::backdrop { background: color-mix(in oklab, var(--foreground) 90%, transparent); }

/* showModal() makes the page inert but does not stop it scrolling behind the
   backdrop, which reads as the viewer having come loose from the page. */
html.ms-lb-open { overflow: hidden; }

.rlb__inner {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center; gap: clamp(.25rem, 2vw, 1.25rem);
  width: 100%; height: 100%;
  padding: clamp(1rem, 4vw, 2.5rem);
}

.rlb__fig {
  display: flex; flex-direction: column; align-items: center; gap: 1rem;
  margin: 0; min-width: 0;
}
.rlb__img {
  display: block; max-width: 100%; max-height: 74dvh;
  object-fit: contain; border-radius: var(--radius-md);
}
.rlb__cap {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: baseline;
  gap: .25rem .75rem;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: .6875rem; letter-spacing: .12em; text-transform: uppercase;
}
.rlb__count { font-variant-numeric: tabular-nums; opacity: .55; }
.rlb__by { opacity: .8; letter-spacing: .06em; text-transform: none; font-size: .75rem; }

.rlb__nav, .rlb__x {
  display: grid; place-items: center; flex: none; padding: 0; cursor: pointer;
  width: 2.75rem; height: 2.75rem; border-radius: var(--radius-circle);
  color: inherit;
  border: 1px solid color-mix(in oklab, var(--p-neutral-0) 22%, transparent);
  background: color-mix(in oklab, var(--p-neutral-0) 8%, transparent);
  transition:
    background-color 160ms var(--ease-out-quart),
    border-color 160ms var(--ease-out-quart);
}
@media (hover: hover) and (pointer: fine) {
  .rlb__nav:hover, .rlb__x:hover {
    background: color-mix(in oklab, var(--p-neutral-0) 16%, transparent);
    border-color: color-mix(in oklab, var(--p-neutral-0) 38%, transparent);
  }
}
.rlb__nav:active, .rlb__x:active { scale: .97; }
.rlb__nav:focus-visible, .rlb__x:focus-visible { outline: 2px solid var(--p-neutral-0); outline-offset: 2px; }
.rlb__nav--prev svg { scale: -1 1; }
.rlb__nav[hidden] { display: none; }

.rlb__x {
  position: absolute; top: clamp(1rem, 4vw, 2.5rem); right: clamp(1rem, 4vw, 2.5rem);
  z-index: 1;
}
@media (max-width: 559px) {
  .rlb__nav, .rlb__x { width: 2.25rem; height: 2.25rem; }
  .rlb__inner { gap: .25rem; }
}

/* ---- uploader --------------------------------------------------------------
   A plain multiple file input behind a styled label: the picker opens and the
   files post with no JavaScript at all. Previews, drag-and-drop and per-file
   removal are the enhancement, never the mechanism. */
.rform__row--files { gap: .5rem; }
.rform__opt {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: .5625rem; letter-spacing: .1em; color: var(--ink-4);
}
/* Positioned so the clipped input below anchors here rather than escaping to
   whatever ancestor happens to be positioned. */
.rform__pick { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: .625rem .875rem; }
/* Clipped, not display:none — it must stay focusable and keep its label. */
.rform__file {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
.rform__pickbtn { cursor: pointer; }
.rform__file:focus-visible + .rform__pickbtn { outline: 2px solid var(--brand); outline-offset: 2px; }
.rform__meta {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: .625rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-4);
}

/* Drag target is the whole panel — a dashed dropzone would be a second, weaker
   affordance sitting next to a perfectly good button. */
.rform__panel {
  transition:
    border-color 160ms var(--ease-out-quart),
    background-color 160ms var(--ease-out-quart);
}
.rform__panel.is-dragover {
  border-color: var(--brand);
  background: color-mix(in oklab, var(--brand) 5%, var(--card));
}

.rform__previews {
  display: flex; flex-wrap: wrap; gap: .5rem;
  margin: .25rem 0 0; padding: 0; list-style: none;
}
.rform__previews[hidden] { display: none; }
.rform__preview {
  position: relative; overflow: hidden;
  width: 4rem; height: 4rem;
  border: 1px solid var(--border); border-radius: var(--radius-md);
  background: var(--surface-2);
  /* Animation + `translate`, never transition + transform: this element also
     carries a hover scale, and a shorthand here would reset it. */
  animation: ms-preview-in 220ms var(--ease-out-quart) both;
  animation-delay: calc(var(--i, 0) * 40ms);
}
@keyframes ms-preview-in {
  from { opacity: 0; translate: 0 6px; }
  to   { opacity: 1; translate: none; }
}
.rform__preview img { display: block; width: 100%; height: 100%; object-fit: cover; }
.rform__drop {
  position: absolute; top: .1875rem; right: .1875rem;
  display: grid; place-items: center; padding: 0; cursor: pointer;
  width: 1.25rem; height: 1.25rem; border-radius: var(--radius-circle);
  border: 0; background: color-mix(in oklab, var(--foreground) 72%, transparent);
  color: var(--p-neutral-0);
  transition: background-color 140ms var(--ease-out-quart);
}
.rform__drop svg { width: .75rem; height: .75rem; }
@media (hover: hover) and (pointer: fine) {
  .rform__drop:hover { background: var(--foreground); }
}
.rform__drop:active { scale: .94; }
.rform__drop:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.rform__fileerr {
  margin: 0; font-size: .75rem; line-height: 1.5;
  color: color-mix(in oklab, var(--foreground) 70%, transparent);
}
.rform__fileerr[hidden] { display: none; }

.rform__as { margin: 0 0 .875rem; font-size: .8125rem; color: var(--ink-3); }
.rform__gate { margin: 0; font-size: .875rem; color: var(--ink-2); }
.rform__consent {
  display: flex; align-items: center; gap: .5rem;
  margin: 0 0 .875rem; font-size: .8125rem; color: var(--ink-3);
}
/* Off-screen rather than display:none, which bots detect and skip. */
.rform__hp {
  position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden;
}

/* ---- submission outcome ---------------------------------------------------- */
.rnotice {
  display: flex; align-items: flex-start; gap: .5rem;
  margin: 0 0 1rem; padding: .75rem .875rem;
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--card);
  font-size: .875rem; line-height: 1.5; color: var(--ink-2);
}
.rnotice__i { flex: none; margin-top: .125rem; color: var(--brand); }
.rnotice--err { border-color: color-mix(in oklab, var(--foreground) 22%, transparent); }
.rnotice--err .rnotice__i { color: var(--foreground); }

@media (prefers-reduced-motion: reduce) {
  .rlb, .rlb[open] { scale: 1; }
  .rlb { transition-property: opacity, display, overlay; }
  .review__shot img, .review__shot:active,
  .rlb__nav:active, .rlb__x:active, .rform__drop:active { scale: 1; transition: none; }
  .rform__preview { animation: none; }
}
