/*
 * Reviews section of the product page, custom layout.
 *
 * Every rule is `:where(.wcar-reviews) .something`: one class of specificity, so any
 * theme rule with a class or attribute wins without !important, and the variables
 * below sit on :where() (no specificity at all). The font is always the theme's.
 */
:where(.wcar-reviews) {
  --wcar-accent: #1f1e1c;
  --wcar-accent-text: #ffffff;
  --wcar-star: #e5a000;
  --wcar-star-empty: rgba(0, 0, 0, 0.32);
  --wcar-surface: #ffffff;
  --wcar-border: rgba(0, 0, 0, 0.12);
  --wcar-muted: rgba(0, 0, 0, 0.62);
  --wcar-soft: rgba(0, 0, 0, 0.05);
  --wcar-ok: #2f6b45;
  --wcar-error: #b42318;
  --wcar-radius: 18px;
  --wcar-radius-control: 999px;
  --wcar-radius-small: 12px;
  --wcar-gap: 24px;
}

@supports (color: color-mix(in srgb, red, blue)) {
  :where(.wcar-reviews) {
    --wcar-star-empty: color-mix(in srgb, currentColor 35%, transparent);
    --wcar-border: color-mix(in srgb, currentColor 14%, transparent);
    --wcar-muted: color-mix(in srgb, currentColor 68%, transparent);
    --wcar-soft: color-mix(in srgb, currentColor 6%, transparent);
  }
}

.wcar-reviews {
  display: flex;
  flex-direction: column;
  gap: var(--wcar-gap);
  font: inherit;
  margin: 0 0 2em;
}

:where(.wcar-reviews) *,
:where(.wcar-reviews) *::before,
:where(.wcar-reviews) *::after {
  box-sizing: border-box;
}

:where(.wcar-reviews) .wcar-reviews__title {
  margin: 0;
}

:where(.wcar-reviews) .wcar-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

:where(.wcar-reviews) .wcar-muted {
  color: var(--wcar-muted);
}

:where(.wcar-reviews) .wcar-notice {
  margin: 0;
  padding: 14px 18px;
  border-radius: var(--wcar-radius-small);
  background: #e6f0e9;
  color: #1f3d2b;
}

/* Buttons */
:where(.wcar-reviews) .wcar-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  margin: 0;
  padding: 0 24px;
  border: 1px solid var(--wcar-accent);
  border-radius: var(--wcar-radius-control);
  background: var(--wcar-accent);
  color: var(--wcar-accent-text);
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
}

:where(.wcar-reviews) .wcar-button:hover {
  opacity: 0.9;
  color: var(--wcar-accent-text);
}

:where(.wcar-reviews) .wcar-button--ghost {
  background: var(--wcar-surface);
  border-color: var(--wcar-border);
  color: inherit;
}

:where(.wcar-reviews) .wcar-button--ghost:hover {
  color: inherit;
  border-color: currentColor;
}

:where(.wcar-reviews) .wcar-button[disabled] {
  opacity: 0.6;
  cursor: progress;
}

:where(.wcar-reviews) .wcar-link-button {
  min-height: 48px;
  padding: 0 8px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

/* Summary */
:where(.wcar-reviews) .wcar-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 28px 40px;
  padding: 28px;
  border: 1px solid var(--wcar-border);
  border-radius: var(--wcar-radius);
  background: var(--wcar-surface);
}

:where(.wcar-reviews) .wcar-summary__overall {
  flex: 1 1 200px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

:where(.wcar-reviews) .wcar-summary__average {
  font-size: 3.5em;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
}

:where(.wcar-reviews) .wcar-summary__count,
:where(.wcar-reviews) .wcar-summary__empty {
  margin: 0;
  color: var(--wcar-muted);
}

:where(.wcar-reviews) .wcar-summary__overall .wcar-button {
  margin-top: 8px;
}

:where(.wcar-reviews) .wcar-summary--empty .wcar-summary__overall {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
}

/* Stars */
:where(.wcar-reviews) .wcar-stars {
  display: inline-flex;
  gap: 2px;
  line-height: 1;
}

:where(.wcar-reviews) .wcar-stars svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--wcar-star-empty);
  stroke-width: 1.5;
  stroke-linejoin: round;
}

