/* VysyaFamily - the Family Web canvas (30-44, 148-151).
   Only tokens from app.css are used; .pnode itself is styled there so a person
   looks identical on the canvas, in a tray and on a profile page. */

.web-body main.full { padding: 0; }
/* The canvas IS the page: the site footer below a 100vh stage would only add a
   scrollbar to a surface that pans and zooms. Scoped to this body class. */
.web-body .foot { display: none; }
.web {
  /* positioned: the phone rail is absolute inside it, and without this it
     resolves against the page and drags the whole document taller. */
  position: relative;
  display: flex;
  height: calc(100vh - 57px);
  overflow: hidden;
}

/* ------------------------------------------------------------------- rail */
.web-rail {
  width: 322px; flex: 0 0 322px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  overflow-y: auto;
  padding: 16px 16px 70px;
}
.web-rail .card { margin-bottom: 13px; padding: 13px; }
.web-rail h1 { font-size: 17px; }
.rail-head { display: flex; align-items: flex-start; justify-content: space-between;
  gap: 10px; margin-bottom: 14px; }
.railclose, .railopen { display: none; }
.web-rail hr { border: 0; border-top: 1px solid var(--line); margin: 9px 0; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px;
  padding: 3px 0; color: var(--ink); margin: 0; cursor: pointer; }
.check input { width: auto; }
.web-rail .row input[type=text] { flex: 1; min-width: 120px; }
.web-rail .tiny { margin-top: 7px; line-height: 1.5; }

.tabs { display: flex; gap: 6px; margin-bottom: 9px; }
.tab { flex: 1; background: transparent; border: 1px solid var(--line);
  color: var(--muted); border-radius: var(--r-sm); padding: 6px 8px;
  font: 600 12px var(--font); cursor: pointer; }
