/* ────────────────────────────────────────────────────────────
   PULSE — graph editor styles
   ────────────────────────────────────────────────────────── */

.gx-wrap {  flex: 1;
  display: grid;
  grid-template-columns: 1fr 360px;
  min-height: 0;
}

.gx-root {
  position: relative;
  background: var(--surface);
  overflow: hidden;
  min-height: 600px;
}

.gx-viewport {
  position: absolute; inset: 0;
  cursor: grab;
  background-color: var(--surface);
  background-image:
    radial-gradient(circle at 1px 1px, oklch(1 0 0 / 0.06) 1px, transparent 0),
    radial-gradient(circle at 1px 1px, oklch(1 0 0 / 0.10) 1.5px, transparent 0);
  background-size: 24px 24px, 120px 120px;
  background-position: 0 0, 60px 60px;
  user-select: none;
  overflow: hidden;
}
.gx-viewport:active { cursor: grabbing; }

.gx-canvas {
  position: absolute;
  width: 1px; height: 1px; /* anchor; children positioned absolutely */
  will-change: transform;
}

/* edges layer fills the canvas — viewBox lets paths use canvas coords */
.gx-edges {
  position: absolute;
  left: 0; top: 0;
  width: 2000px; height: 1600px;
  pointer-events: none;
  overflow: visible;
}

/* ── clusters ─────────────────────────────────────────────── */
.gx-cluster {
  position: absolute;
  border: 1px dashed oklch(1 0 0 / 0.10);
  border-radius: 24px;
  background: oklch(1 0 0 / 0.012);
  pointer-events: none;
}
.gx-cluster-lbl {
  position: absolute;
  top: -12px; left: 16px;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 3px 12px;
  background: var(--surface);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.gx-cluster-lbl .cat-dot { width: 6px; height: 6px; }
.gx-cluster-n { color: var(--ink-4); margin-left: 4px; }

.gx-cluster-meta {
  position: absolute;
  top: -12px; right: 16px;
  padding: 3px 10px;
  background: var(--surface);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--ink-4);
}

.gx-cluster-idle       { border-color: oklch(from var(--cat-idle) l c h / 0.30); background: oklch(from var(--cat-idle) l c h / 0.04); }
.gx-cluster-action     { border-color: oklch(from var(--cat-action) l c h / 0.30); background: oklch(from var(--cat-action) l c h / 0.04); }
.gx-cluster-effect     { border-color: oklch(from var(--cat-effect) l c h / 0.30); background: oklch(from var(--cat-effect) l c h / 0.04); }
.gx-cluster-transition { border-color: oklch(from var(--cat-transition) l c h / 0.30); background: oklch(from var(--cat-transition) l c h / 0.04); }
.gx-cluster-twopart    { border-color: oklch(from var(--cat-twopart) l c h / 0.30); background: oklch(from var(--cat-twopart) l c h / 0.04); }
.gx-cluster-sub        { border-color: oklch(from var(--cat-twopart) l c h / 0.40); background: oklch(from var(--cat-twopart) l c h / 0.06); border-style: solid; }

/* ── nodes ────────────────────────────────────────────────── */
.gx-node {
  position: absolute;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 8px 12px 8px 8px;
  display: flex; align-items: center; gap: 12px;
  cursor: grab;
  box-shadow: 0 1px 0 oklch(1 0 0 / 0.04), 0 12px 28px -16px oklch(0 0 0 / 0.6);
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease), transform 0.14s var(--ease);
  will-change: transform;
}
.gx-node:active { cursor: grabbing; }
.gx-node.is-hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
  box-shadow: 0 1px 0 oklch(1 0 0 / 0.06), 0 18px 36px -16px oklch(0 0 0 / 0.7);
}
.gx-node.is-selected {
  border-color: var(--pulse);
  box-shadow: 0 0 0 1px var(--pulse), 0 18px 36px -16px oklch(from var(--pulse) l c h / 0.5);
}
.gx-node.is-now {
  border-color: oklch(from var(--pulse) l c h / 0.7);
  box-shadow: 0 0 0 1px oklch(from var(--pulse) l c h / 0.4), 0 0 30px -8px oklch(from var(--pulse) l c h / 0.4);
}

.gx-node-thumb {
  width: 46px; height: 46px;
  border-radius: 9px;
  overflow: hidden;
  background: var(--surface-2);
  flex-shrink: 0;
  position: relative;
}
.gx-node-thumb video {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}

