/*
 * The course page's «Student Reviews» section (course CourseReviews, card
 * #628, the client's final sheet «5. Student Reviews на странице курса —
 * итог», ADR-0101): the heading row with the rating line, the featured review
 * as a big quote on a soft rose panel, then the other reviews in the site's
 * review carousel, and the dialog a card opens.
 *
 * The carousel chrome and the card are the homepage's (`.reviews-carousel*`
 * and `.review-card*` in main.css: the white arrows on the cards' sides on
 * desktop, the right-edge peek fade, the dot pagination); this sheet sizes
 * them for the course column. Every text is 16px or more at every width (the
 * site's type floor, pinned in px — mobile.css shrinks the root on phones).
 */

/* ── The section ─────────────────────────────────────────────────────────── */
/* At the end of the course column: under "What You Will Learn" on desktop,
   after the "Course menu" button on tablets and phones. The column centres
   its items, so the section stretches itself; 32px on top of the column's
   24px gap (56px under the list), 24px on phones (48px). */
.course-reviews {
  align-self: stretch;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  margin-top: 32px;
  color: #131313;
  scroll-margin-top: calc(var(--mobile-header-h, 0px) + 16px);
}

@media (min-width: 1170px) {
  .course-reviews {
    scroll-margin-top: 77px;
  }
}

/* ── Heading row: "Student Reviews  4.9 ★★★★★ 28 reviews" ──────────────── */
/* The heading and its rating line share one baseline (card #628 round 10,
   «Здесь тоже отровнять»): centring the 24px heading against the 16px line
   left the figure and the count 3px above the heading's text. The rating's
   inline-flex baseline is its figure's, so the figure and the count sit on
   the heading's baseline, and the stars stay centred on the figure. */
.course-reviews__head {
  display: flex;
  flex-flow: row wrap;
  align-items: baseline;
  gap: 10px 16px;
  margin-bottom: 20px;
}

.course-reviews__title {
  margin: 0;
  font-size: 24px;
  line-height: 1.25;
  font-weight: 700;
  color: #131313;
}

/* The rating beside the heading: plain text, no backdrop — the figure (600),
   the exact stars and the count (400), 6px then 16px apart, as the product
   page's line (ADR-0099). It wraps under the heading when the row is full. */
.course-reviews__rating {
  display: inline-flex;
  align-items: center;
  font-size: 16px;
  line-height: 22px;
  color: #131313;
  white-space: nowrap;
}

.course-reviews__rating-value {
  font-weight: 600;
}

.course-reviews__rating-count {
  font-weight: 400;
}

.course-reviews__rating .course-reviews__stars {
  margin: 0 16px 0 6px;
}

.course-reviews__stars .star-rating__star,
.course-reviews__stars .star-rating__star svg,
.course-reviews__spotlight-stars .star-rating__star,
.course-reviews__spotlight-stars .star-rating__star svg {
  width: 20px;
  height: 20px;
}