.tab.on { color: var(--ink); border-color: var(--gold); background: var(--gold-soft); }
.tray { max-height: 320px; overflow-y: auto; display: grid; gap: 7px; }
.tray-item { display: flex; align-items: center; gap: 10px; padding: 6px;
  border: 1px solid var(--line); border-radius: var(--r-sm); background: #141834;
  cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.tray-item:hover { border-color: var(--gold); }
.tray-item .nm { font-size: 12.5px; line-height: 1.3; }
.tray-item .sub { font-size: 11px; color: var(--muted); }
.tray-empty { font-size: 12px; color: var(--muted); padding: 8px 2px; }

/* ------------------------------------------------------------------ stage */
.web-stage { flex: 1; position: relative; overflow: hidden; cursor: grab;
  touch-action: none;
  /* a drag must move a portrait, never sweep a text selection across captions */
  user-select: none; -webkit-user-select: none; }
.web-stage.panning { cursor: grabbing; }
.web-world { position: absolute; left: 0; top: 0; transform-origin: 0 0;
  width: 1px; height: 1px; }
.web-edges { position: absolute; left: 0; top: 0; width: 1px; height: 1px;
  overflow: visible; pointer-events: none; }
.web-edges path { fill: none; stroke: #3f4a86; stroke-width: 1.8;
  stroke-linecap: round; }
.web-edges path.spouse { stroke: var(--gold); stroke-opacity: .6; stroke-dasharray: 6 6; }
.web-edges path.sibling { stroke: var(--cyan); stroke-opacity: .5; stroke-dasharray: 2 6; }
.web-edges path.related { stroke: var(--dim); stroke-dasharray: 1 7; }
.web-edges path.pending { stroke: var(--gold); stroke-opacity: .85; stroke-dasharray: 9 5; }
.web-edges path.disputed { stroke: var(--danger); }
.web-edges path.strong { stroke-width: 2.6; stroke: #5b68b6; }
.web-edges path.hot { stroke: var(--gold); stroke-width: 2.6; stroke-opacity: .95; }
.web-edges path.hidden { display: none; }
.web-edges path.linkline { stroke: var(--gold); stroke-width: 2.4; stroke-dasharray: 8 6;
  animation: linkflow .7s linear infinite; }
@keyframes linkflow { to { stroke-dashoffset: -28; } }

.web-nodes { position: absolute; left: 0; top: 0; width: 1px; height: 1px; }

/* -------------------------------------------------------------- the node */
.wnode { position: absolute; left: 0; top: 0; will-change: transform;
  touch-action: none; cursor: grab; }
.wnode .pnode { cursor: inherit; }
.wnode.dragging { cursor: grabbing; z-index: 40; }
.wnode.sel { z-index: 30; }
.wnode.off { display: none; }
.wnode.faded { opacity: .22; }                 /* 37: invalid drop targets dim */
.wnode:focus { outline: none; }
.wnode:focus-visible .pnode .verif,
.wnode.sel .pnode .verif { box-shadow: 0 0 0 3px #7aa2ff, 0 0 0 1px rgba(0,0,0,.5) inset; }

.wnode .cap { position: absolute; left: 50%; top: calc(100% + 10px);
  transform: translateX(-50%); width: 190px; text-align: center;
  pointer-events: none; }
.wnode.has-garland .cap { top: calc(100% + 42px); }
.wnode .cap .nm { font-size: 13px; font-weight: 600; line-height: 1.25; }
.wnode .cap .yr { font-size: 11px; color: var(--muted); margin-top: 2px; }
.wnode .cap .memorial-badge { margin-top: 3px; }
.wnode .cap .pill { margin-top: 3px; background: rgba(13,16,32,.65); }

/* 149: the collapse chip lives INSIDE the caption block, so it always lands
   below the name, the years and the memorial badge - a fixed offset from the
   portrait would collide the moment a garland makes the caption taller. */
.wnode .cap .expand { display: inline-block; margin-top: 6px; pointer-events: auto;
  background: var(--panel2); border: 1px solid var(--line); color: var(--ink);
  border-radius: 20px; padding: 2px 9px; font: 600 11px var(--font); cursor: pointer;
  white-space: nowrap; }
.wnode .cap .expand:hover { border-color: var(--gold); color: var(--gold); }

/* ----------------------------------------------------- 33-36: the handles */
.wnode .handle { position: absolute; width: 24px; height: 24px; border-radius: 50%;
  background: var(--panel2); border: 1px solid var(--line); color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  font: 600 13px var(--font); cursor: crosshair; opacity: 0; pointer-events: none;
  transition: opacity .14s, transform .14s; z-index: 5; padding: 0; }
.wnode.sel .handle, .wnode:hover .handle, .wnode:focus-within .handle { opacity: 1;
  pointer-events: auto; }
.wnode .handle:hover, .wnode .handle:focus-visible { border-color: var(--gold);
  color: var(--gold); transform: scale(1.16); outline: none; }
.wnode .handle.parent { left: 50%; top: -32px; margin-left: -12px; }
.wnode .handle.child  { left: 50%; bottom: -32px; margin-left: -12px; }
.wnode .handle.left   { left: -32px; top: 50%; margin-top: -12px; }
.wnode .handle.right  { right: -32px; top: 50%; margin-top: -12px; }
.wnode.has-garland .handle.parent { top: -50px; }
.wnode.has-garland .handle.child { bottom: -44px; }
.wnode.linking .handle { opacity: 0; pointer-events: none; }

/* 37: destination glows, a relationship zone appears, attraction engages */
.wnode.zone::before { content: ""; position: absolute; inset: -30px; border-radius: 50%;
  border: 1px dashed rgba(240,180,41,.55); background: rgba(240,180,41,.07);
  animation: zonein .18s ease-out; }
@keyframes zonein { from { transform: scale(.86); opacity: 0; } }
.wnode.magnet .pnode .halo { animation: none; opacity: 1; transform: scale(1.18); }
.wnode.magnet .pnode .verif { box-shadow: 0 0 0 5px rgba(240,180,41,.35),
  0 0 22px 6px rgba(240,180,41,.35); }

/* 44: research candidates are visibly provisional */
.wnode.candidate .cap .nm { color: var(--muted); font-style: italic; }
.wnode.candidate .pnode .halo { opacity: .45; }

/* ----------------------------------------------------------- 38: preview */
.web-preview { position: absolute; z-index: 60; pointer-events: none; display: none;
  background: rgba(16,20,44,.97); border: 1px solid var(--gold);
  border-radius: 12px; padding: 9px 13px; font-size: 12.5px; line-height: 1.5;
  box-shadow: 0 14px 34px rgba(0,0,0,.55); max-width: 260px; }
.web-preview.on { display: block; }
.web-preview b { display: block; font-size: 13px; }
.web-preview .rel { color: var(--gold); letter-spacing: .12em; font-weight: 600;
  font-size: 11px; text-transform: uppercase; margin: 3px 0; }
.web-preview .no { color: var(--danger); font-size: 11.5px; margin-top: 3px; }
.web-preview .hint { color: var(--muted); font-size: 11px; margin-top: 4px; }

/* --------------------------------------------------------- stage furniture */
.web-tip { position: absolute; z-index: 55; pointer-events: none; opacity: 0;
  transition: opacity .12s; background: rgba(16,20,44,.96);
  border: 1px solid var(--line); border-radius: 11px; padding: 9px 12px;
  font-size: 12px; line-height: 1.6; min-width: 180px; max-width: 260px;
  box-shadow: 0 12px 32px rgba(0,0,0,.5); }
.web-tip.on { opacity: 1; }
.web-tip b { display: block; font-size: 13px; margin-bottom: 3px; }
.web-tip .k { color: var(--muted); }

.web-zoom { position: absolute; right: 14px; bottom: 14px; display: flex; gap: 6px;
  z-index: 12; }
.web-zoom button { width: 34px; height: 34px; border-radius: 9px; background: var(--panel);
  border: 1px solid var(--line); color: var(--ink); cursor: pointer; font-size: 15px; }
.web-zoom button:hover { border-color: var(--gold); }

.web-legend { position: absolute; left: 14px; bottom: 14px; z-index: 12;
  background: rgba(20,24,52,.86); border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 12px; font-size: 11.5px; color: var(--muted); line-height: 1.7;
  backdrop-filter: blur(4px); max-width: 340px; }
.web-legend b { color: var(--ink); }

.web-undo { position: absolute; right: 14px; top: 14px; z-index: 12; display: flex;
  align-items: center; gap: 8px; background: rgba(20,24,52,.9);
  border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px; }

.web-empty { position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center; gap: 12px;
  padding: 30px; z-index: 8; }
.web-empty p { max-width: 460px; margin: 0; }
.web-empty-art { position: relative; width: 130px; height: 130px; }
.web-empty-art .ring { position: absolute; inset: 0; border-radius: 50%;
  border: 1px solid rgba(240,180,41,.45); animation: emptyPulse 3.6s ease-in-out infinite; }
.web-empty-art .ring:nth-child(2) { inset: 18px; animation-delay: .5s; }
.web-empty-art .ring:nth-child(3) { inset: 36px; animation-delay: 1s; }
@keyframes emptyPulse { 0%,100% { opacity: .35; transform: scale(1); }
  50% { opacity: .9; transform: scale(1.05); } }

/* ---------------------------------------------------------------- dialogs */
.web-modal { position: fixed; inset: 0; background: rgba(6,8,20,.74); z-index: 90;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  backdrop-filter: blur(3px); }
.web-modal[hidden] { display: none; }
.web-modal .web-sheet { background: var(--bg2); border: 1px solid var(--line);
  border-radius: 16px; width: 100%; max-width: 560px; max-height: 88vh;
  overflow: auto; padding: 22px 24px; box-shadow: var(--shadow); }
.web-modal .web-sheet.compact { max-width: 380px; }
.web-modal h2 { font-size: 19px; margin-bottom: 10px; }
.web-modal .sentence { font-size: 15px; line-height: 1.6; margin: 6px 0 14px; }
.web-modal .sentence b { color: var(--gold); }
.web-modal .row.end { justify-content: flex-end; margin-top: 16px; }
.web-modal .warnbox { border-left: 3px solid var(--gold); background: var(--gold-soft);
  border-radius: var(--r-sm); padding: 10px 13px; font-size: 12.5px; line-height: 1.6;
  margin-bottom: 12px; }
.web-modal .warnbox.bad { border-left-color: var(--danger);
  background: rgba(244,105,95,.12); }
.web-modal .pickerbox { border-top: 1px solid var(--line); padding-top: 12px;
  margin-top: 4px; }
.web-modal .pickerbox .row select { flex: 1; min-width: 150px; }
.web-modal .actions { display: grid; gap: 8px; margin-top: 12px; }
.web-modal .actions button, .web-modal .actions a { text-align: left;
  background: var(--panel2); border: 1px solid var(--line); border-radius: var(--r-sm);
  color: var(--ink); padding: 10px 12px; font: 500 13px var(--font); cursor: pointer;
  text-decoration: none; display: block; }
.web-modal .actions button:hover, .web-modal .actions a:hover { border-color: var(--gold); }
.web-modal .preview-node { display: flex; justify-content: center; gap: 46px;
  padding: 16px 0 4px; }

/* ------------------------------------------------------------------ small */
@media (prefers-reduced-motion: reduce) {
  .web-edges path.linkline { animation: none; }
  .wnode.zone::before { animation: none; }
  .web-empty-art .ring { animation: none; }
}
@media (max-width: 760px) {
  /* The mobile shell adds a fixed tab bar and pads the body for it. This page
     sizes its own stage in JS instead, so the padding would only add a stray
     56px of page scroll under a canvas that already fills the screen. */
  body.web-body { padding-bottom: 0; }
  .web-zoom { bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }
}
@media (max-width: 900px) {
  .web { height: calc(100vh - 53px); }
  .web-rail { position: absolute; z-index: 70; height: 100%; width: 300px;
    flex-basis: 300px; transform: translateX(-101%); transition: transform .2s; }
  .web-rail.open { transform: none; }
  .railclose { display: block; background: none; border: 0; color: var(--muted);
    font-size: 22px; line-height: 1; cursor: pointer; padding: 0 4px; }
  .railopen { display: block; position: absolute; left: 12px; top: 12px; z-index: 15;
    background: var(--panel); border: 1px solid var(--line); border-radius: 9px;
    color: var(--ink); padding: 8px 12px; font: 500 13px var(--font); cursor: pointer; }
  .web-legend { display: none; }
  .web-undo { right: 10px; top: 10px; }
}
