@charset "UTF-8";
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
}

body {
  font-family: "Inter", system-ui, sans-serif;
  background: #0f0e0d;
  color: #e8e0d4;
  -webkit-font-smoothing: antialiased;
}

body:has(.app) {
  overflow: hidden;
}

.app {
  width: 100vw;
  height: 100vh;
  position: relative;
  overflow: hidden;
}

.welcome-screen {
  position: absolute;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1a1816;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.welcome-screen--hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.welcome-screen__content {
  max-width: 640px;
  padding: 2rem;
  text-align: center;
}

.welcome-screen__title {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 600;
  color: #c4a882;
  margin-bottom: 1.5rem;
  line-height: 1.2;
}

.welcome-screen__text {
  font-size: 1.125rem;
  line-height: 1.8;
  color: #a89f94;
  margin-bottom: 2.5rem;
}

.welcome-screen__btn {
  font-family: "Inter", system-ui, sans-serif;
  font-size: 1rem;
  font-weight: 500;
  padding: 0.875rem 2.5rem;
  border: 1px solid #c4a882;
  background: transparent;
  color: #c4a882;
  cursor: pointer;
  border-radius: 2px;
  transition: background 0.3s ease, color 0.3s ease;
}

.welcome-screen__btn:hover {
  background: #c4a882;
  color: #0f0e0d;
}

.graph-container {
  width: 100%;
  height: 100%;
  position: relative;
  cursor: grab;
}

.graph-container--hidden {
  visibility: hidden;
}

.graph-container:active {
  cursor: grabbing;
}

.graph-container canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.welcome-reopen {
  font-family: "Inter", system-ui, sans-serif;
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.5rem 0.875rem;
  border: 1px solid rgba(196, 168, 130, 0.45);
  background: rgba(30, 28, 26, 0.9);
  color: #c4a882;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

.welcome-reopen:hover {
  background: rgba(196, 168, 130, 0.15);
  border-color: #c4a882;
  color: #d4bc9a;
}

.graph-toolbar {
  position: absolute;
  top: 1rem;
  left: 1rem;
  z-index: 45;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.graph-labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.layout-hint {
  position: absolute;
  left: 1rem;
  bottom: 1rem;
  z-index: 40;
  padding: 0.5rem 0.75rem;
  background: rgba(30, 28, 26, 0.9);
  border: 1px solid rgba(196, 168, 130, 0.35);
  border-radius: 4px;
  font-size: 0.8125rem;
  color: #a89f94;
  pointer-events: none;
}

.layout-toast {
  position: absolute;
  right: 1rem;
  bottom: 1rem;
  z-index: 40;
  padding: 0.5rem 0.875rem;
  background: rgba(196, 168, 130, 0.95);
  color: #0f0e0d;
  border-radius: 4px;
  font-size: 0.8125rem;
  font-weight: 500;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.layout-toast[hidden] {
  display: none;
}

.tooltip {
  position: fixed;
  z-index: 50;
  padding: 0.375rem 0.75rem;
  background: rgba(30, 28, 26, 0.95);
  border: 1px solid rgba(196, 168, 130, 0.3);
  border-radius: 4px;
  font-size: 0.875rem;
  color: #e8e0d4;
  pointer-events: none;
  white-space: nowrap;
  transform: translate(-50%, -120%);
}

.person-popup {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.person-popup[hidden] {
  display: none;
}

.person-popup__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
}

.person-popup__card {
  position: relative;
  z-index: 1;
  width: 90%;
  max-width: 400px;
  padding: 2rem;
  background: #1e1c1a;
  border: 1px solid rgba(196, 168, 130, 0.2);
  border-radius: 8px;
  text-align: center;
}

.person-popup__close {
  position: absolute;
  top: 0.75rem;
  right: 1rem;
  background: none;
  border: none;
  color: #a89f94;
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

.person-popup__close:hover {
  color: #e8e0d4;
}

.person-popup__photo-wrap {
  width: 96px;
  height: 96px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid #c4a882;
}

.person-popup__photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.person-popup__photo[hidden] {
  display: none;
}

.person-popup__initials {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #2a2622;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 0.95rem;
  line-height: 1.2;
  text-align: center;
  padding: 0.45rem;
  color: #c4a882;
}

.person-popup__initials[hidden] {
  display: none;
}

.person-popup__name {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.55rem;
  color: #c4a882;
  margin-bottom: 0.35rem;
}

.person-popup__dates {
  font-size: 0.875rem;
  color: #a89f94;
  margin-bottom: 0.75rem;
}

.person-popup__dates[hidden] {
  display: none;
}

.person-popup__bio {
  font-size: 0.9375rem;
  line-height: 1.6;
  color: #a89f94;
  margin-bottom: 1.25rem;
}

.person-popup__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.person-popup__link {
  display: inline-block;
  font-size: 0.875rem;
  font-weight: 500;
  color: #c4a882;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s ease, color 0.3s ease;
}

.person-popup__link:hover {
  color: #d4bc9a;
  border-bottom-color: #d4bc9a;
}

.person-popup__help {
  font-family: "Inter", system-ui, sans-serif;
  font-size: 0.8125rem;
  padding: 0.35rem 0.75rem;
  border: 1px solid rgba(196, 168, 130, 0.4);
  background: transparent;
  color: #a89f94;
  cursor: pointer;
  border-radius: 4px;
  transition: color 0.3s ease, border-color 0.3s ease;
}

.person-popup__help:hover {
  color: #c4a882;
  border-color: #c4a882;
}

.help-modal {
  position: fixed;
  inset: 0;
  z-index: 220;
  display: flex;
  align-items: center;
  justify-content: center;
}

.help-modal[hidden] {
  display: none;
}

.help-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
}

.help-modal__card {
  position: relative;
  z-index: 1;
  width: 92vw;
  max-width: 920px;
  max-height: 88vh;
  overflow-y: auto;
  padding: 2rem 1.75rem 1.75rem;
  background: #1e1c1a;
  border: 1px solid rgba(196, 168, 130, 0.25);
  border-radius: 8px;
}

.help-modal__close {
  position: absolute;
  top: 0.75rem;
  right: 1rem;
  background: none;
  border: none;
  color: #a89f94;
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

.help-modal__close:hover {
  color: #e8e0d4;
}

.help-modal__title {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.75rem;
  color: #c4a882;
  margin-bottom: 1.25rem;
  padding-right: 2rem;
}

.help-modal__section {
  margin-bottom: 1.25rem;
}

.help-modal__section h3 {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.125rem;
  color: #e8e0d4;
  margin-bottom: 0.625rem;
}

.help-legend {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.help-legend li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: #a89f94;
  font-size: 0.9375rem;
  line-height: 1.45;
}

.help-legend strong {
  color: #e8e0d4;
  font-weight: 500;
}

.help-legend__line {
  flex-shrink: 0;
  width: 36px;
  height: 3px;
  border-radius: 2px;
}

.help-legend__line--parent {
  background: #6b8f71;
}

.help-legend__line--sibling {
  background: #8f6b7a;
}

.help-legend__line--spouse {
  background: #c4a882;
}

.help-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.help-list li {
  position: relative;
  padding-left: 0.875rem;
  color: #a89f94;
  font-size: 0.9375rem;
  line-height: 1.5;
}

.help-list li::before {
  content: '–';
  position: absolute;
  left: 0;
  color: #c4a882;
}

.help-list em {
  font-style: normal;
  color: #c4a882;
}

.person-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  min-height: 100vh;
  overflow-y: auto;
}

.person-page__back {
  display: inline-block;
  color: #c4a882;
  text-decoration: none;
  font-size: 0.875rem;
  margin-bottom: 2rem;
  transition: color 0.3s ease;
}

.person-page__back:hover {
  color: #d4bc9a;
}

.person-page__header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

.person-page__photo, .person-page__initials {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 2px solid #c4a882;
}

.person-page__photo {
  object-fit: cover;
}

.person-page__initials {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #2a2622;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 0.7rem;
  line-height: 1.15;
  text-align: center;
  padding: 0.4rem;
  color: #c4a882;
}

.person-page__name {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.75rem;
  color: #c4a882;
  margin-bottom: 0.25rem;
}

.person-page__dates {
  color: #a89f94;
  font-size: 0.9375rem;
}

.person-page__bio {
  margin-bottom: 2.5rem;
}

.person-page__bio h2 {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.5rem;
  color: #e8e0d4;
  margin-bottom: 1rem;
}

.person-page__bio p {
  line-height: 1.8;
  color: #a89f94;
}

.person-page__relations {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
}

.person-page__section h3 {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.125rem;
  color: #c4a882;
  margin-bottom: 0.75rem;
}

.person-page__section ul {
  list-style: none;
}

.person-page__section li {
  margin-bottom: 0.375rem;
}

.person-page__section a {
  color: #a89f94;
  text-decoration: none;
  transition: color 0.3s ease;
}

.person-page__section a:hover {
  color: #e8e0d4;
}
