/* VisualWills — base styles.
   Lean stylesheet; no shared inheritance from client-v2. When
   carve-out lands, copy the minimum needed from client-v2/styles.css
   (person spec rules, canvas pan/zoom rules) and prune. */

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  background: #1a1a2e;
  color: #e0e0e0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  overflow: hidden;
}

/* Photoshop-style left toolbox (per Trevor 2026-05-02): readable
   icon slots at ~2× the original grooveboard.maplegroove.com sizes
   (master had 38×38 icons in a 72px-wide slot; visualwills uses
   76×76 icons in a 144px slot). Tray sits in a 168px left column. */
body { display: grid; grid-template-rows: auto 1fr; grid-template-columns: 168px 1fr; }

#vw-header {
  grid-row: 1; grid-column: 1 / -1;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 18px;
  background: #16213e;
  border-bottom: 1px solid #0f3460;
}
.vw-title { font-size: 18px; color: #a78bfa; letter-spacing: 0.02em; }
.vw-toolbar { display: flex; gap: 8px; }
.vw-toolbar button {
  background: #0f3460; color: #e0e0e0; border: 1px solid #533483;
  padding: 6px 12px; border-radius: 4px; font-size: 13px;
  cursor: pointer; transition: background .15s;
}
.vw-toolbar button:hover:not(:disabled) { background: #533483; }
.vw-toolbar button:disabled { opacity: 0.4; cursor: not-allowed; }

#vw-tray {
  grid-row: 2; grid-column: 1;
  background: #0f172a;
  border-right: 1px solid #0f3460;
  padding: 12px 12px;
  /* Vertical scroll only — column width is fixed by the grid, so a
     horizontal scrollbar would only appear if a child overflowed.
     overflow-x:hidden cuts that off cleanly. */
  overflow-y: auto;
  overflow-x: hidden;
  display: flex; flex-direction: column; gap: 8px;
  align-items: center;
  user-select: none;
  box-sizing: border-box;
}

/* Tray slot — readable size. Master had 72px slots / 38px icons /
   9px labels; visualwills doubles those (144px slot, 76px icon,
   13px label) so a passerby can tell what they're looking at. */
.vw-tray-slot {
  display: flex; flex-direction: column; align-items: center;
  width: 144px; padding: 10px 6px; border-radius: 8px;
  background: transparent;
  border: 1px solid transparent;
  cursor: grab;
  transition: background .12s, border-color .12s;
}
.vw-tray-slot:hover {
  background: rgba(167, 139, 250, 0.12);
  border-color: rgba(167, 139, 250, 0.35);
}
.vw-tray-slot:active { cursor: grabbing; }
/* PNGs are transparent, so no white background or padding. */
.vw-tray-slot img {
  width: 76px; height: 92px; object-fit: contain;
  pointer-events: none;
}
.vw-tray-slot .vw-tray-label {
  font-size: 13px; color: #cbd5e1; text-align: center;
  margin-top: 6px; line-height: 1.2; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 132px;
}

#vw-canvas-wrap {
  grid-row: 2; grid-column: 2;
  position: relative;
  overflow: hidden;
}

#vw-canvas {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, #1e293b 0%, #0f172a 100%);
  cursor: grab;
}
#vw-canvas.vw-canvas-panning { cursor: grabbing; }

.vw-placeholder {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  color: #64748b; font-style: italic; font-size: 14px;
}

/* Shortcut legend — fixed in the bottom-right corner of the canvas
   wrap. Subtle background so it's readable without dominating. */
#vw-legend {
  position: absolute;
  bottom: 16px; right: 16px;
  width: 280px; max-height: 60vh; overflow-y: auto;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(167, 139, 250, 0.25);
  border-radius: 8px;
  padding: 10px 14px;
  color: #cbd5e1;
  font-size: 12px;
  z-index: 50;
  pointer-events: auto;
  backdrop-filter: blur(4px);
}
#vw-legend h4 {
  margin: 0 0 6px;
  color: #a78bfa;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
#vw-legend dl {
  display: grid;
  grid-template-columns: minmax(100px, auto) 1fr;
  gap: 4px 10px;
  margin: 0;
}
#vw-legend dt {
  color: #f1f5f9;
  font-weight: 600;
  white-space: nowrap;
}
#vw-legend dd {
  margin: 0;
  color: #94a3b8;
}

/* Tray ghost — follows the mouse during drag-to-spawn. */
.vw-tray-ghost {
  position: fixed; pointer-events: none; z-index: 1000;
  opacity: 0.85;
  background: rgba(167, 139, 250, 0.18);
  border-color: rgba(167, 139, 250, 0.6);
}

/* World layer — all nodes + wires live here. Pan/zoom transform
   applies to this single element. transform-origin: 0 0 so zoom
   anchors at the world origin (not center). */
.vw-world {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  transform-origin: 0 0;
}

