/* Kër Dieng — colours from the house in Sicap, woven pagnes and indigo cloth. */
:root {
  --paper: #fbf6ee;
  --paper-rgb: 251 246 238;
  --card: #fffdf9;
  --sand: #f2e7d7;
  --sand-deep: #e8d8c2;
  --ink: #2d241f;
  --ink-soft: #5b4d43;
  --muted: #85756a;
  --line: #e7dccd;
  --line-strong: #cdbba5;
  --terracotta: #b65a3f;
  --terracotta-deep: #96452e;
  --salmon: #e3967a;
  --ochre: #d4a23f;
  --indigo: #34507a;
  --sage: #6c8a63;

  --serif: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --sans: 'Nunito Sans', 'Segoe UI', system-ui, sans-serif;

  --header-h: 68px;
  --radius: 18px;
  --shadow-sm: 0 1px 2px rgb(74 48 30 / 0.06), 0 2px 6px rgb(74 48 30 / 0.05);
  --shadow: 0 2px 4px rgb(74 48 30 / 0.05), 0 10px 30px -8px rgb(74 48 30 / 0.16);
  --shadow-lg: 0 24px 60px -18px rgb(74 48 30 / 0.32);
}

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

html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 16px); }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body.no-scroll { overflow: hidden; }

img { max-width: 100%; display: block; }

a { color: inherit; }

button, input, select { font: inherit; color: inherit; }

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 520;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0;
  font-variation-settings: 'SOFT' 50;
}

:focus-visible { outline: 3px solid color-mix(in srgb, var(--terracotta) 70%, white); outline-offset: 2px; border-radius: 8px; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--ink); color: var(--paper); padding: 8px 14px; border-radius: 10px;
}
.skip-link:focus { top: 10px; }

.muted { color: var(--muted); }

/* ---------- The house, behind everything ---------- */

.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

.backdrop__house {
  position: absolute;
  inset: 0;
  background: url('../images/house.jpg') center 58% / cover no-repeat;
  filter: saturate(0.92);
}

.backdrop__veil {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgb(var(--paper-rgb) / 0.96) 0%, rgb(var(--paper-rgb) / 0.82) 34%, rgb(var(--paper-rgb) / 0.86) 100%);
  opacity: 1;
  transition: opacity 0.25s linear;
}

body[data-route='tree'] .backdrop__veil {
  background: linear-gradient(180deg, rgb(var(--paper-rgb) / 0.95) 0%, rgb(var(--paper-rgb) / 0.8) 100%);
}

@media (max-width: 720px) {
  .backdrop__house {
    top: auto;
    height: 62vh;
    background-position: 42% center;
  }
  .backdrop__house::before {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 40%;
    background: linear-gradient(180deg, var(--paper), transparent);
  }
}

/* ---------- Woven strip (pagne tissé) ---------- */

.weave {
  height: 6px;
  background:
    repeating-linear-gradient(90deg,
      var(--terracotta) 0 22px,
      var(--paper) 22px 25px,
      var(--ochre) 25px 31px,
      var(--paper) 31px 34px,
      var(--indigo) 34px 52px,
      var(--paper) 52px 55px,
      var(--sage) 55px 61px,
      var(--paper) 61px 64px,
      var(--salmon) 64px 78px,
      var(--paper) 78px 81px);
  opacity: 0.9;
}

.weave--thin { height: 4px; }

.weave--section {
  height: 8px;
  width: min(220px, 50%);
  margin: 8px auto 0;
  border-radius: 4px;
  mask: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent);
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgb(var(--paper-rgb) / 0.86);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
}

.site-header__inner {
  height: var(--header-h);
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}

.brand__mark { width: 38px; height: 38px; }

.brand__text { display: flex; flex-direction: column; line-height: 1; }

.brand__name {
  font-family: var(--serif);
  font-size: 1.6rem;
  font-weight: 560;
  letter-spacing: -0.02em;
  color: var(--terracotta-deep);
}

.brand__sub {
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 3px;
}

.site-nav { display: flex; gap: 4px; }

.site-nav a {
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 999px;
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 0.95rem;
  transition: background 0.15s, color 0.15s;
}

.site-nav a:hover { background: var(--sand); color: var(--ink); }

.site-nav a.is-active { background: var(--ink); color: var(--paper); }

.site-header__tools { margin-left: auto; display: flex; align-items: center; gap: 12px; }

.search-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 10px 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--muted);
  cursor: pointer;
  min-width: 200px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search-trigger:hover { border-color: var(--line-strong); box-shadow: var(--shadow-sm); }

.search-trigger kbd {
  margin-left: auto;
  font: 600 0.75rem var(--sans);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 7px;
  color: var(--muted);
}

.lang-switch {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
  background: var(--card);
}

.lang-switch button {
  border: 0;
  background: none;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--muted);
  cursor: pointer;
}

.lang-switch button[aria-pressed='true'] { background: var(--terracotta); color: white; }

/* Mobile tab bar */
.tabbar { display: none; }

@media (max-width: 960px) {
  .site-nav { display: none; }
  .search-trigger { min-width: 0; }
}

