.relationship-page {
  background: var(--paper);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.relationship-atlas,
.relationship-guestbook-section {
  padding: clamp(84px, 11vw, 150px) clamp(18px, 6vw, 92px);
}

.relationship-atlas {
  border-top: 1px solid var(--line);
  background: #e9e7e0;
}

.relationship-atlas-heading,
.relationship-profiles-heading {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr) minmax(240px, 380px);
  gap: 30px;
  align-items: end;
  margin-bottom: 30px;
}

.relationship-atlas-heading h1,
.relationship-profiles-heading h2 {
  max-width: 860px;
  margin: 0;
  font-family: var(--display-zh);
  font-size: clamp(32px, 4.5vw, 64px);
  font-weight: 500;
  line-height: 1.04;
}

.relationship-atlas-heading > p:last-child,
.relationship-profiles-heading > p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.75;
}

.relationship-atlas-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px 28px;
  margin: 0 0 14px;
  color: #4f4d47;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  line-height: 1.6;
}

.relationship-atlas-toolbar p,
.relationship-atlas-note {
  margin: 0;
}

.relationship-atlas-canvas {
  overflow: hidden;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.relationship-atlas-svg {
  display: block;
  width: 100%;
  height: auto;
  min-height: 520px;
  touch-action: pan-y;
  user-select: none;
}

.relationship-atlas-links path {
  fill: none;
  stroke: rgba(70, 70, 66, .42);
  stroke-width: 1;
  stroke-linecap: round;
  stroke-dasharray: 7 9;
  vector-effect: non-scaling-stroke;
}

.relationship-atlas-center circle { fill: #fff; stroke: #171716; stroke-width: 2; }
.relationship-atlas-center image { pointer-events: none; }

.relationship-hub rect { fill: #292927; stroke: #11110f; stroke-width: 1; }
.relationship-hub text { fill: #fff; font-family: var(--display-zh); font-size: 13px; }

.relationship-person {
  cursor: pointer;
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 140ms ease;
}

.relationship-person circle { fill: #fff; stroke: #171716; stroke-width: 1.25; }
.relationship-person text { fill: #171716; font-family: var(--display-zh); font-size: 14px; }

.relationship-person:hover,
.relationship-person:focus-visible,
.relationship-person.is-selected {
  transform: scale(1.1);
  outline: none;
}

.relationship-person:hover circle,
.relationship-person:focus-visible circle,
.relationship-person.is-selected circle { fill: #171716; }

.relationship-person:hover text,
.relationship-person:focus-visible text,
.relationship-person.is-selected text { fill: #171716; font-weight: 700; }

.relationship-person.is-filtered-out { opacity: 0.08; pointer-events: none; }

.relationship-atlas-note {
  max-width: 820px;
  margin-top: 16px;
  color: #6c6a64;
  font-size: 12px;
  line-height: 1.7;
}

.relationship-guestbook-section { border-top: 1px solid var(--line); background: #f8f7f4; }
.relationship-profiles-heading { margin-bottom: 48px; }

.relationship-guestbook {
  display: grid;
  gap: 12px;
  max-width: 760px;
}

.relationship-guestbook > label {
  color: var(--muted);
  font-size: 12px;
}

.relationship-guestbook textarea {
  width: 100%;
  resize: vertical;
  padding: 14px;
  border: 1px solid #bbb8af;
  border-radius: 0;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  line-height: 1.75;
}

.relationship-guestbook > div {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}

.relationship-guestbook button {
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: var(--ink);
  color: #fff;
  cursor: pointer;
}

.relationship-guestbook p,
.relationship-guestbook-toast {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.relationship-guestbook-toast {
  margin-top: 16px;
  color: #176d77;
}

.relationship-profile-tools {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(180px, 0.34fr) auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 18px;
  padding: 10px;
  border: 1px solid var(--line);
  background: #eeece6;
}

.relationship-profile-tools input,
.relationship-profile-tools select {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid #bbb8af;
  border-radius: 0;
  background: #f8f7f4;
  color: var(--ink);
  font: inherit;
  font-size: 12px;
}

.relationship-profile-tools > span {
  min-width: 58px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
  text-align: right;
}

.relationship-profiles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  border: 1px solid var(--line);
  background: var(--line);
}

.relationship-profile {
  display: grid;
  min-height: 180px;
  align-content: space-between;
  gap: 18px;
  padding: 22px;
  border: 0;
  border-radius: 0;
  background: #fdfdfb;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: background 160ms ease, transform 160ms ease;
}

.relationship-profile[hidden] { display: none; }

.relationship-profile:hover,
.relationship-profile:focus-visible,
.relationship-profile.is-selected { background: #171716; color: #fff; outline: none; transform: translateY(-3px); }

.relationship-profile-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.relationship-profile strong { font-family: var(--display-zh); font-size: 24px; font-weight: 500; }
.relationship-profile small,
.relationship-profile em { color: #75736d; font-size: 10px; font-style: normal; line-height: 1.45; }
.relationship-profile > span:nth-child(2) { font-size: 13px; line-height: 1.66; }

.relationship-profile:hover small,
.relationship-profile:hover em,
.relationship-profile:focus-visible small,
.relationship-profile:focus-visible em,
.relationship-profile.is-selected small,
.relationship-profile.is-selected em { color: rgba(255, 255, 255, 0.62); }

.relationship-dialog {
  width: min(560px, calc(100vw - 32px));
  padding: clamp(28px, 5vw, 52px);
  border: 1px solid #1a1a18;
  border-radius: 0;
  background: #fdfdfb;
  color: var(--ink);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
}

.relationship-dialog::backdrop { background: rgba(17, 17, 15, 0.62); backdrop-filter: blur(3px); }

.relationship-dialog-close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #171716;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.relationship-dialog h2 { margin: 8px 0 22px; font-family: var(--display-zh); font-size: clamp(36px, 6vw, 54px); font-weight: 500; }
.relationship-dialog p:not(.kicker) { margin: 0; color: #3b3a35; font-size: 15px; line-height: 1.9; }

.relationship-dialog [data-relationship-dialog-status] {
  display: inline-block;
  margin-top: 20px;
  color: #77746e;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
}

.relationship-dialog-return {
  display: block;
  margin-top: 30px;
  padding: 11px 15px;
  border: 1px solid #171716;
  border-radius: 0;
  background: #171716;
  color: #fff;
  cursor: pointer;
}

@media (max-width: 1020px) {
  .relationship-atlas-heading,
  .relationship-profiles-heading { grid-template-columns: 56px 1fr; gap: 18px; }
  .relationship-atlas-heading > p:last-child,
  .relationship-profiles-heading > p:last-child { grid-column: 2; max-width: 680px; }
  .relationship-profiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .relationship-atlas,
  .relationship-guestbook-section { padding: 76px 18px; }
  .relationship-atlas-heading,
  .relationship-profiles-heading { grid-template-columns: 34px 1fr; gap: 12px; }
  .relationship-atlas-heading h1,
  .relationship-profiles-heading h2 { font-size: 32px; }
  .relationship-atlas-svg { min-height: 350px; }
  .relationship-person text { font-size: 13px; }
  .relationship-hub text { font-size: 12px; }
  .relationship-profiles { grid-template-columns: 1fr; }
  .relationship-profile-tools { grid-template-columns: 1fr 1fr; }
  .relationship-profile-tools > span { grid-column: 1 / -1; text-align: left; }
  .relationship-profile { min-height: 156px; }
}

@media (prefers-reduced-motion: reduce) {
  .relationship-person,
  .relationship-profile { transition: none; }
}
.relationship-atlas-person-links path { fill: none; stroke: rgba(70,70,66,.26); stroke-width: .75; stroke-linecap: round; stroke-dasharray: 6 8; vector-effect: non-scaling-stroke; }
