/*
 * Review cards from [sbx_reviews] (mu-plugins/speakerboxx-reviews.php), on Home, About and single reviews,
 * plus the full review from [sbx_review_full] on /reviews/<slug>/.
 * Colours are Elementor's global variables only, so the light/dark toggle works.
 */

/* No published reviews: hide the whole section, heading included. */
.sbx-no-review .sbx-reviews-section {
  display: none !important;
}

.sbx-reviews {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 24px;
}

.sbx-review {
  margin: 0;
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 20px;
  background: var(--e-global-color-surface);
  border-radius: 4px;
}

html[data-theme="light"] .sbx-review {
  box-shadow: 0 1px 3px rgba(17, 17, 17, 0.12);
}

.sbx-review__text {
  margin: 0;
  padding: 0;
  border: 0;
  color: var(--e-global-color-text);
  font-size: 1rem;
  line-height: 1.6;
}

/* Big accent-coloured opening quote mark: decoration only, so it's CSS, not text a screen reader reads. */
.sbx-review__text::before {
  content: "\201C";
  display: block;
  height: 0.5em;
  color: var(--e-global-color-accent);
  font-size: 3.5rem;
  line-height: 1;
}

.sbx-review__text p {
  margin: 0 0 0.75em;
}

.sbx-review__text p:last-child {
  margin-bottom: 0;
}

.sbx-review__body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

/* Long reviews on cards: first 3 lines, then "…". The full text is on the review's own page. */
.sbx-review__excerpt {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
}

.sbx-review__more {
  color: var(--e-global-color-accent);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.sbx-review__more:hover,
.sbx-review__more:focus-visible {
  color: var(--e-global-color-text);
}

.sbx-review__more:focus-visible {
  outline: 2px solid var(--e-global-color-accent);
  outline-offset: 2px;
}

/* font-style: the theme italicises every figcaption. */
.sbx-review__by {
  display: flex;
  align-items: center;
  gap: 12px;
  font-style: normal;
}

/* Two classes, to outrank Elementor's `.elementor img { border-radius: 0 }`. */
.sbx-review .sbx-review__photo {
  flex: none;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
}

/*
 * Logos (non-square images, picked in speakerboxx-reviews.php): shown whole on a white tile, since most
 * logos are made for white backgrounds and a dark one would vanish on the dark theme.
 */
.sbx-review .sbx-review__photo--logo {
  width: auto;
  max-width: 112px;
  border-radius: 6px;
  object-fit: contain;
  background: #fff;
  padding: 4px;
}

.sbx-review__who {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.sbx-review__name {
  color: var(--e-global-color-text);
  font-style: normal;
  font-weight: 700;
}

.sbx-review__source {
  color: var(--e-global-color-muted);
  font-size: 0.875rem;
}

/* ---- Single review page ---- */

/* Name and photo first, then the quote; bigger text than a card. */
.sbx-review--full {
  justify-content: flex-start;
  gap: 24px;
  padding: 32px;
}

.sbx-review--full .sbx-review__text {
  font-size: 1.125rem;
  line-height: 1.7;
}

.sbx-review--full .sbx-review__name {
  margin: 0;
  font-size: clamp(1.5rem, 1.2rem + 1.5vw, 2.25rem);
  line-height: 1.2;
}

.sbx-review--full .sbx-review__photo {
  width: 72px;
  height: 72px;
}

.sbx-review--full .sbx-review__photo--logo {
  width: auto;
  max-width: 144px;
}

/* "More reviews": hidden when this is the only review (the grid prints nothing). */
.sbx-single-review-more:not(:has(.sbx-reviews)) {
  display: none;
}

@media (max-width: 767px) {
  .sbx-review--full {
    padding: 20px;
  }

  .sbx-reviews {
    gap: 16px;
  }

  .sbx-review {
    padding: 20px;
  }
}