@media (max-width: 720px) {
  :root { --header-h: 58px; }
  .site-header__inner { padding: 0 16px; gap: 12px; }
  .brand__mark { width: 32px; height: 32px; }
  .brand__name { font-size: 1.35rem; }
  .search-trigger { display: none; }

  .tabbar {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 40;
    background: rgb(var(--paper-rgb) / 0.94);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .tabbar a, .tabbar button {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    border: 0;
    background: none;
    text-decoration: none;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--muted);
    padding: 4px 0;
    cursor: pointer;
  }
  .tabbar svg { width: 24px; height: 24px; }
  .tabbar .is-active { color: var(--terracotta-deep); }
  body { padding-bottom: calc(66px + env(safe-area-inset-bottom)); }
}

/* ---------- Common blocks ---------- */

.page:focus { outline: none; }

.sheet {
  position: relative;
  max-width: 1180px;
  margin: 28px auto 40px;
  padding: 12px 48px 48px;
  background: rgb(var(--paper-rgb) / 0.93);
  border-radius: 32px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.sheet--narrow { max-width: 960px; }

@media (max-width: 720px) {
  .sheet { margin: 12px 10px 24px; padding: 4px 18px 32px; border-radius: 24px; }
}

.section { padding: 40px 0 8px; }

.section-head { max-width: 640px; margin-bottom: 26px; }

.section-head h1 { font-size: clamp(2rem, 4vw, 2.8rem); }

.section-head h2 { font-size: clamp(1.6rem, 3vw, 2.15rem); }

.section-head__text { margin: 10px 0 0; color: var(--ink-soft); }

.section-head--page { padding-top: 8px; }

.eyebrow {
  margin: 0 0 8px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--terracotta);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 46px;
  padding: 0 22px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--card);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.97rem;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}

.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }

.btn--primary { background: var(--terracotta); border-color: var(--terracotta); color: white; }

.btn--primary:hover { background: var(--terracotta-deep); }

.btn--ghost { background: rgb(255 255 255 / 0.6); }

.btn--small { height: 34px; padding: 0 14px; font-size: 0.85rem; }

/* Names: given name, then the family name in small capitals. */
.name__surname {
  font-variant: small-caps;
  letter-spacing: 0.03em;
}

.name--unknown { font-style: italic; color: var(--ink-soft); }

.nickname { font-style: italic; color: var(--muted); font-weight: 400; }

/* ---------- Avatars ---------- */

.avatar {
  --size: 52px;
  flex-shrink: 0;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  overflow: hidden;
  background: var(--sand);
  box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--branch, var(--terracotta));
  display: inline-grid;
  place-items: center;
}

.avatar img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 28%; }

.avatar--sm { --size: 38px; box-shadow: 0 0 0 2px var(--card), 0 0 0 3.5px var(--branch, var(--terracotta)); }
.avatar--md { --size: 52px; }
.avatar--lg { --size: 72px; }
.avatar--xl { --size: 96px; }
.avatar--xxl { --size: 140px; box-shadow: 0 0 0 4px var(--card), 0 0 0 7px var(--branch, var(--terracotta)); }

.avatar--empty {
  background:
    radial-gradient(circle at 30% 25%, rgb(255 255 255 / 0.55), transparent 60%),
    color-mix(in srgb, var(--branch, var(--terracotta)) 18%, var(--paper));
}

.avatar__silhouette { width: 62%; height: 62%; margin-top: 12%; fill: color-mix(in srgb, var(--branch, var(--terracotta)) 40%, var(--paper)); }

.profile__photo--empty .avatar { --size: 100%; width: 100%; height: 100%; border-radius: 0; box-shadow: none; background: transparent; }

.profile__photo--empty .avatar span { font-size: 4.5rem; }

.avatar--empty span {
  font-family: var(--serif);
  font-weight: 560;
  color: color-mix(in srgb, var(--branch, var(--terracotta)) 80%, black);
  font-size: calc(var(--size) * 0.36);
  letter-spacing: 0.02em;
}

/* ---------- Person card ---------- */

.pcard {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px 12px 14px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: inset 4px 0 0 var(--branch, var(--terracotta)), var(--shadow-sm);
  text-decoration: none;
  min-width: 0;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}

.pcard:hover { transform: translateY(-2px); box-shadow: inset 4px 0 0 var(--branch), var(--shadow); border-color: var(--line-strong); }

.pcard__text { display: flex; flex-direction: column; min-width: 0; }

.pcard__name { font-family: var(--serif); font-size: 1.05rem; font-weight: 520; line-height: 1.25; }

.pcard__years { font-size: 0.85rem; color: var(--muted); font-variant-numeric: tabular-nums; }

.pcard__desc { font-size: 0.82rem; color: var(--ink-soft); line-height: 1.35; margin-top: 2px; }

.pcard--married {
  background: rgb(255 253 249 / 0.7);
  border-style: dashed;
  box-shadow: var(--shadow-sm);
}

.pcard--married:hover { box-shadow: var(--shadow); }

.pcard--self { border-color: var(--branch); box-shadow: 0 0 0 3px color-mix(in srgb, var(--branch) 25%, transparent), var(--shadow); }

