/* 器械库组件库 · 共用样式
 * 所有组件依赖以下 CSS 变量，由站点主题（templates/base.html 的 :root）提供。
 * 组件本身不定义颜色常量，确保「骨架统一、基调可变」。
 */

.bsf {
  --bsf-radius: 12px;
  --bsf-gap: clamp(12px, 3vw, 24px);
  font-family: var(--font-body, system-ui, -apple-system, "PingFang SC", sans-serif);
  color: var(--ink, #1a1a1a);
}

.bsf-empty {
  padding: 24px;
  border: 1px dashed var(--line, #ccc);
  border-radius: var(--bsf-radius);
  color: var(--ink-dim, #888);
  font-size: 14px;
  text-align: center;
}

.bsf-title {
  font-family: var(--font-display, inherit);
  font-size: clamp(20px, 5vw, 28px);
  line-height: 1.3;
  margin: 0 0 4px;
}

.bsf-sub {
  font-size: 14px;
  color: var(--ink-dim, #777);
  margin: 0 0 var(--bsf-gap);
}

/* ---------- 1. 关系网络 relation-network ---------- */
.bsf-net { position: relative; }
.bsf-net svg { width: 100%; height: auto; display: block; touch-action: pan-y; }
.bsf-net .edge { stroke: var(--line, #ccc); stroke-width: 1.2; }
.bsf-net .edge.hl { stroke: var(--accent, #c0392b); stroke-width: 2.2; }
.bsf-net .node circle {
  fill: var(--surface, #fff);
  stroke: var(--ink, #222);
  stroke-width: 1.6;
  cursor: pointer;
  transition: fill .18s, stroke .18s;
}
.bsf-net .node.hl circle { fill: var(--accent, #c0392b); stroke: var(--accent, #c0392b); }
.bsf-net .node text {
  font-size: 11px;
  fill: var(--ink, #222);
  text-anchor: middle;
  pointer-events: none;
  paint-order: stroke;
  stroke: var(--bg, #fff);
  stroke-width: 3px;
}
.bsf-net .edge-label { font-size: 9px; fill: var(--ink-dim, #888); text-anchor: middle; opacity: 0; }
.bsf-net .edge-label.show { opacity: 1; }
.bsf-net-card {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: var(--bsf-radius);
  background: var(--surface, #f6f6f4);
  font-size: 14px;
  line-height: 1.6;
  min-height: 3.2em;
}

/* ---------- 2. 时间轴 timeline ---------- */
.bsf-timeline { position: relative; padding-left: 28px; }
.bsf-timeline::before {
  content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px;
  width: 2px; background: var(--line, #ddd);
}
.bsf-tl-item {
  position: relative; padding: 0 0 var(--bsf-gap);
  opacity: 0; transform: translateY(12px);
  transition: opacity .5s ease, transform .5s ease;
}
.bsf-tl-item.in { opacity: 1; transform: none; }
.bsf-tl-item::before {
  content: ""; position: absolute; left: -25px; top: 6px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--bg, #fff); border: 2px solid var(--accent, #c0392b);
}
.bsf-tl-when { font-size: 12px; letter-spacing: .04em; color: var(--accent, #c0392b); font-weight: 600; }
.bsf-tl-what { font-size: 16px; font-weight: 600; margin: 2px 0 4px; }
.bsf-tl-impact { font-size: 14px; color: var(--ink-dim, #666); line-height: 1.6; }

/* ---------- 3. 概念地图 concept-map ---------- */
.bsf-cmap svg { width: 100%; height: auto; display: block; }
.bsf-cmap .link { stroke: var(--line, #ccc); stroke-width: 1.2; fill: none; }
.bsf-cmap .core { fill: var(--accent, #c0392b); }
.bsf-cmap .core-t { fill: var(--bg, #fff); font-size: 13px; font-weight: 700; text-anchor: middle; }
.bsf-cmap .leaf { fill: var(--surface, #f2f2ef); stroke: var(--line, #ddd); cursor: pointer; }
.bsf-cmap .leaf-t { fill: var(--ink, #222); font-size: 11px; text-anchor: middle; pointer-events: none; }
.bsf-cmap-card { margin-top: 12px; font-size: 14px; line-height: 1.6; min-height: 3.2em; color: var(--ink-dim, #555); }

/* ---------- 4. 对比矩阵 comparison-matrix ---------- */
.bsf-matrix-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.bsf-matrix { border-collapse: collapse; width: 100%; min-width: 520px; font-size: 14px; }
.bsf-matrix th, .bsf-matrix td {
  border-bottom: 1px solid var(--line, #e3e3e0);
  padding: 12px 14px; text-align: left; vertical-align: top; line-height: 1.55;
}
.bsf-matrix thead th { font-size: 13px; letter-spacing: .04em; color: var(--ink-dim, #777); font-weight: 600; }
.bsf-matrix tbody th { font-weight: 600; white-space: nowrap; }
.bsf-matrix td.hl { background: color-mix(in srgb, var(--accent, #c0392b) 10%, transparent); font-weight: 600; }
.bsf-matrix tr:hover td { background: var(--surface, #faf9f7); }
.bsf-matrix-hint { font-size: 12px; color: var(--ink-dim, #999); margin-top: 8px; }

/* ---------- 5. 引文墙 quote-wall ---------- */
.bsf-wall { display: grid; gap: var(--bsf-gap); grid-template-columns: 1fr; }
@media (min-width: 720px) { .bsf-wall { grid-template-columns: repeat(2, 1fr); } }
.bsf-q {
  background: var(--surface, #f7f6f3);
  border-radius: var(--bsf-radius);
  padding: 20px 20px 14px;
  border-left: 3px solid var(--accent, #c0392b);
}
.bsf-q-text { font-family: var(--font-display, inherit); font-size: clamp(16px, 4vw, 19px); line-height: 1.7; margin: 0; }
.bsf-q-src {
  margin-top: 10px; font-size: 12px; color: var(--ink-dim, #888);
  background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline dotted;
}
.bsf-q-detail { display: none; margin-top: 8px; font-size: 12px; color: var(--ink-dim, #777); line-height: 1.6; }
.bsf-q.open .bsf-q-detail { display: block; }
.bsf-q[data-status="uncertain"] .bsf-q-text::after {
  content: "存疑"; font-size: 10px; vertical-align: super;
  margin-left: 4px; color: var(--ink-dim, #999); border: 1px solid currentColor;
  border-radius: 4px; padding: 0 3px;
}
