/* Item comments + rating — PARTNER (affiliate) listings only.
   Mirrors the approved .listing-page__review-* palette and the Save-button
   hover (a background layer scales via ::before; text/content never moves, so
   nothing jitters). Real brand avatars come from assets/profile-avatars. */

.jp-comments {
  display: none;
  margin-top: 26px;
  padding-top: 22px;
  border-top: 1px solid rgba(35, 32, 48, 0.12);
}
body.page[data-listing-page-live="1"].is-listing-partner-mode .jp-comments {
  display: block;
}

.jp-comments__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.jp-comments__heading {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 700;
  color: var(--color-ink);
  letter-spacing: -0.01em;
}
.jp-comments__count {
  font-family: var(--font-body, "DM Sans", sans-serif);
  font-size: 14px;
  font-weight: 500;
  color: var(--color-ink-soft, #4A465D);
  margin-left: 4px;
}

/* Rate button — solid forest, Save-style ::before scale (no jitter). */
.jp-comments__rate-btn {
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  min-height: 46px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  /* Gold button (matches the star) with ink text + ink icon. */
  color: var(--color-ink, #232030);
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  overflow: visible;
}
.jp-comments__rate-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: var(--rate-btn-gold, #F19D27);
  transform: scale(1);
  transform-origin: center;
  transition: transform 0.18s ease;
}
.jp-comments__rate-btn:hover::before,
.jp-comments__rate-btn:focus-visible::before {
  transform: scale(1.035);
}
.jp-comments__rate-btn-star {
  width: 16px;
  height: 16px;
  display: block;
  /* Gold star glyph → ink, so it reads on the gold button. */
  filter: brightness(0);
}

/* Rating summary (read-only) */
.jp-comments__summary {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--color-ink-soft, #4A465D);
}
/* The class `display: flex` was overriding the UA `[hidden]{display:none}`, so
   the JS `wrap.hidden = true` (no ratings yet) never actually hid the block —
   it showed a stray "0" beside empty stars. Honour the attribute. */
.jp-comments__summary[hidden] {
  display: none;
}
.jp-comments__summary-stars {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.jp-comments__star {
  width: 15px;
  height: 15px;
  display: block;
}
.jp-comments__star:not(.is-on) { opacity: 0.26; }
.jp-comments__summary-value {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  color: var(--color-ink);
}

/* Avatars — real brand SVG art with the member's initial centred on top. */
.jp-comments__avatar {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 999px;
  background-color: #efe6da;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  user-select: none;
}
.jp-comments__avatar-initial {
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
  color: var(--color-cream, #FFF9F1);
  text-shadow: 0 1px 3px rgba(35, 32, 48, 0.45);
  pointer-events: none;
}
.jp-comments__item--reply .jp-comments__avatar-initial { font-size: 12px; }

/* Composer */
.jp-comments__composer {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin: 14px 0 4px;
}
.jp-comments__composer-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.jp-comments__input {
  width: 100%;
  box-sizing: border-box;
  padding: 11px 14px;
  border: 1.5px solid rgba(35, 32, 48, 0.18);
  border-radius: 14px;
  background: var(--color-sand, #F8F5ED);
  color: var(--color-ink);
  caret-color: var(--color-ink, #232030);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.45;
  resize: none;
  min-height: 44px;
  overflow: hidden;
  transition: border-color 0.16s ease;
}
/* Same focus feel as the auth-popup inputs: forest border + soft green ring. */
.jp-comments__input:focus {
  outline: none;
  border-color: var(--color-forest, #3F6A60);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-forest, #3F6A60) 14%, transparent);
}
.jp-comments__composer-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}
.jp-comments__counter {
  font-size: 12px;
  color: var(--color-ink-soft, #4A465D);
  margin-right: auto;
}
.jp-comments__error {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-alert-red, #E45B5B);
}

/* Cancel — outline, no color change; the outline grows via ::before. */
.jp-comments__cancel {
  position: relative;
  isolation: isolate;
  padding: 9px 20px;
  min-height: 40px;
  border: 0;
  background: transparent;
  color: var(--color-ink);
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 999px;
}
.jp-comments__cancel::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  border: 1.5px solid rgba(35, 32, 48, 0.32);
  transform: scale(1);
  transform-origin: center;
  transition: transform 0.18s ease, border-color 0.16s ease;
}
.jp-comments__cancel:hover::before,
.jp-comments__cancel:focus-visible::before {
  border-color: var(--color-ink);
}

/* Submit — solid ink, ::before scale. */
.jp-comments__submit {
  position: relative;
  isolation: isolate;
  padding: 9px 22px;
  min-height: 40px;
  border: 0;
  background: transparent;
  color: var(--color-cream, #FFF9F1);
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  border-radius: 999px;
}
.jp-comments__submit::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: var(--color-ink, #232030);
  transform: scale(1);
  transform-origin: center;
  transition: transform 0.18s ease, opacity 0.16s ease;
}
.jp-comments__submit:hover:not(:disabled)::before,
.jp-comments__submit:focus-visible:not(:disabled)::before { transform: scale(1.04); }
/* Inactive state = the auth-popup disabled button exactly. */
.jp-comments__submit:disabled {
  color: var(--auth-disabled-text, #6b6577);
  cursor: not-allowed;
}
.jp-comments__submit:disabled::before {
  background: var(--control-disabled-bg, #DCDDD3);
  transform: none;
}

/* Sort toolbar — background fill only, no scale. */
.jp-comments__toolbar {
  display: flex;
  gap: 8px;
  margin: 16px 0 6px;
}
.jp-comments__sort {
  padding: 7px 16px;
  min-height: 36px;
  border: 1.5px solid rgba(35, 32, 48, 0.18);
  border-radius: 999px;
  background: transparent;
  color: var(--color-ink);
  font-family: var(--font-heading);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}
.jp-comments__sort:hover { border-color: rgba(35, 32, 48, 0.4); }
.jp-comments__sort.is-active {
  background: var(--color-ink);
  color: var(--color-cream, #FFF9F1);
  border-color: var(--color-ink);
}

/* Comment items */
.jp-comments__list {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 12px;
}
.jp-comments__item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.jp-comments__item--reply { margin-top: 14px; }
.jp-comments__item--reply .jp-comments__avatar {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
}
.jp-comments__item-body { flex: 1; min-width: 0; }
.jp-comments__item-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.jp-comments__author {
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 700;
  color: var(--color-ink);
}
.jp-comments__time {
  font-size: 12px;
  color: var(--color-ink-soft, #4A465D);
}
.jp-comments__text {
  margin: 4px 0 6px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--color-ink);
  overflow-wrap: anywhere;
}
.jp-comments__item-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Like / Reply — background fill only, no scale (these were the jittery ones). */
.jp-comments__like {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  min-height: 32px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--color-ink-soft, #4A465D);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.16s ease;
}
.jp-comments__like:hover { background: rgba(35, 32, 48, 0.06); }
.jp-comments__like[aria-pressed="true"] { color: var(--color-forest, #3F6A60); }
.jp-comments__like-icon { width: 15px; height: 15px; display: block; }
.jp-comments__reply-btn {
  border: 0;
  background: transparent;
  padding: 5px 10px;
  min-height: 32px;
  font-family: var(--font-heading);
  font-size: 12px;
  font-weight: 700;
  color: var(--color-forest, #3F6A60);
  cursor: pointer;
  border-radius: 999px;
  transition: background-color 0.16s ease;
}
.jp-comments__reply-btn:hover { background: rgba(63, 106, 96, 0.08); }

/* Replies thread */
.jp-comments__replies {
  margin-top: 6px;
  padding-left: 14px;
  border-left: 2px solid rgba(35, 32, 48, 0.1);
}
.jp-comments__reply-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 10px 0 4px;
}

/* Rate-this-item popup — standard JediPic popup tokens. */
.jp-rate-modal {
  position: fixed;
  inset: 0;
  z-index: 12660;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.jp-rate-modal__overlay {
  position: absolute;
  inset: 0;
  background: var(--popup-overlay, rgba(35, 32, 48, 0.52));
}
/* Reuses the canonical .collection-modal shell + close/cancel/create button
   styles (loaded via homepage.css). We only add the popup's own layout. */
.jp-rate-modal__panel {
  position: relative;
  width: 100%;
  max-width: 440px;
  max-height: calc(100dvh - 32px);
  overflow: visible;
  padding: 26px 24px 22px;
  border-radius: var(--popup-radius);
}
.jp-rate-modal__close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
}
.jp-rate-modal__title {
  margin: 0 40px 4px 0;
}
.jp-rate-modal__sub {
  margin: 0 0 14px;
}
.jp-rate-modal__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
}
.jp-rate-modal__row--overall {
  border-bottom: 1px solid rgba(35, 32, 48, 0.12);
  margin-bottom: 4px;
  padding-bottom: 12px;
}
.jp-rate-modal__label {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-ink);
}
.jp-rate-modal__row--overall .jp-rate-modal__label {
  font-family: var(--font-heading);
  font-weight: 700;
}
.jp-rate-modal__stars { display: inline-flex; gap: 4px; }
.jp-rate-modal__star {
  border: 0;
  background: transparent;
  line-height: 0;
  min-width: 34px;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}
.jp-rate-modal__star img {
  width: 26px;
  height: 26px;
  display: block;
  opacity: 0.26;
  transition: opacity 0.14s ease;
}
.jp-rate-modal__star.is-on img { opacity: 1; }
.jp-rate-modal__star:hover img { opacity: 0.85; }
.jp-rate-modal__star.is-on:hover img { opacity: 1; }
.jp-rate-modal__actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
}
/* Cancel/Save reuse .collection-modal__cancel / .collection-modal__create —
   trim their default min-width so they sit neatly in this narrower popup. */
.jp-rate-modal__cancel.collection-modal__cancel {
  min-width: 0;
  padding: 14px 30px;
  min-height: 48px;
  border-radius: 999px;
}
.jp-rate-modal__save.collection-modal__create {
  min-width: 0;
  padding: 14px 32px;
  min-height: 48px;
}

@media (max-width: 760px) {
  .jp-comments__head { align-items: flex-start; }
  .jp-comments__rate-btn { width: 100%; justify-content: center; }
  /* font-size 16px prevents iOS auto-zoom; the longer placeholder wraps to two
     lines at phone width, so give the empty field room for both (it was clipping
     the 2nd line "sizing, quality, gift ideas" under overflow:hidden). */
  .jp-comments__input { font-size: 16px; min-height: 70px; }
  .jp-rate-modal__panel { border-radius: var(--popup-radius); }
}