/* ---------- Home: hero ---------- */

.hero {
  position: relative;
  min-height: calc(100svh - var(--header-h) - 6px);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(36px, 8vh, 90px) 20px 28px;
  text-align: center;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0 0 auto;
  height: 78%;
  background: radial-gradient(ellipse 62% 70% at 50% 18%, rgb(var(--paper-rgb) / 0.94) 0%, rgb(var(--paper-rgb) / 0.8) 45%, rgb(var(--paper-rgb) / 0) 100%);
  pointer-events: none;
}

.hero__inner { position: relative; max-width: 720px; }

.hero__welcome {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  margin: 0 0 6px;
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.25rem;
  color: var(--terracotta-deep);
}

.hero__welcome-tr {
  font-family: var(--sans);
  font-style: normal;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.hero__title {
  font-size: clamp(4.4rem, 13vw, 9rem);
  font-weight: 480;
  letter-spacing: -0.035em;
  line-height: 0.95;
  color: var(--ink);
  font-variation-settings: 'SOFT' 100, 'opsz' 144;
}

.hero__lede {
  margin: 18px auto 26px;
  max-width: 560px;
  font-size: 1.12rem;
  color: var(--ink-soft);
}

.hero__search {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 480px;
  margin: 0 auto 18px;
  padding: 0 18px;
  height: 56px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  color: var(--muted);
}

.hero__search input { flex: 1; border: 0; background: none; outline: none; font-size: 1.02rem; color: var(--ink); min-width: 0; cursor: pointer; }

.hero__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }

.hero__caption {
  position: relative;
  margin: auto 0 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgb(var(--paper-rgb) / 0.9);
  box-shadow: var(--shadow-sm);
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.98rem;
  color: var(--ink-soft);
}

.hero__caption svg { color: var(--terracotta); flex-shrink: 0; }

@media (max-width: 720px) {
  .hero { min-height: calc(100svh - var(--header-h) - 70px); padding-top: 28px; }
  .hero::before { height: 62%; background: linear-gradient(180deg, var(--paper) 55%, rgb(var(--paper-rgb) / 0)); }
  .hero__lede { font-size: 1rem; }
  .hero__caption { font-size: 0.85rem; text-align: left; }
}

/* ---------- Home: roots ---------- */

.roots { text-align: center; }

.roots .section-head { margin-left: auto; margin-right: auto; }

.founders {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
}

.founder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  width: 200px;
}

.founder__name { font-family: var(--serif); font-size: 1.15rem; line-height: 1.25; }

.founder--main .founder__name { font-size: 1.4rem; }

.founder__role { font-size: 0.88rem; color: var(--muted); margin-top: -6px; }

.founder:hover .avatar { transform: scale(1.03); }

.founder .avatar { transition: transform 0.2s; --branch: var(--terracotta); }

.founders__ring svg, .fv-ring svg, .vchart__ring svg, .tlist__spouse svg {
  fill: none;
  stroke: var(--ochre);
  stroke-width: 1.8;
}

.roots__stat {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px 28px;
  margin: 30px 0 0;
  color: var(--ink-soft);
}

.roots__stat strong { font-family: var(--serif); font-size: 1.5rem; font-weight: 560; color: var(--terracotta-deep); margin-right: 4px; }

@media (max-width: 720px) {
  .founder { width: 140px; }
  .founder--main { order: -1; width: 100%; }
  .founders__ring { display: none; }
}

/* ---------- Home: branches ---------- */

.branch-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
}

.branch-grid > .branch-card { flex: 0 1 168px; }

@media (max-width: 720px) {
  .branch-grid > .branch-card { flex-basis: calc(50% - 7px); }
}

.branch-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
  padding: 26px 16px 18px;
  border-radius: 22px;
  background: var(--card);
  border: 1px solid var(--line);
  text-decoration: none;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s, box-shadow 0.18s;
}

.branch-card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto;
  height: 54px;
  background: color-mix(in srgb, var(--branch) 16%, var(--card));
  border-bottom: 3px solid var(--branch);
}

.branch-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }

.branch-card .avatar { position: relative; margin-bottom: 8px; }

.branch-card__num {
  position: absolute;
  top: 10px;
  left: 14px;
  font-family: var(--serif);
  font-size: 0.95rem;
  font-weight: 600;
  color: color-mix(in srgb, var(--branch) 85%, black);
}

.branch-card__name { font-family: var(--serif); font-size: 1.1rem; line-height: 1.25; }

.branch-card__years { font-size: 0.85rem; color: var(--muted); }

.branch-card__mother { font-size: 0.8rem; color: var(--ink-soft); line-height: 1.3; }

.branch-card__count {
  margin-top: 10px;
  padding: 3px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  color: color-mix(in srgb, var(--branch) 80%, black);
  background: color-mix(in srgb, var(--branch) 12%, var(--card));
}

/* ---------- Home: generations ---------- */

.gen-list { display: flex; flex-direction: column; gap: 10px; }

