/* ───────────────────────────────────────────────────────────────
   Compare node — Weavy-style A/B compare (slider + side-by-side),
   image + video, with an expand/fullscreen view. Pure viewer:
   no job, no credits. Shared compositing for card + overlay.
   ─────────────────────────────────────────────────────────────── */

.node-compare { display: flex; flex-direction: column; gap: 6px; }

/* config row (Mode + expand) */
.cmp-config { display: flex; align-items: center; gap: 8px; }
.cmp-config select {
  flex: 1; font-size: 12px; padding: 3px 6px;
  background: var(--bg2, #1a1a22); color: var(--text, #e8e8ef);
  border: 1px solid var(--border, #2a2a35); border-radius: 6px;
}
.cmp-expand-btn {
  flex-shrink: 0; cursor: pointer; font-size: 12px; line-height: 1;
  padding: 4px 7px; border-radius: 6px;
  background: var(--bg2, #1a1a22); color: var(--text2, #b8b8c8);
  border: 1px solid var(--border, #2a2a35);
}
.cmp-expand-btn:hover { border-color: var(--violet, #7c6dfa); color: var(--text, #e8e8ef); }
.cmp-expand-btn[disabled] { opacity: .4; cursor: not-allowed; }

/* stage — fills a 16:9 box in the card; the overlay sizes it larger */
.cmp-stage {
  position: relative; width: 100%; aspect-ratio: 16/9;
  background: var(--bg2, #14141b); border: 1px solid var(--border, #2a2a35);
  border-radius: 8px; overflow: hidden; user-select: none;
}
.cmp-media { width: 100%; height: 100%; object-fit: cover; display: block; background: #000; }

/* slider mode — two absolutely-stacked layers + draggable divider */
.cmp-stage.mode-slider .cmp-layer { position: absolute; inset: 0; }
.cmp-stage.mode-slider .cmp-layer.b { z-index: 1; }
.cmp-stage.mode-slider .cmp-layer.a { z-index: 2; will-change: clip-path; } /* clip-path set inline from split% */
.cmp-divider {
  position: absolute; top: 0; bottom: 0; z-index: 3; width: 2px;
  background: rgba(255,255,255,0.9); transform: translateX(-1px);
  cursor: ew-resize; box-shadow: 0 0 6px rgba(0,0,0,0.5);
}
.cmp-divider::after {
  content: ''; position: absolute; top: 50%; left: 50%;
  width: 26px; height: 26px; transform: translate(-50%, -50%);
  border-radius: 50%; background: rgba(255,255,255,0.95);
  box-shadow: 0 1px 4px rgba(0,0,0,0.5);
}
.cmp-divider::before {
  content: '⇆'; position: absolute; top: 50%; left: 50%; z-index: 1;
  transform: translate(-50%, -50%); font-size: 13px; color: #222; pointer-events: none;
}

/* side-by-side mode — two halves, no clip, no divider */
.cmp-stage.mode-sxs { display: flex; }
.cmp-stage.mode-sxs .cmp-layer { position: relative; flex: 1 1 50%; min-width: 0; height: 100%; }
.cmp-stage.mode-sxs .cmp-layer.a { border-right: 1px solid rgba(255,255,255,0.25); }
.cmp-stage.mode-sxs .cmp-media { object-fit: contain; }

/* transport (only present when ≥1 layer is video) */
.cmp-transport { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--text2, #b8b8c8); }
.cmp-transport button {
  cursor: pointer; border: 1px solid var(--border, #2a2a35); border-radius: 5px;
  background: var(--bg2, #1a1a22); color: var(--text, #e8e8ef);
  width: 26px; height: 22px; line-height: 1; font-size: 11px;
}
.cmp-transport input[type=range] { flex: 1; min-width: 0; }
.cmp-transport .cmp-time { flex-shrink: 0; font-variant-numeric: tabular-nums; }

/* empty / partial states — always a valid 16:9 box, never broken */
.cmp-empty {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 10px; font-size: 11px; color: var(--mute, #6a6a7a);
}
.cmp-hint {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 4;
  padding: 4px 8px; font-size: 10px; text-align: center;
  color: #fff; background: rgba(0,0,0,0.45);
}
.cmp-badge {
  position: absolute; top: 4px; z-index: 4; font-size: 9px; font-weight: 700;
  padding: 1px 5px; border-radius: 4px; background: rgba(0,0,0,0.55); color: #fff; letter-spacing: .04em;
}
.cmp-badge.a { left: 4px; } .cmp-badge.b { right: 4px; }

/* expand / fullscreen overlay */
.cmp-overlay {
  position: fixed; inset: 0; z-index: 9999; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 12px; padding: 32px;
  background: rgba(8,8,12,0.92); backdrop-filter: blur(4px);
}
.cmp-overlay .cmp-stage { width: min(92vw, calc((100vh - 140px) * 16 / 9)); aspect-ratio: 16/9; max-height: calc(100vh - 140px); }
.cmp-overlay .cmp-transport { width: min(92vw, calc((100vh - 140px) * 16 / 9)); }
.cmp-overlay-close {
  position: absolute; top: 18px; right: 22px; cursor: pointer;
  font-size: 22px; line-height: 1; color: #fff; background: none; border: none;
}
.cmp-overlay-title { color: #fff; font-size: 13px; opacity: .8; }
