/*
 * The customer review cards: "Loved by customers" on /pricing/ and
 * /features/hosting-images/, and the wall on /wall-of-love/
 * (includes/Reviews/CustomerReviews.php loads this file where they render).
 *
 * The markup is not ours. The Schema & Structured Data for WP plugin prints it
 * ([saswp-reviews-collection], grid design) with its own stylesheet,
 * collection-front.min.css; this file restyles it to match the review badges
 * and the pricing cards. Every rule carries one class more than the plugin's
 * rule for the same element, so it wins whichever stylesheet loads first.
 *
 * The plugin's card:
 *   li
 *     .saswp-rc
 *       .saswp-rc-a
 *         .saswp-r1-aimg > img     the reviewer's picture
 *         .saswp-rc-nm
 *           a | span > strong      the name, a link when the review has one
 *           .saswp-rvw-str         five stars, inline SVG
 *           .saswp-rc-dt           the date (not shown)
 *       .saswp-rc-lg > img         the icon of where the review was left
 *                                  (Trustpilot's is not shown)
 *     .saswp-rc-cnt > p            the review
 *
 * The three wrappers (.saswp-rc, .saswp-rc-a, .saswp-rc-nm) are taken out of
 * the layout with display: contents, so the card itself lays out the parts:
 * stars and icon on top, the review, then the reviewer.
 */

/* The plugin sets a system font on its wrapper; take the page's instead. */
body div.saswp-r {
  font-family: inherit;
}