.gen-row {
  display: grid;
  grid-template-columns: 56px minmax(150px, 220px) 1fr 24px;
  align-items: center;
  gap: 16px;
  padding: 12px 18px;
  border-radius: 18px;
  background: var(--card);
  border: 1px solid var(--line);
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s;
}

.gen-row:hover { transform: translateX(4px); box-shadow: var(--shadow-sm); }

.gen-row__num {
  width: 44px; height: 44px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--sand);
  font-family: var(--serif);
  font-weight: 600;
  color: var(--terracotta-deep);
}

.gen-row__label { display: flex; flex-direction: column; line-height: 1.3; }

.gen-row__label strong { font-family: var(--serif); font-weight: 520; font-size: 1.08rem; }

.gen-row__label span { font-size: 0.85rem; color: var(--muted); }

.gen-row__faces { display: flex; padding-left: 8px; overflow: hidden; }

.gen-row__faces .avatar { margin-left: -8px; }

.gen-row__arrow { color: var(--muted); }

@media (max-width: 720px) {
  .gen-row { grid-template-columns: 44px 1fr 20px; padding: 10px 14px; }
  .gen-row__faces { display: none; }
}

/* ---------- Home: newest + house ---------- */

.newest, .people-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.house {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 40px;
  align-items: center;
  padding-top: 56px;
}

.house__photo {
  margin: 0;
  padding: 12px 12px 14px;
  background: white;
  border-radius: 6px;
  box-shadow: var(--shadow-lg);
  transform: rotate(-1.4deg);
}

.house__photo img { border-radius: 2px; aspect-ratio: 2000 / 1032; object-fit: cover; }

.house__text h2 { font-size: 2rem; margin-bottom: 12px; }

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

@media (max-width: 820px) {
  .house { grid-template-columns: 1fr; gap: 28px; }
}

/* ---------- Footer ---------- */

.site-footer { margin-top: 24px; }

body[data-route='tree'] .site-footer { display: none; }

.site-footer__inner {
  background: rgb(var(--paper-rgb) / 0.95);
  text-align: center;
  padding: 34px 20px 40px;
}

.proverb { margin: 0 0 10px; display: flex; flex-direction: column; gap: 2px; }

.proverb__wo { font-family: var(--serif); font-style: italic; font-size: 1.5rem; color: var(--terracotta-deep); }

.proverb__tr { color: var(--ink-soft); }

.site-footer__meta { margin: 0 auto; max-width: 620px; font-size: 0.85rem; color: var(--muted); }

/* ---------- Tree page ---------- */

body[data-route='tree'] { overflow: hidden; padding-bottom: 0; }

.treepage {
  height: calc(100dvh - var(--header-h) - 6px);
  display: flex;
  flex-direction: column;
}

.treepage__bar {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px 20px;
  padding: 14px 24px 12px;
  background: rgb(var(--paper-rgb) / 0.9);
  border-bottom: 1px solid var(--line);
}

.treepage__heading { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 16px; min-width: 0; }

.treepage__title { font-size: 1.5rem; }

.treepage__up { font-size: 0.9rem; font-weight: 600; color: var(--terracotta-deep); text-decoration: none; }

.treepage__up:hover { text-decoration: underline; }

.chips {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px;
  margin: 0 -2px;
}

.chips::-webkit-scrollbar { display: none; }

.chip {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 14px 0 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  font-size: 0.88rem;
  font-weight: 650;
  text-decoration: none;
  color: var(--ink-soft);
  transition: background 0.15s, border-color 0.15s;
}

.chip:hover { border-color: var(--branch); }

.chip__dot { width: 10px; height: 10px; border-radius: 50%; background: var(--branch); }

.chip.is-active { background: var(--branch); border-color: var(--branch); color: white; }

.chip.is-active .chip__dot { background: white; }

.segmented {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: var(--sand);
}

.segmented button {
  border: 0;
  background: none;
  height: 32px;
  padding: 0 16px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--ink-soft);
  cursor: pointer;
}

.segmented button[aria-pressed='true'] { background: var(--card); color: var(--ink); box-shadow: var(--shadow-sm); }

.treepage__stage { position: relative; flex: 1; min-height: 0; }

.treepage__stage--list { overflow-y: auto; padding: 20px 16px 40px; }

/* Chart */

.chart {
  position: absolute;
  inset: 0;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.chart:focus-visible { outline-offset: -4px; }

.chart.is-dragging { cursor: grabbing; }

.chart__world { position: absolute; left: 0; top: 0; transform-origin: 0 0; }

.chart__links { position: absolute; left: 0; top: 0; overflow: visible; }

.chart__links path { fill: none; stroke-linecap: round; stroke-linejoin: round; }

.chart__links .descent { stroke-width: 2.2; opacity: 0.75; }

.chart__links .marriage { stroke: var(--ochre); stroke-width: 2; }

.chart__links .rings circle { fill: var(--paper); stroke: var(--ochre); stroke-width: 1.8; }

.chart__gens { position: absolute; left: 0; top: 0; pointer-events: none; }

.chart__gens span {
  position: absolute;
  left: 14px;
  top: -16px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgb(var(--paper-rgb) / 0.92);
  border: 1px solid var(--line);
  font-family: var(--serif);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--terracotta-deep);
  box-shadow: var(--shadow-sm);
}

