/* MILOS Development: reviews (change 25)

   Load after styles.css on two pages:
     - the homepage, for published reviews in "What homeowners say"
     - review/index.html, the "Leave a review" page
   Uses the colour, type and spacing tokens defined at the top of styles.css. */

/* ---------- Stars (shared) ---------- */
.stars { display: flex; align-items: center; gap: 3px; }
.stars svg { flex: none; width: 18px; height: 18px; }
.stars .on { fill: var(--gold); stroke: var(--gold); }
.stars .off { fill: none; stroke: var(--placeholder); }


/* ---------- Homepage: published reviews in "What homeowners say" ---------- */
.reviews__feature { margin-top: 18px; }
.review { margin: 0; }
.review__text { margin: 0; }
.review__text p { font-size: 16px; line-height: 1.65; color: var(--charcoal); white-space: pre-line; }
.review__text p + p { margin-top: 12px; }
.review--feature .review__text p { font-size: 18px; line-height: 1.6; font-weight: 500; color: var(--primary); }
.review__by { display: grid; justify-items: start; gap: 10px; margin-top: 18px; }
.review__who { display: grid; gap: 2px; }
.review__name { font-size: 15px; line-height: 1.4; font-weight: 600; color: var(--primary); }
.review__meta { font-size: 14px; line-height: 1.5; color: var(--caption); }
.review__quote { display: block; width: 24px; height: 19px; margin-bottom: 14px; }

/* the invitation to leave a review moves under the newest review */
.has-reviews .reviews__invite { margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--line); }

/* the other reviews, under the card */
.reviews__list { margin-top: 16px; display: grid; gap: 16px; }
.reviews__list > li { min-width: 0; }
.reviews__list .review {
  height: 100%;
  padding: 24px 22px;
  background: var(--ivory); border: 1px solid var(--line); border-radius: 20px;
}
.reviews__list .review:focus { outline: none; }
.reviews__list .review:focus-visible { outline: 2px solid var(--ocean); outline-offset: 3px; }
.reviews__more-wrap { display: flex; justify-content: center; }
.reviews__more { margin-top: 24px; }

