/* ==========================================================================
   AIM landing — HERO editor mock.
   Unreal-Engine-Blueprint-style node graph in a light editor canvas.
   Lives only in the hero. Pin geometry mirrors lib/content.php geometry.
   ========================================================================== */

/* ---------- HERO STAGE (frame around the editor) ---------- */
.aim-hero__stage {
  position: relative;
  margin: 56px auto 0;
  max-width: 1180px;
  padding: 36px 36px 28px;
  isolation: isolate;
}

/* Bracket-corner ornaments around the editor frame */
.aim-hero__stage-bracket {
  position: absolute;
  width: 18px;
  height: 18px;
  pointer-events: none;
  color: var(--aim-line-strong);
}
.aim-hero__stage-bracket--tl { top: 0;    left: 0;    border-top: 1px solid currentColor; border-left: 1px solid currentColor; }
.aim-hero__stage-bracket--tr { top: 0;    right: 0;   border-top: 1px solid currentColor; border-right: 1px solid currentColor; }
.aim-hero__stage-bracket--bl { bottom: 0; left: 0;    border-bottom: 1px solid currentColor; border-left: 1px solid currentColor; }
.aim-hero__stage-bracket--br { bottom: 0; right: 0;   border-bottom: 1px solid currentColor; border-right: 1px solid currentColor; }

/* Floating mono-tags on the frame (FIG 1.A · v2.0 etc) */
.aim-hero__tag {
  position: absolute;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--aim-font-mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--aim-ink-4);
  background: var(--aim-bg);
  padding: 0 8px;
  height: 18px;
  z-index: 5;
}
.aim-hero__tag-mark {
  color: var(--aim-accent);
  font-weight: 500;
}
.aim-hero__tag-label { color: var(--aim-ink-3); }
.aim-hero__tag--tl { top: -9px;    left: 36px; }
.aim-hero__tag--br { bottom: -9px; right: 36px; }

@media (max-width: 720px) {
  .aim-hero__stage { padding: 24px 16px 20px; margin-top: 36px; }
  .aim-hero__tag { display: none; }
}

/* ==========================================================================
   EDITOR FRAME
   ========================================================================== */
.aim-editor {
  position: relative;
  background: #ffffff;
  border: 1px solid rgba(12,14,22,0.10);
  border-radius: 4px;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.9) inset,
    0 26px 64px -28px rgba(12,14,22,0.18),
    0 6px 18px -10px rgba(12,14,22,0.08);
  overflow: hidden;
}

/* ---------- CHROME (editorial: tiny mark + breadcrumb + ··· menu) ---------- */
.aim-editor__chrome {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 40px;
  padding: 0 18px;
  background: #ffffff;
  border-bottom: 1px solid rgba(12,14,22,0.08);
  font-family: var(--aim-font-mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--aim-ink-3);
}

