:root {
  color-scheme: light;
  --ink: #0b1720;
  --ink-soft: #21333f;
  --paper: #f3efe5;
  --paper-deep: #e7e0d2;
  --white: #fffdf8;
  --copper: #d26a43;
  --blue: #a9c6d7;
  --line: rgba(11, 23, 32, 0.2);
  --max: 1280px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-size: 1rem;
  line-height: 1.6;
}

button,
a {
  font: inherit;
}

a {
  color: inherit;
}

button {
  color: inherit;
}

.skip-link {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 30;
  padding: 0.65rem 0.9rem;
  background: var(--white);
  transform: translateY(-180%);
}

.skip-link:focus {
  transform: none;
}

.site-header {
  display: flex;
  min-height: 6rem;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(1.5rem, calc((100vw - var(--max)) / 2));
  color: var(--paper);
  background: var(--ink);
  border-bottom: 1px solid rgba(243, 239, 229, 0.2);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.035em;
  text-decoration: none;
}

.wordmark-mark {
  display: grid;
  width: 2.15rem;
  height: 2.15rem;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.3rem;
  font-style: italic;
  font-weight: 400;
}

nav {
  display: flex;
  gap: clamp(1rem, 3vw, 2.5rem);
}

nav a {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-decoration: none;
  text-transform: uppercase;
}

nav a.active,
nav a:hover,
nav a:focus-visible {
  color: var(--blue);
}

.family-intro {
  padding: 1.6rem max(1.5rem, calc((100vw - var(--max)) / 2));
  color: var(--paper);
  background:
    radial-gradient(circle at 74% 34%, rgba(169, 198, 215, 0.22), transparent 27rem),
    linear-gradient(135deg, #0b1720 0%, #132735 65%, #1e3745 100%);
}

.eyebrow,
.section-number {
  margin: 0 0 1rem;
  color: var(--copper);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.intro-copy {
  max-width: 850px;
  margin: 0;
  color: rgba(243, 239, 229, 0.86);
  font-size: clamp(1rem, 1.65vw, 1.15rem);
}

.tree-section,
.focus-summary,
.prototype-note,
footer {
  width: min(calc(100% - 3rem), var(--max));
  margin-inline: auto;
}

.tree-section {
  padding: clamp(2.5rem, 5vw, 4rem) 0;
}

.tree-heading-row {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: 2rem;
}

.tree-heading-row h2,
.focus-summary h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.5rem, 5vw, 4.7rem);
  font-weight: 400;
  letter-spacing: -0.04em;
  line-height: 1;
}

.tree-title-line {
  display: flex;
  align-items: end;
  gap: 0.9rem;
}

.version-badge {
  margin-bottom: 0.28rem;
  padding: 0.28rem 0.52rem;
  border: 1px solid rgba(11, 23, 32, 0.22);
  border-radius: 999px;
  color: var(--ink-soft);
  background: rgba(255, 253, 248, 0.56);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
}

.branch-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.55);
}

.branch-switch > span {
  padding: 0 0.65rem;
  color: var(--ink-soft);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.branch-switch button,
.toolbar-button,
.icon-button {
  border: 0;
  background: transparent;
  cursor: pointer;
}

.branch-switch button {
  min-width: 4.7rem;
  padding: 0.62rem 0.9rem;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 750;
}

.branch-switch button[aria-pressed="true"] {
  color: var(--white);
  background: var(--ink);
}

.tree-toolbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1rem;
  color: var(--paper);
  background: var(--ink);
  border-radius: 0.35rem 0.35rem 0 0;
}

.toolbar-button,
.icon-button {
  color: var(--paper);
  border: 1px solid rgba(243, 239, 229, 0.25);
  border-radius: 999px;
}

.toolbar-button {
  padding: 0.48rem 0.8rem;
  font-size: 0.74rem;
  font-weight: 750;
}

.icon-button {
  display: inline-grid;
  width: 2.2rem;
  height: 2.2rem;
  place-items: center;
  font-size: 1.25rem;
}

.toolbar-button:hover,
.toolbar-button:focus-visible,
.icon-button:hover,
.icon-button:focus-visible {
  border-color: var(--blue);
  color: var(--blue);
}

