:root {
  --bg: #090909;
  --surface: rgba(31, 31, 27, .86);
  --surface-2: #1b1b18;
  --text: #f2efe6;
  --muted: #a6a094;
  --line: rgba(232, 225, 210, .22);
  --accent: #d5c5a2;
  --card-w: 230px;
  --card-h: 350px;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body {
  background:
    radial-gradient(circle at 50% 38%, rgba(255, 255, 255, .025), transparent 32%),
    radial-gradient(circle at 50% 50%, transparent 38%, rgba(0, 0, 0, .38) 100%),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button { font: inherit; }

.topbar {
  position: fixed;
  z-index: 20;
  top: 0;
  left: 0;
  right: 0;
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: linear-gradient(to bottom, rgba(9,9,9,.96), rgba(9,9,9,.52), transparent);
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.brand { display: flex; align-items: baseline; gap: 12px; }
.brand strong { font-family: Georgia, serif; font-size: 22px; letter-spacing: .15em; }
.brand span { color: var(--muted); font-size: 13px; }
.text-btn {
  color: var(--text);
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(27,27,24,.7);
  border-radius: 999px;
  padding: 10px 15px;
  cursor: pointer;
  backdrop-filter: blur(14px);
}

.viewport {
  position: fixed;
  inset: 0;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
}
.viewport.dragging { cursor: grabbing; }
.viewport::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 42%, rgba(255,255,255,.018), transparent 28%),
    linear-gradient(115deg, rgba(255,255,255,.008), transparent 35%, rgba(255,255,255,.006));
  pointer-events: none;
}
.world {
  position: absolute;
  left: 0;
  top: 0;
  width: 18000px;
  height: 4200px;
  transform-origin: 0 0;
  will-change: transform;
}
.links, .nodes { position: absolute; inset: 0; width: 100%; height: 100%; }
.links { overflow: visible; pointer-events: none; }

.person-card {
  position: absolute;
  width: var(--card-w);
  height: var(--card-h);
  border-radius: 24px;
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid rgba(255,255,255,.1);
  box-shadow: 0 22px 60px rgba(0,0,0,.25);
  cursor: pointer;
  user-select: none;
  transition: transform .25s ease, border-color .25s ease, box-shadow .25s ease;
}
.person-card:hover {
  transform: translateY(-7px) scale(1.025);
  border-color: rgba(213,197,162,.45);
  box-shadow: 0 30px 80px rgba(0,0,0,.38);
}
.person-card.founder { width: 250px; height: 370px; }
.portrait {
  position: relative;
  height: 220px;
  background:
    radial-gradient(circle at 50% 30%, rgba(255,255,255,.22), transparent 14%),
    linear-gradient(150deg, #6f6b62 0%, #383731 48%, #171714 100%);
  overflow: hidden;
}
.portrait::after {
  content: "";
  position: absolute;
  inset: -30%;
  background: linear-gradient(115deg, transparent 35%, rgba(255,255,255,.08) 47%, transparent 58%);
  animation: livePortrait 5s ease-in-out infinite;
}
.initials {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: Georgia, serif;
  font-size: 64px;
  color: rgba(255,255,255,.9);
  text-shadow: 0 8px 30px rgba(0,0,0,.35);
  animation: breathe 5s ease-in-out infinite;
}
.live-dot {
  position: absolute;
  left: 14px;
  top: 14px;
  padding: 6px 9px;
  border-radius: 999px;
  background: rgba(10,10,9,.5);
  border: 1px solid rgba(255,255,255,.12);
  backdrop-filter: blur(10px);
  color: rgba(255,255,255,.75);
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.card-copy {
  min-height: 130px;
  padding: 18px 18px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
}
.card-copy h3 {
  margin: 0;
  font-family: Georgia, serif;
  font-size: 20px;
  line-height: 1.16;
  font-weight: 500;
  overflow-wrap: anywhere;
  hyphens: auto;
}
.card-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.2;
  flex: 0 0 auto;
}

.spouse-heart {
  position: absolute;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #181815;
  border: 1px solid rgba(255,255,255,.12);
  color: var(--accent);
  font-size: 17px;
  pointer-events: none;
}

.controls {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 20;
  display: grid;
  gap: 8px;
  padding: 8px;
  border-radius: 18px;
  background: rgba(27,27,24,.78);
  border: 1px solid rgba(255,255,255,.1);
  backdrop-filter: blur(14px);
}
.controls button {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  font-size: 21px;
  cursor: pointer;
}
.controls button:hover { background: rgba(255,255,255,.08); }
.hint {
  position: fixed;
  z-index: 20;
  left: 22px;
  bottom: 26px;
  color: var(--muted);
  font-size: 12px;
  pointer-events: none;
}

.profile-dialog {
  width: min(760px, calc(100vw - 30px));
  padding: 0;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 30px;
  overflow: hidden;
  background: #181815;
  color: var(--text);
  box-shadow: 0 40px 120px rgba(0,0,0,.6);
}
.profile-dialog::backdrop { background: rgba(0,0,0,.65); backdrop-filter: blur(10px); }
.profile-dialog[open] { display: grid; grid-template-columns: 1fr 1fr; }
.profile-media {
  min-height: 460px;
  background:
    radial-gradient(circle at 50% 30%, rgba(255,255,255,.2), transparent 13%),
    linear-gradient(150deg, #6f6b62, #2e2d28 55%, #121210);
  display: grid;
  place-items: center;
  font-family: Georgia, serif;
  font-size: 86px;
}
.profile-copy { padding: 62px 46px 42px; align-self: center; }
.eyebrow { color: var(--accent); text-transform: uppercase; letter-spacing: .14em; font-size: 11px; }
.profile-copy h1 { margin: 16px 0 14px; font-family: Georgia, serif; font-weight: 500; font-size: 48px; }
.profile-date { color: var(--text); font-size: 17px; }
.profile-relation { color: var(--muted); line-height: 1.6; }
.close-dialog {
  position: absolute;
  right: 18px;
  top: 18px;
  z-index: 2;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 50%;
  background: rgba(17,17,15,.56);
  color: white;
  font-size: 24px;
  cursor: pointer;
  backdrop-filter: blur(10px);
}

@keyframes livePortrait {
  0%, 100% { transform: translateX(-16%) rotate(0deg); opacity: .3; }
  50% { transform: translateX(18%) rotate(2deg); opacity: .8; }
}
@keyframes breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.035) translateY(-2px); } }

