/* ========================================================================
   Bewertungen — the section on the product page, the shop-wide list
   (/reviews) and the form customers write in.
   ======================================================================== */

.product-reviews {
  --review-star: #e8a020;
  padding-block: 56px;
  /* No colour and no rule of its own: the page's background runs through. */
  background: transparent;
}

.product-reviews--page {
  border-top: 0;
  padding-block: 32px 64px;
}

.product-reviews .section-head {
  margin-bottom: 36px;
}

/* A quiet kicker in warm sand, the heading, and a lead line under it. */
.product-reviews__head {
  max-width: 760px;
  gap: 10px;
}

.product-reviews__head .section-kicker {
  color: #ac9c86;
  letter-spacing: 0.24em;
}

.product-reviews__head .section-title {
  font-size: clamp(30px, 3vw, 38px);
  letter-spacing: -0.045em;
}

.product-reviews__head .section-text {
  max-width: 620px;
  margin-top: 2px;
  color: #676665;
  line-height: 1.55;
  letter-spacing: -0.015em;
}

.product-reviews__thanks {
  margin-bottom: 24px;
}

/* ---- Overview: score · bars · write ---------------------------------- */

/* The summary straight on the page: three columns, a fine upright rule
   between them, and the list's own line underneath. */
.product-reviews__overview {
  display: grid;
  grid-template-columns: auto minmax(0, 340px) minmax(0, 1fr);
  align-items: center;
  gap: 24px 0;
  padding-bottom: 36px;
}

.product-reviews__overview > * {
  padding-inline: 44px;
}

.product-reviews__overview > :first-child {
  padding-left: 0;
}

.product-reviews__overview > * + * {
  border-left: 1px solid var(--line);
}

.product-reviews__summary {
  display: flex;
  align-items: center;
  gap: 16px;
}

.product-reviews__score {
  font-size: 48px;
  font-weight: 800;
  letter-spacing: -0.05em;
  line-height: 1;
}

.product-reviews__summary .caption {
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
}

.product-reviews__write {
  display: grid;
  justify-items: start;
  gap: 10px;
  color: var(--muted);
}

/* ---- The two lists: the product's own reviews and the shop's ----------
   Tabs on a product page (role=tab, switched by js/product/reviews.js),
   plain links on /reviews; the line under them is where the list starts. */

.product-reviews__tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 26px;
  border-bottom: 1px solid var(--line);
}

.product-reviews__tab {
  position: relative;
  padding: 12px 0 14px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-decoration: none;
  transition: color var(--transition-fast);
}

.product-reviews__tab:hover {
  color: var(--text);
}

.product-reviews__tab[aria-selected="true"],
.product-reviews__tab[aria-current="page"] {
  color: var(--text);
}

.product-reviews__tab[aria-selected="true"]::after,
.product-reviews__tab[aria-current="page"]::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}

