*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body::before {
  /* paper grain */
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.5 0 0 0 0 0.45 0 0 0 0 0.35 0 0 0 0.18 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

:root[data-theme='dark'] body::before {
  mix-blend-mode: screen;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) body::before {
    mix-blend-mode: screen;
  }
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: -0.01em;
  margin: 0 0 var(--space-3);
  text-wrap: balance;
}
h1 {
  font-size: var(--text-2xl);
}
h2 {
  font-size: var(--text-xl);
}
h3 {
  font-size: var(--text-lg);
}
p {
  margin: 0 0 var(--space-4);
  max-width: var(--measure);
}
a {
  color: inherit;
  text-decoration-color: color-mix(in oklch, currentColor 40%, transparent);
  text-underline-offset: 0.14em;
}
a:hover {
  text-decoration-color: currentColor;
}
ul {
  margin: 0;
  padding: 0;
  list-style: none;
}
button,
input,
select {
  font: inherit;
  color: inherit;
}
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--radius-s);
}
em {
  font-style: italic;
}

.skip-link {
  position: absolute;
  left: var(--space-4);
  top: -3rem;
  background: var(--ink);
  color: var(--paper);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-s);
  z-index: 100;
}
.skip-link:focus {
  top: var(--space-4);
}

.eyebrow {
  font-size: var(--text-xs);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: var(--space-3);
}
.lede {
  font-size: var(--text-lg);
  color: var(--ink-2);
  line-height: 1.5;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: var(--text-sm);
}
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.container {
  width: min(1200px, 100% - var(--gutter) * 2);
  margin-inline: auto;
}
.section {
  padding-block: var(--space-section);
}
.section + .section {
  border-top: 1px solid var(--rule);
}
.section__head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
}
.section__head p {
  margin: 0;
}

/* ---------- header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding-inline: var(--gutter);
  background: color-mix(in oklch, var(--paper) 86%, transparent);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid var(--rule);
}
.wordmark {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.wordmark__mark {
  width: 22px;
  height: 22px;
  align-self: center;
  color: var(--gold-ink);
}
.wordmark__sub {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  color: var(--muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 600;
}
.site-nav {
  display: flex;
  gap: var(--space-1);
  margin-left: var(--space-3);
}
.site-nav a {
  text-decoration: none;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-pill);
  color: var(--ink-2);
  font-size: var(--text-sm);
  font-weight: 500;
  transition: background var(--duration-fast), color var(--duration-fast);
}
.site-nav a:hover {
  background: var(--paper-3);
  color: var(--ink);
}
.site-nav a[aria-current='page'] {
  background: var(--ink);
  color: var(--paper);
}
.header-search {
  margin-left: auto;
  width: min(320px, 40vw);
}
.icon-button {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--rule);
  background: var(--paper-raise);
  cursor: pointer;
  color: var(--ink-2);
  transition: background var(--duration-fast), transform var(--duration-fast);
  flex: none;
}
.icon-button:hover {
  background: var(--paper-3);
  color: var(--ink);
}
.icon-button:active {
  transform: scale(0.94);
}
.icon-button svg {
  width: 18px;
  height: 18px;
}
.nav-toggle {
  display: none;
}

@media (max-width: 860px) {
  .site-header {
    gap: var(--space-2);
  }
  .wordmark__sub {
    display: none;
  }
  .site-nav {
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    flex-direction: column;
    padding: var(--space-3) var(--gutter) var(--space-4);
    background: var(--paper);
    border-bottom: 1px solid var(--rule);
    margin: 0;
    box-shadow: var(--shadow-2);
  }
  .site-nav[hidden] {
    display: none;
  }
  .site-nav a {
    padding: var(--space-3);
    font-size: var(--text-base);
  }
  .header-search {
    width: auto;
    flex: 1;
    min-width: 0;
  }
  .nav-toggle {
    display: inline-grid;
  }
}

/* ---------- buttons ---------- */
.button {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0.6rem 1.05rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  font-weight: 600;
  font-size: var(--text-sm);
  text-decoration: none;
  cursor: pointer;
  transition: transform var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast), background var(--duration-fast);
  white-space: nowrap;
}
.button:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-1);
}
.button:active {
  transform: translateY(0) scale(0.98);
}
.button--secondary {
  background: transparent;
  color: var(--ink);
  border-color: var(--rule-strong);
}
.button--secondary:hover {
  background: var(--paper-3);
}
.button--ghost {
  background: transparent;
  border-color: transparent;
  color: var(--ink-2);
  padding-inline: 0.6rem;
}
.button--ghost:hover {
  background: var(--paper-3);
  box-shadow: none;
}
.button--small {
  padding: 0.38rem 0.75rem;
  font-size: var(--text-xs);
}
.button svg {
  width: 16px;
  height: 16px;
}
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

