/* =========================================================
   RM Reviews – base stylesheet (shared, don't edit per client)
   Etch Studio + Automatic CSS edition.
   Layout, breakpoints, skeleton and toggle for the markup built
   by rm-reviews.js. Goes in a global Etch stylesheet: these classes
   are created by the script, so they can't live in Etch class styles.
   Per-client overrides go in the wrapper's own class style
   (see rm-reviews-theme-template.css).
   ========================================================= */

/* ---------- Variables (ACSS defaults) ----------
   Every default points at an Automatic CSS token, so a new section
   matches the site's ACSS settings with no client overrides.
   :where() keeps these at zero specificity, so overrides set on the
   wrapper's own class style in Etch always win. */
:where(.rm-reviews-kqv) {
  /* Colours */
  --rm-rv-text: var(--text-color);
  --rm-rv-heading: var(--heading-color);
  --rm-rv-muted: var(--text-dark-muted);
  --rm-rv-card-bg: var(--neutral-ultra-light);
  --rm-rv-badge-bg: var(--white);
  --rm-rv-featured-bg: var(--base-dark);
  --rm-rv-featured-text: var(--text-light);
  --rm-rv-featured-muted: var(--text-light-muted);
  --rm-rv-featured-divider: color-mix(in srgb, var(--text-light) 18%, transparent);
  --rm-rv-accent: var(--primary);
  --rm-rv-stars: var(--heading-color);
  --rm-rv-featured-stars: var(--rm-rv-accent);
  --rm-rv-skeleton: var(--neutral-light);
  --rm-rv-skeleton-badge: var(--neutral-ultra-light);
  --rm-rv-skeleton-featured: color-mix(in srgb, var(--text-light) 12%, transparent);

  /* Button */
  --rm-rv-button-bg: var(--base-dark);
  --rm-rv-button-text: var(--text-light);
  --rm-rv-button-border: var(--base-dark);
  --rm-rv-button-hover-bg: var(--rm-rv-accent);
  --rm-rv-button-hover-text: var(--text-light);
  --rm-rv-button-hover-border: var(--rm-rv-accent);
  --rm-rv-button-padding: var(--btn-padding-block, 1em) var(--btn-padding-inline, 2em);
  --rm-rv-focus: var(--focus-color);
  --rm-rv-focus-width: var(--focus-width);
  --rm-rv-focus-offset: var(--focus-offset);

  /* 2.4 Read more link (data-clamp) */
  --rm-rv-read-color: var(--rm-rv-accent);
  --rm-rv-read-size: var(--text-s);

  /* Shape & spacing */
  --rm-rv-radius: var(--radius);
  --rm-rv-badge-radius: var(--rm-rv-radius);
  --rm-rv-button-radius: var(--btn-border-radius, var(--rm-rv-radius));
  --rm-rv-gap: var(--grid-gap);
  --rm-rv-gap-sm: var(--space-s);
  --rm-rv-card-padding: var(--space-m);
  --rm-rv-card-padding-sm: var(--space-s);
  --rm-rv-featured-padding: var(--space-xl);
  --rm-rv-featured-padding-sm: var(--space-l) var(--space-m);
  --rm-rv-badge-padding: var(--space-s) var(--space-m);
  --rm-rv-head-space: var(--space-l);
  --rm-rv-more-space: var(--space-l); /* gap above the Show all button */
  --rm-rv-scroll-offset: 120px; /* clears a sticky header on "Show fewer" (no ACSS token) */

  /* Typography */
  --rm-rv-font: inherit;
  --rm-rv-score-size: var(--h1);
  --rm-rv-score-weight: 800;
  --rm-rv-body-size: var(--text-s);
  --rm-rv-body-line-height: var(--text-line-height);
  --rm-rv-title-size: var(--text-l);
  --rm-rv-title-size-sm: var(--text-l);
  --rm-rv-title-weight: 700;
  --rm-rv-small-size: var(--text-xs);
  --rm-rv-badge-text-size: var(--text-s);
  --rm-rv-featured-body-size: var(--text-xl);
  --rm-rv-featured-body-size-sm: var(--text-l);
  --rm-rv-featured-body-weight: 600;
  --rm-rv-featured-title-size: var(--text-xl);
  --rm-rv-featured-title-size-sm: var(--text-l);
  --rm-rv-quote-mark-size: 88px; /* decorative, no ACSS token */
  --rm-rv-quote-mark-size-sm: 68px;
  --rm-rv-button-size: var(--text-m);
  --rm-rv-button-weight: var(--btn-font-weight, 700);
  --rm-rv-star-size: 14px; /* icon size, no ACSS token */
}

