/* ===== ref-link.css · v0.6 第 2 档 a 档 =====
 * [[xxx]] 引用渲染样式 · 克制·黑底金字·hover 描金
 * 命中元素：a.ref-link / span.ref-link.ref-missing / span.ref-link.ref-hidden
 * b 档会扩展 hover 浮窗（ref-link__popover）+ 编辑器 [[ 触发器（ref-typer）
 * ============================================================== */

/* ---- 基础态：金字 + 虚线下划（克制） ---- */
a.ref-link,
.ref-link {
  color: #d4af37;                       /* 金字 */
  text-decoration: underline dotted #b08a2e;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
  border-radius: 2px;
  padding: 0 1px;
  cursor: pointer;
  transition: color .15s ease, text-decoration-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}

/* ---- hover 态：实线下划 + 描金边 ---- */
a.ref-link:hover,
.ref-link:hover {
  color: #f1c948;                       /* 高亮金 */
  text-decoration: underline solid #f1c948;
  text-decoration-thickness: 1px;
  box-shadow: 0 0 0 1px rgba(241, 201, 72, 0.55);  /* 描金边（克制·1px） */
  background-color: rgba(212, 175, 55, 0.06);
}

/* ---- focus 态：键盘可达性 ---- */
a.ref-link:focus-visible,
.ref-link:focus-visible {
  outline: 1px solid #f1c948;
  outline-offset: 2px;
}

/* ---- visited 不变色（避免历史紫） ---- */
a.ref-link:visited {
  color: #d4af37;
}

/* ---- 已删除态：暗灰 + 删除线 ---- */
.ref-link.ref-missing {
  color: #6a5d3a;                       /* 暗金灰 */
  text-decoration: line-through dotted #6a5d3a;
  text-decoration-thickness: 1px;
  cursor: help;
  background-color: rgba(106, 93, 58, 0.06);
}
.ref-link.ref-missing:hover {
  color: #8a7a4d;
  background-color: rgba(106, 93, 58, 0.12);
  box-shadow: none;                     /* 已删除不描金 */
}

/* ---- 不可见态：暗灰斜体 ---- */
.ref-link.ref-hidden {
  color: #6a5d3a;
  font-style: italic;
  text-decoration: none;
  cursor: not-allowed;
  background-color: rgba(106, 93, 58, 0.04);
}
.ref-link.ref-hidden:hover {
  color: #6a5d3a;
  box-shadow: none;
}

/* ---- 类型微标（可选；通过 data-type 投影） ----
 * 默认不显示伪元素图标，b 档若要加，可解开下面注释。
 * .ref-link[data-type="user"]::before { content: '@'; opacity: .7; margin-right: 1px; }
 * .ref-link[data-type="concept"]::before { content: '#'; opacity: .7; margin-right: 1px; }
 */

/* ---- 内嵌于深色面板时的微调（一些卡片预览容器） ---- */
.cog-panel a.ref-link,
.cog-panel .ref-link {
  /* 黑底场景下保持金字 + 描金 hover，无需额外覆写 */
}

/* =================================================================
 * v0.6 第 2 档 b 档：hover 浮窗 (.ref-hover-popover)
 * 黑底金边描金 · 320px 宽 · 圆角 6px · 阴影描金光晕
 * ================================================================= */

.ref-hover-popover {
  width: 320px;
  max-width: 92vw;
  background: linear-gradient(180deg, #0e0d0a 0%, #15120c 100%);
  color: #e6ddc4;
  border: 1px solid #6a5d3a;
  border-radius: 6px;
  box-shadow:
    0 0 0 1px rgba(241, 201, 72, 0.18),
    0 8px 24px rgba(0, 0, 0, 0.55),
    0 0 18px rgba(212, 175, 55, 0.08);
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.55;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
}

.ref-hover-popover .ref-hover-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  font-size: 11px;
  letter-spacing: 0.04em;
}

.ref-hover-popover .ref-hover-type {
  color: #d4af37;
  font-weight: 600;
  text-transform: none;
}

