/* Save/share nudge — small corner popup on listing pages (see
   js/listing-save-share-nudge.js for the trigger mechanic). Styled strictly
   from the shared popup + palette tokens so it reads as the same family as
   the share modal and toasts. */

.listing-ssn {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 9600;
  width: min(300px, calc(100vw - 28px));
  padding: 18px 18px 16px;
  background: var(--popup-bg, var(--color-cream));
  border: 1px solid var(--popup-border, var(--color-line));
  border-radius: var(--popup-radius, 22px);
  box-shadow: var(--popup-shadow, 0 18px 44px rgba(35, 32, 48, 0.18));
  color: var(--color-ink);
  opacity: 0;
  transform: translateY(14px) scale(0.97);
  transition: opacity 0.24s ease, transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}

.listing-ssn.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.listing-ssn__close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
}

.listing-ssn__close:hover,
.listing-ssn__close:focus-visible {
  background: var(--color-sand-dark);
}

.listing-ssn__close-icon {
  width: 12px;
  height: 12px;
  display: block;
}

.listing-ssn__title {
  margin: 0 26px 14px 2px;
  font-family: var(--font-heading);
  font-size: 15.5px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--color-ink);
}

.listing-ssn__actions {
  display: flex;
  justify-content: center;
  gap: 12px;
}

/* Canonical site pill: a background layer scales via ::before on hover while
   the icon+label stay pixel-stable (no jitter) — same pattern as
   .listing-page__cta / .cat-filters__sort. */
.listing-ssn__pill {
  flex: 1 1 0;
  min-width: 0;
  border: 0;
  border-radius: 999px;
  padding: 13px 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  position: relative;
  isolation: isolate;
  overflow: visible;
  background: transparent;
  transition: color 0.16s ease;
}

.listing-ssn__pill::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  transform: scale(1);
  transform-origin: center;
  transition: transform 0.18s ease, background-color 0.16s ease;
}

.listing-ssn__pill:hover::before,
.listing-ssn__pill:focus-visible::before {
  transform: scale(1.035);
}

.listing-ssn__pill:active::before {
  transform: scale(0.99);
}

.listing-ssn__pill--save {
  color: var(--color-cream);
}

.listing-ssn__pill--save::before {
  background: var(--color-forest);
}

.listing-ssn__pill--share {
  color: var(--color-ink);
}

.listing-ssn__pill--share::before {
  background: var(--color-sand-dark);
}

/* Icons are the listing's own ink-coloured SVGs, recoloured via mask so the
   save glyph turns cream on the forest pill (project icon convention). */
.listing-ssn__pill-icon {
  display: block;
  flex: 0 0 auto;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}

.listing-ssn__pill-icon--save {
  width: 17px;
  height: 15px;
  background: var(--color-cream);
  -webkit-mask-image: url("/assets/header-icons/card-reaction-heart.svg");
  mask-image: url("/assets/header-icons/card-reaction-heart.svg");
}

.listing-ssn__pill-icon--share {
  width: 16px;
  height: 16px;
  background: var(--color-ink);
  -webkit-mask-image: url("/assets/product-action-icons/share.svg");
  mask-image: url("/assets/product-action-icons/share.svg");
}

.listing-ssn__pill-label {
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  .listing-ssn__pill::before {
    transition: background-color 0.16s ease;
  }
  .listing-ssn__pill:hover::before,
  .listing-ssn__pill:focus-visible::before,
  .listing-ssn__pill:active::before {
    transform: none;
  }
}

/* Mobile: sit above the bottom tab bar and the floating Buy pill. */
@media (max-width: 900px) {
  .listing-ssn {
    right: 14px;
    bottom: calc(var(--mobile-bottom-nav-height, 72px) + 78px + env(safe-area-inset-bottom, 0px));
  }
}