.tcard {
  position: absolute;
  display: flex;
  flex-direction: column;
  border-radius: 20px;
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 4px solid var(--branch);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s, transform 0.15s;
}

.tcard:hover { box-shadow: var(--shadow); }

.tcard__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  padding: 16px 10px 20px;
  border: 0;
  background: none;
  cursor: pointer;
  text-align: center;
  border-radius: inherit;
}

.tcard__body .avatar { margin-bottom: 6px; }

.tcard__name {
  font-family: var(--serif);
  font-size: 0.98rem;
  line-height: 1.22;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tcard__name .nickname { display: block; font-size: 0.85rem; }

.tcard__years { font-size: 0.8rem; color: var(--muted); font-variant-numeric: tabular-nums; }

.tcard--spouse {
  background: rgb(255 253 249 / 0.82);
  border: 1.5px dashed var(--line-strong);
  border-top: 1.5px dashed var(--line-strong);
}

.tcard--spouse .tcard__body { padding-top: 14px; }

.tcard--spouse .tcard__name { font-size: 0.9rem; }

.tcard__toggle {
  position: absolute;
  left: 50%;
  bottom: -15px;
  transform: translateX(-50%);
  min-width: 30px;
  height: 30px;
  padding: 0 9px;
  border-radius: 999px;
  border: 2px solid var(--card);
  background: var(--branch);
  color: white;
  font-weight: 800;
  font-size: 0.82rem;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s;
}

.tcard__toggle:hover { transform: translateX(-50%) scale(1.1); }

.tcard__toggle.is-open { background: var(--card); color: var(--branch); border-color: var(--branch); font-size: 1.1rem; line-height: 1; }

.tcard.is-focus, .tcard.is-selected {
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--branch) 35%, transparent), var(--shadow);
}

.tcard.is-focus { animation: focus-pulse 1.6s ease-out 2; }

@keyframes focus-pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--branch) 55%, transparent), var(--shadow); }
  100% { box-shadow: 0 0 0 22px transparent, var(--shadow); }
}

.chart__tools {
  position: absolute;
  right: 18px;
  bottom: 18px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px;
  border-radius: 16px;
  background: rgb(var(--paper-rgb) / 0.95);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.chart__tools button {
  height: 38px;
  min-width: 38px;
  border: 0;
  border-radius: 11px;
  background: none;
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  display: grid;
  place-items: center;
}

.chart__tools button:hover { background: var(--sand); color: var(--ink); }

.chart__tools .chart__textbtn { font-size: 0.85rem; font-weight: 700; padding: 0 12px; }

.chart__sep { width: 1px; height: 24px; background: var(--line); margin: 0 4px; }

.chart__legend {
  position: absolute;
  left: 18px;
  bottom: 18px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 16px;
  max-width: min(560px, calc(100% - 480px));
  padding: 9px 14px;
  border-radius: 14px;
  background: rgb(var(--paper-rgb) / 0.92);
  border: 1px solid var(--line);
  font-size: 0.8rem;
  color: var(--ink-soft);
}

.chart__legend span { display: inline-flex; align-items: center; gap: 6px; }

.chart__help { color: var(--muted); }

.chart__legend.is-quiet .chart__help { display: none; }

.lg { display: inline-block; width: 18px; height: 14px; border-radius: 5px; background: var(--card); }

.lg--blood { border: 1px solid var(--line-strong); border-top: 3px solid var(--terracotta); }

.lg--married { border: 1.5px dashed var(--line-strong); }

@media (max-width: 960px) {
  .chart__legend { display: none; }
}

@media (max-width: 720px) {
  body[data-route='tree'] { overflow: auto; }
  .treepage { height: calc(100dvh - var(--header-h) - 6px - 66px - env(safe-area-inset-bottom)); }
  .treepage__bar { padding: 10px 14px; }
  .treepage__title { font-size: 1.2rem; }
  .chart__tools { right: 10px; bottom: 10px; }
  .chart__tools .chart__textbtn, .chart__sep { display: none; }
}

/* List view */

.tlist-wrap {
  max-width: 820px;
  margin: 0 auto;
  padding: 18px;
  border-radius: 24px;
  background: rgb(var(--paper-rgb) / 0.94);
  box-shadow: var(--shadow);
}

.tlist, .tlist__children { list-style: none; margin: 0; padding: 0; }

.tlist__children { margin-left: 22px; padding-left: 16px; border-left: 2px solid color-mix(in srgb, var(--branch, var(--line)) 40%, var(--line)); }

.tlist__item { margin: 6px 0; }

.tlist details > summary { list-style: none; cursor: pointer; position: relative; display: flex; align-items: center; gap: 8px; }

.tlist details > summary::-webkit-details-marker { display: none; }

.tlist__row {
  flex: 1;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 14px;
  padding: 8px 12px;
  border-radius: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: inset 4px 0 0 var(--branch);
  min-width: 0;
}

.tlist__row.is-focus { box-shadow: inset 4px 0 0 var(--branch), 0 0 0 3px color-mix(in srgb, var(--branch) 30%, transparent); }

.tlist__person { display: flex; align-items: center; gap: 12px; text-decoration: none; min-width: 0; }

.tlist__text { display: flex; flex-direction: column; min-width: 0; }

.tlist__name { font-family: var(--serif); font-size: 1rem; line-height: 1.25; }

.tlist__meta { font-size: 0.8rem; color: var(--muted); }

.tlist__spouses { display: flex; flex-wrap: wrap; gap: 4px 12px; }

.tlist__spouse { display: inline-flex; align-items: center; gap: 4px; font-size: 0.85rem; color: var(--ink-soft); text-decoration: none; }

.tlist__spouse:hover { color: var(--ink); text-decoration: underline; }

.tlist__count {
  flex-shrink: 0;
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--sand);
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--ink-soft);
  transition: background 0.15s;
}

