/* 链接图谱（v0.9.1）：全屏力导向图样式——暖纸档案室夜间同源，全走主题变量. */

.graph-layer {
  position: fixed;
  inset: 0;
  z-index: 55;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.g-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--bg);
}

.g-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--serif);
  font-size: 15px;
  color: var(--text);
}

.g-title .icon { color: var(--accent); }

.g-hint {
  flex: 1 1 auto;
  font-size: 12px;
  color: var(--text-faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.g-canvas {
  flex: 1 1 auto;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
}

.g-canvas:active { cursor: grabbing; }

.g-canvas svg { width: 100%; height: 100%; display: block; }

.g-edge {
  stroke: var(--border);
  stroke-width: 1.2;
}

/* 暗色下 --border(白 8.5%) 在深底上近乎隐身：边线提到 26% 白，hover 聚焦衰减照旧
   （2026-11-26 审计：旧 html[data-theme="dark"] 选择器挂在已退役主题上，现役暗肤命中不了） */
[data-theme="refto-dark"] .g-edge,
[data-theme="refto-adaptive"][data-adaptive-mode="dark"] .g-edge { stroke: rgba(255, 255, 255, 0.26); }

.g-node text {
  font-size: var(--gfs, 11px);
  fill: var(--text-dim);
  paint-order: stroke;
  stroke: var(--bg);
  stroke-width: 3px;
  pointer-events: none;
  user-select: none;
}

.g-node { cursor: pointer; }

.g-node.ghost circle:first-child {
  fill: none;
  stroke: var(--text-faint);
  stroke-dasharray: 3 3;
}

.g-node.ghost text { fill: var(--text-faint); font-style: italic; }

/* hover 聚焦：非邻居降透明度，被点中的边亮珊瑚 */
.g-canvas svg.g-focus .g-node { opacity: 0.18; }
.g-canvas svg.g-focus .g-node.focus { opacity: 1; }
.g-canvas svg.g-focus .g-edge { opacity: 0.12; }
.g-canvas svg.g-focus .g-edge.focus { opacity: 1; stroke: var(--accent); stroke-width: 1.6; }
.g-canvas svg .g-node { transition: opacity var(--dur) var(--ease); }
.g-canvas svg .g-edge { transition: opacity var(--dur) var(--ease), stroke var(--dur) var(--ease); }

/* ---------- 图例：小白也能一眼读懂图谱语言 ---------- */
.g-legend {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  padding: 8px 16px;
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  box-shadow: var(--shadow-pop);
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
  pointer-events: none;
  max-width: min(92vw, 760px);
}

.g-legend .dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--dot);
  margin-right: 5px;
  vertical-align: -1px;
}

.g-legend .g-lg-grey { background: var(--text-faint); }

.g-legend .g-lg-line {
  display: inline-block;
  width: 16px;
  height: 0;
  border-top: 1.5px solid var(--border);
  margin-right: 5px;
  vertical-align: 3px;
}

.g-legend .g-lg-sep {
  width: 1px;
  height: 14px;
  background: var(--border-soft);
}