.aim-editor__crumb {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.aim-editor__crumb-mark {
  display: inline-flex;
  width: 12px;
  height: 12px;
  color: var(--aim-ink);
}
.aim-editor__crumb-mark svg { width: 12px; height: 12px; }
.aim-editor__crumb-name {
  color: var(--aim-ink);
  font-weight: 500;
  white-space: nowrap;
}
.aim-editor__crumb-sep {
  color: var(--aim-ink-5);
  font-weight: 400;
  letter-spacing: 0;
}
.aim-editor__crumb-sub {
  color: var(--aim-ink-4);
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.aim-editor__menu {
  display: inline-flex;
  width: 16px;
  height: 16px;
  color: var(--aim-ink-4);
  cursor: default;
  transition: color 0.18s var(--aim-ease);
}
.aim-editor__menu:hover { color: var(--aim-ink); }
.aim-editor__menu svg { width: 16px; height: 16px; }

@media (max-width: 720px) {
  .aim-editor__chrome { padding: 0 14px; }
  .aim-editor__crumb-sep, .aim-editor__crumb-sub { display: none; }
}

/* ==========================================================================
   CANVAS (where the nodes live)
   ========================================================================== */
.aim-editor__canvas {
  position: relative;
  width: 100%;
  background: #faf9f5;
  overflow: hidden;
  /* Fallback scale for SSR — JS replaces it with the real value on mount.
     Without JS the inner just renders at 1:1 (and may overflow visually). */
  --aim-s: 1;
}
.aim-editor__canvas::before,
.aim-editor__canvas::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  pointer-events: none;
  z-index: 5;
  color: rgba(12,14,22,0.20);
}
.aim-editor__canvas::before {
  top: 12px; left: 12px;
  border-top: 1px solid currentColor;
  border-left: 1px solid currentColor;
}
.aim-editor__canvas::after {
  bottom: 12px; right: 12px;
  border-bottom: 1px solid currentColor;
  border-right: 1px solid currentColor;
}

/* Inner layer = fixed-pixel coordinate system (matches viewBox).
   It is uniformly scaled by JS via --aim-s so wires (SVG) and nodes (DOM)
   stay locked to the same coordinate system at any container width. */
.aim-editor__inner {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  transform: scale(var(--aim-s));
  will-change: transform;
}

.aim-editor__grid {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 1px 1px, rgba(12,14,22,0.07) 1px, transparent 1.4px);
  background-size: 22px 22px;
  mask-image: radial-gradient(ellipse 85% 85% at 50% 50%, #000 55%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 85% 85% at 50% 50%, #000 55%, transparent 100%);
  z-index: 0;
}

/* SVG wires layer — fills the inner pixel-canvas exactly. */
.aim-editor__wires {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
  overflow: visible;
}
/* Editorial wires: monochrome ink, single accent on hover. No rainbow. */
.aim-editor__wire {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}
.aim-editor__wire--bg {
  stroke: rgba(12,14,22,0.04);
  stroke-width: 5;
}
.aim-editor__wire--data,
.aim-editor__wire--exec {
  stroke: rgba(12,14,22,0.42);
  stroke-width: 1.25;
  transition: stroke 0.2s var(--aim-ease), stroke-width 0.2s var(--aim-ease), filter 0.2s var(--aim-ease);
}
.aim-editor__wire--exec {
  stroke-width: 1.5;
  stroke-dasharray: 4 3;
}

/* Flow particle: short bright segment travelling along the wire */
.aim-editor__wire-flow {
  fill: none;
  stroke: var(--aim-accent);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-dasharray: 6 240;
  stroke-dashoffset: 0;
  opacity: 0;
  animation: aim-flow 4.2s linear infinite;
}
@keyframes aim-flow {
  0%   { stroke-dashoffset: 240; opacity: 0; }
  12%  { opacity: 0.8; }
  88%  { opacity: 0.8; }
  100% { stroke-dashoffset: 0;   opacity: 0; }
}

/* Hover: connected wires turn accent + glow */
.aim-editor__wire-group.is-hot .aim-editor__wire--data,
.aim-editor__wire-group.is-hot .aim-editor__wire--exec {
  stroke: var(--aim-accent);
  stroke-width: 1.75;
  filter: drop-shadow(0 0 6px rgba(255,92,43,0.45));
}
.aim-editor__wire-group.is-hot .aim-editor__wire-flow {
  animation-duration: 1.6s;
  stroke-dasharray: 12 220;
}

/* ==========================================================================
   NODES (Unreal-Engine Blueprint style)
   ========================================================================== */
.aim-editor__nodes {
  position: absolute;
  inset: 0;
  z-index: 2;
}

/* ----- Editorial fin.ai-style node card ----- */
.aim-node {
  position: absolute;
  background: #ffffff;
  border: 1px solid rgba(12,14,22,0.10);
  border-radius: 2px;
  font-family: var(--aim-font-mono);
  box-shadow:
    0 1px 0 rgba(12,14,22,0.04),
    0 12px 28px -18px rgba(12,14,22,0.18);
  transition:
    transform 0.22s var(--aim-ease),
    box-shadow 0.22s var(--aim-ease),
    border-color 0.22s var(--aim-ease);
  z-index: 3;
}
/* IMPORTANT: do NOT translate the node on hover — pin centers must remain
   pixel-perfect on the SVG wire endpoints (which live in a separate layer). */
.aim-node:hover,
.aim-node.is-hot {
  border-color: var(--aim-ink);
  z-index: 6;
  box-shadow:
    0 1px 0 rgba(12,14,22,0.06),
    0 22px 44px -18px rgba(12,14,22,0.24),
    0 0 0 3px rgba(255,92,43,0.10);
}

/* Bracket-corner ornaments (fin.ai signature) */
.aim-node__corner {
  position: absolute;
  width: 7px;
  height: 7px;
  pointer-events: none;
  color: var(--aim-ink);
  opacity: 0;
  transition: opacity 0.2s var(--aim-ease);
}
.aim-node__corner--tl { top: -4px;    left: -4px;    border-top: 1px solid currentColor; border-left: 1px solid currentColor; }
.aim-node__corner--tr { top: -4px;    right: -4px;   border-top: 1px solid currentColor; border-right: 1px solid currentColor; }
.aim-node__corner--bl { bottom: -4px; left: -4px;    border-bottom: 1px solid currentColor; border-left: 1px solid currentColor; }
.aim-node__corner--br { bottom: -4px; right: -4px;   border-bottom: 1px solid currentColor; border-right: 1px solid currentColor; }
.aim-node:hover .aim-node__corner,
.aim-node.is-hot .aim-node__corner { opacity: 0.65; }

/* Header — flat white, hairline divider, mono uppercase. No gradient. */
.aim-node__head {
  display: grid;
  grid-template-columns: 14px 1fr auto;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 11px;
  color: var(--aim-ink);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: #ffffff;
  border-bottom: 1px solid rgba(12,14,22,0.08);
}
.aim-node__icon { width: 14px; height: 14px; display: inline-flex; align-items: center; justify-content: center; color: var(--aim-ink); }
.aim-node__icon svg { width: 14px; height: 14px; }
.aim-node__title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.aim-node__badge {
  font-size: 8.5px;
  letter-spacing: 0.18em;
  font-weight: 500;
  padding: 2px 6px;
  border: 1px solid rgba(12,14,22,0.18);
  border-radius: 1px;
  color: var(--aim-ink-3);
  background: transparent;
  white-space: nowrap;
}

.aim-node__sub {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 26px;
  padding: 0 11px;
  font-size: 10.5px;
  letter-spacing: 0.02em;
  color: var(--aim-ink-3);
  text-transform: none;
  border-bottom: 1px solid rgba(12,14,22,0.05);
  background: #faf9f5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.aim-node__sub-dot {
  width: 5px;
  height: 5px;
  flex-shrink: 0;
  background: var(--aim-accent);
  border-radius: 50%;
}

/* No vertical padding — pin Y-formula in editor-mock.php assumes rows
   start exactly at (header_h + sub_h). Any padding here would offset the
   DOM pins from the SVG wire endpoints. */
.aim-node__rows {
  display: flex;
  flex-direction: column;
  padding: 0;
  background: #ffffff;
}
.aim-node__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 12px;
  align-items: center;
  height: 24px;
  padding: 0 11px;
  position: relative;
}
.aim-node__plabel {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  font-size: 10.5px;
  color: var(--aim-ink-2);
  letter-spacing: 0.02em;
  text-transform: lowercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.aim-node__plabel--in  { justify-content: flex-start; }
.aim-node__plabel--out { justify-content: flex-end; }
.aim-node__pname { color: var(--aim-ink); font-weight: 500; }
.aim-node__ptype {
  font-size: 8.5px;
  color: var(--aim-ink-4);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* Pins — hollow hairline circles. Pin CENTER is anchored exactly on the
   node edge (left:0 / right:0 + translate by 50%) so the SVG wire endpoint
   (node.x or node.x + node_w) lands dead-center. No off-by-half-pixel. */
.aim-node__pin {
  position: absolute;
  top: 50%;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #ffffff;
  border: 1px solid var(--aim-ink);
  transition: box-shadow 0.18s var(--aim-ease), background 0.18s var(--aim-ease);
}
.aim-node__pin--in  { left:  0; transform: translate(-50%, -50%); }
.aim-node__pin--out { right: 0; transform: translate( 50%, -50%); }
.aim-node:hover .aim-node__pin,
.aim-node.is-hot .aim-node__pin {
  background: var(--aim-accent);
  border-color: var(--aim-accent);
  box-shadow: 0 0 0 3px rgba(255,92,43,0.18);
}

/* ==========================================================================
   STATUSBAR (bottom of editor)
   ========================================================================== */
.aim-editor__statusbar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 12px;
  height: 32px;
  padding: 0 18px;
  background: #ffffff;
  border-top: 1px solid rgba(12,14,22,0.08);
  font-family: var(--aim-font-mono);
  font-size: 10px;
  color: var(--aim-ink-4);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  overflow: hidden;
}
.aim-editor__stat { display: inline-flex; align-items: baseline; gap: 7px; white-space: nowrap; }
.aim-editor__stat-k { color: var(--aim-ink-4); font-weight: 400; }
.aim-editor__stat-v { color: var(--aim-ink); font-weight: 500; letter-spacing: 0.06em; text-transform: none; }
.aim-editor__stat-sep { color: var(--aim-ink-5); letter-spacing: 0; }

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 980px) {
  .aim-editor__statusbar { font-size: 10px; gap: 12px; }
}
@media (max-width: 720px) {
  /* Below tablet the entire inner layer is JS-scaled; nothing to override. */
  .aim-editor__statusbar { font-size: 9.5px; gap: 10px; padding: 0 10px; }
  .aim-editor__stat-k { display: none; }
}
