@font-face {
  font-family: "Editorial New";
  src: url("/fonts/PPEditorialNew-Ultralight.otf") format("opentype");
  font-style: normal;
  font-weight: 200;
  font-display: swap;
}
@font-face {
  font-family: "Editorial New";
  src: url("/fonts/PPEditorialNew-UltralightItalic.otf") format("opentype");
  font-style: italic;
  font-weight: 200;
  font-display: swap;
}
:root {
  color-scheme: light;
  --snow: #f3f0e9;
  --paper: #fcf9f1;
  --ink: #293c37;
  --muted: #626c63;
  --river: #3f6256;
  --pine: #344f43;
  --mist: #e9ece5;
  --line: #d9ddd3;
  --shadow: 0 6px 24px #293c370a;
  --wall: #252824;
  --wall-text: #e4dece;
  --wall-muted: #bcb8aa;
  --timeline-gold: #c7ad78;
  --timeline-sage: #b0c4a7;
  --gallery-line: #b9aa8875;
  --gallery-paper: linear-gradient(125deg, #fffdf6 0%, #f4eedf 65%, #eee7d7 100%);
  --gallery-mat: linear-gradient(135deg, #eee7d74d, #fffdf344);
  --gallery-accent: #b7a177;
  --gallery-ring: #c6af7b;
  --gallery-badge: #e5e2d66e;
  --gallery-shadow: 0 2px 3px #00000030, 0 14px 28px #00000038, 0 0 48px #ead4a90b;
  --sans: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --editorial: "Editorial New", Georgia, "Times New Roman", serif;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--wall);
  font-size: 15px;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  color: var(--wall-text);
  background:
    radial-gradient(ellipse 65% 75vh at 50% 20vh, #cbb7881c, transparent 78%),
    radial-gradient(ellipse 35% 65vh at 8% 45vh, #d6b1760d, transparent 90%),
    linear-gradient(110deg, #1c211e, #292b25 49%, #222720);
  background-attachment: fixed;
  min-height: 100vh;
}
button,
input,
textarea,
select {
  font: inherit;
}
button,
a {
  -webkit-tap-highlight-color: transparent;
}
button {
  color: inherit;
  border: 0;
  background: none;
  cursor: pointer;
  padding: 0;
}
button:disabled {
  cursor: default;
  opacity: 0.32;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--river);
  outline-offset: 4px;
  border-radius: 4px;
}
a {
  color: var(--river);
  text-decoration: none;
}
a:hover {
  text-decoration: none;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1,
h2,
h3 {
  font-family: var(--editorial);
  font-weight: 200;
  letter-spacing: 0;
}
h1 {
  font-size: clamp(30px, 3.2vw, 44px);
}
h2 {
  font-size: 30px;
}
h3 {
  font-size: 23px;
}
.icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  vertical-align: middle;
}
.skip {
  position: fixed;
  top: -100px;
  left: 20px;
  z-index: 99;
  background: white;
  padding: 12px;
}
.skip:focus {
  top: 10px;
}
/* Directory cards wrap to the width available in each generation. */
#app {
  max-width: 1640px;
  margin: 0 auto;
  padding: 18px calc(36px + env(safe-area-inset-right)) calc(36px + env(safe-area-inset-bottom)) calc(36px + env(safe-area-inset-left));
}
[data-fit-name] {
  --name-size: 17px;
  display: block;
  width: 100%;
  min-width: 0;
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
  letter-spacing: 0;
  font-size: var(--name-size);
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.directory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: 18px;
  align-items: stretch;
}
.couple {
  position: relative;
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid transparent;
  background: var(--paper);
  border-radius: 2px;
  box-shadow: none;
  transition:
    border-color 0.18s,
    background-color 0.18s;
}
.couple.is-expandable:hover,
.editing .couple.is-editable:hover {
  border-color: var(--line);
  background: #f0f2eb;
}
.couple.selected {
  border-color: var(--river);
  background: var(--mist);
  box-shadow: none;
}
.halves {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 12px 8px 8px;
  flex: 1;
}
.halves.single {
  grid-template-columns: 1fr;
}
.person {
  position: relative;
  min-width: 0;
  padding: 0 10px;
}
.person + .person {
  border-left: 0;
}
.hit {
  position: absolute;
  inset: -9px 0;
  width: 100%;
  height: calc(100% + 18px);
  border-radius: 7px;
  z-index: 0;
}
.hit:hover {
  background: #d9ddd330;
}
.person-content {
  pointer-events: none;
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 3px;
  align-items: start;
}
.person-content button {
  pointer-events: auto;
  position: relative;
  text-align: left;
}
.name {
  font-family: var(--editorial);
  font-size: 17px;
  font-weight: 200;
  line-height: 1.35;
  letter-spacing: -0.025em;
  white-space: nowrap;
  width: 100%;
  min-height: 23px;
  margin: 0 0 4px;
  grid-column: 1;
}
.age {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  line-height: 20px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  grid-column: 1;
  grid-row: 2;
  justify-self: start;
  border-radius: 999px;
  background: var(--mist);
  padding: 1px 6px;
  color: var(--muted);
}
.age .icon {
  width: 12px;
  height: 12px;
}
.gender {
  font-family: Arial, sans-serif;
  font-size: 13px;
}
.age small {
  font-size: 10px;
}
.meta {
  display: flex;
  align-items: center;
  gap: 5px;
  grid-column: 1/-1;
  min-height: 22px;
  font-size: 11px;
  color: var(--muted);
  width: 100%;
  line-height: 1.4;
}
.meta .icon {
  width: 13px;
  height: 13px;
  color: var(--river);
}
.meta span {
  overflow-wrap: anywhere;
}
.name:hover,
.meta:hover span {
  text-decoration: none;
}
.family-summary {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 6px;
  margin: 0 14px;
  padding: 6px 0 7px;
  border-top: 1px solid var(--line);
  font-size: 10px;
  line-height: 1.5;
  color: var(--muted);
  min-height: 29px;
  text-align: left;
}
.family-summary .icon {
  width: 13px;
  height: 13px;
}
.family-summary:hover {
  color: var(--river);
}
.chevron {
  position: absolute;
  right: 10px;
  bottom: 20px;
  width: 11px;
  height: 11px;
  pointer-events: none;
  opacity: 0.65;
  transform: rotate(90deg);
}
.selected > .chevron {
  transform: rotate(-90deg);
}
.family-expansion {
  grid-column: 1/-1;
  background: var(--mist);
  border: 1px solid #bbc5b6;
  border-radius: 2px;
  padding: 0 18px 18px;
  min-width: 0;
  position: relative;
}
.expansion-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 51px;
}
.expansion-heading h2 {
  font-size: 19px;
  letter-spacing: 0;
}
.expansion-heading h2 button {
  font: inherit;
  min-height: 40px;
}
.expansion-heading h2 button:hover {
  color: var(--river);
}
.heading-suffix {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0;
  color: var(--muted);
  white-space: nowrap;
}
.expansion-heading .tool {
  min-width: 36px;
  min-height: 36px;
}
.expansion-heading .icon {
  width: 17px;
  height: 17px;
}
@keyframes reveal {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes arrive {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.empty {
  padding: 35px 0;
  line-height: 1.8;
  color: var(--muted);
}
.empty h1 {
  margin-bottom: 16px;
}
.initial-load {
  text-align: center;
  padding-top: 30vh;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 25px;
}
.loading-dot {
  display: block;
  width: 10px;
  height: 10px;
  background: var(--river);
  border-radius: 50%;
  margin: 0 auto 20px;
}
.eyebrow {
  font-size: 10px;
  letter-spacing: 0.16em;
  margin-bottom: 12px;
}
.family-timeline {
  position: relative;
  --timeline-birth: #a8bca5;
  --timeline-wedding: #cbb17c;
  --timeline-other: #c0ad96;
  --muted: var(--wall-muted);
  --river: #c3ceb7;
  --pine: #d5dccb;
  --line: #ddd3ba35;
  --snow: var(--wall);
  --event-color: var(--pine);
  padding: 0 0 12px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--line);
}
.timeline-detailed-link { position: absolute; top: -4px; left: 0; display: inline-flex; align-items: center; gap: 7px; min-height: 30px; color: var(--wall-muted); font-size: 11px; transition: color .2s; }
.timeline-detailed-link:hover { color: var(--wall-text); }
.timeline-detailed-link .icon { width: 14px; height: 14px; }
.timeline-detailed-link .icon:last-child { width: 11px; height: 11px; }
.family-timeline .timeline-legend { padding-left: 110px; min-height: 24px; }
.family-timeline [data-kind="birth"] { --event-color: var(--timeline-birth); }
.family-timeline [data-kind="wedding"] { --event-color: var(--timeline-wedding); }
.family-timeline [data-kind="other"] { --event-color: var(--timeline-other); }
.family-timeline [data-kind="mixed"] { --event-color: var(--pine); }
.timeline-legend { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px 18px; list-style: none; margin: 0 24px 2px; padding: 0; color: var(--wall-muted); font-size: 10px; }
.timeline-legend li { display: inline-flex; align-items: center; gap: 7px; }
.timeline-symbol { display: block; width: var(--dot-size, 10px); height: var(--dot-size, 10px); border-radius: 50%; flex-shrink: 0; }
.timeline-symbol > span { display: block; width: 100%; height: 100%; border-radius: 50%; background: var(--event-fill, var(--event-color)); }
[data-has-wedding="true"] > .timeline-symbol { border: 2px solid var(--timeline-wedding); padding: 2px; }
[data-kind="wedding"] > .timeline-symbol > span { background: transparent; }
.timeline-surface { display: flex; align-items: stretch; gap: 12px; }
.timeline-chart { flex: 1; min-width: 0; height: 132px; padding: 0 24px; touch-action: pan-y; }
.timeline-chart[hidden], .timeline-undated[hidden] { display: none; }
.timeline-chart:focus-visible { outline: 2px solid var(--river); outline-offset: -2px; }
.timeline-plot { position: relative; height: 100%; }
.timeline-baseline { position: absolute; left: 0; right: 0; top: 90px; height: 1px; background: var(--line); }
.timeline-tick { position: absolute; top: 105px; transform: translateX(-50%); white-space: nowrap; font-size: 10px; color: var(--muted); font-variant-numeric: tabular-nums; }
.timeline-tick::before { content: ""; position: absolute; width: 1px; height: 5px; background: var(--line); left: 50%; top: -14px; }
.timeline-cursor { position: absolute; top: 8px; height: 84px; width: 1px; background: var(--river); opacity: 0; pointer-events: none; transition: left .18s ease-out, opacity .2s; }
.timeline-cursor.is-visible { opacity: .24; }
.timeline-dot { position: absolute; display: grid; place-items: center; width: 40px; height: 40px; transform: translateX(-50%); border-radius: 50%; }
.timeline-dot > span {
  box-shadow: 0 0 0 3px var(--snow);
  transition: transform .22s ease, box-shadow .22s ease;
}
.timeline-dot.is-cluster > span { box-shadow: 0 0 0 2px var(--snow), 0 0 0 3px var(--line); }
.timeline-dot:hover > span, .timeline-dot:focus-visible > span, .timeline-dot[aria-expanded="true"] > span { transform: scale(1.12); box-shadow: 0 0 0 3px var(--snow), 0 0 0 4px var(--event-color); }
.timeline-undated { position: relative; width: 44px; min-height: 108px; flex-shrink: 0; border-left: 1px solid var(--line); margin: 14px 0 10px; }
.timeline-undated .timeline-dot { top: 20px; left: 50%; }
.timeline-uncertain-mark { position: absolute; top: 82px; left: 50%; transform: translateX(-50%); color: var(--muted); }
.timeline-uncertain-mark .icon { width: 13px; height: 13px; }
.timeline-empty { padding: 10px 0; font-size: 12px; color: var(--muted); }
.timeline-reveal { display: grid; grid-template-rows: 0fr; opacity: 0; transition: grid-template-rows .25s ease, opacity .2s; }
.timeline-reading.is-open .timeline-reveal { grid-template-rows: 1fr; opacity: 1; }
.timeline-reveal-inner { overflow: hidden; min-width: 0; min-height: 0; }
.timeline-preview-list { display: flex; flex-wrap: wrap; align-items: stretch; gap: 8px; min-width: 0; padding: 6px 2px 10px; }
/* Shared translucent surfaces for timeline bubbles and directory cards. */
.event-bubble,
.couple,
.info-card[data-generation] {
  --bubble-fill: #d8c8a813;
  --bubble-edge: #d8c8a837;
  --bubble-accent: #c7b48b;
  --bubble-shadow: 0 4px 18px #00000012, inset 0 1px #fff5da08;
  color: var(--wall-text);
  border: 1px solid var(--bubble-edge);
  background: var(--bubble-fill);
  box-shadow: var(--bubble-shadow);
}
.event-bubble {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 15px 22px;
  border-radius: 999px;
}
.bubble-symbol { display: flex; color: var(--timeline-sage); flex-shrink: 0; }
[data-kind="wedding"] > .bubble-symbol { color: var(--timeline-gold); }
[data-kind="other"] > .bubble-symbol { color: var(--wall-muted); }
.bubble-symbol .icon { width: 19px; height: 19px; }
.bubble-copy { min-width: 0; flex: 1; }
.bubble-name { --name-size: 25px; font-family: var(--editorial); line-height: 1.2; }
.bubble-date { --name-size: 10px; margin-top: 5px; color: var(--wall-muted); font-family: var(--sans); font-size: var(--name-size); line-height: 1.35; }
.bubble-count { flex-shrink: 0; color: var(--wall-muted); font-size: 10px; font-variant-numeric: tabular-nums; }
.bubble-action { display: grid; place-items: center; flex: 0 0 28px; width: 28px; height: 32px; color: var(--wall-muted); border-radius: 50%; }
.bubble-action:hover { color: var(--wall-text); }
.bubble-action .icon { width: 14px; height: 14px; }
.event-bubble[data-depth="2"], :is(.couple, .info-card)[data-generation="2"] { --bubble-fill: #b8c9a916; --bubble-edge: #b8c9a936; --bubble-accent: #b0c4a7; }
.event-bubble[data-depth="3"], :is(.couple, .info-card)[data-generation="3"] { --bubble-fill: #b6cbd916; --bubble-edge: #b6cbd936; --bubble-accent: #b6cbd9; }
.timeline-preview-event { position: relative; flex: 0 1 390px; max-width: 100%; animation: timeline-preview-in .18s ease-out; }
@media (max-width: 760px) {
  .event-bubble { padding: 14px 17px; gap: 9px; }
  .bubble-name { --name-size: 23px; }
}
@media (max-width: 620px) {
  .event-bubble { padding: 12px; gap: 6px; }
  .bubble-symbol .icon { width: 13px; height: 13px; }
  .bubble-name { --name-size: 21px; }
  .bubble-date { --name-size: 8px; }
  .bubble-count { font-size: 8px; }
}
@keyframes timeline-preview-in { from { opacity: .3; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 759px) {
  #tools [data-action="review-records"] { display: none; }
  .family-timeline { padding-bottom: 0; margin-bottom: 16px; border-bottom: 0; }
  .timeline-detailed-link { position: static; min-height: 44px; }
  .family-timeline :is(.timeline-legend, .timeline-surface, .timeline-empty, .timeline-reading, .timeline-status) { display: none; }
}
.controls {
  position: fixed;
  right: calc(16px + env(safe-area-inset-right));
  bottom: calc(16px + env(safe-area-inset-bottom));
  width: 54px;
  max-height: calc(100dvh - 32px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  overflow-y: auto;
  scrollbar-width: thin;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  padding: 4px;
  border: 1px solid #ddd3ba26;
  border-radius: 18px;
  background: #30352ee8;
  box-shadow: 0 8px 24px #00000030, inset 0 1px 0 #ffffff08;
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  --muted: var(--wall-muted);
  --pine: var(--wall-text);
  --river: #c3ceb7;
  color: var(--wall-text);
}
.tool {
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}
.tool .icon {
  width: 23px;
  height: 23px;
}
.controls .tool {
  justify-content: center;
  flex-shrink: 0;
  width: 100%;
  padding: 0;
  border-radius: 12px;
  color: var(--wall-muted);
}
.controls .tool .icon { width: 19px; height: 19px; }
.controls .tool:hover, .controls .tool[aria-pressed="true"] { color: var(--wall-text); background: #ffffff0b; }
.controls .tool:focus-visible { outline: 2px solid #c3ceb7; outline-offset: -2px; }
body.export-open { overflow: hidden; }
.family-export {
  width: min(720px, calc(100vw - 48px));
  max-width: none;
  max-height: calc(100dvh - 48px);
  margin: auto;
  padding: 0;
  border: 1px solid #f6f3e680;
  border-radius: 24px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 32px 120px #0007, 0 2px 8px #0002;
  overflow: hidden;
}
.family-export[open] { display: flex; flex-direction: column; }
.family-export::backdrop { background: #111b18a8; backdrop-filter: blur(7px); }
.export-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  gap: 16px;
  padding: 22px 28px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(115deg, #fffdf7, #f2efe5);
}
.export-header h2 { font-size: 30px; outline: none; }
.export-close {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  gap: 6px;
  min-height: 44px;
  padding: 6px 10px;
  border-radius: 12px;
  color: var(--muted);
  font-size: 14px;
}
.export-close:hover { background: #e7e7dd; color: var(--ink); }
.export-close .icon { width: 18px; height: 18px; }
.export-body {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  padding: 24px 28px 28px;
}
.family-export :is(button, summary):focus-visible { outline: 2px solid #527548; outline-offset: 3px; }
.export-intro {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.6;
}
.export-options {
  display: grid;
  gap: 0;
}
.export-option {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  width: 100%;
  padding: 20px 0;
  border-top: 1px solid var(--line);
  text-align: left;
}
.export-option > .icon {
  flex: 0 0 23px;
  margin-top: 2px;
}
.export-option > span:not(.export-format) {
  flex: 1;
  min-width: 0;
}
.export-option strong {
  display: block;
  font-size: 17px;
  font-weight: 550;
}
.export-option small {
  display: block;
  max-width: 60ch;
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}
.export-format {
  color: var(--muted);
  font-size: 12px;
  padding-top: 3px;
}
.export-status:empty { display: none; }
.export-status { margin: 12px 0; line-height: 1.6; }
.export-help {
  margin-top: 14px;
  max-width: 78ch;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}
.export-help summary { cursor: pointer; min-height: 36px; padding: 6px 0; }
.export-steps { margin: 12px 0 18px; padding-left: 24px; }
.export-steps li { padding-left: 6px; }
.export-steps li + li { margin-top: 12px; }
.export-steps li::marker { color: var(--pine); font-weight: 550; }
.export-help > p + p { margin-top: 12px; }
.export-help a { display: inline-flex; align-items: center; gap: 4px; }
.export-help a .icon { width: 14px; height: 14px; }
@media (max-width: 600px) {
  .family-export { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); border-radius: 18px; }
  .export-header { padding: 14px 16px; gap: 8px; }
  .export-header h2 { font-size: 26px; }
  .export-close { padding-inline: 6px; }
  .export-body { padding: 20px 18px max(20px, env(safe-area-inset-bottom)); }
  .export-option { gap: 10px; }
}
.editing .person [data-action="person"].meta,
.editing .person [data-action="person"].name,
.editing [data-action="person"].family-summary,
.editing [data-action="person"].age {
  outline: 1px dashed transparent;
  outline-offset: 1px;
}
.editing .person [data-action="person"].meta:hover,
.editing .person [data-action="person"].name:hover,
.editing [data-action="person"].family-summary:hover,
.editing [data-action="person"].age:hover {
  outline-color: #9ba990;
  border-radius: 3px;
  background: #e9ece5;
}
.editing .couple.is-editable {
  outline: 1px dashed #9ba990;
  outline-offset: 3px;
}
.editing .couple.is-editable.selected {
  outline-style: solid;
}
.quiet-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--river);
  min-height: 44px;
}
.quiet-action:hover {
  text-decoration: none;
}
.quiet-action .icon {
  width: 19px;
}
#notice {
  position: fixed;
  top: calc(20px + env(safe-area-inset-top));
  left: 50%;
  transform: translate(-50%, -8px);
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 12px;
  width: max-content;
  max-width: min(600px, calc(100% - 32px));
  background: #384332;
  color: #fff4dc;
  border: 1px solid #b8c9a980;
  border-radius: 20px;
  padding: 14px 20px;
  box-shadow: 0 10px 36px #0006, inset 0 1px #f5ffe51a;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.5;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
#notice.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
#notice .notice-message {
  min-width: 0;
  overflow-wrap: anywhere;
  white-space: pre-line;
}
#notice .notice-icon {
  display: grid;
  place-items: center;
  flex: 0 0 30px;
  height: 30px;
  border-radius: 50%;
  background: #c2d2b5;
  color: #263321;
}
#notice .notice-icon .icon {
  width: 18px;
  height: 18px;
  stroke-width: 2.2;
}
/* Non-modal cards live in the directory flow and never block the page. */
.info-card{grid-column:1/-1;min-width:0;width:100%;margin:0 0 14px;padding:0;border:1px solid #bbc5b6;border-radius:2px;box-shadow:none;color:var(--ink);background:var(--paper);scroll-margin-top:18px}
.info-card[hidden]{display:none}
.directory-grid>.info-card{margin:0}
.panel-top {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 24px 26px 10px;
  position: relative;
  background: var(--paper);
}
.panel-top h2 {
  flex: 1;
  min-width: 0;
  --name-size: 23px;
}
.panel-body {
  padding: 12px 28px 30px;
}
.detail-age {
  font-size: 20px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}
.fact-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  min-width: 0;
  padding: 3px 7px;
  border: 0;
  border-radius: 999px;
  background: var(--mist);
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
  line-height: 1.4;
  text-align: left;
  vertical-align: middle;
}
.fact-badge .icon { width: 13px; height: 13px; flex-shrink: 0; color: var(--river); }
.fact-badge > span:not(.sr-only) { min-width: 0; overflow-wrap: anywhere; }
.fact-badge > [data-fit-name] { --name-size: 11px; overflow-wrap: normal; }
.fact-badge:hover { color: var(--ink); }
.detail-badges, .result-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 5px;
}
.detail-badges { padding: 4px 0 10px; }
.result-badges { margin-top: 6px; }
.detail-note { border-radius: 8px; max-width: 72ch; white-space: pre-wrap; }
.detail-links {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.detail-links [data-fit-name] { --name-size: 12px; }
.detail-links button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  min-width: 0;
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--mist);
  color: var(--river);
  text-align: left;
}
.section-label {
  font-size: 13px;
  color: var(--muted);
  margin: 24px 0 6px;
  letter-spacing: 0.02em;
}
.results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr));
  gap: 6px;
  list-style: none;
  margin: 18px 0 0;
  padding: 0;
}
.result {
  min-width: 0;
  padding: 6px 9px;
  border-radius: 8px;
  background: var(--snow);
  display: flex;
  align-items: center;
  gap: 8px;
}
.result-main {
  min-width: 0;
  flex: 1;
  text-align: left;
  padding: 5px 0;
}
.result-main strong {
  font-family: var(--editorial);
  --name-size: 17px;
  font-weight: 200;
  display: block;
}
.result-main small {
  color: var(--muted);
  display: block;
  margin-top: 5px;
  line-height: 1.5;
}
.result .tool {
  color: var(--river);
}
/* The gallery composer opens a conversation with its own scrollable transcript. */
:is(.family-search, .family-chat) {
  --muted: var(--wall-muted);
  --river: #c3ceb7;
  color: var(--wall-text);
}
.family-search {
  width: min(100%, 720px);
  margin: 24px auto 40px;
}
:is(.family-search, .family-chat) [hidden] { display: none; }
body.chat-open { overflow: hidden; }
.family-chat {
  --chat-gap: 24px;
  position: fixed;
  inset: var(--chat-viewport-top, 0px) 0 auto;
  width: min(860px, calc(100vw - 2 * var(--chat-gap)));
  height: min(820px, calc(var(--chat-viewport-height, 100dvh) - 2 * var(--chat-gap)));
  max-width: none;
  max-height: none;
  margin: var(--chat-gap) auto;
  padding: 0;
  border: 1px solid #d6d1bf38;
  border-radius: 24px;
  background: radial-gradient(ellipse at 50% 0, #bbaa8712, transparent 70%), #292d27;
  box-shadow: 0 32px 120px #0008;
  overflow: hidden;
}
.family-chat[open] { display: flex; flex-direction: column; }
.family-chat::backdrop { background: #111b18b8; backdrop-filter: blur(7px); }
.chat-header { display: flex; align-items: center; justify-content: flex-end; flex-shrink: 0; gap: 12px; padding: 16px 24px; border-bottom: 1px solid #d6d1bf26; }
.chat-actions { display: flex; align-items: center; gap: 10px; }
.question-close { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 6px 10px; font-size: 14px; color: var(--wall-text); border-radius: 12px; }
.question-close:hover { background: #ffffff0b; }
.question-close .icon { width: 18px; height: 18px; }
.chat-footer { flex-shrink: 0; padding: 18px 24px 24px; border-top: 1px solid #d6d1bf26; }
.chat-empty { position: absolute; top: 45%; left: 20px; right: 20px; text-align: center; color: var(--wall-muted); pointer-events: none; }
.search-composer { position: relative; }
.question-form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 8px 10px 8px 22px;
  border: 1px solid #d6d1bf26;
  border-radius: 30px;
  background: #3a3d36;
  box-shadow: 0 3px 12px #00000012;
}
.question-form:focus-within { border-color: #c3ceb773; }
.question-form .search-input {
  display: block;
  min-width: 0;
  width: 100%;
  flex: 1;
  min-height: 44px;
  max-height: 160px;
  margin: 0;
  padding: 10px 0;
  border: 0;
  border-radius: 0;
  outline: none;
  resize: none;
  background: transparent;
  color: var(--wall-text);
  font-size: 16px;
  line-height: 24px;
  scrollbar-width: thin;
}
.search-input::placeholder { color: #c3c2b7; opacity: 1; }
.question-submit {
  display: grid;
  place-items: center;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 50%;
  color: #252824;
  background: #eeeade;
}
.question-submit:hover:not(:disabled) { background: #fffdf5; }
.question-submit:disabled { color: #b4b7ac; background: #ffffff12; opacity: 1; }
.question-submit .icon { width: 22px; height: 22px; }
:is(.family-search, .family-chat) :is(button, summary, [role="log"]):focus-visible { outline: 2px solid #c3ceb7; outline-offset: 2px; }
.conversation { position: relative; display: flex; flex-direction: column; flex: 1; min-height: 0; }
.question-clear, .question-retry { display: inline-flex; align-items: center; gap: 7px; min-height: 44px; padding: 6px 10px; color: var(--wall-muted); font-size: 12px; }
.question-clear:hover:not(:disabled), .question-retry:hover { color: var(--wall-text); }
.question-clear .icon, .question-retry .icon { width: 15px; height: 15px; }
.family-answers { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-gutter: stable; scrollbar-color: #878b7890 transparent; padding: 26px 30px; }
.family-answers:focus-visible { outline-offset: -4px !important; }
.chat-turn + .chat-turn { margin-top: 30px; }
.chat-question { width: fit-content; max-width: 85%; margin-left: auto; padding: 11px 18px; border-radius: 24px; background: #ffffff10; font-size: 15px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-answer { margin-top: 22px; padding: 0 8px; }
.answer-text { font-size: 15px; line-height: 1.8; white-space: pre-wrap; overflow-wrap: anywhere; }
.question-thinking, .question-state { color: var(--wall-muted); font-size: 14px; line-height: 1.7; }
.question-error { color: #ecc3ad; line-height: 1.7; font-size: 14px; }
.answer-references { margin-top: 8px; }
.answer-references summary { width: fit-content; min-height: 44px; padding: 14px 0; color: var(--wall-muted); cursor: pointer; font-size: 11px; }
.answer-sources { margin: 0; }
.family-chat .answer-sources button { min-height: 44px; max-width: min(100%, 320px); padding: 8px 10px; border-radius: 12px; background: #ffffff0a; color: var(--wall-text); }
.answer-sources .icon { flex-shrink: 0; width: 14px; height: 14px; }
.answer-sources [data-fit-name] { --name-size: 13px; font-family: var(--sans); }
.answer-date { color: var(--wall-muted); font-size: 11px; line-height: 1.5; margin-top: 10px; }
.search-suggestions { position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 6; padding: 6px; border: 1px solid #d6d1bf26; border-radius: 20px; background: #353830; box-shadow: 0 12px 30px #00000040; }
:is(.family-search, .family-chat) .results { display: grid; grid-template-columns: 1fr; gap: 2px; max-height: min(320px, 45dvh); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; margin: 0; }
:is(.family-search, .family-chat) .result { padding: 2px 10px; border: 0; border-radius: 13px; background: transparent; color: var(--wall-text); box-shadow: none; }
:is(.family-search, .family-chat) .result:hover, :is(.family-search, .family-chat) .result:focus-within { background: #ffffff0b; }
:is(.family-search, .family-chat) .result-main { min-height: 44px; padding: 9px 0; }
:is(.family-search, .family-chat) .result-main strong { font-family: var(--sans); --name-size: 14px; font-weight: 400; }
:is(.family-search, .family-chat) .result-main small { margin-top: 3px; font-size: 11px; color: var(--wall-muted); }
:is(.family-search, .family-chat) .result .tool { color: var(--wall-muted); }
.family-chat .search-suggestions { top: auto; bottom: calc(100% + 8px); }
.family-chat .results { max-height: min(280px, calc(var(--chat-viewport-height, 100dvh) * .35)); }
.family-chat .search-input { max-height: min(160px, calc(var(--chat-viewport-height, 100dvh) * .2)); }
@media (max-width: 600px) {
  .family-search { margin: 18px auto 28px; }
  .family-chat { --chat-gap: 8px; border-radius: 18px; }
  .chat-header { padding: 10px 12px; gap: 6px; }
  .chat-actions { gap: 2px; }
  .chat-actions button { padding-inline: 6px; gap: 4px; font-size: 12px; }
  .chat-footer { padding: 12px 12px max(12px, env(safe-area-inset-bottom)); }
  .question-form { gap: 4px; padding-left: 16px; }
  .chat-question { max-width: 95%; padding: 10px 14px; }
  .chat-answer { padding: 0; }
  .family-answers { padding: 20px 16px; }
}
.event-date {
  min-width: 60px;
  color: var(--river);
  font-size: 13px;
}
.event-detail {
  line-height: 1.7;
  white-space: pre-wrap;
  margin-top: 16px;
}
#edit-form {
  display: grid;
  gap: 16px;
}
.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}
.field label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 550;
}
.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--snow);
  color: var(--ink);
  min-height: 44px;
}
.field textarea {
  min-height: 85px;
  resize: vertical;
  line-height: 1.5;
}
.field select[multiple] {
  min-height: 135px;
}
.field-help {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}
.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}
.form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  bottom: 0;
  background: var(--paper);
  padding: 16px 0 0;
}
.form-error {
  color: #963f36;
  font-size: 14px;
  line-height: 1.6;
}
.editor-note {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
  margin-bottom: 20px;
}
.mobile-selected {
  display: none;
}
.history-note {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  margin-top: 12px;
}

.demo-label {
  position: fixed;
  left: max(16px, env(safe-area-inset-left));
  bottom: max(12px, env(safe-area-inset-bottom));
  font-size: 11px;
  color: var(--wall-muted);
}
.editing .demo-label {
  display: none;
}
@media (max-width: 1099px) {
  #app {
    padding-left: calc(22px + env(safe-area-inset-left));
    padding-right: calc(22px + env(safe-area-inset-right));
  }
  .name {
    font-size: 17px;
  }
}
@media (max-width: 759px) {
  .directory-grid {
    gap: 10px;
  }
  #app {
    padding-left: calc(18px + env(safe-area-inset-left));
    padding-right: calc(18px + env(safe-area-inset-right));
  }
  .family-expansion {
    padding: 0 10px 10px;
  }
  .name {
    font-size: 17px;
  }
  .person {
    padding: 0 8px;
  }
  .halves {
    padding: 18px 4px 10px;
  }
  .meta {
    min-height: 26px;
  }
  .family-summary {
    font-size: 10px;
  }
  .expansion-heading h2 {
    font-size: 18px;
  }
}
@media (max-width: 519px) {
  #app {
    padding-left: calc(10px + env(safe-area-inset-left));
    padding-right: calc(12px + env(safe-area-inset-right));
  }
  .person {
    padding: 0 12px;
  }
  .name {
    font-size: 19px;
    min-height: 25px;
  }
  .age {
    font-size: 12px;
    line-height: 20px;
  }
  .meta {
    font-size: 12px;
    min-height: 27px;
  }
  .halves {
    padding: 13px 5px 10px;
  }
  .family-summary {
    font-size: 11px;
    padding-top: 8px;
    padding-bottom: 8px;
  }
  .expansion-heading h2 {
    font-size: 18px;
  }
  .heading-suffix {
    display: block;
    font-size: 11px;
    line-height: 1.5;
    margin-bottom: 10px;
  }
  .expansion-heading h2 button {
    min-height: 30px;
  }
  .family-expansion {
    padding: 4px 10px 10px;
  }
  .expansion-heading .tool {
    align-self: flex-start;
    margin-top: 4px;
  }
  .panel-top {
    padding: 20px 22px 8px;
  }
  .panel-top h2 {
    font-size: 29px;
  }
  .panel-body {
    padding: 12px 22px 28px;
  }
  #notice {
    width: calc(100% - 32px);
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* Repeated downward expansion keeps all ancestor generations in context. */
.generation-label {
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--river);
  margin: 11px 0 0;
}
.child-grid > .family-expansion {
  background: var(--snow);
}
.expansion-heading:has(.generation-label) {
  min-height: 65px;
}

/* Facts only: no empty footer, unknown-value markers, or childless expansion. */
.card-facts {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0 18px;
  padding: 0 0 10px;
  border-top: 0;
  min-height: 30px;
}
.card-facts .family-summary {
  border: 0;
  margin: 0;
  padding: 3px 7px;
  min-height: 22px;
  font-size: 11px;
}
.marriage {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
  text-align: left;
}
.marriage .icon {
  width: 13px;
  height: 13px;
  color: var(--river);
}
.marriage:hover {
  color: var(--river);
  text-decoration: none;
}
.card-facts:has(.family-summary) {
  padding-right: 10px;
}
@media (max-width: 519px) {
  .card-facts {
    padding: 2px 0 10px;
    gap: 4px;
  }
  .card-facts .family-summary,
  .marriage {
    font-size: 11px;
    min-height: 24px;
  }
}

/* Each person's recorded details stay in their own column, in card order. */
.person-details {
  display: grid;
  gap: 7px;
  min-width: 0;
  margin-top: 8px;
  pointer-events: auto;
}
.person-vitals {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.person-vitals .age {
  flex-shrink: 0;
}
.person-detail {
  display: flex;
  align-items: flex-start;
  gap: 5px;
  min-width: 0;
  max-width: 100%;
  text-align: left;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}
.person-detail .icon {
  width: 12px;
  height: 12px;
  margin-top: 2px;
  color: var(--river);
}
.person-detail > span:not(.sr-only) {
  min-width: 0;
  overflow-wrap: anywhere;
}
.person-detail:is(a, button):hover {
  color: var(--river);
}
@media (max-width: 519px) {
  .name [data-fit-name] { --name-size: 19px; }
}

/* Quiet controls keep the family and its facts in focus. */
.expansion-heading{justify-content:flex-end;min-height:34px}
.expansion-heading .tool{min-height:30px;min-width:30px}
.age{gap:5px}.gender{font-size:14px}

.info-card .panel-top{padding:20px 28px 8px}.info-card .panel-top h2{font-size:23px}.info-card .panel-body{padding:8px 28px 28px}
.info-card #edit-form{grid-template-columns:repeat(2,minmax(0,1fr));align-items:start}.info-card #form-error,.info-card .form-actions{grid-column:1/-1}.info-card .form-actions{position:static}
@media(max-width:600px){.info-card #edit-form{grid-template-columns:1fr}.info-card .panel-top{padding:12px 14px 6px}.info-card .panel-body{padding:6px 14px 18px}}

/* Inline record surfaces. */
:is(.info-card, .result) {
  --ink: #293c37;
  --muted: #62675c;
  --river: #3f6256;
  --pine: #344f43;
  --line: #d7d0bd;
  --snow: #f3f0e9;
  color: var(--ink);
  border: 1px solid var(--gallery-line);
  border-radius: 0;
  background: var(--gallery-paper);
  box-shadow: inset 0 0 0 4px #fffdf44d, var(--gallery-shadow);
}
.info-card .panel-top,
.info-card .form-actions {
  background: transparent;
}
.results {
  gap: 12px;
}
.result {
  --gallery-shadow: 0 2px 5px #302b2012;
}
.result {
  padding: 10px 12px;
}
.couple,
.info-card[data-generation] {
  --ink: var(--wall-text);
  --muted: var(--wall-muted);
  --river: var(--bubble-accent);
  --pine: var(--wall-text);
  --line: var(--bubble-edge);
  --mist: #d8c8a814;
  border-radius: 32px;
}
.couple {
  padding: clamp(22px, 2vw, 30px);
  transition: border-color .18s, box-shadow .18s;
}
.info-card[data-generation] {
  --detail-padding: clamp(22px, 2vw, 30px);
  --mist: color-mix(in srgb, var(--bubble-accent) 10%, transparent);
}
.info-card[data-generation] .panel-top {
  padding: var(--detail-padding) var(--detail-padding) 8px;
}
.info-card[data-generation] .panel-top h2 {
  --name-size: 28px;
  line-height: 1.4;
}
.info-card[data-generation] .panel-body {
  padding: 8px var(--detail-padding) var(--detail-padding);
}
.info-card[data-generation] .detail-links {
  gap: 6px;
}
.info-card[data-generation] .detail-links button {
  color: var(--muted);
  font-size: 12px;
}
.info-card[data-generation] .detail-links .icon {
  color: var(--bubble-accent);
}
.info-card[data-generation] .detail-links button:hover {
  color: var(--ink);
  background: color-mix(in srgb, var(--bubble-accent) 18%, transparent);
}
.info-card[data-generation] .panel-top .tool {
  flex-shrink: 0;
  color: var(--muted);
}
.info-card[data-generation] .panel-top .tool:hover {
  color: var(--ink);
}
/* The configured root has a warmer tint within the same translucent surface. */
:is(.couple, .info-card)[data-generation="0"] {
  --bubble-fill: #c7ad781c;
  --bubble-edge: #c7ad784f;
  --bubble-accent: var(--timeline-gold);
}
.couple[data-generation="0"] span.family-summary:hover {
  color: var(--muted);
}
.gallery-display {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  flex: 1;
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
}
.couple-name {
  --name-size: 28px;
  margin: 0;
  line-height: 1.4;
  text-align: left;
}
.couple-name-part {
  font: inherit;
  line-height: inherit;
}
button.couple-name-part:hover {
  color: var(--river);
}
.editing [data-action="person"].couple-name-part:hover {
  outline: 1px dashed var(--bubble-accent);
  outline-offset: 3px;
}
.couple .halves {
  flex: 0;
  padding: 12px 0 0;
}
.couple .halves.single {
  padding-top: 0;
}
.couple .person {
  padding: 0;
}
.couple .name {
  text-align: left;
}
.couple .name [data-fit-name] {
  --name-size: 28px;
}
.couple .age {
  grid-row: auto;
  justify-self: start;
  background: var(--mist);
}
.has-shared-name .halves {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 20px;
}
.has-shared-name .person + .person {
  padding-left: 0;
  border-left: 0;
}
.has-shared-name .age {
  grid-row: auto;
}
.couple .card-facts {
  position: relative;
  justify-content: flex-start;
  gap: 6px 10px;
  margin: 18px 0 0;
  padding: 12px 16px 0 0;
  border: 0;
  border-top: 1px solid var(--line);
}
.couple .card-facts .fact-badge {
  background: var(--mist);
  padding: 3px 7px;
}
.couple .card-facts .marriage {
  margin-left: auto;
  text-align: right;
}
.couple > .chevron {
  right: 20px;
  bottom: 23px;
  width: 10px;
  height: 10px;
}
.couple.is-expandable:hover,
.editing .couple.is-editable:hover {
  border-color: color-mix(in srgb, var(--bubble-accent) 55%, transparent);
  background: var(--bubble-fill);
  box-shadow: var(--bubble-shadow), 0 8px 28px #00000014;
}
.couple.selected {
  border-color: var(--bubble-accent);
  background: var(--bubble-fill);
  box-shadow: var(--bubble-shadow), 0 0 0 1px color-mix(in srgb, var(--bubble-accent) 25%, transparent);
}
.couple .hit:hover { background: none; }
.editing .couple.is-editable { outline-color: var(--bubble-edge); }
.editing .couple.is-editable :is(.name, .meta, .family-summary, .age)[data-action="person"]:hover { background: var(--mist); outline-color: var(--bubble-accent); }
.result:hover { border-color: var(--gallery-accent); }
.couple.is-expandable,
.editing .couple.is-editable {
  cursor: pointer;
}
.couple:not(.is-expandable) span.marriage:hover {
  color: var(--muted);
}
.initial-load,
#tree.empty {
  --muted: var(--wall-muted);
  --river: #c3ceb7;
}
@media (max-width: 759px) {
  .couple,
  .info-card[data-generation] {
    border-radius: 28px;
  }
  .couple {
    padding: 22px;
  }
  .couple .card-facts {
    padding-top: 10px;
  }
}

/* Branches are open wall space, not containing cards. Each depth retains its
   own narrow connection lane so wrapped and nested rows remain distinct. */
.family-expansion,
.child-grid > .family-expansion {
  padding: 38px 0 0 12px;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
}
.family-expansion > .child-grid {
  position: relative;
  row-gap: 32px;
}
.family-connections {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  fill: none;
  stroke: #c5b58ec9;
  stroke-width: 1.25;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.branch-collapse {
  --river: #c3ceb7;
  position: absolute;
  right: 0;
  top: -4px;
  min-width: 32px;
  min-height: 32px;
  color: var(--wall-muted);
}
.branch-collapse .icon {
  width: 15px;
  height: 15px;
}
.branch-collapse:hover {
  color: var(--wall-text);
}
.family-expansion.enter {
  animation: branch-reveal .3s ease-out;
}
.family-expansion.enter > .child-grid > .couple {
  animation: descendant-arrive .48s cubic-bezier(.22, 1, .36, 1) both;
}
.family-expansion.enter > .child-grid > .couple:nth-of-type(2) {
  animation-delay: 45ms;
}
.family-expansion.enter > .child-grid > .couple:nth-of-type(3) {
  animation-delay: 90ms;
}
.family-expansion.enter > .child-grid > .couple:nth-of-type(n + 4) {
  animation-delay: 135ms;
}
.family-expansion.enter > .family-connections path {
  stroke-dasharray: 1;
  animation: branch-connect .65s cubic-bezier(.22, 1, .36, 1) both;
}
@keyframes branch-reveal {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes descendant-arrive {
  from { opacity: 0; transform: translateY(-12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes branch-connect {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}

/* Person editor: a calm, focused workspace above the gallery. */
body.editor-open { overflow: hidden; }
.person-editor {
  color-scheme: dark;
  --ink: var(--wall-text);
  --muted: var(--wall-muted);
  --river: #c3ceb7;
  --pine: var(--timeline-sage);
  --editor-border: #d6d1bf26;
  --editor-surface: #343931;
  --editor-hover: #ffffff0b;
  --editor-selected: #404b3a;
  --editor-accent-border: #aabc9973;
  --editor-error: #ecc3ad;
  --editor-error-surface: #ecc3ad12;
  width: min(1040px, calc(100vw - 64px));
  height: min(850px, calc(100dvh - 64px));
  max-width: none;
  max-height: none;
  margin: auto;
  padding: 0;
  border: 1px solid #d6d1bf38;
  border-radius: 24px;
  background: radial-gradient(ellipse at 50% 0, #bbaa8712, transparent 70%), #292d27;
  color: var(--ink);
  box-shadow: 0 32px 120px #0007, 0 2px 8px #0002;
  overflow: hidden;
  scrollbar-color: #878b7890 transparent;
}
.person-editor[open] { display: flex; flex-direction: column; animation: editor-arrive .24s ease-out; }
.person-editor::backdrop { background: #111b18b8; backdrop-filter: blur(7px); }
.person-editor [hidden] { display: none !important; }
.editor-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 12px 24px;
  padding: 30px 36px 24px;
  border-bottom: 1px solid var(--editor-border);
  background: linear-gradient(115deg, #c7ad7810, transparent);
}
.editor-heading { display: contents; }
.editor-eyebrow { grid-column: 1; grid-row: 1; display: flex; gap: 10px; color: var(--muted); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; }
.editor-eyebrow > span { color: var(--muted); }
.editor-heading h2 { --name-size: 38px; grid-column: 1 / -1; grid-row: 2; min-width: 0; margin-top: 0; line-height: 1.16; outline: none; }
.editor-header > .editor-history { grid-column: 2; grid-row: 1; justify-self: center; }
.editor-close { grid-column: 3; grid-row: 1; justify-self: end; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0; color: var(--muted); background: var(--editor-hover); }
.editor-close:hover { background: #ffffff14; color: var(--ink); }
#edit-form.person-form { display: flex; flex-direction: column; flex: 1; min-height: 0; gap: 0; }
.editor-workspace { display: grid; grid-template-columns: 190px minmax(0, 1fr); flex: 1; min-height: 0; }
.editor-navigation { display: flex; flex-direction: column; padding: 25px 16px; border-right: 1px solid var(--editor-border); background: #23282180; }
.editor-tabs { display: flex; flex-direction: column; gap: 7px; }
.editor-tabs > button { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 12px 16px; border-radius: 12px; text-align: left; font-size: 14px; color: var(--muted); }
.editor-tabs > button:hover { background: var(--editor-hover); color: var(--ink); }
.editor-tabs > [aria-selected="true"] { background: var(--editor-selected); color: var(--pine); font-weight: 600; }
.editor-tabs .icon { width: 18px; height: 18px; }
.tab-dot { width: 5px; height: 5px; border-radius: 50%; margin-left: auto; }
[aria-selected="true"] > .tab-dot { background: var(--pine); }
.editor-content { overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; padding: 30px 42px 36px; }
.editor-content > section { display: grid; gap: 24px; max-width: 660px; margin: 0 auto; }
.editor-field { display: grid; gap: 9px; min-width: 0; }
.editor-field label, .editor-choice-field legend, .birthday-heading > label, .contact-field legend, .address-field legend, .relationship legend {
  display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: 13px; font-weight: 550;
}
.required-mark { color: var(--muted); font-size: 10px; font-weight: 400; margin-left: auto; }
.person-editor input:not([type="hidden"]), .person-editor textarea {
  width: 100%; min-width: 0; min-height: 48px; padding: 12px 14px;
  border: 1px solid var(--editor-border); border-radius: 10px;
  background: var(--editor-surface); color: var(--ink); font-size: 15px; line-height: 1.5;
  transition: border-color .15s, box-shadow .15s;
}
.person-editor input::placeholder, .person-editor textarea::placeholder { color: var(--muted); opacity: 1; }
.person-editor input:hover, .person-editor textarea:hover { border-color: var(--editor-accent-border); }
.person-editor input:focus, .person-editor textarea:focus { border-color: var(--river); box-shadow: 0 0 0 3px #c3ceb71c; outline: none; }
.person-editor :is(input, textarea)[aria-invalid="true"] { border-color: var(--editor-error); box-shadow: 0 0 0 3px var(--editor-error-surface); }
.person-editor #f-name { font-size: 18px; min-height: 54px; }
.person-editor textarea { resize: vertical; min-height: 100px; }
.person-editor textarea.editor-notes { min-height: 150px; }
.editor-choice-field, .contact-field, .address-field, .relationship { min-width: 0; border: 0; padding: 0; margin: 0; }
.editor-choice-field legend, .contact-field legend, .address-field legend, .relationship legend { padding: 0; margin-bottom: 12px; }
.address-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 16px; align-items: start; }
.address-grid > .editor-field:first-child, .address-grid > .editor-field:nth-child(2) { grid-column: 1 / -1; }
.region-picker { position: relative; min-width: 0; }
.person-editor .region-picker input { padding-right: 42px; }
.region-toggle { position: absolute; right: 4px; top: 4px; width: 40px; height: 40px; display: grid; place-items: center; color: var(--muted); border-radius: 8px; }
.region-toggle:hover { color: var(--ink); background: var(--editor-hover); }
.region-options { position: relative; max-height: 220px; overflow-y: auto; overscroll-behavior: contain; margin-top: 6px; padding: 4px; border: 1px solid var(--editor-border); border-radius: 10px; background: var(--editor-surface); }
.region-options [role="option"] { padding: 10px; border-radius: 7px; font-size: 14px; cursor: pointer; }
.region-options [role="option"]:hover, .region-options [aria-selected="true"] { background: var(--editor-selected); color: var(--pine); }
.editor-pills { display: flex; flex-wrap: wrap; gap: 7px; }
.editor-pills > button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; padding: 9px 15px; border: 1px solid var(--editor-border); border-radius: 999px; color: var(--muted); font-size: 12px; background: var(--editor-surface); }
.editor-pills > button:hover { border-color: var(--editor-accent-border); color: var(--pine); }
.editor-pills > [aria-pressed="true"] { border-color: var(--editor-accent-border); background: var(--editor-selected); color: var(--pine); }
.editor-pills .icon { width: 14px; height: 14px; }
.editor-pills.compact { gap: 4px; padding: 3px; background: #1f251f; border-radius: 999px; }
.editor-pills.compact > button { min-height: 34px; padding: 6px 12px; border-color: transparent; background: transparent; font-size: 11px; }
.editor-pills.compact > [aria-pressed="true"] { background: var(--editor-selected); border-color: var(--editor-accent-border); box-shadow: 0 1px 3px #0002; }
.custom-gender { margin-top: 12px; }
.birthday-editor { display: grid; gap: 14px; padding-top: 22px; border-top: 1px solid var(--editor-border); }
.birthday-heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; }
.birthday-editor [data-birthday-full] .editor-field { gap: 0; }
.contact-field legend .icon, .address-field legend .icon, .relationship legend .icon { width: 17px; height: 17px; color: var(--pine); }
.contact-entries { display: grid; gap: 9px; }
.contact-entry { display: flex; align-items: center; gap: 6px; position: relative; }
.contact-input-icon { position: absolute; left: 14px; display: flex; color: var(--muted); pointer-events: none; }
.contact-input-icon .icon { width: 17px; height: 17px; }
.contact-entry input { padding-left: 43px !important; }
.contact-remove { display: grid; place-items: center; width: 44px; height: 44px; flex-shrink: 0; border-radius: 50%; color: var(--muted); }
.contact-remove:hover { background: var(--editor-error-surface); color: var(--editor-error); }
.contact-remove .icon { width: 16px; height: 16px; }
.phone-entry {
  gap: 10px; min-height: 60px; padding: 6px 7px 6px 12px;
  border: 1px solid var(--editor-border); border-radius: 14px;
  background: var(--editor-surface); box-shadow: 0 2px 5px #0001;
  transition: border-color .15s, box-shadow .15s;
}
.phone-entry:hover { border-color: var(--editor-accent-border); }
.phone-entry:focus-within { border-color: var(--river); box-shadow: 0 0 0 3px #c3ceb71c; }
.phone-entry:has(input[aria-invalid="true"]) { border-color: var(--editor-error); box-shadow: 0 0 0 3px var(--editor-error-surface); }
.phone-entry .contact-input-icon { position: static; display: grid; place-items: center; flex: 0 0 34px; height: 34px; border-radius: 10px; background: var(--editor-selected); color: var(--pine); }
.person-editor .phone-entry input {
  flex: 1; min-height: 44px; padding: 8px 0 !important;
  border: 0; border-radius: 0; background: transparent; box-shadow: none;
  font-size: 17px; font-variant-numeric: tabular-nums; letter-spacing: .025em;
}
.person-editor .phone-entry input::placeholder { color: var(--muted); letter-spacing: .015em; }
.phone-entry .contact-remove { width: 40px; height: 44px; border-radius: 10px; }
.editor-add { display: inline-flex; align-items: center; gap: 6px; min-height: 42px; padding: 8px 13px; border-radius: 999px; margin-top: 9px; background: var(--editor-hover); color: var(--river); font-size: 12px; }
.editor-add:hover { background: var(--editor-selected); }
.editor-add .icon { width: 15px; height: 15px; }
[data-contact="phones"] .editor-add { padding-left: 2px; padding-right: 2px; min-height: 44px; background: transparent; }
[data-contact="phones"] .editor-add:hover { color: var(--pine); }
.relationship { border: 1px solid var(--editor-border); border-radius: 14px; padding: 16px; background: #ffffff03; }
.relationship legend { margin: 0; padding: 0 7px; font-size: 14px; }
.relationship-count { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; min-height: 20px; font-size: 11px; border-radius: 50%; background: var(--editor-selected); color: var(--pine); }
.relationship-count:empty { display: none; }
.relationship-selection { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 7px; min-height: 56px; padding: 6px; margin: 0 -6px 12px; border: 1px dashed transparent; border-radius: 11px; transition: background .15s, border-color .15s; }
.relationship-empty { display: flex; flex-wrap: wrap; align-items: center; align-self: center; gap: 6px; padding: 6px 2px; font-size: 12px; color: var(--muted); }
.relationship-empty .icon { width: 16px; height: 16px; }
.is-dragging .relationship-selection { border-color: var(--editor-accent-border); background: var(--editor-hover); }
.is-drag-over .relationship-selection { border-color: var(--pine); background: var(--editor-selected); }
.person-pill { display: inline-flex; align-items: center; gap: 7px; min-width: 0; max-width: 100%; min-height: 40px; padding: 0 4px 0 12px; border-radius: 999px; background: var(--editor-selected); color: var(--pine); border: 1px solid var(--editor-accent-border); }
.person-pill > .icon { width: 14px; height: 14px; flex-shrink: 0; }
.person-pill > [data-fit-name] { --name-size: 13px; width: auto; flex: 0 1 auto; }
.person-pill > button { display: grid; place-items: center; width: 36px; height: 36px; flex-shrink: 0; border-radius: 50%; color: var(--pine); }
.person-pill > button:hover { background: var(--editor-hover); color: var(--ink); }
.person-pill > button .icon { width: 14px; height: 14px; }
.relationship-search { display: flex; align-items: center; position: relative; }
.relationship-search > .icon { position: absolute; left: 13px; width: 17px; height: 17px; pointer-events: none; color: var(--muted); }
.relationship-search input { padding-left: 40px !important; font-size: 13px !important; }
.relationship-results { padding-top: 10px; }
.relationship-results-label { font-size: 10px; color: var(--muted); padding: 6px 5px 9px; line-height: 1.5; }
.relationship-option { width: 100%; display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 8px; border-radius: 9px; text-align: left; cursor: grab; }
.relationship-option:hover, .relationship-option:focus-visible { background: var(--editor-hover); }
.relationship-option:active { cursor: grabbing; }
.relationship-avatar { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--editor-selected); color: var(--pine); flex-shrink: 0; }
.relationship-avatar .icon { width: 16px; height: 16px; }
.relationship-option-text { flex: 1; min-width: 0; }
.relationship-option-text [data-fit-name] { --name-size: 14px; }
.relationship-option-text small { display: block; font-size: 11px; color: var(--muted); margin-top: 4px; overflow-wrap: anywhere; }
.relationship-option-action { color: var(--river); display: flex; }
.relationship-option-action .icon { width: 16px; height: 16px; }
.drag-grip { width: 12px; height: 16px; color: var(--muted); }
.relationship-no-results { font-size: 12px; color: var(--muted); line-height: 1.6; padding: 10px 5px 3px; }
.editor-footer { flex-shrink: 0; padding: 19px 30px; border-top: 1px solid var(--editor-border); background: #262b24; }
.editor-footer .form-error:empty { display: none; }
.editor-footer .form-error:not(:empty) { max-height: 100px; overflow-y: auto; padding: 10px 12px; margin-bottom: 12px; border-radius: 8px; background: var(--editor-error-surface); color: var(--editor-error); font-size: 13px; }
.editor-footer-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.editor-save-status { display: flex; align-items: center; gap: 10px; min-width: 0; font-size: 12px; color: var(--muted); }
.editor-status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--pine); flex-shrink: 0; }
.has-changes .editor-status-dot { background: var(--timeline-gold); }
.editor-history { display: flex; align-items: center; gap: 4px; }
.editor-history > button { display: grid; place-items: center; width: 44px; height: 44px; color: var(--muted); border-radius: 50%; }
.editor-history > button:hover:not(:disabled) { color: var(--pine); background: var(--editor-hover, #e8eee0); }
.editor-history .icon { width: 18px; height: 18px; }
.editor-history > button:disabled { opacity: .35; cursor: default; }
.person-editor :is(button, summary):focus-visible { outline: 2px solid var(--river); outline-offset: 3px; }
@keyframes editor-arrive { from { opacity: 0; transform: translateY(12px) scale(.99); } to { opacity: 1; transform: translateY(0) scale(1); } }
@media (max-width: 760px) {
  .person-editor { width: calc(100vw - 24px); height: calc(100dvh - 24px); border-radius: 20px; }
  .editor-header { padding: 22px 24px 20px; }
  .editor-heading h2 { --name-size: 31px; }
  .editor-workspace { display: flex; flex-direction: column; }
  .editor-navigation { padding: 10px 18px; border-right: 0; border-bottom: 1px solid var(--editor-border); }
  .editor-tabs { flex-direction: row; gap: 4px; }
  .editor-tabs > button { flex: 1; justify-content: center; gap: 6px; padding: 10px 6px; min-height: 44px; font-size: 12px; border-radius: 999px; }
  .editor-tabs .icon { width: 16px; height: 16px; }
  .tab-dot { display: none; }
  .editor-content { padding: 25px 24px; flex: 1; }
  .editor-footer { padding: 15px 22px; }
}
@media (max-width: 480px) {
  .person-editor { width: 100%; height: 100dvh; border-radius: 0; border: 0; }
  .editor-header { padding: max(20px, env(safe-area-inset-top)) 20px 18px; }
  .editor-eyebrow { font-size: 9px; }
  .editor-heading h2 { --name-size: 30px; }
  .editor-navigation { padding: 10px 14px; }
  .editor-content { padding: 24px 20px 30px; }
  .address-grid { grid-template-columns: minmax(0, 1fr); }
  .person-editor input:not([type="hidden"]), .person-editor textarea, .relationship-search input { font-size: 16px !important; }
  .editor-content > section { gap: 23px; }
  .editor-pills > button { min-height: 44px; padding: 10px 13px; }
  .editor-footer { padding: 13px 20px max(14px, env(safe-area-inset-bottom)); }
  .editor-footer-row { flex-wrap: wrap; gap: 10px; }
  .editor-save-status { width: 100%; font-size: 11px; }
  .relationship { padding: 13px; }
  .person-pill { min-height: 44px; }
  .person-pill > button { width: 40px; height: 40px; }
  .birthday-heading { align-items: flex-start; }
}
@media (pointer: coarse) {
  .drag-grip { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .person-editor[open] { animation: none; }
  .person-editor *, .person-editor::backdrop { transition: none; }
}

/* Account and family access controls share the existing evergreen surfaces. */
.auth-gate { gap: 1rem; text-align: center; }
.timeline-account { position: fixed; right: 1rem; bottom: 1rem; z-index: 30; }
.family-access { color: var(--text, #eee9dd); background: #252e29; border: 1px solid #647365; border-radius: 24px; width: min(760px, calc(100vw - 2rem)); max-height: calc(100dvh - 3rem); padding: clamp(1rem, 4vw, 2rem); }
.family-access::backdrop { background: #101a16b8; }
.family-access header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.family-access h2, .family-access h3 { font-family: 'Editorial New', Georgia, serif; font-weight: 300; }
.family-access section { margin-block: 1.5rem; }
.family-access p, .family-access small { line-height: 1.55; color: #c9d1c8; }
.family-access form { display: flex; flex-wrap: wrap; align-items: end; gap: .8rem; margin-block: .75rem; }
.family-access label { display: grid; gap: .4rem; flex: 1 1 12rem; }
.family-access input, .family-access select { width: 100%; min-height: 42px; color: #eee9dd; background: #1d2721; border: 1px solid #647365; border-radius: 9px; padding: .6rem; }
.family-access form p { flex-basis: 100%; margin: 0; font-size: .85rem; }
.family-access .access-entry { display: grid; gap: .35rem; padding: .8rem 0; border-bottom: 1px solid #77826f40; }
.family-access .access-entry > span, .access-audit { font-size: .85rem; }
.family-access footer { position: sticky; bottom: -1rem; background: #252e29; padding-block: .6rem; }

.family-access { color-scheme: dark; }
.family-access .quiet-action { color: #b6cdb0; }
.family-access :focus-visible { outline-color: #b6cdb0; }
.family-picker { position:relative; display:none; max-width:32rem; }
.family-picker[open] { display:grid; gap:1rem; }
.family-picker > .tool { position:absolute; top:1rem; right:1rem; }
.family-picker h2 { padding-right:2rem; }
.family-choice { display:block; text-align:left; padding:.8rem 1rem; border-radius:1rem; }
.family-choice[aria-current="true"] { background:rgba(154,183,164,.15); }
.auth-gate .family-choice { margin:.5rem auto; }
