/* ==========================================================================
   Graph Visualization
   Full-viewport canvas for force-directed graph.

   Structure: .graph-wrapper contains .graph-canvas (where force-graph renders)
   and .graph-legend (overlay). The wrapper is the positioning context.
   force-graph clears innerHTML of its target element on init, so the legend
   must be a sibling, not a child, of the canvas element.
   ========================================================================== */

.graph-wrapper {
  position: relative;
  width: 100vw;
  margin-left: calc(-50vw + 50%);
  margin-right: calc(-50vw + 50%);
  overflow: hidden;
}

.graph-canvas {
  width: 100%;
  height: 100%;
}

/* ==========================================================================
   Graph Legend
   Absolutely positioned within .graph-wrapper, bottom-left corner.
   ========================================================================== */

.graph-legend {
  position: absolute;
  bottom: 1.5rem;
  left: 1.5rem;
  background: var(--parchment-base, #faf6ef);
  border: 1px solid var(--parchment-dark, #c9b99a);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  font-size: 0.8rem;
  line-height: 1.5;
  z-index: 10;
  display: flex;
  gap: 1.5rem;
  opacity: 0.92;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15), 0 1px 3px rgba(0, 0, 0, 0.1);
}

.graph-legend:hover {
  opacity: 1;
}

.graph-legend-section {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.graph-legend-title {
  font-weight: 600;
  margin-bottom: 0.125rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--grey-600);
}

.graph-legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--grey-800);
}

.graph-legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.graph-legend-line {
  display: inline-block;
  width: 20px;
  height: 0;
  flex-shrink: 0;
}

.graph-legend-line--hierarchy {
  border-top: 2px solid #666;
}

.graph-legend-line--location {
  border-top: 2px dashed #2d8a4e;
}

.graph-legend-line--ownership {
  border-top: 2px dotted #b45309;
}

.graph-legend-line--membership {
  border-top: 1px solid #888;
}

.graph-legend-line--participation {
  border-top: 1px solid #999;
}

.graph-legend-line--mention {
  border-top: 1px solid #aaa;
}

/* Stack sections vertically on narrow screens */
@media (max-width: 480px) {
  .graph-legend {
    flex-direction: column;
    gap: 0.75rem;
  }
}