:where(.wcar-reviews) .wcar-stars svg.is-on {
  fill: var(--wcar-star);
  stroke: var(--wcar-star);
}

:where(.wcar-reviews) .wcar-star {
  position: relative;
  display: inline-block;
  width: 22px;
  height: 22px;
}

:where(.wcar-reviews) .wcar-star svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 22px;
  height: 22px;
}

:where(.wcar-reviews) .wcar-star__fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 22px;
  overflow: hidden;
  display: block;
}

:where(.wcar-reviews) .wcar-star__fill svg {
  fill: var(--wcar-star);
  stroke: var(--wcar-star);
}

/* Distribution */
:where(.wcar-reviews) .wcar-distribution {
  flex: 2 1 260px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

:where(.wcar-reviews) .wcar-distribution__row {
  display: grid;
  grid-template-columns: 6em minmax(0, 1fr) 3em;
  align-items: center;
  gap: 12px;
  min-height: 36px;
  margin: 0 -8px;
  padding: 0 8px;
  border-radius: 8px;
  color: inherit;
  font-size: 0.9em;
  text-decoration: none;
}

:where(.wcar-reviews) .wcar-distribution__row:hover,
:where(.wcar-reviews) .wcar-distribution__row.is-active {
  background: var(--wcar-soft);
  color: inherit;
}

:where(.wcar-reviews) .wcar-distribution__track {
  display: block;
  height: 8px;
  border-radius: 999px;
  background: var(--wcar-soft);
  overflow: hidden;
}

:where(.wcar-reviews) .wcar-distribution__bar {
  display: block;
  height: 8px;
  background: var(--wcar-star);
}

:where(.wcar-reviews) .wcar-distribution__count {
  text-align: right;
  color: var(--wcar-muted);
}

/* Criteria */
:where(.wcar-reviews) .wcar-criteria {
  flex: 1.6 1 240px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

:where(.wcar-reviews) .wcar-criteria__heading {
  font-size: 0.8em;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--wcar-muted);
}

:where(.wcar-reviews) .wcar-criteria__rating {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

:where(.wcar-reviews) .wcar-criteria__rating strong {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

:where(.wcar-reviews) .wcar-criteria__rating svg {
  width: 16px;
  height: 16px;
  fill: var(--wcar-star);
}

:where(.wcar-reviews) .wcar-criteria__choice {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

:where(.wcar-reviews) .wcar-criteria__bar {
  display: flex;
  gap: 2px;
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
}

:where(.wcar-reviews) .wcar-criteria__part {
  display: block;
  height: 8px;
  background: var(--wcar-accent);
}

:where(.wcar-reviews) .wcar-criteria__part--1 {
  opacity: 0.6;
}

:where(.wcar-reviews) .wcar-criteria__part--2 {
  opacity: 0.35;
}

:where(.wcar-reviews) .wcar-criteria__part--3 {
  opacity: 0.18;
}

:where(.wcar-reviews) .wcar-criteria__legend {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 12px;
  font-size: 0.85em;
  color: var(--wcar-muted);
}

/* Customer photos */
:where(.wcar-reviews) .wcar-customer-photos {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

:where(.wcar-reviews) .wcar-customer-photos__title {
  margin: 0;
  font-size: 1.05em;
}

:where(.wcar-reviews) .wcar-customer-photos__list {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}

:where(.wcar-reviews) .wcar-photo {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 104px;
  height: 104px;
  border-radius: var(--wcar-radius-small);
  overflow: hidden;
  background: var(--wcar-soft);
}

:where(.wcar-reviews) .wcar-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  margin: 0;
}

:where(.wcar-reviews) .wcar-photo--small {
  width: 72px;
  height: 72px;
}

:where(.wcar-reviews) .wcar-photo--more {
  padding: 8px;
  border: 1px solid var(--wcar-border);
  background: var(--wcar-surface);
  color: inherit;
  font-size: 0.85em;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
}

/* Toolbar */
:where(.wcar-reviews) .wcar-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

:where(.wcar-reviews) .wcar-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

:where(.wcar-reviews) .wcar-chip {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  margin: 0;
  padding: 0 16px;
  border: 1px solid var(--wcar-border);
  border-radius: var(--wcar-radius-control);
  background: var(--wcar-surface);
  color: inherit;
  font: inherit;
  font-size: 0.9em;
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
}

:where(.wcar-reviews) .wcar-chip:hover {
  border-color: currentColor;
  color: inherit;
}

:where(.wcar-reviews) .wcar-chip.is-active {
  background: var(--wcar-accent);
  border-color: var(--wcar-accent);
  color: var(--wcar-accent-text);
}

:where(.wcar-reviews) .wcar-sort {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--wcar-muted);
  font-size: 0.9em;
}

:where(.wcar-reviews) .wcar-sort select {
  min-height: 40px;
  width: auto;
  margin: 0;
}

/* Review cards */
:where(.wcar-reviews) .wcar-review-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

:where(.wcar-reviews) .wcar-review-list > li {
  margin: 0;
  padding: 0;
}

:where(.wcar-reviews) .wcar-review-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 24px;
  border: 1px solid var(--wcar-border);
  border-radius: var(--wcar-radius);
  background: var(--wcar-surface);
}

:where(.wcar-reviews) .wcar-review-card__header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

:where(.wcar-reviews) .wcar-avatar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: var(--wcar-soft);
  font-size: 0.85em;
  font-weight: 700;
}

:where(.wcar-reviews) .wcar-review-card__author {
  flex: 1 1 200px;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

:where(.wcar-reviews) .wcar-verified {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.85em;
  color: var(--wcar-ok);
}

:where(.wcar-reviews) .wcar-verified svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

:where(.wcar-reviews) .wcar-review-card__date {
  font-size: 0.9em;
  color: var(--wcar-muted);
}

:where(.wcar-reviews) .wcar-review-card__headline {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
}

:where(.wcar-reviews) .wcar-review-card__title {
  margin: 0;
  font-size: 1.05em;
  line-height: 1.3;
}

:where(.wcar-reviews) .wcar-review-card__text {
  max-width: 72ch;
}

:where(.wcar-reviews) .wcar-review-card__text p {
  margin: 0 0 0.6em;
}

:where(.wcar-reviews) .wcar-review-card__text p:last-child {
  margin-bottom: 0;
}

:where(.wcar-reviews) .wcar-review-card__answers {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

:where(.wcar-reviews) .wcar-answer-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 4px 12px;
  border-radius: var(--wcar-radius-control);
  background: var(--wcar-soft);
  font-size: 0.9em;
}

:where(.wcar-reviews) .wcar-answer-chip__label {
  color: var(--wcar-muted);
}

:where(.wcar-reviews) .wcar-answer-chip strong {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-weight: 600;
}

:where(.wcar-reviews) .wcar-answer-chip svg {
  width: 13px;
  height: 13px;
  fill: var(--wcar-star);
}

:where(.wcar-reviews) .wcar-review-card__photos {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

:where(.wcar-reviews) .wcar-review-card__bought {
  margin: 0;
  font-size: 0.85em;
  color: var(--wcar-muted);
}

:where(.wcar-reviews) .wcar-review-card__reply {
  margin: 4px 0 0;
  padding: 14px 16px;
  border-radius: var(--wcar-radius-small);
  background: var(--wcar-soft);
}

:where(.wcar-reviews) .wcar-review-card__reply p {
  margin: 4px 0 0;
}

:where(.wcar-reviews) .wcar-empty {
  margin: 0;
  color: var(--wcar-muted);
}

:where(.wcar-reviews) .wcar-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px 20px;
}

/* Form */
:where(.wcar-reviews) .wcar-form-panel[hidden] {
  display: none;
}

:where(.wcar-reviews) .wcar-form-box {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 28px;
  border: 1px solid var(--wcar-border);
  border-radius: var(--wcar-radius);
  background: var(--wcar-surface);
}

:where(.wcar-reviews) .wcar-form__head {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

:where(.wcar-reviews) .wcar-form__title {
  margin: 0;
}

:where(.wcar-reviews) .wcar-form__blocked {
  margin: 0;
}

:where(.wcar-reviews) .wcar-form {
  display: flex;
  flex-direction: column;
  gap: 22px;
  margin: 0;
}

:where(.wcar-reviews) .wcar-form__alert {
  margin: 0;
  padding: 12px 16px;
  border-radius: var(--wcar-radius-small);
  background: #fbedea;
  color: #8a1c12;
}

:where(.wcar-reviews) .wcar-form__alert[hidden],
:where(.wcar-reviews) .wcar-field__error[hidden] {
  display: none;
}

:where(.wcar-reviews) .wcar-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

:where(.wcar-reviews) .wcar-field__label {
  padding: 0;
  margin: 0 0 4px;
  font-weight: 600;
}

:where(.wcar-reviews) .wcar-field__hint {
  margin-left: 4px;
  font-size: 0.85em;
  font-weight: 400;
  color: var(--wcar-muted);
}

:where(.wcar-reviews) .wcar-field__help {
  margin: -2px 0 4px;
  font-size: 0.9em;
  color: var(--wcar-muted);
}

:where(.wcar-reviews) .wcar-field__error {
  margin: 0;
  font-size: 0.9em;
  color: var(--wcar-error);
}

/* A theme that styles input[type=text] or textarea with a class keeps its own look. */
:where(.wcar-reviews) .wcar-input {
  width: 100%;
  min-height: 48px;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--wcar-border);
  border-radius: var(--wcar-radius-small);
  background: var(--wcar-surface);
  color: inherit;
  font: inherit;
}

:where(.wcar-reviews) textarea.wcar-input {
  min-height: 120px;
  resize: vertical;
}

:where(.wcar-reviews) .wcar-field.is-invalid .wcar-input {
  border-color: var(--wcar-error);
}

:where(.wcar-reviews) .wcar-stars-input {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  margin-left: -8px;
}

:where(.wcar-reviews) .wcar-stars-input label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: 0;
  border-radius: 8px;
  cursor: pointer;
}

:where(.wcar-reviews) .wcar-stars-input svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: var(--wcar-star-empty);
  stroke-width: 1.5;
  stroke-linejoin: round;
}

