/* =========================================================
   Essence Soaps & Candles — reviews.css
   Seeded social-proof UI. Amethyst / plum design system.
   Pairs with reviews-ui.js. Uses tokens from styles.css with fallbacks.
   ========================================================= */

:root {
  --rv-amethyst: var(--amethyst, #7E6BA6);
  --rv-plum:     var(--plum, #4A3B63);
  --rv-heather:  var(--heather, #B9A8D0);
  --rv-gray:     var(--warm-gray, #8A8A8F);
  --rv-stone:    var(--stone, #EDECEF);
  --rv-cream:    var(--cream, #FAF8FB);
  --rv-white:    var(--white, #FFFFFF);
  --rv-star:     #C9A227;          /* warm gold, harmonizes with amethyst */
  --rv-star-empty: rgba(126,107,166,0.22);
}

/* ----------------------------- Stars ----------------------------- */
.rv-star { width: 16px; height: 16px; display: inline-block; vertical-align: middle; }
.rv-star-bg { fill: var(--rv-star-empty); }
.rv-star-fg { fill: var(--rv-star); }
.rv-star-sm { width: 12px; height: 12px; }

/* ----------------------- Compact badge (cards + PDP header) ----------------------- */
.rv-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  line-height: 1;
  font-family: var(--font-body, "Inter", sans-serif);
}
.rv-stars { display: inline-flex; align-items: center; gap: 1px; }
.rv-badge-meta { display: inline-flex; align-items: center; gap: 5px; font-size: 0.8rem; }
.rv-avg { font-weight: 700; color: var(--rv-plum); font-variant-numeric: lining-nums tabular-nums; }
.rv-count { color: var(--rv-gray); font-weight: 500; font-variant-numeric: lining-nums tabular-nums; }

.rv-badge-lg .rv-star { width: 20px; height: 20px; }
.rv-badge-lg .rv-badge-meta { font-size: 0.95rem; }

/* Inside a product card, sit the badge above the price row */
.card-rv { margin: 2px 0 10px; min-height: 16px; }
.shop-card .card-rv { margin: 2px 0 10px; }

/* PDP header placement */
.pd-rv { margin: 0 0 18px; min-height: 20px; }
.pd-rv .rv-badge { cursor: default; }

/* ============================ Full review block ============================ */
.rv-block {
  margin: 8px 0 0;
  padding-top: 26px;
  border-top: 1px solid var(--rv-stone);
}
.rv-block-head { margin-bottom: 22px; }
.rv-block-title {
  font-family: var(--font-head, "Cormorant Garamond", serif);
  font-size: clamp(1.6rem, 3.2vw, 2.1rem);
  color: var(--rv-plum);
  letter-spacing: 0.01em;
  line-height: 1.1;
  margin: 0;
}
.rv-seed-note {
  color: var(--rv-gray);
  font-size: 0.84rem;
  font-style: italic;
  margin: 6px 0 0;
}

/* ----------------------- Summary (avg + distribution) ----------------------- */
.rv-summary {
  display: grid;
  grid-template-columns: minmax(180px, 0.7fr) 1fr;
  gap: 28px;
  align-items: center;
  background: var(--rv-cream);
  border: 1px solid rgba(185,168,208,0.32);
  border-radius: var(--radius, 18px);
  padding: 24px 26px;
  margin-bottom: 28px;
}
.rv-summary-score { text-align: center; }
.rv-summary-avg {
  display: block;
  font-family: var(--font-head, serif);
  font-size: 3.2rem;
  font-weight: 700;
  line-height: 1;
  color: var(--rv-plum);
  font-variant-numeric: lining-nums tabular-nums;
}
.rv-summary-stars { display: inline-flex; gap: 2px; margin: 8px 0 6px; }
.rv-summary-stars .rv-star { width: 19px; height: 19px; }
.rv-summary-count { display: block; color: var(--rv-gray); font-size: 0.86rem; }

.rv-dist { display: grid; gap: 8px; }
.rv-dist-row { display: grid; grid-template-columns: 40px 1fr 28px; align-items: center; gap: 12px; }
.rv-dist-label {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 0.84rem; font-weight: 600; color: var(--rv-gray);
  font-variant-numeric: lining-nums;
}
.rv-dist-track {
  height: 9px;
  background: var(--rv-stone);
  border-radius: 999px;
  overflow: hidden;
}
.rv-dist-fill {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--rv-amethyst), var(--rv-heather));
  border-radius: 999px;
  transition: width 0.6s var(--ease, cubic-bezier(0.22,1,0.36,1));
}
.rv-dist-count { text-align: right; font-size: 0.8rem; color: var(--rv-gray); font-variant-numeric: lining-nums tabular-nums; }

.rv-empty { color: var(--rv-gray); font-style: italic; margin: 0 0 24px; }

/* ----------------------- Review list ----------------------- */
.rv-list { display: grid; gap: 18px; margin: 0 0 34px; }
.rv-item {
  background: var(--rv-white);
  border: 1px solid rgba(185,168,208,0.28);
  border-radius: var(--radius, 18px);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm, 0 2px 10px rgba(74,59,99,0.06));
}
.rv-item-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.rv-avatar {
  width: 38px; height: 38px; flex-shrink: 0;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-head, serif);
  font-weight: 700; font-size: 1.05rem;
  color: var(--rv-white);
  background: linear-gradient(135deg, var(--rv-amethyst), var(--rv-plum));
}
.rv-item-who { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.rv-name { font-weight: 600; color: var(--rv-plum); font-size: 0.96rem; }
.rv-item-stars { display: inline-flex; gap: 1px; }
.rv-item-stars .rv-star { width: 14px; height: 14px; }
.rv-date { color: var(--rv-gray); font-size: 0.78rem; white-space: nowrap; align-self: flex-start; }
.rv-body { color: var(--charcoal, #2C2C30); margin: 0; font-size: 0.95rem; line-height: 1.6; }

/* ----------------------- Write-a-review form ----------------------- */
.rv-form {
  background: var(--rv-cream);
  border: 1px solid rgba(185,168,208,0.32);
  border-radius: var(--radius-lg, 28px);
  padding: 26px 28px 30px;
}
.rv-form-title {
  font-family: var(--font-head, serif);
  font-size: 1.5rem; color: var(--rv-plum);
  margin: 0 0 18px;
}
.rv-field { margin-bottom: 16px; display: flex; flex-direction: column; gap: 7px; }
.rv-field label, .rv-field-label {
  font-size: 0.82rem; font-weight: 600; letter-spacing: 0.02em;
  color: var(--rv-plum); text-transform: uppercase;
}
.rv-field input[type="text"],
.rv-field textarea {
  font-family: var(--font-body, "Inter", sans-serif);
  font-size: 0.96rem;
  color: var(--charcoal, #2C2C30);
  background: var(--rv-white);
  border: 1.5px solid rgba(185,168,208,0.5);
  border-radius: 12px;
  padding: 12px 14px;
  width: 100%;
  transition: border-color 0.2s var(--ease, ease), box-shadow 0.2s var(--ease, ease);
}
.rv-field textarea { resize: vertical; min-height: 96px; }
.rv-field input[type="text"]:focus,
.rv-field textarea:focus {
  outline: none;
  border-color: var(--rv-amethyst);
  box-shadow: 0 0 0 3px rgba(126,107,166,0.16);
}

/* star rating input (reverse-ordered radios → hover/checked fills left) */
.rv-rating-input {
  display: inline-flex;
  flex-direction: row-reverse;
  justify-content: flex-end;
  gap: 4px;
}
.rv-rating-input input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.rv-rating-input label { cursor: pointer; line-height: 0; }
.rv-rating-input label svg { width: 30px; height: 30px; fill: var(--rv-star-empty); transition: fill 0.15s var(--ease, ease), transform 0.15s var(--ease, ease); }
.rv-rating-input label:hover svg,
.rv-rating-input label:hover ~ label svg,
.rv-rating-input input:checked ~ label svg { fill: var(--rv-star); }
.rv-rating-input label:hover svg { transform: scale(1.12); }
.rv-rating-input input:focus-visible + label svg { outline: 2px solid var(--rv-amethyst); outline-offset: 2px; border-radius: 4px; }

.rv-form-msg { font-size: 0.88rem; margin: 4px 0 14px; font-weight: 500; }
.rv-form-msg.is-ok { color: var(--rv-amethyst); }
.rv-form-msg.is-err { color: #B23A48; }
.rv-submit { margin-top: 4px; }

/* ----------------------- Responsive ----------------------- */
@media (max-width: 640px) {
  .rv-summary { grid-template-columns: 1fr; gap: 20px; text-align: center; }
  .rv-summary-avg { font-size: 2.7rem; }
  .rv-item-head { flex-wrap: wrap; }
  .rv-date { width: 100%; margin-left: 50px; }
  .rv-form { padding: 22px 20px 26px; }
}

@media (prefers-reduced-motion: reduce) {
  .rv-dist-fill, .rv-rating-input label svg { transition: none; }
}