/* ---------- Hide TrustIndex's widget while we read it ----------
   Visually hidden rather than display:none, so their loader still
   renders it. The script removes it once read, and removes the
   .rm-rv-active class to reveal it if reading fails. */
.rm-reviews-kqv.rm-rv-active .ti-widget.ti-widget[data-layout-id] {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  border: 0 !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
}

/* ---------- Root ---------- */
.rm-rv {
  font-family: var(--rm-rv-font);
  color: var(--rm-rv-text);
  scroll-margin-top: var(--rm-rv-scroll-offset);
}

.rm-rv *,
.rm-rv *::before,
.rm-rv *::after {
  box-sizing: border-box;
}

.rm-rv__sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* =========================================================
   BADGE
   ========================================================= */
.rm-rv__head {
  display: flex;
  justify-content: flex-end;
  margin-bottom: var(--rm-rv-head-space);
}

.rm-rv__badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-s);
  padding: var(--rm-rv-badge-padding);
  background: var(--rm-rv-badge-bg);
  border-radius: var(--rm-rv-badge-radius);
}

.rm-rv__score {
  font-size: var(--rm-rv-score-size);
  font-weight: var(--rm-rv-score-weight);
  line-height: 0.85;
  letter-spacing: -0.03em;
  color: var(--rm-rv-heading);
}

.rm-rv__badge-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rm-rv__platform,
.rm-rv__count {
  margin: 0;
  font-size: var(--rm-rv-badge-text-size);
  line-height: 1.3;
}

.rm-rv__platform {
  color: var(--rm-rv-heading);
}

.rm-rv__platform strong {
  font-weight: 700;
}

.rm-rv__count {
  color: var(--rm-rv-muted);
}

/* Mixed widgets only: each platform's own score */
.rm-rv__breakdown {
  margin: 2px 0 0;
  font-size: var(--rm-rv-small-size);
  line-height: 1.3;
  color: var(--rm-rv-muted);
}

/* =========================================================
   STARS
   ========================================================= */
.rm-rv__stars {
  display: inline-flex;
  gap: 2px;
  line-height: 0;
  color: var(--rm-rv-stars);
}

.rm-rv__stars svg {
  width: var(--rm-rv-star-size);
  height: var(--rm-rv-star-size);
  fill: currentColor;
}

.rm-rv__stars .is-off,
.rm-rv__stars .rm-rv__star-bg {
  opacity: 0.25;
}

/* =========================================================
   GRID
   ========================================================= */
.rm-rv__grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--rm-rv-gap);
  margin: 0;
  padding: 0;
  list-style: none;
}

.rm-rv__item {
  min-width: 0;
  margin: 0;
  padding: 0;
}

.rm-rv__item::marker {
  content: none;
}

.rm-rv__item--featured {
  grid-column: span 2;
  grid-row: span 2;
}

.rm-rv__item--wide {
  grid-column: span 2;
}

/* Collapsed: hide reviews beyond the limit */
.rm-rv:not(.is-expanded) .rm-rv__item--extra {
  display: none;
}

/* =========================================================
   CARD
   ========================================================= */
.rm-rv__card {
  display: flex;
  flex-direction: column;
  gap: var(--space-s);
  height: 100%;
  margin: 0;
  padding: var(--rm-rv-card-padding);
  background: var(--rm-rv-card-bg);
  border-radius: var(--rm-rv-radius);
}

.rm-rv__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-xs);
}

.rm-rv__date {
  margin: 0;
  font-size: var(--rm-rv-small-size);
  line-height: 1.3;
  color: var(--rm-rv-muted);
  white-space: nowrap;
}

.rm-rv__source {
  display: none; /* only shown on the featured card */
}

.rm-rv__quote {
  flex: 1 1 auto;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  quotes: none;
  font-family: var(--rm-rv-font);
  font-size: var(--rm-rv-body-size);
  font-style: normal;
  font-weight: 400;
  line-height: var(--rm-rv-body-line-height);
  color: var(--rm-rv-muted);
}

.rm-rv__quote::before,
.rm-rv__quote::after {
  content: none;
}

.rm-rv__quote p {
  margin: 0 0 0.6em;
  font: inherit;
  color: inherit;
}

.rm-rv__quote p:last-child {
  margin-bottom: 0;
}

.rm-rv__title {
  margin: 0;
  padding-top: 8px;
  font-family: var(--rm-rv-font);
  font-size: var(--rm-rv-title-size);
  font-weight: var(--rm-rv-title-weight);
  line-height: 1.2;
  letter-spacing: normal;
  text-transform: none;
  color: var(--rm-rv-heading);
}

/* Attribution: reviewer name and/or platform */
.rm-rv__by {
  margin: 0;
  font-size: var(--rm-rv-small-size);
  line-height: 1.3;
  color: var(--rm-rv-muted);
}

