/* 双向链接（v0.9）：纸卡「引用 · 被引用 · 断链」三区 + 备注内联 [[引用]] 徽章 + 表单补全弹层.
   全量走主题变量（html[data-theme] 镜像），夜间自动适配；视觉语言沿用 collections.css 的盒徽章. */

/* ---------- 纸卡链接区 ---------- */
.d-links {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--border-soft);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.d-links-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
  font-size: 12.5px;
}

.d-links-label {
  flex: 0 0 auto;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  min-width: 3.6em;
}

.link-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  padding: 2px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 12px;
  line-height: 1.5;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: background 200ms var(--ease, ease), border-color 200ms var(--ease, ease);
}

.link-chip:hover { background: var(--accent-soft); border-color: var(--accent); }

.link-chip .mono { font-size: 10.5px; opacity: 0.6; }

/* 断链：虚线框 + 降透明度——还链不到，但看得见 */
.link-chip.dangling {
  border-style: dashed;
  opacity: 0.62;
  cursor: default;
}

/* 织网建议：虚线框 + 珊瑚星标——还没链上，但值得链，点一下就成 */
.link-chip.suggest {
  border-style: dashed;
  border-color: var(--accent);
  color: var(--accent-ink, var(--accent));
  background: var(--accent-soft);
}

.link-chip.suggest:hover { border-style: solid; }

.link-chip .count-tag { font-size: 10.5px; opacity: 0.55; }

/* ---------- 备注内联 [[引用]] 徽章（d-note 里） ---------- */
.d-note .note-ref {
  display: inline;
  padding: 0 4px;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent-ink, var(--accent));
  font-size: 12px;
  cursor: pointer;
}

.d-note .note-ref:hover { text-decoration: underline; }

.d-note .note-ref.dangling { opacity: 0.55; text-decoration: underline dashed; }

/* ---------- 表单 [[ 补全弹层 ---------- */
.wiki-pop {
  position: fixed;
  z-index: 60;
  min-width: 220px;
  max-width: 320px;
  max-height: 200px;
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  box-shadow: var(--shadow-menu, 0 8px 24px rgba(0, 0, 0, 0.14));
  padding: 4px;
}

.wiki-pop button {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.wiki-pop button.active,
.wiki-pop button:hover { background: var(--accent-soft); }

.wiki-pop .wp-type {
  flex: 0 0 auto;
  font-size: 10px;
  opacity: 0.55;
}

.wiki-pop .wp-title {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wiki-pop .wp-empty {
  padding: 8px 10px;
  font-size: 12px;
  opacity: 0.6;
}

/* ---------- v0.9.4 快照全文兜底（搜索空态的快照命中区） ---------- */
.snap-hits {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px dashed var(--border-soft);
  width: 100%;
}

.snap-hits-title {
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  margin-bottom: 8px;
}

.snap-hit {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.snap-hit:hover { background: var(--accent-soft); }

/* v0.9.21b 链接 chip × 删链钮 */
.chip-wrap { display: inline-flex; align-items: center; gap: 1px; }
.chip-x {
  border: none; background: none; padding: 2px 5px; margin-left: -2px;
  color: var(--text-faint); font-size: 11px; line-height: 1; cursor: pointer;
  border-radius: 4px; transition: color 0.15s, background 0.15s;
}
.chip-x:hover { color: #e5484d; background: rgba(229, 72, 77, 0.12); }