.tlist details[open] > summary .tlist__count { background: var(--ink); color: var(--paper); }

.tlist__with {
  margin: 12px 0 4px 40px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.tlist__item--leaf .tlist__row { margin-right: 40px; }

.tlist__note { text-align: center; color: var(--muted); font-size: 0.85rem; margin: 16px 0 0; }

/* ---------- Drawer ---------- */

.drawer {
  position: fixed;
  z-index: 35;
  top: calc(var(--header-h) + 6px);
  right: 0;
  bottom: 0;
  width: min(400px, 100%);
  overflow-y: auto;
  background: var(--paper);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  padding: 26px 24px 30px;
  transform: translateX(105%);
  transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.drawer.is-open { transform: none; }

.drawer__close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: var(--sand);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.drawer__head { display: flex; align-items: center; gap: 18px; margin-bottom: 14px; padding-right: 30px; }

.drawer__name { font-size: 1.4rem; }

.drawer__rel { margin: 4px 0 0; font-size: 0.9rem; color: var(--terracotta-deep); font-weight: 600; }

.drawer__desc { margin: 2px 0 0; font-size: 0.88rem; color: var(--ink-soft); }

.drawer__sub {
  margin: 20px 0 8px;
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.drawer__list { display: grid; gap: 8px; }

.drawer__list .pcard { padding: 8px 12px; }

.drawer__list .pcard__name { font-size: 0.95rem; }

.drawer__actions { display: grid; gap: 8px; margin-top: 24px; }

@media (max-width: 720px) {
  .drawer {
    top: auto;
    left: 0;
    width: 100%;
    max-height: 78vh;
    border-radius: 24px 24px 0 0;
    border-left: 0;
    padding-bottom: calc(30px + 66px + env(safe-area-inset-bottom));
    transform: translateY(105%);
  }
}

/* ---------- Profile ---------- */

.lineage {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  padding: 24px 0 0;
  font-size: 0.88rem;
  color: var(--muted);
}

.lineage a { color: var(--ink-soft); text-decoration: none; font-weight: 600; }

.lineage a:hover { color: var(--terracotta-deep); text-decoration: underline; }

.lineage__current { color: var(--terracotta-deep); font-weight: 700; }

.profile {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 40px;
  align-items: start;
  padding: 28px 0 10px;
}

.profile__photo {
  padding: 0;
  border: 0;
  background: var(--sand);
  border-radius: 26px;
  overflow: hidden;
  box-shadow: 0 0 0 6px var(--card), 0 0 0 9px var(--branch), var(--shadow-lg);
  cursor: zoom-in;
  aspect-ratio: 4 / 5;
  margin: 9px;
}

.profile__photo img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 25%; }

.profile__photo--empty {
  display: grid;
  place-items: center;
  cursor: default;
  background: color-mix(in srgb, var(--branch) 12%, var(--paper));
}

.profile__tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--sand);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink-soft);
  text-decoration: none;
}

.tag--branch { background: color-mix(in srgb, var(--branch) 14%, var(--card)); color: color-mix(in srgb, var(--branch) 75%, black); }

.tag--branch i { width: 9px; height: 9px; border-radius: 50%; background: var(--branch); }

.tag--married { background: var(--card); border: 1px dashed var(--line-strong); }

.profile__name { font-size: clamp(2rem, 4.4vw, 3rem); font-weight: 500; }

.profile__name .nickname { display: block; font-size: 0.55em; margin-top: 6px; }

.profile__rel { margin: 10px 0 0; font-size: 1.05rem; color: var(--terracotta-deep); font-weight: 600; }

.profile__note { margin: 10px 0 0; color: var(--ink-soft); font-style: italic; }

.profile__facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin: 22px 0 0;
}

.profile__facts > div { padding: 12px 16px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); }

.profile__facts dt { font-size: 0.72rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }

.profile__facts dd { margin: 2px 0 0; font-family: var(--serif); font-size: 1.08rem; }

.profile__prayer { margin: 18px 0 0; font-family: var(--serif); font-style: italic; color: var(--ink-soft); }

.profile__actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }

@media (max-width: 760px) {
  .profile { grid-template-columns: 1fr; gap: 20px; justify-items: center; text-align: center; }
  .profile__photo { width: min(240px, 70vw); }
  .profile__tags, .profile__actions { justify-content: center; }
  .profile__facts { text-align: left; }
}

