/* Public pages: home (placeholder), members directory, CV, sign-in, invite, setup */

.site { min-height: 100dvh; display: flex; flex-direction: column; }
.site-head {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 12px;
  padding: calc(10px + var(--safe-top)) max(18px, var(--safe-right)) 10px max(18px, var(--safe-left));
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; letter-spacing: -.02em; }
.brand-mark { width: 30px; height: 30px; flex: none; }
.site-nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
/* the header holds logo, languages, theme and a button: the logo never shrinks, and on phones the rest tightens */
.site-head { flex-wrap: wrap; }
.brand { flex: none; }
.when-narrow { display: none; }
@media (max-width: 480px) {
  .site-head { gap: 8px; padding-left: max(12px, var(--safe-left)); padding-right: max(12px, var(--safe-right)); }
  .site-head .brand-logo { height: 26px; }
  .site-nav { gap: 4px; }
  .lang-switch a { min-width: 30px; }
  .when-wide { display: none; }
  .when-narrow { display: inline; }
}
.site-nav a.nav-link { display: inline-flex; align-items: center; min-height: 40px; padding: 0 12px; border-radius: 9px; color: var(--ink-2); font-weight: 600; text-decoration: none; font-size: var(--fs-sm); }
.site-nav a.nav-link:hover, .site-nav a.nav-link[aria-current="page"] { color: var(--ink); background: var(--surface-2); }
.lang-switch { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--surface-2); }
.lang-switch a { min-width: 38px; min-height: 34px; display: grid; place-items: center; border-radius: 8px; font-size: var(--fs-xs); font-weight: 700; color: var(--ink-2); text-decoration: none; letter-spacing: .04em; }
.lang-switch a[aria-current="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.site-main { flex: 1; width: 100%; max-width: 1080px; margin: 0 auto; padding: 28px max(18px, var(--safe-left)) 56px; }
.site-foot { padding: 24px 18px calc(24px + var(--safe-bottom)); text-align: center; color: var(--ink-3); font-size: var(--fs-xs); }
@media (max-width: 560px) { .site-nav a.hide-sm { display: none; } }
@media (min-width: 481px) and (max-width: 560px) { .site-nav { gap: 6px; } }


/* Home placeholder */
.hero { position: relative; display: grid; gap: 22px; padding: 7vh 0 4vh; }
.hero h1 { font-family: var(--font-display); font-weight: 600; font-size: clamp(2.4rem, 9vw, 4.6rem); letter-spacing: -.04em; line-height: 1; }
.hero p { font-size: var(--fs-lg); color: var(--ink-2); max-width: 36ch; margin: 0; }
.hero .row-wrap { gap: 12px; }

/* Members directory */
.page-head { display: grid; gap: 8px; margin-bottom: 26px; }
.page-head h1 { font-family: var(--font-display); font-weight: 600; font-size: clamp(1.8rem, 6vw, 2.6rem); letter-spacing: -.03em; }
.page-head p { color: var(--ink-2); margin: 0; max-width: 60ch; }
.member-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.member-card { display: flex; flex-direction: column; gap: 14px; padding: 20px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: inherit; transition: border-color .15s, transform .15s var(--ease); }
.member-card:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.member-card h2 { font-size: var(--fs-lg); font-weight: 700; }
.member-card .headline { color: var(--ink-2); font-size: var(--fs-sm); margin: 2px 0 0; }
.contact-list { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; font-size: var(--fs-sm); }
.contact-list li { display: flex; align-items: center; gap: 10px; min-width: 0; }
.contact-list svg { width: 18px; height: 18px; color: var(--ink-3); flex: none; }
.contact-list a { color: var(--ink); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contact-list a:hover { color: var(--accent); text-decoration: underline; }

/* CV */
.cv { display: grid; gap: 28px; max-width: 760px; margin: 0 auto; }
.cv-head { display: flex; gap: 20px; align-items: center; }
.cv-head h1 { font-family: var(--font-display); font-weight: 600; font-size: clamp(1.7rem, 6vw, 2.4rem); letter-spacing: -.03em; }
.cv-head .headline { font-size: var(--fs-lg); color: var(--ink-2); margin: 6px 0 0; }
.cv-section h2 { font-size: var(--fs-xs); font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 12px; }
.cv-bio { white-space: pre-line; font-size: var(--fs-md); }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.timeline li { position: relative; display: grid; grid-template-columns: 96px 1fr; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line); }
.timeline li:first-child { border-top: 0; padding-top: 0; }
.timeline .years { font-variant-numeric: tabular-nums; color: var(--ink-2); font-size: var(--fs-sm); font-weight: 600; padding-top: 2px; }
.timeline h3 { font-size: var(--fs-md); font-weight: 700; }
.timeline .org { color: var(--ink-2); font-size: var(--fs-sm); }
.timeline p { margin: 6px 0 0; font-size: var(--fs-sm); white-space: pre-line; }
@media (max-width: 520px) { .timeline li { grid-template-columns: 1fr; gap: 4px; } .cv-head { flex-direction: column; align-items: flex-start; } }

/* Auth pages */
.auth { display: grid; place-items: center; min-height: calc(100dvh - 160px); }
.auth-card { width: 100%; max-width: 420px; display: grid; gap: 18px; padding: 30px 24px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1); }
.auth-card h1 { font-family: var(--font-display); font-weight: 600; font-size: var(--fs-xl); letter-spacing: -.03em; }
.auth-card p { color: var(--ink-2); margin: 0; }
.auth-mark { width: 52px; height: 52px; }
.auth-status { min-height: 1.5em; font-size: var(--fs-sm); color: var(--ink-2); }
.auth-status.is-error { color: var(--danger); }
.auth-foot { font-size: var(--fs-xs); color: var(--ink-3); }
.passkey-steps { margin: 0; padding-left: 20px; color: var(--ink-2); font-size: var(--fs-sm); display: grid; gap: 4px; }

