/**
 * Student experience cards.
 * Loaded only by templates/sltwentythree/html/com_content/category/reviews.php
 */

.sl-reviews__intro {
  max-width: 775px;
}

.sl-reviews__grid {
  margin-top: 2.25rem;
}

/* Padding sits on the inner sections so the image can run edge to edge. */
.sl-review-card {
  height: 100%;
  overflow: hidden;
  background-color: #fff;
  border: 1px solid #dee2e6;
  border-radius: 0.5rem;
}

.sl-review-card__figure,
.sl-review-card__figure .img-full {
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
}

/* Cropped server-side too; this also covers gif/svg sources, which bypass the crop. */
.sl-review-card__photo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sl-review-card__body {
  padding: 1.5rem;
}

.sl-review-card__quote,
.sl-review-card__title {
  margin-bottom: 1rem;
  font-size: 1.25rem;
  line-height: 1.4;
  hyphens: none;
  word-break: break-word;
}

.sl-review-card__quote {
  font-weight: 500;
}

.sl-review-card__quote p:last-child {
  margin-bottom: 0;
}

/*
 * Image cards limit the visible text so a row stays even. This only crops what is painted:
 * the stored value is still output in full and remains readable on the article page.
 * Text-only cards are left unclamped, because they have no story link to read the rest from.
 *
 * The clamp sits on the blockquote rather than its paragraphs, so a multi-paragraph quote is
 * limited to four lines in total instead of four lines per paragraph.
 */
.sl-review-card--has-image .sl-review-card__quote,
.sl-review-card--has-image .sl-review-card__title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  overflow: hidden;
}

/* Paragraph gaps count towards the clamped height, so keep them tighter than the default. */
.sl-review-card--has-image .sl-review-card__quote p {
  margin-bottom: 0.5rem;
}

.sl-review-card__attribution {
  margin-bottom: 0;
}

.sl-review-card__name {
  display: block;
  font-style: normal;
  font-weight: 600;
}

.sl-review-card__role {
  display: block;
  font-size: 0.9375rem;
  color: #6c757d;
}

.sl-review-card__footer {
  padding: 0 1.5rem 1.5rem;
}

/*
 * Image cards put the photo behind the text rather than above it. The photo and the gradient sit
 * on negative z-index inside the card's own stacking context, which keeps the body and footer in
 * normal flow. That matters for the call to action: positioning the content instead would make
 * the stretched link resolve against the footer, shrinking the click target from the whole card
 * down to the button.
 */
.sl-review-card--has-image {
  position: relative;
  isolation: isolate;
  justify-content: flex-end;
  min-height: 24rem;
  border-color: transparent;
}

.sl-review-card--has-image .sl-review-card__figure {
  position: absolute;
  inset: 0;
  z-index: -2;
}

/*
 * Readability cannot be left to the photograph, but the scrim should read as a light editorial
 * panel rather than a dark one. It rides on the text block itself rather than washing the whole
 * card, so it is only ever as tall as the content and a short quote leaves most of the picture
 * untouched. The ramp is measured in rem rather than percent so it finishes exactly where the
 * first line starts, whatever the card height.
 *
 * The panel is left neutral white on purpose: because it is translucent, each photograph's own
 * pastel wash tints it, so the cards keep the individual colour they were prepared with instead
 * of all being pushed towards one house tint.
 *
 * 0.7 is the floor for dark text over a black photograph, which is the worst case now that the
 * polarity is inverted, and it deepens to 0.8 behind the name, description and button.
 */
.sl-review-card--has-image .sl-review-card__body {
  padding-top: 3.5rem;
  color: #212529;
  background: linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0) 0,
    rgba(255, 255, 255, 0.7) 3.5rem,
    rgba(255, 255, 255, 0.8) 100%
  );
}

/* Continues the foot of the body gradient, so the two read as one block. */
.sl-review-card--has-image .sl-review-card__footer {
  background-color: rgba(255, 255, 255, 0.8);
}

/* Muted enough to sit under the name, but not the #6c757d the opaque cards can afford. */
.sl-review-card--has-image .sl-review-card__role {
  color: #343a40;
}

@media (min-width: 768px) {
  .sl-review-card--has-image {
    min-height: 26rem;
  }
}

@media (min-width: 992px) {
  .sl-review-card--has-image {
    min-height: 28rem;
  }
}

/*
 * Text-only cards have no image to balance the quote against, so they get a light tint of
 * the brand colour and centre the testimonial in the card instead of reserving empty space.
 *
 * The colour alone defines the card, so the border is made transparent rather than removed:
 * keeping the 1px leaves the box model identical to an image card, and the background paints
 * under it anyway. The tint rules below deliberately set no border-colour of their own, since
 * being two classes deep they would outrank this one.
 */
.sl-review-card--no-image {
  background-color: rgba(var(--bs-primary-rgb), 0.04);
  border-color: transparent;
}

/*
 * Editorial background colour, set per article through the Baggrundsfarve field. The alpha is
 * tuned per hue rather than shared, because the brand colours differ a lot in lightness:
 * --bs-info (195,240,240) and --bs-warning (245,245,115) are already near-white and need a high
 * alpha to register at all, while --bs-success (73,167,73) is a full-strength green that has to
 * stay far back to keep the default dark body text legible. Every tint here resolves to a very
 * light wash over white, so the card never inverts to light-on-dark.
 * Both classes are required in the selector so the tint cannot leak onto an image card.
 */
.sl-review-card--no-image.sl-review-card--tint-info {
  background-color: rgba(var(--bs-info-rgb), 0.55);
}

.sl-review-card--no-image.sl-review-card--tint-lightgreen {
  background-color: rgba(var(--bs-lightgreen-rgb), 0.4);
}

.sl-review-card--no-image.sl-review-card--tint-pink {
  background-color: rgba(var(--bs-pink-rgb), 0.45);
}

.sl-review-card--no-image.sl-review-card--tint-warning {
  background-color: rgba(var(--bs-warning-rgb), 0.45);
}

.sl-review-card--no-image.sl-review-card--tint-success {
  background-color: rgba(var(--bs-success-rgb), 0.18);
}

.sl-review-card--no-image .sl-review-card__body {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  justify-content: center;
  padding: 2.5rem 2rem;
  text-align: center;
}

.sl-review-card--no-image .sl-review-card__quote,
.sl-review-card--no-image .sl-review-card__title {
  font-size: 1.375rem;
  line-height: 1.45;
}

.sl-review-card--no-image .sl-review-card__footer {
  padding: 0 2rem 2.5rem;
  text-align: center;
}

@media (max-width: 575.98px) {
  .sl-review-card--no-image .sl-review-card__body {
    padding: 2rem 1.5rem;
  }

  .sl-review-card--no-image .sl-review-card__footer {
    padding: 0 1.5rem 2rem;
  }
}

.sl-review-card--linked {
  transition: box-shadow 0.2s ease-in-out, transform 0.2s ease-in-out;
}

.sl-review-card--linked:hover,
.sl-review-card--linked:focus-within {
  box-shadow: 0 5px 30px rgba(0, 0, 0, 0.08);
  transform: scale(1.01);
}

/* The call to action is stretched across the card, so show focus on the card itself. */
.sl-review-card--linked:focus-within {
  outline: 2px solid #212529;
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .sl-review-card--linked {
    transition: none;
  }

  .sl-review-card--linked:hover,
  .sl-review-card--linked:focus-within {
    transform: none;
  }
}