/* Family view: parents above, the person and spouses, children below */

.family-view {
  margin: 30px 0 10px;
  padding: 30px 24px;
  border-radius: 28px;
  background:
    radial-gradient(circle at 50% 0%, color-mix(in srgb, var(--branch) 8%, transparent), transparent 60%),
    rgb(255 255 255 / 0.45);
  border: 1px solid var(--line);
}

.fv-row { display: flex; flex-direction: column; align-items: center; gap: 12px; }

.fv-label, .fam-group__title {
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.fv-people { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; }

.fv-people .pcard { min-width: 220px; }

.fv-stem { width: 2px; height: 30px; margin: 8px auto; background: var(--branch); opacity: 0.5; border-radius: 2px; }

.fv-ring { display: inline-flex; }

.fv-row--children { width: 100%; gap: 22px; }

.fv-row--children .fam-group { width: 100%; }

.fv-row--children .fam-group__title { text-align: center; }

.fv-empty { text-align: center; margin: 0; }

.fam-group { margin: 0 0 22px; }

.fam-group__title { margin-bottom: 10px; }

.fam-group__note { text-transform: none; letter-spacing: 0; font-weight: 600; font-size: 0.85rem; color: var(--ink-soft); }

.fam-group__people { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }

.relatives { margin-top: 28px; }

.fam-more { margin-top: 8px; }

.fam-more summary {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--line);
  font-weight: 700;
  font-size: 0.92rem;
  margin-bottom: 14px;
}

.fam-more .count { padding: 0 8px; border-radius: 999px; background: var(--sand); font-size: 0.8rem; }

.source { font-size: 0.82rem; margin-top: 28px; }

@media (max-width: 720px) {
  .fam-group__people, .people-grid, .newest { grid-template-columns: 1fr 1fr; gap: 8px; }
  .fam-group__people .pcard, .people-grid .pcard, .newest .pcard {
    flex-direction: column;
    text-align: center;
    gap: 8px;
    padding: 14px 8px 12px;
    box-shadow: inset 0 3px 0 var(--branch), var(--shadow-sm);
  }
  .fam-group__people .pcard--married, .people-grid .pcard--married { box-shadow: var(--shadow-sm); }
  .fam-group__people .pcard__name, .people-grid .pcard__name, .newest .pcard__name { font-size: 0.95rem; }
  .people-grid .avatar--lg, .newest .avatar--lg { --size: 60px; }
  .family-view { padding: 22px 12px; }
  .fv-people .pcard { min-width: 0; width: 100%; }
  .fv-ring { display: none; }
}

/* ---------- Everyone ---------- */

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  padding: 16px;
  border-radius: 20px;
  background: var(--card);
  border: 1px solid var(--line);
  margin-bottom: 16px;
}

.field { display: flex; flex-direction: column; gap: 4px; min-width: 150px; }

.field--grow { flex: 1 1 240px; }

.field > span { font-size: 0.72rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }

.field input, .field select {
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  font-size: 0.95rem;
}

.field input:focus, .field select:focus { outline: none; border-color: var(--terracotta); box-shadow: 0 0 0 3px color-mix(in srgb, var(--terracotta) 20%, transparent); }

.check { display: inline-flex; align-items: center; gap: 8px; height: 44px; font-size: 0.92rem; font-weight: 600; cursor: pointer; }

.check input { width: 18px; height: 18px; accent-color: var(--terracotta); }

@media (max-width: 720px) {
  .filters { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 12px; }
  .field { min-width: 0; }
  .field--grow, .check { grid-column: 1 / -1; }
  .field input, .field select { height: 40px; font-size: 16px; }
}

.results-count { margin: 0 0 12px; font-size: 0.88rem; color: var(--muted); font-weight: 600; }

.empty { color: var(--muted); }

/* ---------- Related ---------- */

.pickers {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 16px;
  align-items: start;
}

.picker {
  position: relative;
  padding: 16px;
  border-radius: 20px;
  background: var(--card);
  border: 1px solid var(--line);
  min-height: 132px;
}

.picker__label { display: block; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }

.picker__field { position: relative; }

.picker input {
  width: 100%;
  height: 50px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
  font-size: 1rem;
}

.picker input:focus { outline: none; border-color: var(--terracotta); box-shadow: 0 0 0 3px color-mix(in srgb, var(--terracotta) 20%, transparent); }

.picker__results, .search__results {
  list-style: none;
  margin: 0;
  padding: 6px;
}

.picker__results {
  position: absolute;
  z-index: 5;
  left: 0; right: 0; top: calc(100% + 6px);
  max-height: 340px;
  overflow-y: auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
}

.picker__results li, .search__results a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 12px;
  cursor: pointer;
  text-decoration: none;
}

.picker__results li > span:last-child, .r-text { display: flex; flex-direction: column; min-width: 0; }

.picker__results li.is-active, .picker__results li:hover, .search__results li.is-active a, .search__results a:hover { background: var(--sand); }