.rm-rv__quote + .rm-rv__by {
  padding-top: 8px; /* matches the title's spacing when there's no title */
}

.rm-rv__name {
  font-weight: 600;
  color: var(--rm-rv-heading);
}

/* 2.1 (data-initials="true"): letter circle + name and platform stacked.
   The circle uses --rm-rv-item-color (set per card by data-colors) */
.rm-rv__by--initials {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.rm-rv__initial {
  display: grid;
  place-items: center;
  flex: none;
  inline-size: 2.75em;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--rm-rv-item-color, var(--rm-rv-accent));
  color: var(--white);
  font-weight: 800;
  line-height: 1;
}

.rm-rv__who {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
}

/* =========================================================
   FEATURED CARD
   ========================================================= */
.rm-rv__item--featured .rm-rv__card {
  gap: var(--space-m);
  padding: var(--rm-rv-featured-padding);
  background: var(--rm-rv-featured-bg);
  color: var(--rm-rv-featured-text);
}

/* Quote mark */
.rm-rv__item--featured .rm-rv__card::before {
  content: "\201C";
  height: 0.5em;
  font-size: var(--rm-rv-quote-mark-size);
  font-weight: 900;
  line-height: 1;
  color: var(--rm-rv-accent);
}

.rm-rv__item--featured .rm-rv__quote {
  order: 1;
  font-size: var(--rm-rv-featured-body-size);
  font-weight: var(--rm-rv-featured-body-weight);
  line-height: 1.45;
  color: var(--rm-rv-featured-text);
}

.rm-rv__item--featured .rm-rv__quote p {
  margin-bottom: 1em;
}

.rm-rv__item--featured .rm-rv__title {
  order: 2;
  font-size: var(--rm-rv-featured-title-size);
  color: var(--rm-rv-featured-text);
}

.rm-rv__item--featured .rm-rv__by {
  order: 2;
  color: var(--rm-rv-featured-muted);
}

.rm-rv__item--featured .rm-rv__name {
  color: var(--rm-rv-featured-text);
}

/* Divider under the quote: above the title, or above the name when there's no title */
.rm-rv__item--featured .rm-rv__quote + .rm-rv__title,
.rm-rv__item--featured .rm-rv__quote + .rm-rv__by {
  padding-top: var(--space-s);
  border-top: 1px solid var(--rm-rv-featured-divider);
}

/* Stars + date along the bottom */
.rm-rv__item--featured .rm-rv__meta {
  order: 3;
  justify-content: flex-start;
}

.rm-rv__item--featured .rm-rv__stars {
  color: var(--rm-rv-featured-stars);
}

.rm-rv__item--featured .rm-rv__date {
  color: var(--rm-rv-featured-muted);
}

.rm-rv__item--featured .rm-rv__source {
  display: inline;
}

/* =========================================================
   LOADING SKELETON
   Uses the real grid and card classes so it takes up the
   same space as the reviews.
   ========================================================= */
.rm-rv__badge--skel .rm-rv__badge-info {
  gap: 8px;
}

.rm-rv__skel {
  display: block;
  height: 12px;
  background: var(--rm-rv-skeleton);
  animation: rm-rv-pulse 1.4s ease-in-out infinite;
}

.rm-rv__skel--score    { width: 120px; height: 56px; }
.rm-rv__skel--stars    { width: 78px; }
.rm-rv__skel--short    { width: 110px; }
.rm-rv__skel--date     { width: 70px; }
.rm-rv__skel--line     { width: 100%; margin-bottom: 12px; }
.rm-rv__skel--line-end { width: 60%; }
.rm-rv__skel--title    { width: 55%; height: 18px; }

.rm-rv__badge--skel .rm-rv__skel {
  background: var(--rm-rv-skeleton-badge);
}

.rm-rv__item--featured .rm-rv__skel {
  background: var(--rm-rv-skeleton-featured);
}

.rm-rv__skeleton .rm-rv__item--featured .rm-rv__card::before {
  content: none;
}

.rm-rv__skeleton .rm-rv__item--featured .rm-rv__quote {
  padding-top: 40px;
}

.rm-rv__skeleton .rm-rv__item--featured .rm-rv__skel--line {
  height: 20px;
}

.rm-rv__skeleton .rm-rv__item--featured .rm-rv__skel--title {
  order: 2;
  height: 24px;
}

@keyframes rm-rv-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

@media (prefers-reduced-motion: reduce) {
  .rm-rv__skel {
    animation: none;
  }
}

