/* apps/graph/graph.css — Epistemic Constellation graph styles */

/* ── Layout ──────────────────────────────────────────────────── */

body.graph-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.graph-main {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
}

/* ── Sidebar ─────────────────────────────────────────────────── */

.graph-sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--line);
  overflow-y: auto;
  z-index: 10;
}

.sidebar-inner {
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.sidebar-section {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--line);
}
.sidebar-section:last-child { border-bottom: none; }

.sidebar-heading {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 0.35rem;
}

.sidebar-desc {
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.5;
  margin: 0;
}

.sidebar-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0 0 0.5rem;
}

.sidebar-reset {
  font-size: 0.75rem;
  padding: 0.3rem 0.7rem;
  margin-right: 0.4rem;
  margin-top: 0.25rem;
}

.sidebar-stats {
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.8;
}
.sidebar-stats strong { color: var(--text); }

/* ── Filter pills ────────────────────────────────────────────── */

.filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.filter-pill {
  font-size: 0.68rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1.5px solid var(--line-strong);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.filter-pill:hover {
  background: var(--surface-soft);
  color: var(--text);
}
.filter-pill.active {
  border-color: var(--project-color, var(--line-strong));
  background: color-mix(in srgb, var(--project-color, #888) 18%, transparent);
  color: var(--text);
}
.filter-pill .pill-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--project-color, #888);
  flex-shrink: 0;
}

/* ── Legend ──────────────────────────────────────────────────── */

.legend {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.72rem;
  color: var(--muted);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.legend-dot.stance-synthesis  { background: #f0a050; box-shadow: 0 0 5px #f0a05088; }
.legend-dot.stance-theoretical { background: #6ab0e8; }
.legend-dot.stance-speculative { background: #c0c0c0; border: 1.5px dashed #888; box-sizing: border-box; }
.legend-dot.stance-empirical   { background: #6ed48a; box-shadow: 0 0 5px #6ed48a88; }
.legend-dot.stance-polemic     { background: #e06060; }

/* ── Canvas + SVG ────────────────────────────────────────────── */

.graph-canvas-wrap {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: var(--bg);
}

#star-canvas {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

#graph-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* ── SVG node & edge styles ──────────────────────────────────── */

.graph-edge {
  stroke: var(--line-strong);
  stroke-opacity: 0.35;
  fill: none;
  transition: stroke-opacity 0.2s;
}
.graph-edge.highlighted {
  stroke-opacity: 0.85;
  stroke: var(--text);
}
.graph-edge.dimmed {
  stroke-opacity: 0.06;
}

.node-group {
  cursor: pointer;
}

.node-bg {
  fill: transparent;
  /* larger hit area */
}

.node-glow {
  fill-opacity: 0.18;
  pointer-events: none;
}

.node-circle {
  stroke-width: 1.5;
  transition: r 0.15s;
}

/* Stance ring style applied via JS attributes */
.node-circle.stance-speculative {
  stroke-dasharray: 4 3;
}

.node-label {
  fill: var(--text);
  font-family: 'Source Serif 4', serif;
  font-size: 10px;
  pointer-events: none;
  text-anchor: middle;
  opacity: 0.85;
}

.node-group.dimmed .node-circle,
.node-group.dimmed .node-glow,
.node-group.dimmed .node-label {
  opacity: 0.12;
}

/* ── Tooltip ─────────────────────────────────────────────────── */

.node-tooltip {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 280px;
  z-index: 20;
  pointer-events: none;
}
.node-tooltip:not([hidden]) {
  pointer-events: auto;
}

.tooltip-inner {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  box-shadow: 0 4px 24px rgba(0,0,0,0.18);
}

.tooltip-meta {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.tooltip-project,
.tooltip-stance {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
}

.tooltip-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
  line-height: 1.3;
}

.tooltip-desc {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.55;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tooltip-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}
.tooltip-tag {
  font-size: 0.62rem;
  padding: 0.1rem 0.4rem;
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 999px;
}

.tooltip-link {
  font-size: 0.75rem;
  align-self: flex-start;
  padding: 0.3rem 0.75rem;
}

/* ── Responsive ──────────────────────────────────────────────── */

@media (max-width: 680px) {
  .graph-sidebar {
    width: 100%;
    height: auto;
    max-height: 35vh;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
  .graph-main { flex-direction: column; }
  .node-tooltip {
    top: auto;
    bottom: 0.75rem;
    right: 0.75rem;
    left: 0.75rem;
    width: auto;
  }
}