/* ── The big quote ───────────────────────────────────────────────────────── */
.course-reviews__spotlight {
  position: relative;
  box-sizing: border-box;
  margin: 0;
  padding: 32px 36px 28px 96px;
  border-radius: 20px;
  background: linear-gradient(135deg, #fff0fa 0%, #fdf6fb 55%, #f7f3ff 100%);
}

.course-reviews__mark {
  position: absolute;
  left: 30px;
  top: 22px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 96px;
  line-height: 1;
  font-weight: 700;
  color: #e106a4;
  opacity: 0.9;
}

/* The text as written: its own line breaks stay. */
.course-reviews__quote {
  margin: 0 0 22px;
  padding: 0;
  border: 0;
  font-size: 20px;
  line-height: 1.55;
  font-weight: 500;
  color: #131313;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.course-reviews__by {
  display: flex;
  flex-flow: row wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
}

/* ── Who wrote it (the quote, the cards, the dialog); the quote adds when ─ */
.course-review-by {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.course-review-by__who {
  display: flex;
  flex-flow: column nowrap;
  gap: 2px;
  min-width: 0;
}

.course-review-by__name {
  font-size: 16px;
  line-height: 22px;
  font-weight: 600;
  color: #131313;
  overflow-wrap: anywhere;
}

.course-review-by__meta {
  font-size: 16px;
  line-height: 22px;
  color: #131313;
}

.course-reviews__spotlight .course-review-by__avatar {
  width: 56px;
  height: 56px;
  box-shadow: 0 0 0 3px #ffffff;
}

/* ── The carousel ────────────────────────────────────────────────────────── */
/* 16px under the quote: 10px + the slider's own 6px of shadow room. */
.course-reviews__carousel {
  margin-top: 10px;
}

/* Nothing bound to the course means no quote: the carousel follows the
   heading row at once. And the parts that wait for the fetched cards (ADR-0108)
   stay hidden whatever display the chrome gives them. */
.course-reviews__head + .course-reviews__carousel {
  margin-top: 0;
}

.course-reviews[hidden],
.course-reviews__carousel[hidden] {
  display: none;
}

.course-reviews .reviews-carousel .swiper-pagination {
  /* Flush under the slider as before: the round dots' 24px boxes (card #636,
     .carousel-dots in main.css) reach 9px below the line the old dash sat on
     (10px on the compact ≤1169 chrome); the margin hands them back. */
  margin-bottom: -9px;
}

@media screen and (max-width: 1169px) {
  .course-reviews .reviews-carousel .swiper-pagination {
    margin-bottom: -10px;
  }
}

/* The arrows are the homepage carousel's; being real buttons here, they shed
   the browser's button chrome and show a keyboard ring. */
.course-reviews__arrow {
  padding: 0;
  border: 0;
  font: inherit;
}

.course-reviews__arrow:focus-visible {
  outline: 2px solid #e106a4;
  outline-offset: 2px;
}

/* The carousel stops at its ends: a spent arrow fades. */
.course-reviews__arrow.swiper-button-disabled,
.course-reviews__arrow:disabled {
  color: #b8b8c2;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  cursor: default;
}

/* Every card already fits: no arrows to offer. */
.course-reviews__arrow.swiper-button-lock {
  display: none;
}

/* ── The card ────────────────────────────────────────────────────────────── */
.course-review-card {
  position: relative;
  align-items: stretch;
  padding: 20px;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.course-review-card:hover {
  border-color: #dcdce6;
  box-shadow: 0 4px 14px rgba(19, 19, 19, 0.08);
}

.course-review-card .review-card__head {
  min-width: 0;
}

.course-review-card__rate {
  display: flex;
}

/* Four lines, then the shared fade; the review's own line breaks stay. */
.course-review-card__body {
  --fade-lines: 4;
  text-align: left;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

/* The whole card is the button that opens the full review. */
.course-review-card__open {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: transparent;
  cursor: pointer;
}

.course-review-card__open:focus {
  outline: none;
}

.course-review-card__open:focus-visible {
  outline: 2px solid #e106a4;
  outline-offset: -2px;
}

/* ── Full-review dialog ──────────────────────────────────────────────────── */
html.course-review-dialog-open {
  overflow: hidden;
}

.course-review-dialog {
  width: min(560px, calc(100vw - 32px));
  max-width: none;
  max-height: calc(100vh - 48px);
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: #ffffff;
  color: #131313;
  box-shadow: 0 24px 64px rgba(19, 19, 19, 0.25);
  overflow: hidden;
}

.course-review-dialog::backdrop {
  background: rgba(19, 19, 19, 0.5);
}

.course-review-dialog__panel {
  position: relative;
  display: flex;
  flex-flow: column nowrap;
  gap: 14px;
  max-height: calc(100vh - 48px);
  box-sizing: border-box;
  padding: 28px 28px 24px;
  overflow-y: auto;
}

.course-review-dialog__close {
  position: absolute;
  top: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: #f4f5f7;
  color: #131313;
  cursor: pointer;
}

.course-review-dialog__close:hover {
  background: #ebecf0;
}

.course-review-dialog__close:focus {
  outline: none;
}

.course-review-dialog__close:focus-visible {
  outline: 2px solid #e106a4;
  outline-offset: 2px;
}

.course-review-dialog__close svg {
  width: 22px;
  height: 22px;
}

.course-review-dialog__by {
  padding-right: 48px;
}

.course-review-dialog__body {
  font-size: 16px;
  line-height: 1.6;
  color: #131313;
  overflow-wrap: anywhere;
}

.course-review-dialog__body p {
  margin: 0 0 10px;
}

.course-review-dialog__body p:last-child {
  margin-bottom: 0;
}

/* The card's date, copied in under the text at the bottom right, in the
   text's own type (card #628, round 8). An undated review leaves it empty. */
.course-review-dialog__date {
  align-self: flex-end;
  font-size: 16px;
  line-height: 1.6;
  color: #131313;
  white-space: nowrap;
}

.course-review-dialog__date:empty {
  display: none;
}

/* ── Tablets and phones ──────────────────────────────────────────────────── */
@media (max-width: 1169px) {
  .course-reviews__spotlight {
    padding: 28px 28px 24px 84px;
  }

  .course-reviews__mark {
    left: 24px;
    top: 18px;
    font-size: 84px;
  }
}

@media (max-width: 799px) {
  .course-reviews {
    margin-top: 24px;
  }

  .course-reviews__head {
    gap: 10px 12px;
    margin-bottom: 14px;
  }

  .course-reviews__title {
    font-size: 22px;
  }

  .course-reviews__stars .star-rating__star,
  .course-reviews__stars .star-rating__star svg {
    width: 18px;
    height: 18px;
  }

  .course-reviews__spotlight {
    padding: 56px 20px 20px;
    border-radius: 16px;
  }

  .course-reviews__mark {
    left: 18px;
    top: 10px;
    font-size: 72px;
  }

  .course-reviews__quote {
    margin-bottom: 18px;
    font-size: 18px;
  }

  .course-reviews__carousel {
    margin-top: 6px;
  }

  .course-review-card {
    padding: 16px;
  }

  .course-review-dialog__panel {
    padding: 20px 18px 18px;
  }
}
