/* Living Legacy: archive overview, source timeline and relationship map. */
.site-legacy .legacy-dashboard {
  --dash-line: rgba(137, 167, 220, 0.18);
  --dash-panel: #0b1526;
  --dash-cyan: #78d8ec;
  --dash-violet: #b59afa;
  position: relative;
  padding: 64px 0 96px;
  overflow: clip;
  background: #070e1c;
  border-block: 1px solid var(--dash-line);
}

.legacy-dashboard .shell {
  width: min(calc(100% - 96px), 1280px);
}

.dashboard-top {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 32px;
  min-width: 0;
}

.dashboard-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 320px);
  grid-template-areas: "title action" "lead note";
  align-items: center;
  gap: 16px 48px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--dash-line);
}

.dashboard-intro h2,
.dashboard-map-copy h2 {
  margin: 0;
  color: #f1f3fa;
  font-family: Lexend, Inter, sans-serif;
  font-size: clamp(28px, 2.6vw, 36px);
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 1.2;
}

.dashboard-intro h2 { grid-area: title; }

.dashboard-intro p,
.dashboard-map-copy p {
  max-width: 52ch;
  margin: 0;
  color: #aab8ce;
  font-size: 15px;
  line-height: 1.8;
}

.dashboard-intro p { grid-area: lead; }

.dashboard-create {
  grid-area: action;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 48px;
  padding: 12px 24px;
  color: #eee8ff;
  border: 1px solid rgba(181, 154, 250, 0.6);
  border-radius: 8px;
  background: rgba(154, 119, 234, 0.12);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
  text-decoration: none;
  transition: color 160ms ease, background-color 160ms ease, border-color 160ms ease;
}

.dashboard-intro-foot {
  grid-area: note;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  color: #8998b1;
  font-size: 12px;
  line-height: 1.6;
}

.dashboard-main {
  position: relative;
  min-width: 0;
  padding: 40px;
  border: 1px solid var(--dash-line);
  border-radius: 24px;
  background: var(--dash-panel);
}

.dashboard-transcript {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  color: #bdb4db;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
}

.dashboard-transcript svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  fill: none;
  stroke: var(--dash-violet);
  stroke-width: 1.7;
}

.dashboard-main h3 {
  max-width: 30ch;
  margin: 0;
  color: #f3f5fc;
  font-family: Lexend, Inter, sans-serif;
  font-size: clamp(28px, 3.3vw, 44px);
  font-weight: 400;
  letter-spacing: -0.04em;
  line-height: 1.22;
}

.dashboard-events {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: start;
  gap: 24px;
  margin-top: 40px;
}

.dashboard-event {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 0;
  color: inherit;
  border: 0;
  border-radius: 8px;
  background: transparent;
  text-align: start;
  cursor: pointer;
}

.dashboard-event figure {
  position: relative;
  aspect-ratio: 1 / 1.06;
  margin: 0 0 8px;
  overflow: hidden;
  border: 1px solid rgba(137, 167, 220, 0.28);
  border-radius: 12px;
  background: #111e30;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.dashboard-event img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.9);
  transition: transform 300ms cubic-bezier(0.23, 1, 0.32, 1);
}

.dashboard-event[data-dash-event="1"] img { object-fit: contain; }

.dashboard-event.is-selected figure {
  border-color: var(--dash-violet);
  box-shadow: 0 0 0 2px rgba(181, 154, 250, 0.18);
}

.dashboard-event-confirmed {
  position: absolute;
  inset-block-start: 8px;
  inset-inline-end: 8px;
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  color: #f2edff;
  border: 1px solid rgba(226, 216, 255, 0.32);
  border-radius: 50%;
  background: #65538e;
}

.dashboard-event-confirmed svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.dashboard-event time {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #e0bf85;
  font-size: 13px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  line-height: 1.5;
}

.dashboard-event time::before {
  content: "";
  width: 4px;
  height: 4px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: currentColor;
}

.dashboard-event b,
.dashboard-event small {
  overflow-wrap: anywhere;
  hyphens: auto;
}

