:root {
  --bg: #f8f7f5;
  --panel: #ffffff;
  --text: #11100e;
  --muted: #6b6a66;
  --border: #e4e2dd;
  --accent: #b87333;
  --accent-text: #ffffff;
  --danger: #c45d4c;
  --shadow: 0 1px 2px rgba(0,0,0,0.04);
}

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

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.brand small {
  font-weight: 400;
  color: var(--muted);
  font-size: 0.8rem;
}

.nav a {
  color: var(--muted);
  margin-left: 1rem;
  font-size: 0.9rem;
}

.nav a:hover { color: var(--accent); }

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

.hero {
  text-align: center;
  padding: 3rem 1rem;
}

.hero h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.hero p {
  color: var(--muted);
  margin-bottom: 1.5rem;
}

.hero-link {
  margin-top: 1rem;
}

.hero-link a {
  font-weight: 600;
  font-size: 1rem;
}

.search-bar {
  display: flex;
  max-width: 600px;
  margin: 0 auto;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.search-bar input {
  flex: 1;
  border: none;
  padding: 0.85rem 1.25rem;
  font-size: 1rem;
  outline: none;
  background: transparent;
  color: var(--text);
}

.search-bar button {
  border: none;
  background: var(--accent);
  color: var(--accent-text);
  padding: 0 1.5rem;
  font-weight: 600;
  cursor: pointer;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 1.25rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}

.card h2 {
  font-size: 1.1rem;
  margin-bottom: 0.75rem;
  color: var(--text);
}

.person-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.person-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem;
  border-radius: 0.5rem;
  background: var(--bg);
  cursor: pointer;
  transition: background 0.15s;
}

.person-item:hover { background: #eef0f2; }

.person-thumb {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--border);
  flex-shrink: 0;
}

.person-meta { flex: 1; }
.person-meta h3 { font-size: 1rem; font-weight: 600; }
.person-meta p { font-size: 0.85rem; color: var(--muted); }

.badge {
  display: inline-block;
  font-size: 0.7rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-text);
  margin-left: 0.5rem;
  font-weight: 600;
}

.badge.gray { background: #e5e7eb; color: var(--muted); }

.profile-header {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  flex-wrap: wrap;
}

.profile-photo {
  width: 120px;
  height: 120px;
  border-radius: 0.5rem;
  object-fit: cover;
  background: var(--border);
}

.profile-info { flex: 1; min-width: 200px; }
.profile-info h1 { font-size: 1.6rem; margin-bottom: 0.25rem; }
.profile-info .subtitle { color: var(--muted); font-size: 0.95rem; margin-bottom: 0.5rem; }

.vitals {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.vital { font-size: 0.9rem; }
.vital strong { display: block; color: var(--muted); font-weight: 500; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.03em; }

.summary {
  margin: 1rem 0;
  line-height: 1.6;
}

.source-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.source-links a {
  font-size: 0.85rem;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
}

.actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-block;
  padding: 0.55rem 1rem;
  border-radius: 0.35rem;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
}

.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.danger { border-color: var(--danger); color: var(--danger); }

.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 0.35rem; }
.form-group input, .form-group textarea, .form-group select {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.35rem;
  font: inherit;
  background: var(--panel);
}

.form-group small { color: var(--muted); font-size: 0.75rem; }

.tabs { display: flex; gap: 0.5rem; margin-bottom: 1rem; border-bottom: 1px solid var(--border); }
.tab { padding: 0.5rem 1rem; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; }
.tab.active { color: var(--accent); border-color: var(--accent); }

.revisions { list-style: none; }
.revisions li { padding: 0.75rem 0; border-bottom: 1px solid var(--border); }
.revisions li:last-child { border-bottom: none; }

.toast {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 0.35rem;
  background: #1a1a1a;
  color: #fff;
  z-index: 100;
  display: none;
}

.empty { color: var(--muted); text-align: center; padding: 2rem; }

@media (max-width: 640px) {
  .hero h1 { font-size: 1.5rem; }
  .profile-photo { width: 80px; height: 80px; }
  .nav a { margin-left: 0.6rem; font-size: 0.8rem; }
}

.graph-shell {
  display: grid;
  grid-template-columns: 280px 1fr 320px;
  height: calc(100vh - 56px);
}

.graph-controls {
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 1.25rem;
  overflow-y: auto;
}

.graph-controls h1 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.graph-controls p {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.graph-controls .search-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.graph-controls .search-bar input {
  flex: 1;
  min-width: 0;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  font-size: 0.9rem;
}

.graph-controls .search-bar button {
  padding: 0.5rem 0.75rem;
  border: none;
  border-radius: 0.5rem;
  background: var(--accent);
  color: var(--accent-text);
  cursor: pointer;
  font-size: 0.9rem;
}

.graph-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 1rem;
}

.legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 0.25rem;
}