/* ── Family tree (main page) ─────────────────────────── */
.tree-hero { display: grid; gap: 10px; padding: 6px 0 18px; }
.tree-hero h1 { font-family: var(--font-display); font-weight: 600; font-size: clamp(1.9rem, 7.5vw, 3.1rem); letter-spacing: -.04em; line-height: 1.05; }
.tree-intro { margin: 0; max-width: 62ch; color: var(--ink-2); font-size: var(--fs-lg); }
.tree-shell { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); overflow: hidden; }
.tree-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px; border-bottom: 1px solid var(--line); }
.tree-search { position: relative; flex: 1 1 220px; }
.tree-search .input { min-height: 42px; border-radius: var(--r-pill); }
.tree-results { position: absolute; z-index: 5; top: calc(100% + 6px); left: 0; right: 0; max-height: 320px; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-2); }
.tree-results button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 12px; border: 0; background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.tree-results button:hover, .tree-results button:focus-visible { background: var(--surface-2); }
.tree-results .tc-photo { width: 34px; height: 34px; margin: 0; font-size: 13px; }
.tree-results small { margin-left: auto; color: var(--ink-3); }
.tree-noresults { padding: 12px 14px; color: var(--ink-3); }
.tree-zoom { display: flex; gap: 6px; }
.tree-zoom .btn-icon { font-size: 20px; }
.tree-viewport { height: min(72dvh, 760px); overflow: auto; overscroll-behavior: contain; cursor: grab;
  background-color: var(--bg); background-image: radial-gradient(var(--line) 1px, transparent 1.2px); background-size: 22px 22px; }