/* =========================================================
   SHOW ALL / SHOW FEWER
   The toggle rules use .rm-rv .rm-rv__toggle (two classes) so they
   beat ACSS's own button rule, button:not(nav button, [class*=btn--]),
   which outranks a single class.
   ========================================================= */
.rm-rv__more {
  display: flex;
  justify-content: center;
  margin-top: var(--rm-rv-more-space);
}

.rm-rv .rm-rv__toggle {
  -webkit-appearance: none;
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 0;
  padding: var(--rm-rv-button-padding);
  background: var(--rm-rv-button-bg);
  border: 2px solid var(--rm-rv-button-border);
  border-radius: var(--rm-rv-button-radius);
  box-shadow: none;
  font-family: var(--rm-rv-font);
  font-size: var(--rm-rv-button-size);
  font-weight: var(--rm-rv-button-weight);
  line-height: 1.2;
  letter-spacing: 0.02em;
  color: var(--rm-rv-button-text);
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

/* Chevron: down when collapsed, up when expanded */
.rm-rv .rm-rv__toggle::after {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  transition: transform 0.2s ease;
}

.rm-rv .rm-rv__toggle[aria-expanded="true"]::after {
  transform: translateY(2px) rotate(-135deg);
}

.rm-rv .rm-rv__toggle:hover,
.rm-rv .rm-rv__toggle:focus-visible {
  background: var(--rm-rv-button-hover-bg);
  border-color: var(--rm-rv-button-hover-border);
  color: var(--rm-rv-button-hover-text);
}

.rm-rv .rm-rv__toggle:focus-visible {
  outline: var(--rm-rv-focus-width) solid var(--rm-rv-focus);
  outline-offset: var(--rm-rv-focus-offset);
}

/* =========================================================
   2.4 READ MORE / READ LESS (data-clamp="6")
   Long reviews are cut to N lines with a fade; the script adds the
   clamp class and shows the link only when a review is more than
   ~1.5 lines over. Browsers without the lh unit just show the full text.
   Two-class selectors beat ACSS's button rule (see the toggle below).
   ========================================================= */
.rm-rv__quote--clamp:not(.rm-rv__quote--open) {
  max-block-size: calc(var(--rm-rv-clamp, 6) * 1lh);
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 1.5lh), transparent);
  mask-image: linear-gradient(to bottom, #000 calc(100% - 1.5lh), transparent);
}

.rm-rv .rm-rv__read {
  -webkit-appearance: none;
  appearance: none;
  align-self: flex-start;
  margin: 0 0 auto; /* keeps it under the text; spare card height goes below it */
  padding: 0;
  background: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  font-family: var(--rm-rv-font);
  font-size: var(--rm-rv-read-size);
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: normal;
  color: var(--rm-rv-read-color);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.rm-rv .rm-rv__read:hover {
  background: none;
  color: var(--rm-rv-read-color);
  text-decoration-thickness: 2px;
}

.rm-rv .rm-rv__read:focus-visible {
  outline: var(--rm-rv-focus-width) solid var(--rm-rv-focus);
  outline-offset: var(--rm-rv-focus-offset);
}

.rm-rv .rm-rv__read[hidden] {
  display: none;
}

.rm-rv__card {
  scroll-margin-top: var(--rm-rv-scroll-offset); /* "Read less" scrolls the card back into view */
}

/* =========================================================
   RESPONSIVE
   ========================================================= */

/* Tablet (1100px and below): two cards per row, featured included */
@media (max-width: 1100px) {
  .rm-rv__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .rm-rv__item,
  .rm-rv__item--featured,
  .rm-rv__item--wide {
    grid-column: auto;
    grid-row: auto;
  }
}

/* Mobile (767px and below): one card per row, full-width badge */
@media (max-width: 767px) {
  .rm-rv__head {
    margin-bottom: var(--space-m);
  }

  .rm-rv__badge {
    width: 100%;
    padding: var(--space-s);
  }

  .rm-rv__grid {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--rm-rv-gap-sm);
  }

  .rm-rv__card {
    padding: var(--rm-rv-card-padding-sm);
  }

  .rm-rv__title {
    font-size: var(--rm-rv-title-size-sm);
  }

  .rm-rv__item--featured .rm-rv__card {
    padding: var(--rm-rv-featured-padding-sm);
  }

  .rm-rv__item--featured .rm-rv__card::before {
    font-size: var(--rm-rv-quote-mark-size-sm);
  }

  .rm-rv__item--featured .rm-rv__quote {
    font-size: var(--rm-rv-featured-body-size-sm);
  }

  .rm-rv__item--featured .rm-rv__title {
    font-size: var(--rm-rv-featured-title-size-sm);
  }

  .rm-rv .rm-rv__toggle {
    width: 100%;
  }
}