/* SVG wire overlay — under the nodes, above the canvas bg. */
.vw-wires {
  position: absolute;
  pointer-events: none;
  overflow: visible;
}
.vw-wire {
  stroke: #a78bfa;
  stroke-width: 2.5;
  fill: none;
  pointer-events: stroke;
  cursor: pointer;
  transition: stroke .12s, stroke-width .12s;
}
.vw-wire:hover { stroke: #f43f5e; stroke-width: 3.5; }
.vw-wire-pending {
  stroke: #c4b5fd;
  stroke-dasharray: 6 4;
  pointer-events: none;
}

/* Person card — chromeless per Trevor 2026-05-03. PNGs are
   transparent isometric figures, so the card has no border and no
   solid fill. Bottom padding is 30px — that's the dead zone where
   the bottom cleat lives, so content (chevron header / panel) is
   guaranteed to stay above it. */
.vw-person {
  position: absolute;
  background: transparent;
  border: none;
  display: flex; flex-direction: column;
  padding: 10px 12px 30px 12px;
  cursor: grab;
  user-select: none;
  z-index: 2;
}
.vw-person.vw-dragging { cursor: grabbing; }
.vw-person.vw-selected, .vw-linker.vw-selected {
  outline: 2px solid #a78bfa;
  outline-offset: 4px;
  border-radius: 8px;
}
.vw-person:active { cursor: grabbing; }
.vw-person-del {
  position: absolute; top: 4px; right: 6px;
  background: transparent; color: #94a3b8;
  border: none; font-size: 18px; line-height: 1;
  cursor: pointer; padding: 0 4px; border-radius: 4px;
  z-index: 3;
}
.vw-person-del:hover { background: #f43f5e; color: #fff; }
.vw-person-img {
  width: 130px; height: 160px; object-fit: contain;
  align-self: center; margin-top: 4px;
  pointer-events: none;
}
.vw-person-name {
  margin-top: 8px; padding: 4px 6px;
  text-align: center; font-weight: 600; font-size: 14px;
  color: #f1f5f9; outline: none; border-radius: 4px;
  cursor: text; min-height: 1.2em;
}
.vw-person-name:empty::before {
  content: attr(data-placeholder);
  color: #64748b; font-style: italic; font-weight: 400;
}
.vw-person-name:focus { background: rgba(255, 255, 255, 0.06); }
.vw-person-dob {
  display: flex; flex-direction: column; gap: 2px;
  align-items: center;
  margin-top: 6px;
}
.vw-person-dob-input {
  background: #0f172a; color: #e0e0e0;
  border: 1px solid #334155; border-radius: 4px;
  padding: 3px 6px; font: inherit; font-size: 12px;
  outline: none;
  color-scheme: dark;
}
.vw-person-dob-input:focus { border-color: #a78bfa; }
.vw-person-age {
  font-size: 11px; color: #a78bfa; font-weight: 600;
  letter-spacing: 0.02em; min-height: 1.1em;
}

/* Contact chevron — collapsed by default to keep the card compact.
   Click "▸ Contact" to expand and reveal Mobile / Email / Place
   of birth. State persists per-node in node.contactOpen. */
.vw-person-chev {
  margin-top: 8px;
  display: flex; flex-direction: column;
}
.vw-person-chev-header {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  padding: 5px 8px;
  border-radius: 5px;
  font: inherit; font-size: 12px;
  text-align: left; cursor: pointer;
  transition: background .12s, color .12s;
}
.vw-person-chev-header:hover {
  background: rgba(167, 139, 250, 0.15);
  color: #fff;
}
.vw-person-chev-panel {
  display: flex; flex-direction: column;
  gap: 4px;
  margin-top: 4px;
}
/* Author CSS's `display: flex` overrides the UA `[hidden]{display:none}`,
   so we have to reassert it here for the chevron to actually hide. */
.vw-person-chev-panel[hidden] { display: none; }

.vw-person-field {
  display: flex; flex-direction: column; gap: 2px;
  margin-top: 4px;
}
.vw-person-field-label {
  font-size: 10px; color: #64748b;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.vw-person-field-input {
  background: #0f172a; color: #e0e0e0;
  border: 1px solid #334155; border-radius: 4px;
  padding: 4px 6px; font: inherit; font-size: 12px;
  outline: none; width: 100%; box-sizing: border-box;
}
.vw-person-field-input:focus { border-color: #a78bfa; }

/* Linker — chain image + relationship dropdown. Connects two
   people. Mirrors the grooveboard linker spec visually. */
.vw-linker {
  position: absolute;
  background: transparent;
  border: none;
  display: flex; flex-direction: column;
  padding: 6px 8px;
  cursor: grab;
  user-select: none;
  z-index: 2;
}
.vw-linker-del {
  position: absolute; top: 4px; right: 6px;
  background: transparent; color: #94a3b8;
  border: none; font-size: 18px; line-height: 1;
  cursor: pointer; padding: 0 4px; border-radius: 4px;
  z-index: 3;
}
.vw-linker-del:hover { background: #f43f5e; color: #fff; }
.vw-linker-img {
  width: 110px; height: 110px; object-fit: contain;
  align-self: center;
  pointer-events: none;
}
.vw-linker-select {
  margin-top: 6px;
  background: #0f172a; color: #e0e0e0;
  border: 1px solid #334155; border-radius: 4px;
  padding: 4px 6px; font: inherit; font-size: 12px;
  outline: none; width: 100%; box-sizing: border-box;
}
.vw-linker-select:focus { border-color: #a78bfa; }

/* Cleats — small dots on each edge of the card. */
.vw-cleat {
  position: absolute; width: 14px; height: 14px;
  border-radius: 50%;
  background: #533483; border: 2px solid #1e293b;
  cursor: crosshair;
  z-index: 4;
  transition: transform .12s, background .12s;
}
.vw-cleat:hover { background: #a78bfa; transform: scale(1.4); }