/* columns follow the number of reviews, so a short row never leaves an empty gap (data-count is set by reviews-feed.js) */
@media (min-width: 768px) {
  .reviews__list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .reviews__list[data-count="1"] { grid-template-columns: minmax(0, 1fr); }
}
@media (min-width: 960px) {
  .reviews__feature { margin-top: 24px; }
  .review__text p { font-size: 17px; line-height: 1.7; }
  .review--feature .review__text p { font-size: 21px; line-height: 1.55; letter-spacing: -.005em; }
  .has-reviews .reviews__invite { margin-top: 32px; padding-top: 24px; }
  .reviews__list { margin-top: 24px; gap: 24px; }
  .reviews__list .review { padding: 32px; border-radius: 24px; }
  .reviews__more { margin-top: 32px; }
}
@media (min-width: 1200px) {
  .reviews__list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .reviews__list[data-count="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}


/* ---------- "Leave a review" page ---------- */
.review-page { padding-top: clamp(40px, calc(3.4vw + 26.7px), 96px); }
.review-page__grid { display: grid; gap: 28px; grid-template-areas: "intro" "form" "policy"; }
.review-page__intro { grid-area: intro; }
.review-form { grid-area: form; }
.review-page__policy { grid-area: policy; }

.review-page__title {
  font-size: clamp(34px, calc(27.6px + 1.64vw), 50px);
  line-height: 1.1; letter-spacing: -.02em;
}
.review-page__intro .lede { margin-top: 20px; }

/* how we share reviews */
.review-policy { padding-top: 24px; border-top: 1px solid var(--line); }
.review-policy__title {
  font-size: 12px; line-height: 1; letter-spacing: .18em; text-transform: uppercase;
  font-weight: 600; color: var(--ocean-text);
}
.review-policy__list { margin-top: 16px; display: grid; gap: 12px; }
.review-policy__list li {
  display: flex; align-items: flex-start; gap: 12px;
  font-size: 15.5px; line-height: 1.6; color: var(--muted);
}
.review-policy__list li::before {
  content: ""; flex: none; width: 6px; height: 6px; margin-top: 9px;
  border-radius: 999px; background: var(--gold);
}

/* star rating */
.rating { margin: 0; padding: 0; border: 0; min-width: 0; }
.rating legend { padding: 0; font-size: 14px; line-height: 1.4; font-weight: 600; color: var(--charcoal); }
.rating__row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-top: 10px; }
.rating__stars { position: relative; display: flex; margin-left: -5px; }
.rating__input {
  position: absolute; top: 0; left: 0;
  width: 1px; height: 1px; margin: 0; padding: 0;
  overflow: hidden; clip-path: inset(50%); border: 0; opacity: 0;
}
.rating__star {
  display: flex; align-items: center; justify-content: center;
  width: 44px; height: 48px; border-radius: 12px;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.rating__star svg {
  width: 34px; height: 34px;
  fill: transparent; stroke: var(--placeholder); stroke-width: 1.4; stroke-linejoin: round;
  transition: fill .15s var(--ease), stroke .15s var(--ease), transform .15s var(--ease);
}
.rating__star.is-on svg { fill: var(--gold); stroke: var(--gold); }
.rating__star:hover svg { transform: scale(1.08); }
.rating__input:focus-visible + .rating__star { outline: 2px solid var(--ocean); outline-offset: -3px; }
.rating.is-invalid .rating__star:not(.is-on) svg { stroke: var(--error); }
.rating__value { font-size: 14px; line-height: 1.4; font-weight: 600; color: var(--primary); }
.rating .field__error { margin-top: 2px; }

/* without JavaScript, the chosen star still shows */
.rating:not(.rating--js) .rating__stars:has(.rating__input:nth-of-type(1):checked) .rating__star:nth-of-type(-n+1) svg,
.rating:not(.rating--js) .rating__stars:has(.rating__input:nth-of-type(2):checked) .rating__star:nth-of-type(-n+2) svg,
.rating:not(.rating--js) .rating__stars:has(.rating__input:nth-of-type(3):checked) .rating__star:nth-of-type(-n+3) svg,
.rating:not(.rating--js) .rating__stars:has(.rating__input:nth-of-type(4):checked) .rating__star:nth-of-type(-n+4) svg,
.rating:not(.rating--js) .rating__stars:has(.rating__input:nth-of-type(5):checked) .rating__star:nth-of-type(-n+5) svg {
  fill: var(--gold); stroke: var(--gold);
}

.review-form__text { height: 168px; min-height: 140px; }

/* tick boxes (".checks .check" so the form's ".field label" style doesn't apply) */
.checks { display: grid; }
.checks .check {
  position: relative;
  display: flex; align-items: flex-start; gap: 12px;
  padding: 10px 0;
  font-size: 15px; line-height: 1.5; font-weight: 400; color: var(--charcoal);
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.check__input {
  position: absolute; top: 10px; left: 0;
  width: 22px; height: 22px; margin: 0;
  opacity: 0;
}
.check__box {
  flex: none; position: relative;
  width: 22px; height: 22px; margin-top: 1px;
  border: 1px solid var(--placeholder); border-radius: 6px; background: var(--white);
  transition: background-color .15s var(--ease), border-color .15s var(--ease);
}
.check__box::after {
  content: ""; position: absolute; left: 6px; top: 6px;
  width: 9px; height: 5px;
  border-left: 2px solid var(--white); border-bottom: 2px solid var(--white);
  transform: rotate(-45deg);
  opacity: 0; transition: opacity .15s var(--ease);
}
.check:hover .check__box { border-color: var(--primary); }
.check__input:checked + .check__box { background: var(--primary); border-color: var(--primary); }
.check__input:checked + .check__box::after { opacity: 1; }
.check__input:focus-visible + .check__box { outline: 2px solid var(--ocean); outline-offset: 3px; }
.check__hint { margin: -6px 0 6px 34px; font-size: 13px; line-height: 1.5; color: var(--caption); }

/* thank-you message */
.review-done__title { font-size: 26px; line-height: 1.25; font-weight: 600; letter-spacing: -.01em; color: var(--primary); }
.review-google { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--line); }
.review-google h3 { font-size: 19px; line-height: 1.35; font-weight: 600; color: var(--primary); }
.review-google p { margin-top: 8px; font-size: 16px; line-height: 1.6; }
.review-google__actions { margin-top: 18px; display: grid; gap: 10px; }
.review-google__actions .btn { width: 100%; }
.review-google .review-google__status { min-height: 1.5em; margin-top: 12px; font-size: 14px; line-height: 1.5; font-weight: 600; color: var(--primary); }
.review-google__text { height: 120px; margin-top: 8px; }
.review-done__home { margin-top: 20px; }

/* on touch screens, a tapped outline button shouldn't stay filled in */
@media (hover: none) {
  .review-google .btn--outline:hover { background: transparent; color: var(--primary); }
}
@media (min-width: 640px) {
  .review-google__actions { display: flex; flex-wrap: wrap; gap: 12px; }
  .review-google__actions .btn { width: auto; }
}
@media (min-width: 960px) {
  .review-page__grid {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    grid-template-rows: auto 1fr;
    grid-template-areas: "intro form" "policy form";
    column-gap: clamp(48px, 5.6vw, 80px); row-gap: 40px;
    align-items: start;
  }
  .review-page__intro .lede { margin-top: 28px; }
  .review-policy { padding-top: 32px; }
  .review-policy__list li { font-size: 16px; }
  .review-done__title { font-size: 30px; }
}

/* ---------- Homepage: reviews carousel (two or more reviews, one per slide) ---------- */
/* without JavaScript, every review shows, one under the other */
.review-carousel:not(.is-ready) .review-carousel__slide + .review-carousel__slide {
  margin: 20px 0 0;
}

/* all slides share one place, so the card keeps the height of the longest review */
.review-carousel.is-ready .review-carousel__track {
  display: grid;
}
.review-carousel.is-ready .review-carousel__slide {
  opacity: 0;
  visibility: hidden;
  grid-area: 1 / 1;
  transition: opacity .3s ease, visibility 0s linear .3s;
}
.review-carousel.is-ready .review-carousel__slide.is-active {
  opacity: 1;
  visibility: visible;
  transition: opacity .3s ease;
}

.review-carousel__controls {
  display: flex;
  align-items: center;
  gap: 15px;
  margin: 20px 0 0;
}
.review-carousel__controls[hidden] {
  display: none;
}
.review-carousel__arrow {
  width: 44px;
  height: 44px;
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  border-radius: 1.375rem;
  border: 1px solid rgb(21, 63, 89);
  background: transparent;
  color: rgb(21, 63, 89);
  padding: 0;
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease;
}
.review-carousel__arrow svg {
  width: 20px;
  height: 20px;
}
.review-carousel__arrow:hover {
  background: rgb(21, 63, 89);
  color: rgb(255, 255, 255);
}
.review-carousel__arrow:focus-visible,
.review-carousel__dot:focus-visible {
  outline: 2px solid rgb(78, 130, 152);
  outline-offset: 3px;
}
.review-carousel__dots {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
}
.review-carousel__dot {
  width: 20px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
}
.review-carousel__dot::before {
  width: 10px;
  height: 10px;
  border-radius: .3125rem;
  background: rgb(207, 193, 169);
  content: "";
  transition: background-color .15s ease;
}
.review-carousel__dot[aria-current="true"]::before {
  background: rgb(181, 154, 98);
}
.review-carousel__count {
  font-size: .875rem;
  line-height: 1.5;
  color: rgb(111, 107, 100);
}

@media (hover: none) {
  .review-carousel__arrow:hover {
    background: transparent;
    color: rgb(21, 63, 89);
  }
}
@media (prefers-reduced-motion: reduce) {
  .review-carousel.is-ready .review-carousel__slide,
  .review-carousel.is-ready .review-carousel__slide.is-active {
    transition: none;
  }
}