.legend-dot.occupation { background: #8b5cf6; }
.legend-dot.nationality { background: #10b981; }
.legend-dot.year { background: #f59e0b; }
.legend-dot.place { background: #ef4444; }
.legend-dot.multi { background: #0ea5e9; }

.graph-meta {
  font-size: 0.85rem;
  color: var(--muted);
}

.graph-canvas {
  background: #0f172a;
  position: relative;
  overflow: hidden;
}

.graph-panel {
  background: var(--panel);
  border-left: 1px solid var(--border);
  padding: 1rem;
  overflow-y: auto;
}

.graph-panel .card {
  box-shadow: none;
  border: 1px solid var(--border);
}

.graph-panel .profile-photo {
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
}

.graph-panel .btn {
  margin-right: 0.5rem;
  margin-top: 0.5rem;
}

@media (max-width: 900px) {
  .graph-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto;
    height: auto;
    min-height: 100vh;
  }
  .graph-canvas { height: 60vh; }
}

.connections-tip {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
  margin-top: 1rem;
  font-size: 0.9rem;
  color: #065f46;
}

.connections-headline {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.connections-headline a {
  font-weight: 600;
}

.home-graph-body {
  background: #020204;
  color: #f5f2ea;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  overflow: hidden;
  color-scheme: dark;
}

.home-graph-shell {
  position: fixed;
  inset: 0;
}

.home-graph-full {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(circle at 50% 40%, #0a0b12 0%, #020204 70%);
}

.home-graph-full canvas {
  filter: drop-shadow(0 0 10px rgba(212, 163, 115, 0.3));
}

.home-graph-ui {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  padding: 1.5rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}

.home-graph-ui > * { pointer-events: auto; }

.home-brand {
  font-family: 'Bodoni Moda', Georgia, serif;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #f5f2ea;
  text-decoration: none;
}

.home-nav {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  font-size: 0.85rem;
  font-weight: 500;
}

.home-nav a {
  color: #6c6f7d;
  text-decoration: none;
  transition: color 0.2s;
}

.home-nav a:hover { color: #f5f2ea; }

.home-nav .home-join {
  color: #020204;
  background: #d4a373;
  padding: 0.45rem 0.9rem;
  border-radius: 2px;
  font-weight: 600;
}

.home-nav .home-join:hover { background: #f2cc8f; color: #020204; }

.home-hero {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -55%);
  z-index: 10;
  text-align: center;
  width: min(86vw, 680px);
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

.home-hero > * { pointer-events: auto; }

.home-eyebrow {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #d4a373;
}

.home-title {
  font-family: 'Bodoni Moda', Georgia, serif;
  font-size: clamp(2.4rem, 7vw, 5.2rem);
  font-weight: 400;
  line-height: 1.0;
  letter-spacing: -0.03em;
  color: #f5f2ea;
  margin: 0;
}

.home-invite {
  font-size: 0.95rem;
  color: #6c6f7d;
  max-width: 440px;
  line-height: 1.5;
  margin: 0;
}

.home-search-bar {
  display: flex;
  align-items: center;
  width: min(420px, 80vw);
  border: 1px solid rgba(245, 242, 234, 0.12);
  background: rgba(245, 242, 234, 0.04);
  backdrop-filter: blur(6px);
  padding: 0.2rem 0.2rem 0.2rem 0.75rem;
  border-radius: 2px;
}

.home-search-bar input {
  flex: 1;
  background: transparent;
  border: none;
  padding: 0.6rem 0.5rem;
  color: #f5f2ea;
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  outline: none;
}

.home-search-bar input::placeholder { color: #6c6f7d; }

.home-search-bar button {
  background: transparent;
  border: none;
  color: #d4a373;
  padding: 0.5rem 0.7rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.home-cta {
  color: #d4a373;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  border: none;
  border-bottom: 1px solid rgba(212, 163, 115, 0.35);
  padding: 0 0 0.15rem 0;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  transition: color 0.2s, border-color 0.2s;
}

.home-cta span { transition: transform 0.2s; display: inline-block; }

.home-cta:hover,
.home-cta:focus-visible {
  color: #f2cc8f;
  border-color: rgba(242, 204, 143, 0.6);
  outline: none;
}

.home-cta:hover span,
.home-cta:focus-visible span { transform: translateX(3px); }

.home-search-bar input:focus-visible,
.home-search-bar button:focus-visible,
.home-nav a:focus-visible,
.home-brand:focus-visible {
  outline: 1px solid rgba(212, 163, 115, 0.6);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .home-cta,
  .home-cta span,
  .home-nav a,
  .home-brand,
  .home-search-bar {
    transition: none;
  }
}

.home-stats {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  gap: 2.5rem;
  pointer-events: none;
}

.home-stats > div {
  text-align: center;
  pointer-events: auto;
}

.home-stats .value {
  font-family: 'Bodoni Moda', Georgia, serif;
  font-size: 1.4rem;
  color: #f5f2ea;
  line-height: 1;
}

.home-stats .label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.6rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #6c6f7d;
  margin-top: 0.35rem;
}

.home-graph-meta {
  position: absolute;
  bottom: 2rem;
  right: 2rem;
  z-index: 10;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  color: #4a4d5a;
  text-transform: uppercase;
  pointer-events: none;
}

@media (max-width: 640px) {
  .home-graph-ui {
    padding: 1rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
  .home-nav { gap: 1rem; font-size: 0.8rem; }
  .home-hero { transform: translate(-50%, -50%); gap: 1rem; }
  .home-title { font-size: clamp(2rem, 11vw, 3.5rem); }
  .home-stats {
    bottom: 1rem;
    gap: 1.25rem;
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
  }
  .home-stats .value { font-size: 1.1rem; }
  .home-graph-meta { display: none; }
}