.tree-viewport.is-panning { cursor: grabbing; user-select: none; }
.tree-canvas { display: inline-block; min-width: 100%; padding: 32px 48px 56px; }
.tree-canvas ul { display: flex; justify-content: center; position: relative; margin: 0; padding: 26px 0 0; list-style: none; }
.tree-canvas > ul { padding-top: 0; gap: 64px; align-items: flex-start; }
.tree-canvas li { position: relative; display: flex; flex-direction: column; align-items: center; padding: 26px 8px 0; }
.tree-canvas > ul > li { padding-top: 0; }
.tree-canvas li::before, .tree-canvas li::after { content: ""; position: absolute; top: 0; right: 50%; width: 50%; height: 26px; border-top: 2px solid var(--line-strong); }
.tree-canvas li::after { right: auto; left: 50%; border-left: 2px solid var(--line-strong); }
.tree-canvas li:only-child::before, .tree-canvas li:only-child::after, .tree-canvas > ul > li::before, .tree-canvas > ul > li::after { display: none; }
.tree-canvas li:only-child { padding-top: 0; }
.tree-canvas li:first-child::before, .tree-canvas li:last-child::after { border: 0 none; }
.tree-canvas li:last-child::before { border-right: 2px solid var(--line-strong); border-radius: 0 10px 0 0; }
.tree-canvas li:first-child::after { border-radius: 10px 0 0 0; }
.tree-canvas ul ul::before { content: ""; position: absolute; top: 0; left: 50%; height: 26px; border-left: 2px solid var(--line-strong); }
.tree-family { position: relative; z-index: 1; display: inline-flex; align-items: center; }
.tree-link { width: 16px; height: 3px; flex: none; background: var(--sun); border-radius: 2px; }
.tree-link.k-partner { background: color-mix(in srgb, var(--sun) 55%, transparent); }
.tree-link.k-divorced { background: repeating-linear-gradient(90deg, var(--ink-3) 0 4px, transparent 4px 7px); }
.tree-card { width: 116px; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 12px 8px 10px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); color: var(--ink); font: inherit; text-align: center; cursor: pointer; transition: border-color .15s, transform .15s var(--ease), box-shadow .3s; }
.tree-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.tree-card.is-root { border-color: var(--accent); }
.tree-card.is-flash { box-shadow: 0 0 0 4px var(--sun); }
.tree-card.is-private { opacity: .6; cursor: default; }
.tc-photo { width: 58px; height: 58px; margin-bottom: 6px; border-radius: 50%; display: grid; place-items: center; object-fit: cover; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 18px; flex: none; }
.g-f .tc-photo:not(img) { background: hsl(338 62% 92%); color: hsl(338 45% 34%); }
.g-m .tc-photo:not(img) { background: hsl(212 62% 91%); color: hsl(212 50% 32%); }
:root[data-theme="dark"] .g-f .tc-photo:not(img) { background: hsl(338 28% 26%); color: hsl(338 70% 86%); }
:root[data-theme="dark"] .g-m .tc-photo:not(img) { background: hsl(212 30% 26%); color: hsl(212 70% 86%); }
.tree-card.is-deceased img.tc-photo { filter: grayscale(.45); }
.tc-name { font-weight: 700; font-size: 14px; line-height: 1.2; overflow-wrap: anywhere; }
.tc-last { font-size: 12.5px; color: var(--ink-2); line-height: 1.2; overflow-wrap: anywhere; }
.tc-years { margin-top: 3px; font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.tree-plain { columns: 2 220px; }
.tree-foot { margin: 18px 2px 0; }
.tree-foot a { font-weight: 600; text-decoration: none; }

.tree-sheet { position: fixed; inset: 0; z-index: 100; }
body.has-sheet { overflow: hidden; }
.ts-backdrop { position: absolute; inset: 0; background: var(--overlay); animation: fade .2s; }
.ts-panel { position: absolute; left: 0; right: 0; bottom: 0; max-height: 86dvh; overflow-y: auto; padding: 22px 20px calc(26px + var(--safe-bottom)); background: var(--surface); border-radius: 24px 24px 0 0; box-shadow: var(--shadow-2); animation: rise .24s var(--ease); }
@media (min-width: 760px) { .ts-panel { left: auto; top: 0; width: 420px; max-height: none; border-radius: 0; animation-name: slide; } }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(40px); opacity: 0; } }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }
.ts-close { position: absolute; top: 12px; right: 12px; width: 42px; height: 42px; border: 0; border-radius: 50%; background: var(--surface-2); color: var(--ink); font-size: 24px; line-height: 1; cursor: pointer; }
.ts-head { display: flex; align-items: center; gap: 16px; margin: 4px 44px 16px 0; }
.ts-head .tc-photo { width: 88px; height: 88px; margin: 0; font-size: 28px; }
.ts-head h2 { font-family: var(--font-display); font-weight: 600; font-size: 1.45rem; letter-spacing: -.03em; line-height: 1.15; }
.ts-nee { color: var(--ink-2); font-size: var(--fs-sm); margin-top: 2px; }
.ts-years { color: var(--ink-3); font-variant-numeric: tabular-nums; margin-top: 2px; }
.ts-facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0 0 14px; font-size: var(--fs-sm); }
.ts-facts dt { color: var(--ink-2); font-weight: 600; }
.ts-facts dd { margin: 0; }
.ts-note { white-space: pre-line; margin: 0 0 14px; }
.ts-profile { margin-bottom: 6px; }
.ts-section h3 { margin: 18px 0 8px; font-size: var(--fs-xs); font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.ts-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.ts-chip { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 4px 14px 4px 4px; border: 1px solid var(--line); border-radius: var(--r-pill); background: var(--bg); color: var(--ink); font: inherit; font-size: var(--fs-sm); cursor: pointer; }
.ts-chip:hover { border-color: var(--accent); }
.ts-chip .tc-photo { width: 32px; height: 32px; margin: 0; font-size: 12px; }
.ts-chip small { color: var(--ink-3); }
.ts-chip.is-private { cursor: default; opacity: .7; }
@media (max-width: 560px) { .site-main:has(.tree-shell) { padding-left: 10px; padding-right: 10px; } .tree-canvas { padding: 24px 24px 48px; } }
.cv-bday { margin: 8px 0 0; color: var(--ink-2); font-weight: 600; }