.gx-node-meta {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; gap: 3px;
}
.gx-node-name {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.005em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.gx-node-tags {
  display: flex; align-items: center; gap: 7px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.gx-node-tags .cat-dot { width: 6px; height: 6px; }
.gx-node-dur { color: var(--ink-4); }

.gx-node-now {
  position: absolute;
  top: 8px; right: 8px;
}
.gx-node-now .pulse-dot { width: 8px; height: 8px; }

/* category tint on left edge of the node */
.gx-node-idle       { background: linear-gradient(to right, oklch(from var(--cat-idle)       l c h / 0.18) 0%, oklch(from var(--cat-idle)       l c h / 0) 18%), var(--panel); }
.gx-node-action     { background: linear-gradient(to right, oklch(from var(--cat-action)     l c h / 0.18) 0%, oklch(from var(--cat-action)     l c h / 0) 18%), var(--panel); }
.gx-node-effect     { background: linear-gradient(to right, oklch(from var(--cat-effect)     l c h / 0.18) 0%, oklch(from var(--cat-effect)     l c h / 0) 18%), var(--panel); }
.gx-node-transition { background: linear-gradient(to right, oklch(from var(--cat-transition) l c h / 0.18) 0%, oklch(from var(--cat-transition) l c h / 0) 18%), var(--panel); }
.gx-node-twopart    { background: linear-gradient(to right, oklch(from var(--cat-twopart)    l c h / 0.18) 0%, oklch(from var(--cat-twopart)    l c h / 0) 18%), var(--panel); }

/* ── toolbar (overlay, not transformed) ───────────────────── */
.gx-toolbar {
  position: absolute;
  top: 16px; left: 16px;
  display: flex; align-items: center; gap: 2px;
  background: oklch(from var(--panel) l c h / 0.85);
  backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px;
  z-index: 10;
  box-shadow: var(--shadow-md);
}
.gx-toolbar button {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 999px;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.gx-toolbar button:hover { background: var(--panel-hi); color: var(--ink); }
.gx-toolbar .gx-zoom {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-2);
  padding: 0 10px;
  min-width: 46px; text-align: center;
  letter-spacing: 0.04em;
}
.gx-toolbar .gx-sep {
  width: 1px; height: 18px;
  background: var(--line);
  margin: 0 4px;
}

/* ── minimap ──────────────────────────────────────────────── */
.gx-minimap {
  position: absolute;
  right: 16px; bottom: 16px;
  width: 200px; height: 130px;
  background: oklch(from var(--panel) l c h / 0.85);
  backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  cursor: crosshair;
  z-index: 10;
  box-shadow: var(--shadow-md);
}
.gx-minimap svg {
  display: block;
  background:
    radial-gradient(circle at 1px 1px, oklch(1 0 0 / 0.06) 1px, transparent 0);
  background-size: 8px 8px;
}
.gx-minimap-lbl {
  position: absolute; left: 10px; top: 8px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
  pointer-events: none;
}

/* ── hint strip ──────────────────────────────────────────── */
.gx-hint {
  position: absolute;
  left: 16px; bottom: 16px;
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--ink-4);
  background: oklch(from var(--panel) l c h / 0.7);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px;
  z-index: 10;
  pointer-events: none;
}
.gx-hint .gx-sep-dot { color: var(--ink-4); opacity: 0.5; }

/* ── aside (right panel) ──────────────────────────────────── */
.gx-aside {
  border-left: 1px solid var(--line);
  background: var(--surface);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.gx-aside-head {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center;
}
.gx-aside-head h3 {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 24px;
  font-weight: 400;
  letter-spacing: -0.018em;
}
.gx-aside-close {
  width: 28px; height: 28px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink-2);
  display: flex; align-items: center; justify-content: center;
}
.gx-aside-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
  display: flex; flex-direction: column;
  gap: 18px;
}

.gx-preview {
  position: relative;
  aspect-ratio: 16 / 10;
  border-radius: 14px;
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.gx-preview .avatar-live, .gx-preview video {
  width: 100% !important; height: 100% !important;
  object-fit: cover;
  border-radius: 0 !important;
  display: block;
}
.gx-preview-tag {
  position: absolute; left: 10px; bottom: 10px;
  display: flex; align-items: center; gap: 7px;
  padding: 5px 10px;
  background: oklch(0 0 0 / 0.55);
  border: 1px solid oklch(1 0 0 / 0.10);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--ink);
}
.gx-preview-tag .pulse-dot { width: 7px; height: 7px; }

.gx-key {
  display: flex; flex-direction: column;
  gap: 8px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.gx-key-row {
  display: flex; align-items: center; gap: 10px;
  font-size: 12.5px;
  color: var(--ink-2);
}
.gx-key-row .cat-dot { width: 7px; height: 7px; }

.gx-trace {
  display: flex; flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.gx-trace-head {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.gx-trace-body {
  display: flex; flex-wrap: wrap; gap: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
}
.gx-trace-step {
  padding: 2px 7px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
}
.gx-trace-step.is-now {
  background: var(--pulse-soft);
  color: var(--pulse-hi);
  border-color: var(--pulse);
}
.gx-trace-empty { font-style: italic; color: var(--ink-4); }

/* ── selected node panel ──────────────────────────────────── */
.gx-sel-h {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 26px;
  font-weight: 400;
  letter-spacing: -0.02em;
}
.gx-sel-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
}

.gx-sel-rows {
  display: flex; flex-direction: column;
  border-top: 1px solid var(--line);
}
.gx-sel-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.gx-sel-row .k {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.gx-sel-row .v { color: var(--ink); }

.gx-sub-card {
  padding: 14px 16px;
  background: oklch(from var(--cat-twopart) l c h / 0.08);
  border: 1px solid oklch(from var(--cat-twopart) l c h / 0.30);
  border-radius: 12px;
}
.gx-sub-head {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--cat-twopart);
  margin-bottom: 6px;
}
.gx-sub-card p {
  font-size: 12px;
  color: var(--ink-3);
  line-height: 1.5;
}

.gx-sel-actions {
  display: flex; gap: 8px;
  margin-top: 4px;
}

/* ── landing graph slot uses the same editor ──────────── */
/* override the old .grf-canvas-inner that had a fixed dot bg */
.grf-canvas-inner {
  position: relative;
  padding: 0;
  background: var(--surface-2);
  border: 1px solid var(--line);
  height: 640px;
  overflow: hidden;
  background-image: none;
}
.grf-canvas-inner .gx-root { min-height: 0; height: 100%; }

@media (max-width: 960px) {
  .gx-wrap { grid-template-columns: 1fr; }
  .gx-aside { border-left: 0; border-top: 1px solid var(--line); }
}