.ref-hover-popover .ref-hover-tag {
  display: inline-block;
  padding: 1px 6px;
  border: 1px solid #6a5d3a;
  border-radius: 10px;
  color: #b08a2e;
  font-size: 10px;
  background: rgba(212, 175, 55, 0.04);
  max-width: 12em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ref-hover-popover .ref-hover-title {
  color: #f1c948;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  margin: 2px 0 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.ref-hover-popover .ref-hover-summary {
  color: #c8bda0;
  font-size: 12.5px;
  margin: 6px 0 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  word-break: break-word;
}

.ref-hover-popover .ref-hover-meta {
  color: #8a7a4d;
  font-size: 11px;
  margin-top: 6px;
  border-top: 1px dashed rgba(106, 93, 58, 0.45);
  padding-top: 6px;
}

.ref-hover-popover .ref-hover-thumb {
  margin: 6px 0;
  text-align: center;
  border-radius: 4px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.02);
}

.ref-hover-popover .ref-hover-thumb img {
  max-width: 100%;
  max-height: 120px;
  display: block;
  margin: 0 auto;
}

/* 用户名片头 */
.ref-hover-popover .ref-hover-user-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.ref-hover-popover .ref-hover-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid #6a5d3a;
  object-fit: cover;
  flex: 0 0 40px;
}

.ref-hover-popover .ref-hover-avatar-fallback {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid #6a5d3a;
  background: rgba(212, 175, 55, 0.08);
  color: #d4af37;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 600;
  flex: 0 0 40px;
}

.ref-hover-popover .ref-hover-user-info {
  flex: 1 1 auto;
  min-width: 0;
}

.ref-hover-popover .ref-hover-user-info .ref-hover-title {
  margin: 0;
  -webkit-line-clamp: 1;
}

/* 空态/加载态 */
.ref-hover-popover .ref-hover-loading,
.ref-hover-popover .ref-hover-empty {
  color: #8a7a4d;
  font-size: 12px;
  text-align: center;
  padding: 8px 0;
}

.ref-hover-popover .ref-hover-icon {
  margin-right: 4px;
}

/* =================================================================
 * v0.6 第 2 档 b 档：编辑器 [[ 触发器 (.ref-picker)
 * 黑底金边描金候选浮窗
 * ================================================================= */

.ref-picker {
  width: 320px;
  max-width: 92vw;
  background: linear-gradient(180deg, #0e0d0a 0%, #15120c 100%);
  color: #e6ddc4;
  border: 1px solid #6a5d3a;
  border-radius: 6px;
  box-shadow:
    0 0 0 1px rgba(241, 201, 72, 0.18),
    0 8px 24px rgba(0, 0, 0, 0.55),
    0 0 18px rgba(212, 175, 55, 0.08);
  font-size: 13px;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
}

.ref-picker .ref-picker-header {
  padding: 6px 12px;
  font-size: 11px;
  color: #d4af37;
  letter-spacing: 0.06em;
  border-bottom: 1px dashed rgba(106, 93, 58, 0.45);
}

.ref-picker .ref-picker-list {
  list-style: none;
  margin: 0;
  padding: 4px 0;
  max-height: 280px;
  overflow-y: auto;
}

.ref-picker .ref-picker-list::-webkit-scrollbar {
  width: 6px;
}
.ref-picker .ref-picker-list::-webkit-scrollbar-thumb {
  background: rgba(212, 175, 55, 0.25);
  border-radius: 3px;
}

.ref-picker .ref-picker-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  cursor: pointer;
  transition: background-color 0.1s ease;
  line-height: 1.4;
}

.ref-picker .ref-picker-item.active {
  background: rgba(212, 175, 55, 0.10);
  box-shadow: inset 2px 0 0 #f1c948;
}

.ref-picker .ref-picker-item:hover {
  background: rgba(212, 175, 55, 0.06);
}

.ref-picker .ref-picker-icon {
  flex: 0 0 18px;
  font-size: 14px;
  text-align: center;
  opacity: 0.85;
}

.ref-picker .ref-picker-label {
  flex: 1 1 auto;
  color: #f1c948;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ref-picker .ref-picker-hint {
  flex: 0 0 auto;
  color: #8a7a4d;
  font-size: 11px;
  max-width: 10em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ref-picker .ref-picker-empty {
  list-style: none;
  padding: 14px 12px;
  text-align: center;
  color: #8a7a4d;
  font-size: 12px;
}

.ref-picker .ref-picker-footer {
  padding: 5px 12px;
  font-size: 10.5px;
  color: #6a5d3a;
  border-top: 1px dashed rgba(106, 93, 58, 0.45);
  letter-spacing: 0.04em;
}
