/* AnchorPopover — 原消息上下文弹框
 * 基线: 19-Matters-prototype.html#ContextAnchorPopover
 *
 * 色 / 间距 / 圆角全走 --wk-* token, dark mode 自动继承。
 */

.wk-anchor-pop__mask {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: transparent;
}

.wk-anchor-pop {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  min-width: 380px;
  max-width: 480px;
  max-height: 400px;
  z-index: 401;
  background: var(--wk-bg-surface, #fff);
  border: 1px solid var(--wk-border-default, #e4e4e7);
  border-radius: 8px;
  box-shadow: var(
    --wk-shadow-lg,
    0 12px 32px -8px rgb(0 0 0 / 0.2),
    0 8px 16px -4px rgb(0 0 0 / 0.08)
  );
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: wk-anchor-pop-in 0.12s ease-out both;
}

/*
 * is-anchored: 由调用方传了 x/y, 内联 style 已覆盖 top/left/transform 到
 * 按钮坐标。此时关闭居中入场动画 (居中基线下的 translateY 会让浮层多跳一下),
 * 换成轻量的 fade+shift。
 */
.wk-anchor-pop.is-anchored {
  animation: wk-anchor-pop-fade-in 0.12s ease-out both;
}

@keyframes wk-anchor-pop-in {
  from {
    opacity: 0;
    transform: translate(-50%, -48%);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
}

@keyframes wk-anchor-pop-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* ─── Header ────────────────────────────────────────── */
.wk-anchor-pop__head {
  padding: 12px 14px;
  border-bottom: 1px solid var(--wk-border-default, #e4e4e7);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--wk-bg-muted, #fafafa);
  flex-shrink: 0;
}

.wk-anchor-pop__channel {
  font-size: 12px;
  font-weight: 600;
  color: var(--wk-text-primary, #18181b);
  letter-spacing: -0.005em;
}

.wk-anchor-pop__close {
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 5px;
  background: transparent;
  color: var(--wk-text-tertiary, #71717a);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  line-height: 1;
  transition: all 0.12s;
}

.wk-anchor-pop__close:hover {
  background: var(--wk-bg-surface, #fff);
  color: var(--wk-text-primary, #18181b);
}

/* ─── Body ──────────────────────────────────────────── */
.wk-anchor-pop__body {
  padding: 10px 14px;
  overflow-y: auto;
  flex: 1;
  min-height: 80px;
}

.wk-anchor-pop__empty {
  padding: 28px 12px;
  text-align: center;
  font-size: 12px;
  color: var(--wk-text-tertiary, #71717a);
}

.wk-anchor-pop__msg {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 0;
  max-height: 150px;
  overflow: hidden;
}

.wk-anchor-pop__msg + .wk-anchor-pop__msg {
  border-top: 1px solid var(--wk-border-soft, #f4f4f5);
}

.wk-anchor-pop__msg--missing .wk-anchor-pop__msg-content {
  padding-top: 2px;
}

.wk-anchor-pop__msg-time {
  font-size: 10.5px;
  color: var(--wk-text-tertiary, #71717a);
  font-variant-numeric: tabular-nums;
  min-width: 42px;
  flex-shrink: 0;
  padding-top: 3px;
}

.wk-anchor-pop__msg-avatar {
  flex-shrink: 0;
  display: inline-flex;
  margin-top: 1px;
}

.wk-anchor-pop__msg-avatar .wk-avatar {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: block;
}

.wk-anchor-pop__msg-content {
  flex: 1;
  min-width: 0;
}

.wk-anchor-pop__msg-name {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--wk-text-primary, #18181b);
  margin-bottom: 2px;
  line-height: 1.3;
}

.wk-anchor-pop__msg-text {
  font-size: 12.5px;
  color: var(--wk-text-primary, #18181b);
  line-height: 1.55;
  word-break: break-word;
  white-space: pre-wrap;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
}

.wk-anchor-pop__msg-text--dim {
  color: var(--wk-text-tertiary, #a1a1aa);
  font-style: italic;
}

/* ─── Footer (跳转按钮) ─────────────────────────────── */
.wk-anchor-pop__footer {
  padding: 10px 14px;
  border-top: 1px solid var(--wk-border-soft, #f4f4f5);
  flex-shrink: 0;
}

.wk-anchor-pop__jump-link {
  border: none;
  background: transparent;
  color: var(--wk-text-tertiary, #71717a);
  font-size: 11.5px;
  font-weight: 400;
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  transition: color 0.12s;
}

.wk-anchor-pop__jump-link:hover {
  color: var(--wk-text-secondary, #52525b);
}