.dashboard-event b {
  color: #eef2fb;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
}

.dashboard-event small {
  color: #94a3bc;
  font-size: 12px;
  line-height: 1.6;
}

.dashboard-mic {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  background: radial-gradient(circle at 50% 50%, rgba(60, 105, 179, 0.18), transparent 64%), #101c2f;
}

.dashboard-mic svg {
  width: 48%;
  height: 48%;
  fill: none;
  stroke: #c4d5f1;
  stroke-width: 1.3;
}

.dashboard-wave-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 40px;
  align-items: center;
  gap: 16px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--dash-line);
}

.dashboard-play {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  color: #d4e9fa;
  border: 1px solid rgba(120, 216, 236, 0.5);
  border-radius: 50%;
  background: rgba(74, 137, 173, 0.12);
  cursor: pointer;
  transition: background-color 160ms ease, color 160ms ease;
}

.dashboard-play svg { width: 16px; height: 16px; fill: currentColor; }
.dashboard-play.is-playing { color: #10192a; background: #cce7ff; }
.dashboard-play.is-playing svg { width: 12px; }

.dashboard-wave {
  position: relative;
  height: 48px;
  overflow: hidden;
  background: repeating-linear-gradient(90deg, transparent 0 3px, rgba(116, 146, 200, 0.24) 3px 4px, transparent 4px 8px);
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}

.dashboard-wave::before {
  content: "";
  position: absolute;
  inset: 8px 0;
  background: repeating-linear-gradient(90deg, transparent 0 6px, rgba(145, 174, 224, 0.72) 6px 8px, transparent 8px 12px);
  clip-path: polygon(0 47%,3% 47%,4% 22%,5% 72%,7% 40%,9% 40%,10% 9%,11% 89%,13% 31%,16% 55%,19% 55%,20% 20%,21% 80%,23% 40%,27% 40%,28% 8%,29% 92%,30% 28%,32% 65%,36% 45%,100% 45%,100% 57%,36% 57%,32% 35%,30% 72%,29% 8%,28% 92%,27% 60%,23% 60%,21% 20%,20% 80%,19% 45%,16% 45%,13% 69%,11% 11%,10% 91%,9% 60%,7% 60%,5% 28%,4% 78%,3% 53%,0 53%);
}

.dashboard-play.is-playing + .dashboard-wave::before { animation: dashboard-wave-shift 900ms linear infinite; }
@keyframes dashboard-wave-shift { to { transform: translateX(16px); } }
.dashboard-wave-row > small { color: #94a3bc; font-size: 12px; font-variant-numeric: tabular-nums; text-align: end; }

.dashboard-trust {
  min-width: 0;
  padding: 24px;
  border: 1px solid var(--dash-line);
  border-radius: 16px;
  background: rgba(17, 28, 47, 0.5);
}

.dashboard-trust > h3 {
  margin: 0 0 16px;
  color: #a8b5cd;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  line-height: 1.5;
}

.dashboard-trust-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px 24px;
}

.dashboard-trust-item {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 48px;
  color: #e0e7f4;
  border-radius: 8px;
  text-decoration: none;
}

.dashboard-trust-icon {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  color: #b3a0de;
  border: 1px solid rgba(181, 154, 250, 0.32);
  border-radius: 12px;
  transition: border-color 160ms ease, background-color 160ms ease;
}

.dashboard-trust-icon svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.45; }
.dashboard-trust-item b { overflow-wrap: anywhere; hyphens: auto; font-size: 14px; font-weight: 400; line-height: 1.6; }

.dashboard-map {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 32px;
  margin-top: 64px;
}

.dashboard-map-copy {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: end;
  gap: 24px 48px;
}

.dashboard-map-copy p { justify-self: end; max-width: 44ch; }

.relationship-stage {
  position: relative;
  min-width: 0;
  height: 480px;
  overflow: hidden;
  border: 1px solid var(--dash-line);
  border-radius: 24px;
  background: radial-gradient(ellipse at center, rgba(100, 83, 158, 0.08), transparent 64%), #0a1424;
  direction: ltr;
}