:where(.wcar-reviews) .wcar-field.is-invalid .wcar-stars-input svg {
  stroke: var(--wcar-error);
}

:where(.wcar-reviews) .wcar-stars-input label.is-on svg,
:where(.wcar-reviews) .wcar-stars-input input:checked + label svg {
  fill: var(--wcar-star);
  stroke: var(--wcar-star);
}

:where(.wcar-reviews) .wcar-stars-input input:focus-visible + label,
:where(.wcar-reviews) .wcar-chips input:focus-visible + .wcar-chip {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

:where(.wcar-reviews) .wcar-stars-input__word {
  margin-left: 10px;
  font-size: 0.9em;
  color: var(--wcar-muted);
}

:where(.wcar-reviews) .wcar-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

:where(.wcar-reviews) .wcar-chips .wcar-chip {
  min-height: 44px;
  padding: 0 18px;
  font-size: 1em;
  font-weight: 400;
}

:where(.wcar-reviews) .wcar-chips input:checked + .wcar-chip {
  background: var(--wcar-accent);
  border-color: var(--wcar-accent);
  color: var(--wcar-accent-text);
}

:where(.wcar-reviews) .wcar-field.is-invalid .wcar-chip {
  border-color: var(--wcar-error);
}

:where(.wcar-reviews) .wcar-form__identity {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

:where(.wcar-reviews) .wcar-form__cookies {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  font-size: 0.9em;
}

:where(.wcar-reviews) .wcar-form__actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 16px;
  padding-top: 20px;
  border-top: 1px solid var(--wcar-border);
}

:where(.wcar-reviews) .wcar-form__actions .wcar-muted {
  font-size: 0.9em;
}

@media (max-width: 600px) {
  :where(.wcar-reviews) .wcar-summary,
  :where(.wcar-reviews) .wcar-form-box {
    padding: 20px;
  }

  :where(.wcar-reviews) .wcar-review-card {
    padding: 18px;
  }

  :where(.wcar-reviews) .wcar-summary__overall .wcar-button {
    width: 100%;
  }

  :where(.wcar-reviews) .wcar-filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    margin-right: -16px;
    padding-bottom: 4px;
  }

  :where(.wcar-reviews) .wcar-chip {
    flex: none;
  }
}