.tree-status {
  margin: 0;
  overflow: hidden;
  color: rgba(243, 239, 229, 0.72);
  font-size: 0.78rem;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-context {
  display: grid;
  justify-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.family-group-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.26rem 0.42rem;
  border: 1px solid rgba(210, 106, 67, 0.72);
  border-radius: 999px;
  color: var(--paper);
  background: rgba(210, 106, 67, 0.13);
  font-size: 0.72rem;
  font-weight: 700;
}

.family-group-switch[hidden] {
  display: none;
}

.family-group-switch button {
  display: inline-flex;
  width: auto;
  height: 1.65rem;
  align-items: center;
  gap: 0.28rem;
  padding: 0 0.52rem;
  border: 1px solid rgba(243, 239, 229, 0.3);
  border-radius: 999px;
  color: var(--paper);
  background: transparent;
  cursor: pointer;
}

.family-group-switch button:hover,
.family-group-switch button:focus-visible {
  border-color: var(--blue);
  color: var(--blue);
}

.family-group-switch.is-called-out {
  animation: family-switch-callout 1.7s ease-out;
}

@keyframes family-switch-callout {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(210, 106, 67, 0);
  }
  18% {
    border-color: var(--paper);
    background: rgba(210, 106, 67, 0.42);
    box-shadow: 0 0 0 6px rgba(210, 106, 67, 0.2);
  }
}

.zoom-controls {
  display: flex;
  gap: 0.35rem;
}

