/* assets/profile-pins.css — Profile PINS overlay (Decision 14, RFC 2026-05-29)
 *
 * Placement: absolute top-right inside .profile-header (position:relative;
 * overflow:hidden). z-index:2 sits above the ::after gradient (z-index:1)
 * and below modals/menus.
 *
 * Mobile: respects env(safe-area-inset-*); collapses to cap=2 via container
 * query. Touch targets ≥ 44×44px enforced by min-width/min-height.
 *
 * A11y: color is never the sole signal — every pin has a distinct icon+label.
 * Tooltips use role="tooltip"; overflow popover uses role="dialog".
 */

/* ── Overlay container ───────────────────────────────────────────────────────── */

.pp-overlay {
  position: absolute;
  top: calc(8px + env(safe-area-inset-top, 0px));
  right: calc(8px + env(safe-area-inset-right, 0px));
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: flex-start;
  justify-content: flex-end;
  max-width: 60%;          /* never overlaps avatar focal area */
  pointer-events: none;    /* overlay itself passes clicks through */
}

.pp-overlay > * {
  pointer-events: auto;    /* children are interactive */
}

/* ── Pin button ──────────────────────────────────────────────────────────────── */

.pp-pin {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 44px;
  min-height: 44px;
  padding: 5px 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(11, 18, 32, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: rgba(255, 255, 255, 0.82);
  cursor: pointer;
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
  -webkit-tap-highlight-color: transparent;
}

.pp-pin:focus-visible {
  outline: 2px solid rgba(96, 165, 250, 0.9);
  outline-offset: 2px;
}

.pp-pin:hover {
  background: rgba(30, 45, 72, 0.88);
  border-color: rgba(255, 255, 255, 0.28);
  transform: translateY(-1px);
}

.pp-pin:active {
  transform: translateY(0);
}

/* Ensure SVG icons inherit color signal without being sole differentiator */
.pp-pin svg {
  flex-shrink: 0;
  pointer-events: none;
}

/* ── Translator tier variants ────────────────────────────────────────────────── */

.pp-pin--bronze {
  color: #cd7f32;
  border-color: rgba(205, 127, 50, 0.45);
}

.pp-pin--silver {
  color: #c0c0c0;
  border-color: rgba(192, 192, 192, 0.45);
}

.pp-pin--gold {
  color: #ffd700;
  border-color: rgba(255, 215, 0, 0.45);
}

/* Embajador accent: gold + faint rainbow frame */
.pp-pin--embajador.pp-pin--gold {
  border-color: rgba(255, 215, 0, 0.6);
  box-shadow: 0 0 0 1px rgba(167, 139, 250, 0.4);
}

/* Top translator: prestige gold+ */
.pp-pin--top-translator {
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.5);
  background: rgba(30, 25, 10, 0.80);
}

/* Founder: prestige indigo/amber */
.pp-pin--founder {
  color: #a78bfa;
  border-color: rgba(167, 139, 250, 0.45);
}

/* Verified original: teal/cyan */
.pp-pin--verified {
  color: #34d399;
  border-color: rgba(52, 211, 153, 0.4);
}

/* Premium: subtle gold accent */
.pp-pin--premium {
  color: #f59e0b;
  border-color: rgba(245, 158, 11, 0.4);
}

/* ── Tooltip ─────────────────────────────────────────────────────────────────── */

.pp-pin-tooltip {
  position: absolute;
  bottom: calc(100% + 6px);
  right: 0;
  z-index: 10;
  min-width: max-content;
  max-width: 180px;
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(11, 18, 32, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.9);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.3;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.pp-pin-tooltip--visible {
  opacity: 1;
  transform: translateY(0);
}

/* Arrow below tooltip */
.pp-pin-tooltip::after {
  content: "";
  position: absolute;
  top: 100%;
  right: 10px;
  border: 5px solid transparent;
  border-top-color: rgba(11, 18, 32, 0.95);
}

/* ── Overflow chip ───────────────────────────────────────────────────────────── */

.pp-pin--overflow {
  font-size: 12px;
  font-weight: 600;
  gap: 2px;
}

.pp-overflow-count {
  font-variant-numeric: tabular-nums;
}

/* ── Overflow popover (focus-trapped dialog) ─────────────────────────────────── */

.pp-overflow-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 20;
  min-width: 160px;
  padding: 8px 4px;
  border-radius: 10px;
  background: rgba(11, 18, 32, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.48);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.pp-overflow-list {
  list-style: none;
  margin: 0;
  padding: 0 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pp-overflow-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 12px;
  font-weight: 500;
}

.pp-overflow-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.pp-overflow-item-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pp-overflow-close {
  display: block;
  width: calc(100% - 8px);
  margin: 6px 4px 0;
  padding: 5px 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.55);
  font-size: 12px;
  cursor: pointer;
  text-align: center;
  min-height: 32px;
}

.pp-overflow-close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.8);
}

.pp-overflow-close:focus-visible {
  outline: 2px solid rgba(96, 165, 250, 0.9);
  outline-offset: 2px;
}

/* ── Skeleton placeholder ────────────────────────────────────────────────────── */

.pp-overlay--skeleton {
  pointer-events: none;
}

.pp-pin--skel {
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  animation: pp-skel-pulse 1.4s ease-in-out infinite;
  cursor: default;
}

@keyframes pp-skel-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

/* ── Narrow banner: collapse to 2 visible + overflow ────────────────────────── */

@media (max-width: 480px) {
  .pp-overlay {
    max-width: 50%;
    gap: 3px;
  }
  .pp-pin {
    min-width: 44px;
    min-height: 44px;
    padding: 4px 6px;
  }
  .pp-pin-tooltip {
    max-width: 140px;
    font-size: 10px;
  }
}

/* ── Reduced motion ──────────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .pp-pin { transition: none; }
  .pp-pin-tooltip { transition: none; }
  .pp-pin--skel { animation: none; opacity: 0.6; }
}
