/* ==========================================================================
   My Travel — review form and published reviews
   Save as assets/css/reviews.css
   Load after styles.css:
     <link href="<?= CMS_BASE ?>assets/css/reviews.css" rel="stylesheet">
   ========================================================================== */

/* --- Rating summary ----------------------------------------------------- */

.reviews-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--mt-s2);
  margin-bottom: var(--mt-s4);
  font-size: var(--mt-small);
  color: var(--mt-muted);
}

.reviews-summary__score {
  font-family: var(--mt-font-sans);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--mt-ink);
}

/* --- Stars, read-only --------------------------------------------------- */

.stars {
  display: inline-flex;
  gap: 2px;
  font-size: 1rem;
  line-height: 1;
}

.stars__on  { color: #f0a500; }
.stars__off { color: #d8dce5; }

.testimonial-card .stars { margin-bottom: var(--mt-s2); }

/* --- Leave a review ----------------------------------------------------- */

.review-form {
  max-width: 640px;
  margin: var(--mt-s5) auto 0;
  padding: clamp(1.5rem, 1rem + 2vw, 2.5rem);
  background: #fff;
  border: 1px solid var(--mt-line);
  border-radius: var(--mt-radius);
  box-shadow: var(--mt-shadow-sm);
}

.review-form__title {
  font-size: 1.375rem;
  text-align: center;
  margin-bottom: var(--mt-s1);
}

.review-form__note {
  margin-bottom: var(--mt-s4);
  font-size: var(--mt-small);
  color: var(--mt-muted);
  text-align: center;
}

.review-form .form-control {
  min-height: 48px;
  padding: .625rem 1rem;
  font-size: var(--mt-small);
  border-color: #e2e4e8;
  border-radius: var(--mt-radius-sm);
}

.review-form textarea.form-control {
  min-height: 130px;
  resize: vertical;
}

.review-form .form-control:focus {
  border-color: var(--mt-brand);
  box-shadow: 0 0 0 .2rem var(--mt-brand-soft);
}

/* --- Star input ---------------------------------------------------------
   Radio buttons, reversed in the DOM so a plain CSS sibling selector can
   light every star to the left of the hovered one. Radios keep it keyboard
   operable and it submits with no JavaScript at all.
   ------------------------------------------------------------------------ */

.rating {
  display: flex;
  flex-direction: row-reverse;
  justify-content: center;
  gap: 4px;
  margin-bottom: var(--mt-s3);
}

.rating input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.rating label {
  font-size: 2rem;
  line-height: 1;
  color: #d8dce5;
  cursor: pointer;
  transition: color .15s ease, transform .15s ease;
}

.rating label:hover,
.rating label:hover ~ label,
.rating input:checked ~ label {
  color: #f0a500;
}

.rating label:hover { transform: scale(1.12); }

.rating input:focus-visible + label {
  outline: 3px solid var(--mt-brand);
  outline-offset: 2px;
  border-radius: 4px;
}

/* --- Status ------------------------------------------------------------- */

.review-status {
  max-width: 640px;
  margin: 0 auto var(--mt-s3);
  padding: var(--mt-s2);
  border-radius: var(--mt-radius-sm);
  font-size: var(--mt-small);
  line-height: 1.6;
  text-align: center;
}

.review-status--ok  { background: #e7f6ef; color: #1a6b4c; }
.review-status--bad { background: #fdeced; color: #a4252f; }

@media (prefers-reduced-motion: reduce) {
  .rating label { transition: none; }
  .rating label:hover { transform: none; }
}

/* --- Invitation, shown when nothing is published yet -------------------- */

.review-invite {
  max-width: 520px;
  margin-inline: auto;
  padding: var(--mt-s5) var(--mt-s3);
  text-align: center;
}

.review-invite__title {
  font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2rem);
  margin-bottom: var(--mt-s2);
}

.review-invite__text {
  margin-bottom: var(--mt-s3);
  color: var(--mt-body);
}

/* --- Modal -------------------------------------------------------------- */

.modal-content {
  border: 0;
  border-radius: var(--mt-radius);
}

/* The standalone form carried its own card; inside a modal the dialog
   already provides one, so strip it back. */
.review-form--modal {
  max-width: none;
  margin: 0;
  padding: 0;
  background: none;
  border: 0;
  box-shadow: none;
}

/* --- Leave a review, under the carousel --------------------------------
   Secondary to the reviews above it, but not so quiet it reads as
   disabled. A star and a warm tint carry it. */

.btn-review {
  --bs-btn-padding-y: .875rem;
  --bs-btn-padding-x: 1.75rem;
  --bs-btn-font-weight: 700;
  --bs-btn-font-size: .9375rem;
  --bs-btn-border-radius: var(--mt-radius-pill);

  display: inline-flex;
  align-items: center;
  gap: .625rem;
  min-height: 48px;
  color: var(--mt-ink);
  background-color: #fff;
  border: 1px solid var(--mt-line);
  box-shadow: 0 2px 10px rgba(31, 39, 72, .06);
  transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

.btn-review__star {
  font-size: 1.125rem;
  line-height: 1;
  color: #f0a500;
  transition: transform .25s ease;
}

.btn-review:hover {
  color: var(--mt-ink);
  border-color: #f0a500;
  box-shadow: 0 8px 22px rgba(31, 39, 72, .10);
  transform: translateY(-2px);
}

.btn-review:hover .btn-review__star {
  transform: rotate(72deg) scale(1.15);
}

.btn-review:focus-visible {
  outline: 3px solid var(--mt-brand);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  .btn-review,
  .btn-review__star { transition: none; }
  .btn-review:hover { transform: none; }
  .btn-review:hover .btn-review__star { transform: none; }
}

.testimonial-card__note {
  margin: 4px 0 0;
  font-size: .75rem;
  font-style: italic;
  color: var(--mt-muted);
}
