/* Shared FlowGraph styles, themable via CSS custom properties on .fg-wrap */

.fg-wrap {
  /* defaults — overridden per-direction */
  --fg-bg: #0a0a0c;
  --fg-dot: #1c1c22;
  --fg-card-bg: #15151a;
  --fg-card-border: #2a2a32;
  --fg-card-border-active: #4ade80;
  --fg-text: #f4f4f5;
  --fg-muted: #8a8a93;
  --fg-edge-stroke: #4a4a55;
  --fg-edge-active: #4ade80;
  --fg-handle: #4a4a55;
  --fg-shadow: 0 1px 0 rgba(255,255,255,.04) inset, 0 12px 32px rgba(0,0,0,.5);
  --fg-glow: 0 0 0 4px rgba(74,222,128,.12), 0 0 24px rgba(74,222,128,.25);
  --fg-controls-bg: rgba(21,21,26,.85);
  --fg-controls-border: #2a2a32;
  --fg-json-bg: #0d0d10;
  --fg-json-text: #94d3b0;

  position: relative;
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  background: var(--fg-bg);
  overflow: hidden;
  padding: 360px 0;
  margin-top: -200px;
  margin-bottom: -200px;
}

.fg-bg {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, var(--fg-dot) 1.5px, transparent 1.5px);
  background-size: 22px 22px;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, rgba(0,0,0,.4) 12%, #000 22%, #000 78%, rgba(0,0,0,.4) 88%, transparent 100%);
          mask-image: linear-gradient(to bottom, transparent 0%, rgba(0,0,0,.4) 12%, #000 22%, #000 78%, rgba(0,0,0,.4) 88%, transparent 100%);
  -webkit-mask-composite: source-in;
          mask-composite: intersect;
}

.fg-inner {
  position: relative;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 32px;
  height: 100%;
  box-sizing: border-box;
}

.fg-wrap > .fg-inner {
  height: var(--fg-inner-h, 100%);
}

.fg-edges {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  overflow: visible;
}

.fg-edge-base {
  fill: none; stroke: var(--fg-edge-stroke); stroke-width: 2;
  opacity: 1;
}
.fg-edge-active {
  fill: none; stroke: var(--fg-edge-active); stroke-width: 2;
  opacity: 0; transition: opacity .25s ease;
  filter: drop-shadow(0 0 6px var(--fg-edge-active));
}
.fg-edge-active.is-on { opacity: 1; }

.fg-packet {
  fill: var(--fg-edge-active);
  filter: drop-shadow(0 0 8px var(--fg-edge-active));
}

.fg-grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: 1fr 1fr 1fr;
  gap: 24px 56px;
  padding: 32px 32px 56px;
  height: 100%;
  align-items: center;
}

.fg-node {
  min-height: 92px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  background: var(--fg-card-bg);
  border: 1px solid var(--fg-card-border);
  border-radius: 12px;
  padding: 14px 16px;
  color: var(--fg-text);
  font-size: 13px;
  cursor: pointer;
  transition: border-color .25s ease, box-shadow .25s ease, transform .15s ease;
  box-shadow: var(--fg-shadow);
  min-width: 0;
  user-select: none;
  transform: translateY(var(--fg-node-offset-y, 0px));
  transition: transform .45s cubic-bezier(.4, 0, .2, 1), border-color .25s ease, box-shadow .25s ease;
}
.fg-node.is-hovered { transform: translateY(calc(var(--fg-node-offset-y, 0px) - 2px)); }
.fg-node.is-active {
  border-color: var(--fg-card-border-active);
  box-shadow: var(--fg-glow);
}

.fg-node-handle {
  position: absolute;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--fg-handle);
  top: 50%; transform: translateY(-50%);
  transition: background .2s;
}
.fg-node.is-active .fg-node-handle { background: var(--fg-card-border-active); }
.fg-node-handle-l { left: -4px; }
.fg-node-handle-r { right: -4px; }

.fg-node-header {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 6px;
  color: var(--fg-muted);
}
.fg-node-icon {
  width: 22px; height: 22px;
  display: grid; place-items: center;
  border-radius: 6px;
  background: color-mix(in srgb, var(--fg-card-border-active) 12%, transparent);
  color: var(--fg-card-border-active);
}
.fg-node-kind {
  font-family: ui-monospace, "JetBrains Mono", Menlo, monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
}
.fg-node-title {
  font-weight: 600; font-size: 13.5px;
  letter-spacing: -0.005em;
  line-height: 1.25;
  color: var(--fg-text);
}
.fg-node-sub {
  font-size: 11.5px;
  color: var(--fg-muted);
  margin-top: 4px;
  font-family: ui-monospace, "JetBrains Mono", Menlo, monospace;
}
.fg-node-json {
  margin: 8px 0 0; padding: 10px; border-radius: 8px;
  background: var(--fg-json-bg);
  color: var(--fg-json-text);
  font-family: ui-monospace, "JetBrains Mono", Menlo, monospace;
  font-size: 9.5px; line-height: 1.4;
  overflow: hidden;
  white-space: pre;
  border: 1px solid var(--fg-card-border);
}

.fg-node-voice .fg-node-title { font-style: italic; }
.fg-node.is-dim { opacity: .55; }
.fg-node.is-dim .fg-node-title { color: var(--fg-muted); }

@keyframes fg-voice-pop {
  0%   { opacity: 0; }
  60%  { opacity: 1; }
  100% { opacity: 1; }
}
.fg-node-enter { animation: fg-voice-pop .35s ease both; }

.fg-controls {
  position: absolute;
  bottom: 14px; left: 14px;
  display: flex; align-items: center; gap: 6px;
  background: var(--fg-controls-bg);
  border: 1px solid var(--fg-controls-border);
  border-radius: 999px;
  padding: 4px 6px 4px 4px;
  backdrop-filter: blur(8px);
  z-index: 2;
}
.fg-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: 999px;
  background: transparent; border: none;
  color: var(--fg-text); font-size: 12px; font-weight: 500;
  cursor: pointer; font-family: inherit;
  transition: background .15s;
}
.fg-btn:hover { background: color-mix(in srgb, var(--fg-text) 8%, transparent); }
.fg-hint {
  margin-left: 6px; padding-right: 10px;
  font-size: 11.5px; color: var(--fg-muted);
  font-family: ui-monospace, "JetBrains Mono", Menlo, monospace;
}

@media (max-width: 880px) {
  .fg-grid { gap: 12px 32px; padding: 20px; }
  .fg-node-json { display: none; }
  .fg-hint { display: none; }
}