.product-reviews__tab:focus-visible {
  outline: 2px solid var(--header-accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Under the tabs the line is theirs. */
[role="tabpanel"] .product-reviews__list,
.product-reviews__tabs ~ .product-reviews__list {
  border-top: 0;
}

/* ---- Stars: an empty row with a filled one clipped on top ------------ */

.review-stars {
  position: relative;
  display: inline-block;
  /* Exactly five stars wide, also as a grid or flex item — the fill is a
     share of this width, so a stretched box would overstate the rating. */
  width: max-content;
  justify-self: start;
  font-size: 16px;
  line-height: 1;
  letter-spacing: 2px;
  white-space: nowrap;
}

.review-stars--lg {
  font-size: 22px;
}

.review-stars__base {
  color: rgba(30, 33, 29, 0.18);
}

.review-stars__fill {
  position: absolute;
  inset: 0 auto 0 0;
  overflow: hidden;
  width: calc(var(--rating-pct, 0) * 1%);
  color: var(--review-star, #e8a020);
}

/* ---- Distribution ----------------------------------------------------- */

.rating-bars {
  display: grid;
  gap: 6px;
  margin: 0;
  list-style: none;
}

.rating-bars__row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 28px;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.rating-bars__label {
  color: var(--muted);
  white-space: nowrap;
}

.rating-bars__track {
  height: 8px;
  overflow: hidden;
  border-radius: var(--radius-pill);
  background: rgba(30, 33, 29, 0.08);
}

.rating-bars__fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--review-star, #e8a020);
}

.rating-bars__count {
  color: var(--soft);
  text-align: right;
}

/* ---- A review: one column, top down ----------------------------------
   The stars, who wrote it (name with "Verifizierter Kauf" beside it, the
   date under it), then what they said; a fine line between reviews. */

.product-reviews__list {
  display: grid;
  border-top: 1px solid var(--line);
  transition: opacity var(--transition-fast);
}

/* While the next page of them loads (js/product/reviews.js). */
.product-reviews__page[aria-busy="true"] .product-reviews__list {
  opacity: 0.5;
}

.product-review {
  display: grid;
  gap: 14px;
  padding: 26px 0;
  border-bottom: 1px solid var(--line);
}

/* Who wrote it top left, the stars top right. */
.product-review__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.product-review__head .review-stars {
  flex: none;
  margin-top: 4px;
}

.product-review__who {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

/* The author's initial in a round badge, in the shop's sage. */
.product-review__avatar {
  display: grid;
  flex: none;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--header-accent-soft);
  color: var(--accent);
  font-size: 17px;
  font-weight: 700;
  line-height: 1;
}

.product-review__byline {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.product-review__name {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
}

.product-review__author {
  font-weight: 700;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}

.product-review__verified {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px 3px 7px;
  border: 1px solid rgba(47, 125, 79, 0.28);
  border-radius: var(--radius-pill);
  background: var(--success-soft);
  color: var(--success);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
}

.product-review__date {
  color: var(--soft);
  font-size: 13px;
}

.product-review__content {
  min-width: 0;
}

@media (max-width: 749px) {

  .product-review {
    padding: 22px 0;
  }
}

.product-review__product {
  margin-bottom: 6px;
  font-size: 13px;
}

.product-review__product a {
  color: var(--header-accent);
  font-weight: 700;
}

.product-review__title {
  margin-bottom: 6px;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.product-review__body {
  color: var(--muted);
  line-height: 1.6;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.product-review__reply {
  margin-top: 14px;
  padding: 12px 14px;
  border-left: 3px solid var(--header-accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--header-accent-soft);
}

.product-review__reply-label {
  margin-bottom: 4px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--header-accent);
}

.product-review__reply-text {
  line-height: 1.55;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

/* ---- Photos with a review ---------------------------------------------- */

.product-review__photos {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.product-review__photo {
  display: block;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  transition: border-color var(--transition-fast);
}

.product-review__photo:hover,
.product-review__photo:focus-visible {
  border-color: var(--header-accent);
}

.product-review__photo img {
  display: block;
  width: 88px;
  height: 88px;
  object-fit: cover;
}

/* A photo large over the page (js/product/review-photos.js). The margin
   is what centres a modal dialog; the reset in base/reset.css takes it. */
.review-lightbox {
  max-width: min(92vw, 1100px);
  max-height: 92vh;
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  overflow: visible;
}

.review-lightbox::backdrop {
  background: rgba(30, 33, 29, 0.8);
}

.review-lightbox__img {
  display: block;
  max-width: min(92vw, 1100px);
  max-height: 86vh;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
}

.review-lightbox__close {
  position: absolute;
  top: -14px;
  right: -14px;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
}

.review-lightbox__figure {
  margin: 0;
}

/* "2 von 3" under the photo, on the dark around it — only with more than one. */
.review-lightbox__count {
  margin-top: 10px;
  color: rgba(255, 253, 249, 0.85);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.review-lightbox__nav {
  position: absolute;
  top: calc(50% - 38px);
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0 0 3px;
  border: 0;
  border-radius: 50%;
  background: var(--surface);
  color: var(--accent);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
}

.review-lightbox__nav[hidden] {
  display: none;
}

.review-lightbox__nav--previous {
  left: -64px;
}

.review-lightbox__nav--next {
  right: -64px;
}

.review-lightbox__nav:hover,
.review-lightbox__close:hover {
  background: var(--accent);
  color: var(--white);
}

/* No room beside the photo: the arrows sit on its edges. */
@media (max-width: 1239px) {
  .review-lightbox__nav--previous {
    left: 10px;
  }

  .review-lightbox__nav--next {
    right: 10px;
  }
}

@media (max-width: 599px) {
  .review-lightbox__close {
    top: 8px;
    right: 8px;
  }
}

/* ---- The form ---------------------------------------------------------- */

.review-write {
  padding-block: 32px 72px;
}

.review-write__inner {
  max-width: 720px;
}

.review-write__back {
  display: inline-block;
  margin-bottom: 20px;
  color: var(--muted);
  font-size: 14px;
}

.review-write__back:hover {
  color: var(--header-accent);
}

.review-write__product {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.review-write__product img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.review-write__title {
  margin-top: 4px;
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.review-write .form__banner {
  margin-bottom: 20px;
}

.review-form {
  display: grid;
  gap: 16px;
}

.review-form .form__hint {
  margin-top: -8px;
}

.review-form__verified {
  color: var(--success);
  font-size: 14px;
  font-weight: 700;
}

.review-form__consent {
  color: var(--soft);
  font-size: 13px;
  line-height: 1.55;
}

.review-form__consent a {
  color: inherit;
  text-decoration: underline;
}

.review-write__withdraw {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

/* Photos: tiles the size they will have under the review — the review's own,
   the new ones, and the tile that adds more (the label of the file input). */
.review-photos {
  display: grid;
  gap: 12px;
  margin: 6px 0 4px;
  padding: 0;
  border: 0;
}

/* "Fotos (optional)" with the count at the other end of the line. */
.review-photos__legend {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  margin-bottom: 12px;
  font-weight: 700;
}

.review-photos__optional {
  color: var(--muted);
  font-weight: 400;
}

/* How many there are, of how many a review can carry. */
.review-photos__count {
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

.review-photos__tray {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.review-photos__tile {
  position: relative;
  width: 88px;
  height: 88px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.review-photos__tile img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: inherit;
  transition: opacity var(--transition-fast);
}

/* The × in the corner takes a photo out: a checkbox for the review's own,
   a button for new ones. */
.review-photos__drop {
  position: absolute;
  top: -8px;
  right: -8px;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
  color: var(--accent);
  font: inherit;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.review-photos__drop:hover {
  background: var(--accent);
  color: var(--white);
}

.review-photos__drop:focus-visible,
.review-photos__drop:has(input:focus-visible) {
  outline: 2px solid var(--header-accent);
  outline-offset: 2px;
}

/* Marked to come out: it stays in the tray, faded, until the form is sent;
   another click on the × keeps it. */
.review-photos__note {
  position: absolute;
  inset: auto 6px 6px;
  display: none;
  padding: 3px 6px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}

.review-photos__tile:has(input:checked) img {
  opacity: 0.35;
}

.review-photos__tile:has(input:checked) .review-photos__note {
  display: block;
}

/* Marked, the × turns into ↺: one more click keeps the photo. */
.review-photos__keep-icon,
.review-photos__tile:has(input:checked) .review-photos__drop-icon {
  display: none;
}

.review-photos__tile:has(input:checked) .review-photos__keep-icon {
  display: inline;
}

/* A new photo still being made smaller for sending. */
.review-photos__tile.is-busy img {
  opacity: 0.5;
}

/* The tile that adds photos — the one place in the form that asks for something. */
.review-photos__add {
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 4px;
  width: 100%;
  height: 100%;
  border: 1.5px dashed var(--header-accent);
  border-radius: inherit;
  background: var(--surface);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
  transition: background-color var(--transition-fast);
}

.review-photos__add svg {
  color: var(--header-accent);
}

.review-photos__add:hover,
.review-photos__tile--add.is-over .review-photos__add {
  border-style: solid;
  background: var(--header-accent-soft);
}

.review-photos__tile--add:has(input:focus-visible) .review-photos__add {
  outline: 2px solid var(--header-accent);
  outline-offset: 2px;
}

.review-photos__tile--add[hidden] {
  display: none;
}

.review-photos__error {
  color: var(--danger);
  font-size: 13px;
  font-weight: 700;
}

/* Stars to click. The radios stay in the DOM (keyboard, screen readers);
   reversed order + row-reverse lets "~" light every star up to the choice. */

.star-input {
  margin: 0;
  padding: 0;
  border: 0;
}

.star-input__legend {
  margin-bottom: 8px;
  font-weight: 700;
}

.star-input__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 16px;
}

/* The chosen stars in a word, or the ones under the pointer (review-form.js). */
.star-input__value {
  min-height: 1.4em;
  color: var(--accent);
  font-weight: 700;
}

.star-input__stars {
  position: relative;
  display: inline-flex;
  flex-direction: row-reverse;
  gap: 4px;
}

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

.star-input__star {
  cursor: pointer;
  font-size: 38px;
  line-height: 1;
  color: rgba(30, 33, 29, 0.18);
  transition: color 0.12s ease, transform 0.12s ease;
}

.star-input__radio:checked ~ .star-input__star {
  color: #e8a020;
}

/* While the pointer is over the row, it shows what a click would choose. */
.star-input__stars:hover .star-input__radio ~ .star-input__star {
  color: rgba(30, 33, 29, 0.18);
}

.star-input__stars:hover .star-input__star:hover,
.star-input__stars:hover .star-input__star:hover ~ .star-input__star {
  color: #e8a020;
}

.star-input__star:hover {
  transform: scale(1.08);
}

.star-input__radio:focus-visible + .star-input__star {
  outline: 2px solid var(--header-accent);
  outline-offset: 3px;
  border-radius: 6px;
}

.star-input--error .star-input__legend {
  color: var(--danger, #b3261e);
}

@media screen and (max-width: 989px) {
  /* One column: the rules lie between the parts instead of beside them. */
  .product-reviews__overview {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    padding-bottom: 8px;
  }

  .product-reviews__overview > * {
    padding: 0 0 22px;
  }

  .product-reviews__overview > * + * {
    padding-top: 22px;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .rating-bars {
    max-width: 360px;
  }
}

@media screen and (max-width: 749px) {
  .product-reviews {
    padding-block: 40px;
  }

  .product-reviews__score {
    font-size: 40px;
  }
}
