/**
 * Soft rounded tooltips — Colour Atelier
 * Solid pill + small pointer toward the trigger.
 */

.zmm-pc-swatch[data-tip]::after,
.zmm-pc-root[data-zmm-pc-mode="both"] .zmm-pc-picker-open[data-tip]::after,
.zmm-attr-info-btn[data-tip]::after,
.zoom-related-swatch[data-tip]::after,
#colorModalContent #colorModalShopBtn[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  /* Room for caret (~5px) + small gap to host */
  bottom: calc(100% + 9px);
  transform: translateX(-50%) translateY(3px);
  padding: 5px 11px;
  background: #111;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  font-style: normal;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.25;
  letter-spacing: 0.01em;
  white-space: nowrap;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s ease;
  z-index: 30;
}

/*
 * Caret: only top + side borders (no bottom border — that pushed the tip up).
 * Point sits at `bottom`; base tucks under the pill.
 */
.zmm-pc-swatch[data-tip]::before,
.zmm-pc-root[data-zmm-pc-mode="both"] .zmm-pc-picker-open[data-tip]::before,
.zmm-attr-info-btn[data-tip]::before,
.zoom-related-swatch[data-tip]::before,
#colorModalContent #colorModalShopBtn[data-tip]::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: calc(100% + 4px);
  transform: translateX(-50%) translateY(3px);
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 5px 5px 0 5px;
  border-color: #111 transparent transparent transparent;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s ease;
  z-index: 31;
}

/* Zoom “also in this image” — compact */
.zoom-related-swatch[data-tip]::after {
  font-size: 11px;
  padding: 3px 9px;
  max-width: 180px;
  bottom: calc(100% + 8px);
}

.zoom-related-swatch[data-tip]::before {
  border-width: 4px 4px 0 4px;
  bottom: calc(100% + 4px);
}

/* Shop button may wrap longer copy */
#colorModalContent #colorModalShopBtn[data-tip]::after {
  white-space: normal;
  width: max-content;
  max-width: 220px;
  text-align: center;
  border-radius: 12px;
  padding: 6px 12px;
  font-weight: 500;
}

.zmm-pc-swatch:hover::after,
.zmm-pc-swatch:focus-visible::after,
.zmm-pc-swatch.is-selected[data-tip]::after,
.zmm-pc-swatch:hover::before,
.zmm-pc-swatch:focus-visible::before,
.zmm-pc-swatch.is-selected[data-tip]::before,
.zmm-pc-root[data-zmm-pc-mode="both"] .zmm-pc-picker-open:hover::after,
.zmm-pc-root[data-zmm-pc-mode="both"] .zmm-pc-picker-open:focus-visible::after,
.zmm-pc-root[data-zmm-pc-mode="both"] .zmm-pc-picker-open:hover::before,
.zmm-pc-root[data-zmm-pc-mode="both"] .zmm-pc-picker-open:focus-visible::before,
.zmm-attr-info-btn:hover::after,
.zmm-attr-info-btn:focus-visible::after,
.zmm-attr-info-btn:hover::before,
.zmm-attr-info-btn:focus-visible::before,
.zoom-related-swatch:hover::after,
.zoom-related-swatch:focus-visible::after,
.zoom-related-swatch.is-tip-open::after,
.zoom-related-swatch:hover::before,
.zoom-related-swatch:focus-visible::before,
.zoom-related-swatch.is-tip-open::before,
#colorModalContent #colorModalShopBtn[data-tip]:hover::after,
#colorModalContent #colorModalShopBtn[data-tip]:focus-visible::after,
#colorModalContent #colorModalShopBtn[data-tip]:hover::before,
#colorModalContent #colorModalShopBtn[data-tip]:focus-visible::before {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* Touch: no sticky hover tip; first tap uses .is-tip-open */
@media (hover: none) {
  .zoom-related-swatch:hover::after,
  .zoom-related-swatch:hover::before {
    opacity: 0;
    visibility: hidden;
    transform: translateX(-50%) translateY(3px);
  }

  .zoom-related-swatch.is-tip-open::after,
  .zoom-related-swatch.is-tip-open::before {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
  }

  /* Product attribute help: tip is desktop-only; tap opens the modal */
  .zmm-attr-info-btn:hover::after,
  .zmm-attr-info-btn:hover::before,
  .zmm-attr-info-btn:focus-visible::after,
  .zmm-attr-info-btn:focus-visible::before {
    opacity: 0 !important;
    visibility: hidden !important;
  }
}