@media (max-width: 700px) {
  :root { --card-w: 190px; --card-h: 310px; }
  .topbar { height: 68px; padding: 0 16px; }
  .brand span { display: none; }
  .text-btn { font-size: 12px; padding: 9px 12px; }
  .hint { display: none; }
  .controls { right: 14px; bottom: max(14px, env(safe-area-inset-bottom)); }
  .person-card.founder { width: 210px; height: 330px; }
  .person-card .portrait { height: 185px; }
  .person-card.founder .portrait { height: 195px; }
  .card-copy { min-height: 125px; padding: 16px 15px 14px; gap: 10px; }
  .card-copy h3 { font-size: 18px; line-height: 1.16; }
  .card-copy p { font-size: 12px; }
  .profile-dialog[open] { grid-template-columns: 1fr; }
  .profile-media { min-height: 290px; }
  .profile-copy { padding: 34px 28px 38px; }
  .profile-copy h1 { font-size: 38px; }
}


.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.important-days-panel {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
}

.important-days-panel.open {
  display: block;
}

.important-days-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.62);
  backdrop-filter: blur(8px);
}

.important-days-sheet {
  position: absolute;
  top: 18px;
  right: 18px;
  bottom: 18px;
  width: min(520px, calc(100vw - 36px));
  border-radius: 28px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: rgba(20,20,18,.96);
  border: 1px solid rgba(255,255,255,.1);
  box-shadow: 0 30px 100px rgba(0,0,0,.55);
}

.important-days-header {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 28px 28px 22px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.important-days-header h2 {
  margin: 5px 0 6px;
  font-family: Georgia, serif;
  font-size: 34px;
  font-weight: 500;
}

.important-days-header p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.close-important-days {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 50%;
  background: rgba(255,255,255,.04);
  color: var(--text);
  font-size: 26px;
  cursor: pointer;
}

.important-days-list {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 12px 28px 30px;
}

.important-month {
  padding: 18px 0 8px;
}

.important-month h3 {
  position: sticky;
  top: -12px;
  z-index: 2;
  margin: 0;
  padding: 14px 0 10px;
  background: linear-gradient(to bottom, rgba(20,20,18,1) 75%, rgba(20,20,18,0));
  color: var(--accent);
  font-size: 12px;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.important-day-row {
  display: grid;
  grid-template-columns: 62px minmax(0,1fr);
  gap: 16px;
  align-items: center;
  min-height: 68px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}

.important-day-date {
  color: var(--accent);
  font-family: Georgia, serif;
  font-size: 20px;
}

.important-day-name {
  min-width: 0;
  font-size: 15px;
  line-height: 1.35;
}

.important-days-note {
  flex: 0 0 auto;
  padding: 18px 28px 22px;
  border-top: 1px solid rgba(255,255,255,.08);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

body.important-days-open {
  overflow: hidden;
}

@media (max-width: 700px) {
  .topbar {
    height: auto;
    min-height: 72px;
    padding: 12px 14px;
    align-items: flex-start;
  }
  .brand span {
    display: none;
  }
  .top-actions {
    gap: 6px;
  }
  .text-btn {
    padding: 9px 11px;
    font-size: 12px;
  }
  .important-days-sheet {
    inset: auto 0 0 0;
    width: 100%;
    height: min(86vh, 760px);
    border-radius: 26px 26px 0 0;
  }
  .important-days-header {
    padding: 24px 20px 18px;
  }
  .important-days-header h2 {
    font-size: 30px;
  }
  .important-days-list {
    padding: 8px 20px 28px;
  }
  .important-days-note {
    padding: 16px 20px 20px;
  }
}

.person-card.founder .portrait { height: 235px; }
.person-card.founder .card-copy { min-height: 135px; }
