/* ==========================================================================
   Trajectory — full-bleed force-directed graph with a floating detail panel.
   ========================================================================== */

.traj-stage {
  position: relative;
  width: 100%;
  height: clamp(560px, 82vh, 900px);
}

#trajectory-graph {
  position: absolute;
  inset: 0;
  /* Node labels are real <text>, so a tap or a drag would otherwise select
     them — and `::selection` paints ink-on-ink, turning a label into a block. */
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

/* Node labels are SVG <text>; var() is not resolved in presentation
   attributes, so the family is set here rather than on the element. */
#trajectory-graph text {
  font-family: var(--font-sans);
}

/* --------------------------------------------------------------------------
   Detail panel
   -------------------------------------------------------------------------- */

.traj-panel {
  position: absolute;
  top: 0;
  right: var(--gutter);
  width: 300px;
  max-height: calc(100% - 56px);
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border: 1px solid var(--rule);
}

.traj-panel-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 14px 18px;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--rule);
  color: var(--ink);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.traj-panel.collapsed .traj-panel-toggle {
  border-bottom: 0;
}

.traj-panel-title {
  font-size: 15px;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.traj-panel-chevron {
  color: var(--muted);
  transition: transform 0.2s ease;
}

.traj-panel.collapsed .traj-panel-chevron {
  transform: rotate(-90deg);
}

.traj-panel-body {
  padding: 18px;
  overflow-y: auto;
}

.traj-panel.collapsed .traj-panel-body {
  display: none;
}

/* --------------------------------------------------------------------------
   Panel contents
   -------------------------------------------------------------------------- */

.traj-meta {
  font-size: 11px;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}

.traj-sub {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 14px;
}

.traj-blurb {
  font-size: 14px;
  line-height: 1.6;
  color: var(--muted);
  margin: 0 0 18px;
  text-wrap: pretty;
}

.traj-tags-label {
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 10px;
}

.traj-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.traj-tag {
  font-size: 11px;
  color: var(--ink);
  border: 1px solid var(--rule);
  padding: 4px 9px;
}

/* --------------------------------------------------------------------------
   Legend
   -------------------------------------------------------------------------- */

.traj-legend {
  position: absolute;
  left: var(--gutter);
  bottom: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.traj-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--paper);
  padding: 3px 6px;
}

.traj-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.traj-dot-me {
  background: var(--accent);
}

.traj-dot-org {
  background: var(--ink);
}

.traj-dot-role {
  background: var(--muted);
}

.traj-dot-cat {
  background: var(--paper);
  border: 2px solid var(--ink);
}

.traj-dot-skill {
  width: 8px;
  height: 8px;
  background: var(--paper);
  border: 1.5px solid var(--rule);
}

/* --------------------------------------------------------------------------
   Responsive — panel docks to the bottom, legend moves to the top
   -------------------------------------------------------------------------- */

@media (max-width: 800px) {
  .traj-stage {
    height: clamp(520px, 80vh, 760px);
  }

  .traj-panel {
    top: auto;
    bottom: 0;
    left: var(--gutter-sm);
    right: var(--gutter-sm);
    width: auto;
    max-height: 60%;
  }

  .traj-legend {
    left: var(--gutter-sm);
    right: var(--gutter-sm);
    top: 0;
    bottom: auto;
    gap: 14px;
  }
}