.r-name { font-family: var(--serif); font-size: 1rem; line-height: 1.25; }

.r-desc { font-size: 0.8rem; color: var(--muted); line-height: 1.3; }

.picker__chosen { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }

.picker__chosen .pcard { width: 100%; }

.pickers__swap {
  align-self: center;
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--card);
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--ink-soft);
}

.pickers__swap:disabled { opacity: 0.4; cursor: default; }

.relation {
  margin-top: 26px;
  padding: 30px 26px;
  border-radius: 26px;
  background: rgb(255 255 255 / 0.5);
  border: 1px solid var(--line);
  text-align: center;
}

.relation--empty { color: var(--ink-soft); }

.relation__sentence {
  margin: 0 auto;
  max-width: 640px;
  font-family: var(--serif);
  font-size: clamp(1.35rem, 3vw, 1.9rem);
  line-height: 1.3;
  color: var(--ink);
}

.relation__path-title {
  margin: 30px 0 16px;
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.examples { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; margin: 14px 0 0; font-size: 0.9rem; }

.examples a {
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--line);
  text-decoration: none;
  font-weight: 600;
}

.examples a:hover { border-color: var(--terracotta); }

.mini {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px 6px 6px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--line);
  text-decoration: none;
  max-width: 100%;
  position: relative;
  z-index: 1;
}

.mini:hover { border-color: var(--branch); }

.mini__name { font-family: var(--serif); font-size: 0.95rem; line-height: 1.2; text-align: left; }

.mini--end { border-color: var(--branch); box-shadow: 0 0 0 3px color-mix(in srgb, var(--branch) 22%, transparent); }

/* Relationship chart: shared ancestors on top, two lines of descent */
.vchart { display: flex; flex-direction: column; align-items: stretch; gap: 0; }

.vchart__label { margin: 0 0 8px; font-size: 0.8rem; color: var(--muted); font-weight: 700; }

.vchart__apex { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 6px; position: relative; padding-bottom: 26px; }

.vchart__apex::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 25%;
  right: 25%;
  height: 14px;
  border: 2px solid var(--line-strong);
  border-bottom: 0;
  border-radius: 12px 12px 0 0;
}

.vchart__apex::before {
  content: '';
  position: absolute;
  bottom: 14px;
  left: 50%;
  height: 12px;
  border-left: 2px solid var(--line-strong);
}

.vchart--line .vchart__apex::after { display: none; }

.vchart--line .vchart__apex::before { bottom: 0; height: 26px; }

.vchart__row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.vchart--line .vchart__row { grid-template-columns: 1fr; }

.vchart--line .vchart__empty { display: none; }

.vchart__cell { position: relative; display: flex; flex-direction: column; align-items: center; padding-bottom: 22px; }

.vchart__cell::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 0;
  height: 22px;
  border-left: 2px solid var(--line-strong);
}

.vchart__row:last-of-type .vchart__cell::after,
.vchart__row:has(+ .vchart__row--spouse) .vchart__cell::after { display: none; }

.vchart__row--spouse .vchart__cell { padding-top: 0; flex-direction: column; }

.vchart__ring { display: inline-flex; margin: 4px 0; }

.vchart__row--spouse .vchart__cell::after { display: none; }

.chain { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; }

.chain__step { font-size: 0.8rem; color: var(--muted); font-style: italic; }

@media (max-width: 720px) {
  .pickers { grid-template-columns: 1fr; }
  .pickers__swap { justify-self: center; transform: rotate(90deg); }
  .relation { padding: 22px 12px; }
  .vchart__row { gap: 8px; }
  .mini { padding-right: 10px; }
  .mini__name { font-size: 0.85rem; }
}

/* ---------- Search overlay ---------- */

.search { position: fixed; inset: 0; z-index: 60; }

.search__scrim { position: absolute; inset: 0; background: rgb(45 36 31 / 0.35); backdrop-filter: blur(3px); }

.search__panel {
  position: relative;
  width: min(620px, calc(100% - 24px));
  margin: 10vh auto 0;
  background: var(--paper);
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.search__field {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px 0 20px;
  height: 64px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}

.search__field input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font-size: 1.1rem; color: var(--ink); }

.search__close {
  border: 0;
  background: var(--sand);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}

.search__results { max-height: min(60vh, 520px); overflow-y: auto; }

.search__results .r-branch { margin-left: auto; width: 10px; height: 10px; border-radius: 50%; background: var(--branch); flex-shrink: 0; }

.search__hint { padding: 16px 14px; color: var(--muted); font-size: 0.92rem; }

@media (max-width: 720px) {
  .search__panel { margin-top: 12px; }
}

/* ---------- Lightbox ---------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgb(30 22 18 / 0.86);
  cursor: zoom-out;
  animation: fade 0.2s ease-out;
}

.lightbox img { max-height: 90vh; max-width: 92vw; border-radius: 12px; box-shadow: var(--shadow-lg); }

.lightbox button {
  position: absolute;
  top: 16px;
  right: 18px;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: rgb(255 255 255 / 0.15);
  color: white;
  font-size: 1.6rem;
  cursor: pointer;
}

@keyframes fade { from { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
