/**
 * @file
 * Ratings — star display (active green, empty gray) and the rating
 * summary widget with 5→1 breakdown bars. Also styles fivestar output.
 */

/* ============================================================
   STAR RATING
   ============================================================ */
.rating {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.rating__stars {
  display: inline-flex;
  gap: 2px;
  line-height: 0;
}

.rating__star {
  width: 16px;
  height: 16px;
  display: inline-block;
  background-color: var(--star-empty);
  -webkit-mask: var(--star-mask) center / contain no-repeat;
  mask: var(--star-mask) center / contain no-repeat;
}

.rating__star--full {
  background-color: var(--star-active);
}

/* Half star: green left, gray right */
.rating__star--half {
  background-color: var(--star-empty);
  background-image: linear-gradient(90deg, var(--star-active) 50%, var(--star-empty) 50%);
}

:root {
  --star-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2.5l2.9 5.9 6.5.95-4.7 4.6 1.1 6.5L12 21.4 6.1 20.45l1.1-6.5L2.5 9.35l6.5-.95z'/%3E%3C/svg%3E");
}

.rating--lg .rating__star { width: 20px; height: 20px; }
.rating--sm .rating__star { width: 15px; height: 15px; }

/* Interactive star input (comment/review form) */
.star-input__stars {
  display: inline-flex;
  gap: 4px;
  margin-top: 4px;
}

.star-input__star {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  line-height: 0;
}

.star-input__star::before {
  content: "";
  display: block;
  width: 100%;
  height: 100%;
  background-color: var(--star-empty);
  -webkit-mask: var(--star-mask) center / contain no-repeat;
  mask: var(--star-mask) center / contain no-repeat;
  transition: background-color 0.1s ease;
}

.star-input__star.is-on::before {
  background-color: var(--star-active);
}

.star-input__star:focus-visible {
  outline: 2px solid var(--blue-600);
  outline-offset: 2px;
  border-radius: 4px;
}

.rating__value {
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--ink-700);
}

.rating__value strong {
  font-weight: var(--weight-semibold);
}

.rating__count {
  color: var(--gray-500);
}

/* ============================================================
   RATING SUMMARY WIDGET (sidebar)
   ============================================================ */
.rating-summary__head {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-3);
}

.rating-summary__score {
  font-family: var(--font-display);
  font-weight: var(--weight-bold);
  font-size: 2.5rem;
  color: var(--ink-900);
  line-height: 1;
}

.rating-summary__count {
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--gray-500);
  margin-top: 4px;
}

.rating-bar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: 6px 0;
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--gray-500);
}

.rating-bar__label {
  width: 12px;
  flex: none;
}

.rating-bar__track {
  height: 7px;
  border-radius: 4px;
  background: var(--surface-100);
  overflow: hidden;
  flex: 1;
}

.rating-bar__fill {
  height: 100%;
  background: var(--green-600);
}

/* ============================================================
   FIVESTAR MODULE OVERRIDES
   ============================================================ */
.fivestar-widget .star,
.fivestar-static-form .star {
  background: none;
}

.fivestar-widget .star a,
.field--type-fivestar .star {
  color: var(--star-empty);
}

.fivestar-widget .star.on a,
.fivestar-widget .star.hover a {
  color: var(--star-active);
}