.relationship-orbits {
  position: absolute;
  inset: 48px 16%;
  border: 1px solid rgba(137, 167, 220, 0.12);
  border-radius: 50%;
  box-shadow: inset 0 0 0 64px rgba(74, 104, 159, 0.03);
  pointer-events: none;
}

.relationship-lines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.relationship-lines path { fill: none; stroke: #9580c7; stroke-width: 1.25; vector-effect: non-scaling-stroke; opacity: 0.6; }
.relationship-lines path:nth-child(2), .relationship-lines path:nth-child(4) { stroke: #70b4c5; }
.relationship-lines path:nth-child(3) { stroke: #c1a56e; }

.relationship-node {
  --node-size: 64px;
  position: absolute;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
  align-items: start;
  gap: 12px;
  width: 160px;
  padding: 0;
  color: #edf2fb;
  border: 0;
  border-radius: 12px;
  background: transparent;
  text-align: center;
  transform: translate(-50%, calc(var(--node-size) / -2));
  cursor: pointer;
}

.relationship-node img {
  display: block;
  width: var(--node-size);
  height: var(--node-size);
  object-fit: cover;
  border: 1px solid #76b3c4;
  border-radius: 50%;
  box-shadow: 0 0 0 4px #12273b;
  transition: transform 200ms cubic-bezier(0.23, 1, 0.32, 1), border-color 160ms ease;
}

.relationship-node span { min-width: 0; max-width: 100%; }
.relationship-node strong { display: block; overflow-wrap: anywhere; font-size: 14px; font-weight: 500; line-height: 1.5; }
.relationship-node small { display: block; margin-top: 4px; overflow-wrap: anywhere; color: #8fc8d5; font-size: 12px; line-height: 1.5; }
.relationship-node.central { --node-size: 96px; top: 48%; left: 50%; }
.relationship-node.central img { border-color: #b59afa; box-shadow: 0 0 0 6px #302647; }
.relationship-node.central small { color: #c0ace9; }
.relationship-node.harold { top: 20%; left: 22%; }
.relationship-node.david { top: 20%; left: 78%; }
.relationship-node.margaret { top: 76%; left: 22%; }
.relationship-node.emily { top: 76%; left: 78%; }

.dashboard-event:focus-visible,
.dashboard-create:focus-visible,
.dashboard-play:focus-visible,
.dashboard-trust-item:focus-visible,
.relationship-node:focus-visible {
  outline: 2px solid #c7b1ff;
  outline-offset: 8px;
}

.legacy-dashboard .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.legacy-person-dialog {
  width: min(640px, calc(100vw - 32px));
  max-height: calc(100svh - 48px);
  padding: 0;
  overflow: auto;
  color: #eff4ff;
  border: 1px solid rgba(143, 171, 238, 0.4);
  border-radius: 24px;
  background: #0b1526;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.4);
}

.legacy-person-dialog::backdrop { background: rgba(1, 4, 10, 0.72); }
.person-dialog-inner { display: grid; grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr); min-height: 360px; }
.person-dialog-inner > img { display: block; width: 100%; height: 100%; min-height: 360px; object-fit: cover; }
.person-dialog-copy { min-width: 0; padding: 48px 32px 32px; }
.person-dialog-copy p { margin: 16px 0 24px; color: #b6c5dc; font-size: 14px; line-height: 1.8; }
.person-dialog-copy > span { color: #98cbd6; font-size: 12px; }
.person-dialog-copy h2 { margin: 8px 0 0; font-family: Lexend, Inter, sans-serif; font-size: 28px; font-weight: 500; letter-spacing: -0.04em; line-height: 1.25; }
.person-dialog-copy small { display: block; padding-top: 16px; color: #94a3bc; border-top: 1px solid rgba(141, 167, 219, 0.17); font-size: 12px; line-height: 1.7; }
.person-dialog-close { position: absolute; inset-block-start: 12px; inset-inline-end: 12px; display: grid; width: 40px; height: 40px; place-items: center; color: #d9e8ff; border: 1px solid rgba(159, 187, 239, 0.3); border-radius: 50%; background: #0b1526; cursor: pointer; font-size: 24px; }

html[dir="rtl"] .relationship-node span { direction: rtl; }
html[dir="rtl"] .dashboard-create > span:last-child { transform: scaleX(-1); }

@media (hover: hover) and (pointer: fine) {
  .dashboard-create:hover { color: #fff; background: rgba(154, 119, 234, 0.22); border-color: #b59afa; }
  .dashboard-event:hover img { transform: scale(1.025); }
  .dashboard-event:hover figure { border-color: #b59afa; }
  .dashboard-play:hover { background: rgba(74, 137, 173, 0.28); }
  .dashboard-trust-item:hover .dashboard-trust-icon { border-color: #b59afa; background: rgba(181, 154, 250, 0.08); }
  .relationship-node:hover img { transform: translateY(-4px); border-color: #b59afa; }
  .person-dialog-close:hover { color: #fff; border-color: #b59afa; }
}

@media (max-width: 1000px) {
  .dashboard-main { padding: 32px; }
  .dashboard-trust-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .dashboard-intro { grid-template-columns: minmax(0, 1fr); grid-template-areas: "title" "lead" "action" "note"; gap: 16px; }
  .dashboard-create, .dashboard-intro-foot { width: min(100%, 320px); }
  .dashboard-create { margin-top: 8px; }
  .dashboard-events { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px 24px; }
  .dashboard-map-copy { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .dashboard-map-copy p { justify-self: start; max-width: 52ch; }
}

@media (max-width: 768px) {
  .site-legacy .legacy-dashboard { padding: 48px 0 64px; }
  .legacy-dashboard .shell { width: calc(100% - 48px); }
  .dashboard-main { padding: 24px; border-radius: 16px; }
  .dashboard-main h3 { max-width: 30ch; }
  .dashboard-events { margin-top: 32px; }
  .dashboard-map { margin-top: 48px; }
  .relationship-stage { height: 520px; border-radius: 16px; }
}

@media (max-width: 560px) {
  .legacy-dashboard .shell { width: calc(100% - 32px); }
  .dashboard-top { gap: 24px; }
  .dashboard-intro { padding-bottom: 24px; }
  .dashboard-create, .dashboard-intro-foot { width: 100%; }
  .dashboard-main { padding: 24px 16px; }
  .dashboard-main h3 { font-size: 28px; letter-spacing: -0.035em; }
  .dashboard-events { gap: 24px 16px; }
  .dashboard-event b { font-size: 13px; }
  .dashboard-event small { font-size: 11px; }
  .dashboard-wave-row { grid-template-columns: 48px minmax(0, 1fr) 32px; gap: 8px; }
  .dashboard-trust { padding: 16px; }
  .dashboard-trust-list { gap: 16px; }
  .dashboard-trust-item { grid-template-columns: 32px minmax(0, 1fr); gap: 8px; }
  .dashboard-trust-icon { width: 32px; height: 32px; border-radius: 8px; }
  .dashboard-trust-icon svg { width: 20px; height: 20px; }
  .dashboard-trust-item b { font-size: 13px; }
  .dashboard-map { gap: 24px; }
  .relationship-stage { height: 560px; }
  .relationship-node { --node-size: 56px; width: min(128px, calc(44% - 16px)); gap: 12px; }
  .relationship-node.central { --node-size: 80px; }
  .relationship-node strong { font-size: 12px; }
  .relationship-node small { font-size: 11px; }
  .relationship-orbits { inset: 64px 12%; }
  .person-dialog-inner { grid-template-columns: minmax(0, 1fr); }
  .person-dialog-inner > img { height: 240px; min-height: 0; object-position: center 35%; }
  .person-dialog-copy { padding: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  .dashboard-play.is-playing + .dashboard-wave::before { animation: none; }
  .dashboard-event img, .relationship-node img { transition: none; transform: none; }
}