.saswp-r .saswp-r1 {
  --imgv-cr-ink: var(--wp--preset--color--custom-dark, #023c40);
  --imgv-cr-deep: var(--wp--preset--color--custom-secondary, #0b7c3e);
  --imgv-cr-leaf: var(--wp--preset--color--custom-primary, #0bba68);
  --imgv-cr-text: var(--wp--preset--color--body, #4b5563);
  --imgv-cr-outline: var(--wp--preset--color--outline, #e7eeeb);
  --imgv-cr-gap: 20px;
  font-family: inherit;
}

/* The plugin writes three columns and overflow-x: hidden on the list itself
   (a style attribute), and one column below 768px with !important. */
.saswp-r .saswp-r1 ul {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: var(--imgv-cr-gap);
  overflow: visible !important;
  margin: 0;
  padding: 0;
  list-style: none;
}

.saswp-r .saswp-r1 li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-rows: auto 1fr auto;
  grid-template-areas:
    "stars stars source"
    "text  text  text"
    "face  name  name";
  align-items: center;
  column-gap: 12px;
  margin: 0;
  padding: 22px 22px 20px;
  background: #fff;
  border: 1px solid var(--imgv-cr-outline);
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(2, 60, 64, 0.05);
  color: var(--imgv-cr-text);
  font-family: inherit;
}

.saswp-r .saswp-r1 .saswp-rc,
.saswp-r .saswp-r1 .saswp-rc-a,
.saswp-r .saswp-r1 .saswp-rc-nm {
  display: contents;
  font-family: inherit;
}

/* Stars: the plugin fills each one with a gradient of two stops, gold for the
   part that counts and grey for the rest. Same green as the review badges. */
.saswp-r .saswp-r1 .saswp-rvw-str {
  grid-area: stars;
  position: static;
  display: flex;
  align-items: center;
  gap: 2px;
  width: auto;
  /* As tall as the icon beside it, so a card without one lines up with its neighbours. */
  min-height: 22px;
}

.saswp-r .saswp-r1 .saswp-rvw-str > span {
  display: block;
  margin: 0;
  font-size: 0;
  line-height: 0;
}

.saswp-r .saswp-r1 .saswp-rvw-str svg {
  display: block;
  width: 18px;
  height: 18px;
}

.saswp-r .saswp-r1 .saswp-rvw-str stop {
  stop-color: #dfe7e3;
}

.saswp-r .saswp-r1 .saswp-rvw-str stop.saswp_star {
  stop-color: var(--imgv-cr-leaf);
}

.saswp-r .saswp-r1 .saswp-rc-lg {
  grid-area: source;
  position: static;
  justify-self: end;
  line-height: 0;
}

.saswp-r .saswp-r1 .saswp-rc-lg img {
  display: block;
  width: 22px;
  height: 22px;
  border-radius: 50%;
}

/* No Trustpilot icon: Trustpilot allows its marks only in its own widgets.
   The reviewer's name still links to the review there. */
.saswp-r .saswp-r1 .saswp-rc-lg img[src*="trustpilot" i],
.saswp-r .saswp-r1 .saswp-rc-lg img[alt="Trustpilot" i] {
  display: none;
}

/* The review, whole: the plugin's card cut it off in a 80px scroll box. */
.saswp-r .saswp-r1 .saswp-rc-cnt {
  grid-area: text;
  align-self: start;
  height: auto;
  overflow: visible;
  margin: 14px 0 20px;
  padding: 0;
  font-size: 15px;
  line-height: 1.6;
  text-align: left;
  color: var(--imgv-cr-text);
}

.saswp-r .saswp-r1 .saswp-rc-cnt p {
  margin: 0;
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  color: inherit;
  /* Reviewers' own line breaks and blank lines. */
  white-space: pre-line;
  overflow-wrap: anywhere;
}

/* The picture is a person's photo or a shop's logo, square, wide or tall:
   shown whole on a white tile, never cropped to a circle. */
.saswp-r .saswp-r1 .saswp-r1-aimg {
  grid-area: face;
  box-sizing: border-box;
  width: 44px;
  height: 44px;
  overflow: hidden;
  border: 1px solid var(--imgv-cr-outline);
  border-radius: 10px;
  background: #fff;
}

.saswp-r .saswp-r1 .saswp-r1-aimg img {
  display: block;
  float: none;
  width: 100%;
  height: 100%;
  min-height: 0;
  max-width: none;
  max-height: none;
  margin: 0;
  border-radius: 0;
  object-fit: contain;
}

/* A reviewer without a picture gets the plugin's grey silhouette; show a
   green one in its place. */
.saswp-r .saswp-r1 .saswp-r1-aimg:has(img[src*="default_user"]) {
  border-color: transparent;
  background: #e4f5dc url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 44 44'%3E%3Cg fill='%230b7c3e'%3E%3Ccircle cx='22' cy='17' r='7'/%3E%3Cpath d='M8 41c1.2-8.2 6.9-13 14-13s12.8 4.8 14 13z'/%3E%3C/g%3E%3C/svg%3E") center / 44px 44px no-repeat;
}

.saswp-r .saswp-r1 .saswp-r1-aimg:has(img[src*="default_user"]) img {
  opacity: 0;
}

.saswp-r .saswp-r1 .saswp-rc-nm > a,
.saswp-r .saswp-r1 .saswp-rc-nm > span:first-child {
  grid-area: name;
  display: block;
  width: auto;
  min-width: 0;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0;
  color: var(--imgv-cr-ink);
  text-decoration: none;
  overflow-wrap: anywhere;
}

.saswp-r .saswp-r1 .saswp-rc-nm > span:first-child strong {
  font-weight: inherit;
}

/* A linked name opens the review where it was left, in a new tab. The arrow
   is a no-break space with the icon as its mask, so it never wraps to a line
   of its own. */
.saswp-r .saswp-r1 .saswp-rc-nm > a::after {
  content: "\00a0";
  margin-left: 6px;
  padding-left: 8px;
  background: currentColor;
  opacity: 0.55;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4.5 1.8H1.8v8.4h8.4V7.5M7 1.8h3.2V5M10.2 1.8 5.4 6.6'/%3E%3C/svg%3E") center / 11px 11px no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4.5 1.8H1.8v8.4h8.4V7.5M7 1.8h3.2V5M10.2 1.8 5.4 6.6'/%3E%3C/svg%3E") center / 11px 11px no-repeat;
}

.saswp-r .saswp-r1 .saswp-rc-nm > a:hover {
  color: var(--imgv-cr-deep);
  text-decoration: underline;
}

.saswp-r .saswp-r1 .saswp-rc-nm > a:focus-visible {
  outline: 2px solid var(--imgv-cr-leaf);
  outline-offset: 3px;
  border-radius: 3px;
}

.saswp-r .saswp-r1 .saswp-rc-dt {
  display: none;
}

/* More than two rows of cards (the wall of love): columns of cards as tall as
   their own review, instead of rows as tall as their longest one. */
.saswp-r .saswp-r1 ul:has(> li:nth-child(7)) {
  display: block;
  columns: 3;
  column-gap: var(--imgv-cr-gap);
  /* Takes back the margin under the last card of each column. */
  margin-bottom: calc(-1 * var(--imgv-cr-gap));
}

.saswp-r .saswp-r1 ul:has(> li:nth-child(7)) > li {
  break-inside: avoid;
  margin-bottom: var(--imgv-cr-gap);
}

@media (max-width: 1023px) {
  .saswp-r .saswp-r1 ul {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .saswp-r .saswp-r1 ul:has(> li:nth-child(7)) {
    columns: 2;
  }
}

@media (max-width: 640px) {
  .saswp-r .saswp-r1 {
    --imgv-cr-gap: 14px;
  }

  .saswp-r .saswp-r1 ul {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .saswp-r .saswp-r1 ul:has(> li:nth-child(7)) {
    columns: 1;
  }

  .saswp-r .saswp-r1 li {
    padding: 18px 18px 16px;
  }
}