/* ---------- combobox ---------- */
.combobox {
  position: relative;
}
.combobox__input {
  width: 100%;
  padding: 0.62rem 0.95rem 0.62rem 2.4rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--rule-strong);
  background: var(--paper-raise)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23777' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='7' cy='7' r='4.5'/%3E%3Cpath d='M10.5 10.5 14 14'/%3E%3C/svg%3E")
    no-repeat 0.95rem center;
  font-size: var(--text-sm);
  transition: border-color var(--duration-fast), box-shadow var(--duration-fast);
}
.combobox__input::-webkit-search-cancel-button {
  -webkit-appearance: none;
}
.combobox__input:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--focus) 25%, transparent);
}
.combobox--large .combobox__input {
  padding: 0.95rem 1.2rem 0.95rem 2.9rem;
  font-size: var(--text-base);
  background-position: 1.2rem center;
  background-size: 18px;
}
.combobox__list {
  position: absolute;
  z-index: 50;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  background: var(--paper-raise);
  border: 1px solid var(--rule);
  border-radius: var(--radius-m);
  box-shadow: var(--shadow-2);
  padding: var(--space-1);
  max-height: 320px;
  overflow: auto;
}
.combobox__option {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-3);
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-s);
  cursor: pointer;
  font-size: var(--text-sm);
}
.combobox__option.is-active {
  background: var(--paper-3);
}
.combobox__name {
  font-weight: 500;
}
.combobox__meta {
  color: var(--muted);
  font-size: var(--text-xs);
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 55%;
}

/* ---------- chips & person links ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.7rem 0.3rem 0.55rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--rule);
  background: var(--paper-raise);
  font-size: var(--text-sm);
  text-decoration: none;
  line-height: 1.2;
  transition: border-color var(--duration-fast), transform var(--duration-fast) var(--ease-out), background var(--duration-fast);
  cursor: pointer;
  color: var(--ink);
}
.chip:hover {
  border-color: var(--ink);
  transform: translateY(-1px);
}
.chip__dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--rule-strong);
  flex: none;
}
.chip__dot--royal {
  background: var(--royal);
}
.chip__dot--maternal {
  background: var(--lagoon);
}
.chip__dot--both {
  background: linear-gradient(135deg, var(--royal) 50%, var(--lagoon) 50%);
}
.chip__meta {
  color: var(--muted);
  font-size: var(--text-xs);
}
.chip--half .chip__meta::before {
  content: '½ ';
}
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.tag {
  display: inline-block;
  padding: 0.18rem 0.55rem;
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--paper-3);
  color: var(--ink-2);
}
.tag--royal {
  background: var(--royal-soft);
  color: var(--royal-ink);
}
.tag--maternal {
  background: var(--lagoon-soft);
  color: var(--lagoon-ink);
}
.tag--gold {
  background: var(--gold-soft);
  color: var(--gold-ink);
}
.tag--coral {
  background: var(--coral-soft);
  color: var(--coral);
}

/* ---------- cards ---------- */
.card {
  background: var(--paper-raise);
  border: 1px solid var(--rule);
  border-radius: var(--radius-m);
  padding: var(--space-5);
  box-shadow: var(--shadow-1);
}
.card--flat {
  box-shadow: none;
  background: transparent;
}
.card h3 {
  margin-bottom: var(--space-2);
}
.card p:last-child {
  margin-bottom: 0;
}
.grid {
  display: grid;
  gap: var(--space-4);
}
.grid--2 {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
}
.grid--3 {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
}
.grid--4 {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr));
}

/* ---------- segmented control ---------- */
.segmented {
  display: inline-flex;
  padding: 3px;
  border-radius: var(--radius-pill);
  background: var(--paper-3);
  border: 1px solid var(--rule);
}
.segmented button {
  border: 0;
  background: transparent;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-pill);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  color: var(--ink-2);
  transition: background var(--duration-fast), color var(--duration-fast);
}
.segmented button[aria-pressed='true'] {
  background: var(--paper-raise);
  color: var(--ink);
  box-shadow: var(--shadow-1);
}

/* ---------- viewer identity ("This is me") ---------- */
.you-banner {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  margin: var(--space-2) 0 var(--space-4);
  border-radius: var(--radius-m);
  background: var(--lagoon-soft);
  color: var(--lagoon-ink);
  border: 1px solid color-mix(in oklch, var(--lagoon) 35%, transparent);
  text-decoration: none;
  font-size: var(--text-sm);
  line-height: 1.45;
  max-width: 62ch;
}
.you-banner svg {
  width: 18px;
  height: 18px;
  flex: none;
  margin-top: 0.1rem;
}
.you-banner--self {
  background: var(--gold-soft);
  color: var(--gold-ink);
  border-color: color-mix(in oklch, var(--gold) 45%, transparent);
}
.you-banner a {
  color: inherit;
  font-weight: 600;
}
.you-banner__link {
  border: 0;
  background: transparent;
  padding: 0;
  font: inherit;
  font-weight: 600;
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 0.14em;
  cursor: pointer;
}
.you-line {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: var(--text-sm);
  color: var(--lagoon-ink);
  text-decoration: none;
  margin: 0 0 var(--space-3);
}
.you-line svg {
  width: 16px;
  height: 16px;
}
.you-line strong {
  font-weight: 600;
}

/* ---------- footer ---------- */
.site-footer {
  border-top: 1px solid var(--rule);
  padding: var(--space-6) var(--gutter);
  color: var(--muted);
  font-size: var(--text-sm);
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
}
body.is-tree .site-footer {
  display: none;
}

.empty {
  padding: var(--space-6);
  border: 1px dashed var(--rule-strong);
  border-radius: var(--radius-m);
  color: var(--muted);
  text-align: center;
}

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