.tree-viewport {
  position: relative;
  overflow: auto;
  min-height: 42rem;
  border: 1px solid rgba(11, 23, 32, 0.18);
  border-top: 0;
  background:
    linear-gradient(rgba(11, 23, 32, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(11, 23, 32, 0.035) 1px, transparent 1px),
    var(--white);
  background-size: 40px 40px;
  scrollbar-color: var(--copper) var(--paper-deep);
}

.tree-scale-wrap {
  position: relative;
}

.tree-stage {
  position: relative;
  width: 1120px;
  height: 920px;
  transform-origin: top left;
}

.tree-lines {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.tree-lines path {
  fill: none;
  stroke: rgba(11, 23, 32, 0.42);
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}

.tree-lines path.spouse-line {
  stroke: var(--copper);
  stroke-width: 2;
}

.generation-label {
  position: absolute;
  left: 22px;
  z-index: 2;
  color: rgba(11, 23, 32, 0.5);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

.generation-label-grandparents { top: 70px; }
.generation-label-parents { top: 306px; }
.generation-label-focus { top: 536px; }
.generation-label-children { top: 766px; }

.tree-row {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 1;
  display: grid;
  align-items: center;
}

.tree-row-grandparents {
  top: 48px;
  grid-template-columns: repeat(4, 1fr);
  padding: 0 56px;
}

.tree-row-parents {
  top: 272px;
  grid-template-columns: repeat(2, 1fr);
  padding: 0 220px;
}

.tree-row-focus {
  top: 502px;
  display: flex;
  justify-content: center;
  gap: 30px;
}

.tree-row-children {
  top: 732px;
  display: flex;
  justify-content: center;
  gap: 30px;
  padding: 0 56px;
}

.tree-row-focus > *,
.tree-row-children > * {
  flex: 0 0 198px;
}

.person-card,
.person-placeholder {
  position: relative;
  width: 198px;
  min-height: 132px;
  justify-self: center;
  border: 1px solid rgba(11, 23, 32, 0.2);
  border-radius: 0.3rem;
  background: rgba(255, 253, 248, 0.96);
  box-shadow: 0 10px 28px rgba(11, 23, 32, 0.08);
}

.person-card.is-active {
  border-color: var(--copper);
  box-shadow: 0 0 0 2px rgba(210, 106, 67, 0.18), 0 16px 38px rgba(11, 23, 32, 0.13);
}

.person-card.is-home-spouse {
  border-color: rgba(169, 198, 215, 0.95);
}

.family-count-button {
  position: absolute;
  z-index: 2;
  top: 0.48rem;
  right: 0.48rem;
  display: inline-grid;
  width: 2.15rem;
  height: 1.7rem;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(210, 106, 67, 0.62);
  border-radius: 999px;
  color: var(--copper);
  background: rgba(255, 253, 248, 0.96);
  cursor: pointer;
}

.family-count-button:hover,
.family-count-button:focus-visible {
  border-color: var(--copper);
  background: rgba(210, 106, 67, 0.12);
  box-shadow: 0 0 0 3px rgba(210, 106, 67, 0.13);
}

.family-stack-icon,
.family-stack-icon::after {
  position: absolute;
  width: 0.72rem;
  height: 0.54rem;
  border: 1.5px solid currentColor;
  border-radius: 0.13rem;
  content: "";
}

.family-stack-icon {
  left: 0.38rem;
  top: 0.46rem;
}

.family-stack-icon::after {
  left: 0.18rem;
  top: 0.16rem;
  background: var(--paper);
}

.family-count {
  position: absolute;
  right: 0.34rem;
  font-size: 0.66rem;
  font-weight: 850;
  line-height: 1;
}

.person-card:has(.family-count-button) .person-focus-button {
  padding-right: 3.1rem;
}

.person-focus-button {
  display: grid;
  width: 100%;
  grid-template-columns: 2.7rem 1fr;
  gap: 0.75rem;
  align-items: center;
  padding: 1rem 1rem 0.65rem;
  border: 0;
  color: inherit;
  text-align: left;
  background: transparent;
  cursor: pointer;
}

.person-focus-button:hover .person-name,
.person-focus-button:focus-visible .person-name {
  color: var(--copper);
}

.person-initials {
  display: grid;
  width: 2.7rem;
  height: 2.7rem;
  place-items: center;
  border-radius: 50%;
  color: var(--paper);
  background: var(--ink-soft);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.95rem;
}

.person-card.is-active .person-initials {
  background: var(--copper);
}

.person-name {
  display: block;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.1;
}

.person-life {
  display: block;
  min-height: 1.15em;
  margin-top: 0.25rem;
  color: rgba(11, 23, 32, 0.58);
  font-size: 0.72rem;
}

.artifact-button {
  display: flex;
  width: calc(100% - 2rem);
  align-items: center;
  justify-content: space-between;
  margin: 0 1rem 0.8rem;
  padding: 0.35rem 0;
  border: 0;
  border-top: 1px solid var(--line);
  color: var(--copper);
  background: transparent;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

.person-placeholder {
  display: grid;
  place-items: center;
  border-style: dashed;
  color: rgba(11, 23, 32, 0.42);
  background: rgba(243, 239, 229, 0.65);
  box-shadow: none;
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tree-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem 1.6rem;
  padding: 1rem 0;
  color: var(--ink-soft);
  font-size: 0.75rem;
}

.tree-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.legend-mark {
  display: inline-block;
  width: 0.72rem;
  height: 0.72rem;
  border-radius: 50%;
}

.legend-focus { background: var(--copper); }
.legend-archive { border: 2px solid var(--copper); }

.legend-family-stack,
.legend-family-stack::after {
  display: inline-block;
  width: 0.72rem;
  height: 0.54rem;
  border: 1.5px solid var(--copper);
  border-radius: 0.13rem;
  content: "";
}

.legend-family-stack {
  position: relative;
  margin-right: 0.18rem;
}

.legend-family-stack::after {
  position: absolute;
  left: 0.2rem;
  top: 0.18rem;
  background: var(--paper);
}

.focus-summary {
  padding: clamp(3rem, 6vw, 5rem) 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.focus-summary-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(15rem, 1fr) auto;
  gap: clamp(2rem, 6vw, 6rem);
  align-items: start;
}

.focus-summary-grid p {
  color: var(--ink-soft);
}

.focus-summary-grid .summary-places {
  margin-top: 1.4rem;
  max-width: 35rem;
}

.focus-summary dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.45rem 1rem;
  margin: 0;
}

.focus-summary dt {
  color: rgba(11, 23, 32, 0.55);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.focus-summary dd {
  margin: 0;
}

.summary-action button {
  padding: 0.78rem 1rem;
  border: 1px solid var(--ink);
  border-radius: 999px;
  color: var(--paper);
  background: var(--ink);
  cursor: pointer;
}

.prototype-note {
  padding: 2.5rem 0 5rem;
}

.prototype-note p {
  max-width: 850px;
  margin: 0;
  color: rgba(11, 23, 32, 0.68);
  font-size: 0.86rem;
}

footer {
  display: flex;
  justify-content: space-between;
  padding: 2rem 0;
  border-top: 1px solid var(--line);
  color: rgba(11, 23, 32, 0.6);
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.artifact-dialog {
  width: min(780px, calc(100% - 2rem));
  max-height: calc(100svh - 2rem);
  padding: 0;
  border: 0;
  border-radius: 0.35rem;
  color: var(--ink);
  background: var(--white);
  box-shadow: 0 28px 90px rgba(11, 23, 32, 0.34);
}

.artifact-dialog::backdrop {
  background: rgba(5, 12, 17, 0.8);
  backdrop-filter: blur(4px);
}

.dialog-close {
  position: sticky;
  top: 0.75rem;
  z-index: 2;
  display: grid;
  width: 2.5rem;
  height: 2.5rem;
  place-items: center;
  float: right;
  margin: 0.75rem;
  border: 0;
  border-radius: 50%;
  color: var(--paper);
  background: var(--ink);
  font-size: 1.4rem;
  cursor: pointer;
}

.artifact-content img {
  display: block;
  width: 100%;
  max-height: 62svh;
  object-fit: contain;
  background: #d8d8d6;
}

.artifact-copy {
  padding: 2rem;
}

.artifact-copy h3 {
  margin: 0 0 0.7rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.8rem, 5vw, 3rem);
  font-weight: 400;
  line-height: 1;
}

.artifact-copy p {
  color: var(--ink-soft);
}

.artifact-meta {
  color: var(--copper) !important;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.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; }
.home-controls { display:flex;align-items:center;gap:.5rem;min-width:0; }
.home-picker { width: min(17rem, 35vw); }
.person-combobox { position:relative;min-width:0; }
.person-combobox input { width:100%;box-sizing:border-box;border:1px solid #b5a992;border-radius:.45rem;padding:.55rem .7rem;font:inherit;color:var(--ink);background:#fffdf8; }
.person-combobox input:focus { outline:2px solid #c99461;outline-offset:2px; }
.person-options { position:absolute;z-index:50;left:0;right:0;top:calc(100% + 3px);max-height:18rem;overflow:auto;background:#fffdf8;color:var(--ink);border:1px solid #b5a992;border-radius:.4rem;box-shadow:0 8px 22px #0004; }
.person-options[hidden] { display:none; }
.person-option { display:flex;align-items:baseline;justify-content:space-between;gap:.8rem;width:100%;border:0;background:transparent;padding:.55rem .7rem;text-align:left;color:inherit;font:inherit;cursor:pointer; }
.person-option-name { min-width:0; }
.person-option-dates { flex:none;color:var(--ink-soft);font-size:.82em;white-space:nowrap; }
.person-option[aria-selected="true"],.person-option:hover { background:#eadcca; }
.person-option-empty { padding:.7rem;color:var(--ink-soft); }
.person-picker-row { display:flex;align-items:center;gap:1rem;padding:1rem 0 1.3rem; }
.person-picker-row label { flex:none;font-size:.73rem;font-weight:800;letter-spacing:.08em;text-transform:uppercase; }
.person-picker-row .person-combobox { width:min(24rem,100%); }
.artifact-picker-link { color:#503c2c;font:600 13px Arial,sans-serif;white-space:nowrap;text-decoration:underline;text-underline-offset:3px; }

@media (max-width: 760px) {
  .site-header {
    min-height: 4.8rem;
    padding-inline: 1rem;
  }

  .site-header nav a:first-child {
    display: none;
  }

  .family-intro {
    padding-inline: 1.5rem;
  }

  .tree-section,
  .focus-summary,
  .prototype-note,
  footer {
    width: min(calc(100% - 2rem), var(--max));
  }

  .tree-heading-row {
    display: grid;
  }

  .branch-switch {
    justify-self: start;
  }

  .tree-toolbar {
    grid-template-columns: 1fr auto;
  }

  .home-controls { grid-column:1/-1; }
  .home-picker { width:min(100%,24rem);flex:1; }

  .tree-status {
    grid-column: 1 / -1;
    grid-row: 2;
    text-align: left;
  }

  .tree-context {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-items: start;
  }

  .tree-viewport {
    min-height: 31rem;
  }

  .focus-summary-grid {
    grid-template-columns: 1fr;
  }

  footer {
    display: grid;
    gap: 0.35rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

.artifact-picker-link {color:#503c2c;font:600 13px Arial,sans-serif;white-space:nowrap;text-decoration:underline;text-underline-offset:3px}
