/* Kinnected shared styles.
   Light theme: purple and teal palette. Dark theme: red accent on charcoal. */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Playfair+Display:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500&display=swap');

:root {
  /* Brand (Kinnected brand board): Deep Navy, Vibrant Blue, Teal, Purple, Soft Blue.
     The main accent keeps its old name, --purple, so every page picks it up. */
  --navy: #1F3A5F;
  --violet: #8B5CF6;
  --purple: #2563EB;
  --purple-600: #1D4ED8;
  --purple-50: #EAF1FF;
  --teal: #14B8A6;
  --teal-50: #E6F7F5;
  --teal-ink: #0F766E; /* green text on pale-green backgrounds (readable contrast) */
  --amber: #C98A1B;
  --amber-50: #FBF3E2;
  --amber-ink: #8A5A0E; /* amber text on pale-amber backgrounds */
  /* Light theme: --base is the palette colour. The sidebar uses it as is,
     and the page background is a near-white chosen for each palette. */
  --base: #F3F6FF;
  --bg: #F3F6FF;
  --surface: #FFFFFF;
  --blue-grey: #E3E9F2;
  --blue-grey-50: #EEF2F8;
  --text: #1E293B;
  --text-2: #475569;
  --text-3: #5B6B80;
  --border: var(--blue-grey);
  --radius: 12px;
  --radius-sm: 10px;
  --hero-grad: linear-gradient(120deg, #1F3A5F 0%, #2563EB 60%, #14B8A6 140%);
  --brand-grad: linear-gradient(135deg, #2563EB, #8B5CF6);
  /* Soft sidebar: a shade of the page background, so it fits every style palette */
  --side-bg: var(--base);
  --side-border: rgba(31,29,43,.08);
  --side-text: #4F4D63;
  --side-muted: #5D5B72;
  --side-hover: rgba(255,255,255,.55);
  --side-active-bg: var(--surface);
  --side-active-text: var(--purple);
  --side-label: #5D5B72;
  --side-foot-border: #DCE3EC;
  --font-head: 'Playfair Display', Georgia, serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  /* Names used by older pages (notifications, profile, search) */
  --accent: var(--purple);
  --accent-deep: var(--purple-600);
  --accent-mid: var(--purple);
  --accent-soft: var(--purple-50);
  --radius-lg: var(--radius);
  --gray-100: var(--blue-grey-50);
  --font-ui: var(--font-body);
  --font-serif: var(--font-head);
  --gray-200: #D5DAE5;
  --gray-400: #8F8DA3;
  /* Secondary (green) shades used by the sign-in, welcome and landing pages */
  --second: var(--teal);
  --second-deep: var(--teal-ink);
  --second-mid: #5CBB98;
  --second-soft: var(--teal-50);
}

/* Dark theme (set by data-theme="dark" on <html>) */
:root[data-theme="dark"] {
  --purple: #E0503A;
  --purple-600: #C43C24;
  --purple-50: #3A1F1B;
  --teal: #9FB0BE;
  --teal-50: #26313A;
  --amber: #E0A84A;
  --amber-50: #3A2E16;
  --bg: #13171B;
  --surface: #1C2227;
  --blue-grey: #2E373F;
  --blue-grey-50: #232A30;
  --text: #E9EDF0;
  --text-2: #B6C0C8;
  --text-3: #8C98A2;
  --border: #2E373F;
  --hero-grad: linear-gradient(120deg, #2B3238 0%, #3D4B57 60%, #C43C24 150%);
  --brand-grad: linear-gradient(135deg, #C43C24, #7A2A1C);
  --side-bg: #0E1215;
  --side-border: #222A31;
  --side-text: #C9D2D9;
  --side-muted: #8C98A2;
  --side-hover: rgba(255,255,255,.06);
  --side-active-bg: #E0503A;
  --side-active-text: #FFFFFF;
  --side-label: #8C979F;
  --side-foot-border: rgba(255,255,255,.12);
}
/* Dark option: charcoal sidebar with red accents on a light content area, as in the Lineago-style screenshot */
:root[data-theme="dark"] {
  --purple: #2563EB;
  --purple-600: #1D4ED8;
  --purple-50: #EAF1FF;
  --teal: #3D4B57;
  --teal-50: #E7ECF0;
  --amber: #B7791F;
  --amber-50: #FBF3E2;
  --bg: #EEF2F5;
  --surface: #FFFFFF;
  --blue-grey: #D5DDE4;
  --blue-grey-50: #E8EEF3;
  --text: #1E2226;
  --text-2: #4A545D;
  --text-3: #5F6973;
  --border: #D5DDE4;
  --hero-grad: linear-gradient(120deg, #1F3A5F 0%, #2B3238 60%, #2563EB 150%);
  --brand-grad: linear-gradient(135deg, #2563EB, #8B5CF6);
  --side-bg: #1F2A3A;
  --side-border: #3A444C;
  --side-text: #C9D2D9;
  --side-muted: #A7B1B9;
  --side-hover: rgba(255,255,255,.06);
  --side-active-bg: #2563EB;
  --side-active-text: #FFFFFF;
  --side-label: #8C979F;
  --side-foot-border: rgba(255,255,255,.12);
}
:root[data-theme="dark"] .person-card:hover { box-shadow: 0 8px 20px rgba(0,0,0,.4); }
:root[data-theme="dark"] .edge { stroke: #4A565F; }
:root[data-theme="dark"] .tree-wrap,
:root[data-theme="dark"] .date-chip { background: var(--blue-grey-50); }

* { box-sizing: border-box; margin: 0; padding: 0; }
/* Anything marked hidden stays hidden, whatever display its class gives it */
[hidden] { display: none !important; }
body { font-family: var(--font-body); background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.55; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; border: none; background: none; }
h1, h2, h3 { font-family: var(--font-head); font-weight: 700; letter-spacing: -0.01em; color: var(--navy, var(--text)); }
h1 { font-size: 30px; line-height: 1.15; }
h2 { font-size: 22px; }
h3 { font-size: 16px; font-family: var(--font-body); font-weight: 600; }

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.main { padding: 24px 32px 48px; min-width: 0; max-width: 1200px; margin: 0 auto; width: 100%; }
/* Every page's content is 1200px wide at most; the family tree uses the full width */
.main.tree-page { max-width: none; }

/* ---------- Sidebar ---------- */
.sidebar { background: var(--side-bg); border-right: 1px solid var(--side-border); padding: 24px 16px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 24px; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; }
.brand-mark { width: 36px; height: 36px; border-radius: 10px; background: var(--brand-grad); display: grid; place-items: center; color: #fff; font-family: var(--font-head); font-size: 18px; font-weight: 700; }
.brand-name { font-family: var(--font-head); font-size: 20px; font-weight: 700; color: var(--text); }
.brand-sub { font-size: 11px; color: var(--text-3); letter-spacing: .08em; text-transform: uppercase; }
/* The app icon at the top of the menu, linking home */
.brand-icon { padding: 0 8px; }
.brand-icon img { width: 52px; height: 52px; border-radius: 12px; display: block; }
.brand-icon:hover img { box-shadow: 0 0 0 3px var(--purple-50); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 11px; color: var(--side-label); letter-spacing: .08em; text-transform: uppercase; padding: 0 12px; margin: 6px 0 6px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: var(--radius-sm); color: var(--side-text); font-weight: 500; }
.nav a:hover { background: var(--side-hover); color: var(--text); }
.nav a.active { background: var(--side-active-bg); color: var(--side-active-text); }
.nav svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav .count { margin-left: auto; font-size: 12px; font-weight: 600; background: var(--teal-50); color: var(--teal-ink); padding: 1px 8px; border-radius: 999px; }
.nav-storage { display: block; margin: 2px 12px 10px 42px; font-size: 12px; color: var(--side-muted); text-decoration: none; }
.nav a.nav-storage { display: block; padding: 0; border-radius: 0; font-weight: 400; color: var(--side-muted); }
.nav a.nav-storage:hover { background: none; color: var(--side-muted); }
.nav a.nav-storage[hidden], .nav-storage[hidden] { display: none; }
.nav-storage:hover small { color: var(--purple); }
.nav-storage-top { display: flex; justify-content: space-between; margin-bottom: 6px; }
.nav-storage small { display: block; margin-top: 6px; font-size: 11px; color: var(--side-muted); }
.nav-storage .storage-bar { background: var(--side-border); }
.nav-storage .storage-bar span { background: var(--purple); }
.nav-storage.warn { color: #C0392B; }
.nav-storage.warn .storage-bar span { background: #E8453C; }
/* Footer: a thin line, then your name (opens your page) and Sign out, no boxes */
.side-foot-wrap { margin-top: auto; border-top: 1px solid var(--side-border); padding-top: 12px; display: flex; flex-direction: column; gap: 2px; }
.sidebar-foot { padding: 8px 12px; border-radius: var(--radius-sm); display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.sidebar-foot:hover { background: var(--side-hover); }
.side-signout { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: var(--radius-sm); color: var(--side-muted); font-weight: 500; font-size: 14px; text-align: left; }
.side-signout:hover { background: var(--side-hover); color: var(--text); }
.side-signout svg { width: 18px; height: 18px; }
.sidebar-foot .avatar { background: var(--teal-50); color: var(--teal-ink); }
:root:not([data-theme="dark"]) .nav a.active { box-shadow: 0 1px 3px rgba(31,29,43,.08); }
.user-name { font-weight: 600; font-size: 14px; color: var(--text); }
:root[data-theme="dark"] .sidebar .user-name, :root[data-theme="dark"] .sidebar .brand-name { color: #FFFFFF; }
.user-meta { font-size: 12px; color: var(--text-3); }

/* ---------- Top bar ---------- */
.topbar { display: flex; align-items: center; gap: 16px; margin-bottom: 28px; }
/* Page title: the Kinnected logo, with the page name small and in capitals under it */
.page-title { display: flex; flex-direction: column; gap: 4px; flex-shrink: 0; }
.page-logo img { display: block; height: 38px; width: auto; }
.page-title h1 { font-family: var(--font-body); font-size: 11px; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: var(--text-3); line-height: 1.2; margin: 0; padding-left: 2px; }
:root[data-theme="dark"] .page-logo img { filter: brightness(0) invert(1); }
@media (max-width: 700px) { .page-logo img { height: 30px; } }
.crumb { font-size: 12px; color: var(--text-3); margin-bottom: 2px; }
.topbar .meta { font-size: 13px; color: var(--text-3); margin-top: 2px; }
.search { flex: 1; max-width: 480px; display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 10px 16px; color: var(--text-3); }
.search input { border: none; outline: none; background: none; flex: 1; color: var(--text); font-size: 15px; }
.search svg { width: 16px; height: 16px; }
.top-actions { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; background: var(--surface); border: 1px solid var(--border); display: grid; place-items: center; color: var(--text-2); position: relative; }
.icon-btn svg { width: 18px; height: 18px; }
.dot { position: absolute; top: 9px; right: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--teal); border: 2px solid var(--surface); }

/* Light / dark switch in the top bar */
.theme-toggle { display: inline-flex; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 3px; }
.theme-toggle button { padding: 6px 12px; border-radius: 999px; font-size: 12px; font-weight: 600; color: var(--text-3); }
.theme-toggle button.active { background: var(--purple); color: #fff; }

/* ---------- Page hero (photo background, dark overlay) ---------- */
.page-hero { position: relative; background: url('hero.jpg') center 30% / cover no-repeat, var(--hero-grad); color: #fff; border-radius: var(--radius); padding: 56px 32px; text-align: center; margin-bottom: 20px; overflow: hidden; }
/* Lighter shade so the photo shows, a little darker in the middle behind the words */
.page-hero::before { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse at center, rgba(20,24,28,.5) 0%, rgba(20,24,28,.28) 70%, rgba(20,24,28,.18) 100%); }
.page-hero > * { position: relative; }
.page-hero h1 { color: #fff; font-size: 44px; line-height: 1.1; margin: 12px 0 8px; }
.page-hero p { color: rgba(255,255,255,.85); max-width: 560px; margin: 0 auto; font-size: 15px; }
.hero-tag { display: inline-block; background: var(--purple); color: #fff; font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; padding: 6px 12px; border-radius: 2px; }
.hero-search { max-width: 640px; margin: 24px auto 0; display: flex; align-items: center; gap: 12px; background: #fff; border-radius: 999px; padding: 14px 22px; box-shadow: 0 10px 30px rgba(0,0,0,.18); color: var(--text-3); }
.hero-search input { border: none; outline: none; flex: 1; font-size: 15px; color: var(--text); background: none; }
.sort-row { display: flex; gap: 18px; justify-content: center; margin: 16px 0 22px; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); }
.sort-row button { color: var(--text-3); font-weight: 600; }
.sort-row button:hover { color: var(--text); }

/* ---------- Buttons ---------- */
.btn { padding: 10px 18px; border-radius: 999px; font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; gap: 8px; border: 1px solid transparent; }
.btn-primary { background: var(--purple); color: #fff; }
.btn-primary:hover { background: var(--purple-600); }
.btn-ghost { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--purple); color: var(--purple); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.small-link { font-size: 13px; color: var(--purple); font-weight: 600; }

/* ---------- Hero (dashboard) ---------- */
.hero { background: var(--hero-grad); color: #fff; border-radius: 22px; padding: 32px 36px; display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: center; margin-bottom: 24px; position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px; border-radius: 50%; background: rgba(255,255,255,.08); }
.hero h1 { color: #fff; font-size: 34px; margin-bottom: 8px; }
.hero p { opacity: .85; max-width: 520px; }
.hero-actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.hero .btn-ghost { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.3); color: #fff; }
.hero .btn-ghost:hover { background: rgba(255,255,255,.22); color: #fff; border-color: #fff; }
.hero .btn-primary { background: #fff; color: var(--purple); }
.hero .btn-primary:hover { background: var(--purple-50); color: var(--purple-600); }
.hero-stats { display: flex; gap: 12px; position: relative; z-index: 1; }
.stat { background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.2); border-radius: var(--radius); padding: 14px 18px; min-width: 110px; text-align: center; }
.stat strong { display: block; font-family: var(--font-head); font-size: 26px; font-weight: 700; }
.stat span { font-size: 12px; opacity: .85; }

/* ---------- Quick tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 24px; }
.tile { border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; background: var(--surface); transition: transform .15s ease, border-color .15s ease; display: flex; flex-direction: column; gap: 12px; }
.tile:hover { transform: translateY(-2px); border-color: var(--purple); }
.tile-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; }
.tile-icon svg { width: 20px; height: 20px; }
.tile p { font-size: 13px; color: var(--text-3); }
.tone-purple .tile-icon { background: var(--purple-50); color: var(--purple); }
.tone-teal .tile-icon { background: var(--teal-50); color: var(--teal-ink); }
.tone-amber .tile-icon { background: var(--amber-50); color: var(--amber-ink); }
.tone-mix .tile-icon { background: linear-gradient(135deg, var(--purple-50), var(--teal-50)); color: var(--purple); }

/* ---------- Cards and grids ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 12px; }
.card-head .link { color: var(--purple); font-weight: 600; font-size: 13px; }
.card-head .link:hover { text-decoration: underline; }
.card-head .meta { font-size: 12px; color: var(--text-3); }
.stack { display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; }
.section-gap { margin-top: 24px; }

/* ---------- Avatars and tags ---------- */
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; flex-shrink: 0; }
.avatar.purple { background: var(--purple-50); color: var(--purple); }
.avatar.teal { background: var(--teal-50); color: var(--teal-ink); }
.avatar.amber { background: var(--amber-50); color: var(--amber-ink); }
.avatar.lg { width: 56px; height: 56px; font-size: 16px; }
.avatar.xl { width: 72px; height: 72px; font-size: 22px; }
img.avatar { object-fit: cover; }
.tag { font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.tag-birthday { background: var(--amber-50); color: var(--amber-ink); }
.tag-anniv { background: var(--teal-50); color: var(--teal-ink); }
.tag-memorial { background: var(--purple-50); color: var(--purple); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; color: var(--text-2); padding: 7px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); }
.chip:hover { border-color: var(--purple); color: var(--purple); }
.chip.active { background: var(--purple); border-color: var(--purple); color: #fff; }
.chip svg { width: 15px; height: 15px; }
.empty { font-size: 13px; color: var(--text-3); padding: 8px 0; }
.bio { color: var(--text-2); font-size: 14px; }
.footnote { font-size: 12px; color: var(--text-3); text-align: center; margin-top: 28px; }

/* ---------- Dashboard: this week ---------- */
.week-list { display: flex; flex-direction: column; gap: 4px; }
.week-item { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: var(--radius-sm); }
.week-item:hover { background: var(--bg); }
.date-chip { width: 52px; text-align: center; border-radius: 10px; padding: 6px 0; background: var(--blue-grey-50); border: 1px solid var(--border); flex-shrink: 0; }
.date-chip b { display: block; font-size: 18px; line-height: 1; font-family: var(--font-head); }
.date-chip small { font-size: 10px; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; }
.week-info { flex: 1; min-width: 0; }
.week-info strong { display: block; font-weight: 600; }
.week-info span { font-size: 13px; color: var(--text-3); }

/* ---------- Composer and feed ---------- */
.composer { display: flex; gap: 12px; align-items: center; }
.composer input { flex: 1; border: 1px solid var(--border); border-radius: 999px; padding: 11px 18px; outline: none; background: var(--bg); font-size: 15px; }
.composer input:focus { border-color: var(--purple); background: var(--surface); }
.composer-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.post { padding: 20px 0; border-top: 1px solid var(--border); }
.post:first-child { border-top: none; padding-top: 0; }
.post-head { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.post-head strong { display: block; font-weight: 600; }
.post-head span { font-size: 12px; color: var(--text-3); }
.post-body { color: var(--text-2); margin-bottom: 12px; }
.post-photos { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.post-actions { display: flex; gap: 18px; font-size: 13px; color: var(--text-3); }
.post-actions button { color: var(--text-3); font-size: 13px; display: inline-flex; gap: 6px; align-items: center; }
.post-actions button:hover, .post-actions button.liked { color: var(--purple); }
.post-actions svg { width: 16px; height: 16px; }

/* ---------- Photos ---------- */
.photo { border-radius: var(--radius-sm); aspect-ratio: 4/3; background: linear-gradient(135deg, var(--purple-50), var(--teal-50)); display: grid; place-items: center; color: var(--purple); font-size: 12px; font-weight: 600; }
.photo.p2 { background: linear-gradient(135deg, var(--teal-50), #D6EFE5); color: var(--teal-ink); }
.photo.p3 { background: linear-gradient(135deg, var(--amber-50), #F4E2B8); color: var(--amber); }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.photo-ph { aspect-ratio: 1/1; border-radius: var(--radius-sm); background: linear-gradient(135deg, var(--purple-50), var(--teal-50)); display: grid; place-items: center; color: var(--purple); font-size: 12px; font-weight: 600; }
.photo-ph:nth-child(3n+2) { background: linear-gradient(135deg, var(--teal-50), #D6EFE5); color: var(--teal-ink); }
.photo-ph:nth-child(3n) { background: linear-gradient(135deg, var(--amber-50), #F4E2B8); color: var(--amber); }
.vault { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.vault .photo { aspect-ratio: 1/1; font-size: 11px; }

/* ---------- Events (dashboard) ---------- */
.event { display: flex; gap: 14px; padding: 12px; border-radius: var(--radius-sm); border: 1px solid var(--border); margin-bottom: 10px; align-items: center; }
.event:last-child { margin-bottom: 0; }
.event-date { width: 56px; flex-shrink: 0; border-radius: 12px; overflow: hidden; text-align: center; border: 1px solid var(--border); }
.event-date .m { background: var(--purple); color: #fff; font-size: 10px; font-weight: 700; padding: 3px 0; letter-spacing: .08em; }
.event-date .d { font-family: var(--font-head); font-size: 22px; font-weight: 700; padding: 4px 0 6px; }
.event-info { flex: 1; min-width: 0; }
.event-info strong { display: block; font-weight: 600; }
.event-info span { font-size: 12px; color: var(--text-3); display: block; }
.rsvp { font-size: 12px; font-weight: 600; color: var(--purple); border: 1px solid var(--purple); padding: 5px 12px; border-radius: 999px; }
.rsvp:hover { background: var(--purple); color: #fff; }
.rsvp.done { background: var(--teal); border-color: var(--teal); color: #fff; }

/* ---------- Tree preview (dashboard) ---------- */
.tree-wrap { background: var(--blue-grey-50); border-radius: var(--radius-sm); padding: 10px; }
.tree-wrap svg { width: 100%; height: auto; display: block; }
.tree-legend { display: flex; gap: 12px; margin-top: 12px; font-size: 12px; color: var(--text-3); flex-wrap: wrap; }
.tree-legend span::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.lg-p::before, .lg-purple::before { background: var(--purple); }
.lg-t::before, .lg-teal::before { background: var(--teal); }
.lg-a::before, .lg-amber::before { background: var(--amber); }

/* ---------- Members row (dashboard) ---------- */
.members { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 4px; }
.member { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 72px; }
.member .avatar { width: 56px; height: 56px; font-size: 16px; }
.member span { font-size: 12px; color: var(--text-2); font-weight: 600; text-align: center; }

/* ---------- Members directory: photo cards in rows of five ---------- */
.person-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 16px; }
.person-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; position: relative; transition: transform .15s ease, box-shadow .15s ease; }
.person-card:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(30,34,38,.08); }
.person-card .avatar.lg { width: 100%; height: 170px; border-radius: 0; font-size: 42px; font-family: var(--font-head); font-weight: 700; }
.pc-info { padding: 14px 12px 16px; text-align: center; display: flex; flex-direction: column; gap: 2px; }
.pc-info strong { font-weight: 600; font-size: 15px; color: var(--text); }
.pc-info span { font-size: 13px; color: var(--text-3); }
.pc-info small { font-size: 12px; color: var(--text-2); }
.person-card .tag { position: absolute; top: 10px; right: 10px; }
.members-toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

/* ---------- Profile ---------- */
.profile-head { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.profile-head .who { flex: 1; min-width: 200px; }
.profile-head h1 { font-size: 34px; }
.profile-head p { color: var(--text-3); font-size: 14px; margin-top: 2px; }
.profile-head .actions { display: flex; gap: 8px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 18px 0; overflow-x: auto; }
.tab { padding: 12px 16px; font-weight: 600; font-size: 13px; color: var(--text-3); letter-spacing: .04em; text-transform: uppercase; border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--purple); border-bottom-color: var(--purple); }
.panel { display: none; }
.panel.active { display: block; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 14px; }
.facts dt { color: var(--text-3); }
.facts dd { font-weight: 600; }
.facts a { color: var(--purple); }
.link-list { display: flex; flex-direction: column; gap: 8px; }
.link-row { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); }
.link-row:hover { border-color: var(--purple); }
.link-row span { font-size: 12px; color: var(--text-3); margin-left: auto; }

/* ---------- Timeline (vertical with a centre line) ---------- */
.timeline { display: flex; flex-direction: column; gap: 14px; border-left: 2px solid var(--blue-grey); padding-left: 20px; margin-left: 6px; }
.tl-item { position: relative; }
.tl-item::before { content: ""; position: absolute; left: -27px; top: 6px; width: 11px; height: 11px; border-radius: 50%; background: var(--purple); border: 2px solid var(--surface); }
.tl-item b { font-size: 12px; color: var(--purple); letter-spacing: .08em; text-transform: uppercase; }
.tl-item p { font-size: 15px; }

/* ---------- Memories ---------- */
.comment { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); }
.comment:first-child { border-top: none; padding-top: 0; }
.comment strong { font-size: 14px; }
.comment span { font-size: 12px; color: var(--text-3); margin-left: 6px; }
.comment p { color: var(--text-2); font-size: 14px; margin-top: 2px; }
.comment-form { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.comment-form textarea { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; min-height: 72px; resize: vertical; outline: none; background: var(--bg); font-size: 14px; }
.comment-form textarea:focus { border-color: var(--purple); background: var(--surface); }
.comment-form .btn { align-self: flex-end; }

/* Beige "paper" for the Our story and About cards: light beige, dark charcoal */
:root { --paper: #EEEBE6; }
:root[data-theme="dark"] { --paper: #272C32; }
.paper { background: var(--paper); border: 1px solid var(--border); }

/* ---------- Storage meter (Settings page) ---------- */
.storage { margin-top: 10px; }
.storage-bar { height: 6px; background: var(--blue-grey); border-radius: 999px; overflow: hidden; }
.storage-bar span { display: block; height: 100%; background: var(--purple); border-radius: 999px; }
.storage-bar.warn span { background: #E8453C; }
.storage-head { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text); }
.storage-head strong { font-weight: 600; }
.storage-head.warn, .storage-head.warn svg { color: #E8453C; }
.storage-used { display: block; margin-top: 6px; font-size: 12px; color: var(--text-3); }
.storage-btn { display: inline-block; margin-top: 10px; padding: 7px 14px; border: 1px solid var(--border); border-radius: 999px; color: var(--purple); font-size: 13px; font-weight: 600; }
.storage-btn:hover { background: var(--purple-50); }

/* ---------- Family tree page ---------- */
.tree-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 3px; }
.seg button { padding: 6px 14px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--text-3); }
.seg button.active { background: var(--purple); color: #fff; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-3); margin-left: auto; flex-wrap: wrap; }
.legend span::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.tree-canvas { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; overflow: auto; }
.tree-canvas svg { display: block; min-width: 100%; }
.node { cursor: pointer; }
.node:hover .node-box { stroke: var(--purple); }
.node-box { fill: var(--surface); stroke-width: 1.5; }
.node-name { font-family: var(--font-body); font-size: 13px; font-weight: 600; fill: var(--text); }
.node-years { font-family: var(--font-body); font-size: 11px; fill: var(--text-3); }
.edge { stroke: #B9C4CE; stroke-width: 1.5; fill: none; }
.edge-spouse { stroke: var(--purple); stroke-width: 1.5; stroke-dasharray: 3 3; }

/* ---------- Light / dark switch in the top bar ---------- */

/* ---------- Responsive ---------- */
@media (max-width: 1280px) { .person-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 1100px) {
  .grid, .grid-2 { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .person-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  /* Phone: the sidebar becomes a drawer opened from "More" in the bottom bar */
  .sidebar.open { display: flex; position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); height: 100%; z-index: 95; box-shadow: 8px 0 30px rgba(0,0,0,.18); padding-bottom: 90px; }
  .drawer-scrim.open { display: block; }
  .mobile-nav { display: block; }
  .main { padding: 18px 16px calc(84px + env(safe-area-inset-bottom)); }
  .hero { grid-template-columns: 1fr; padding: 24px; }
  .hero h1 { font-size: 28px; }
  .hero-stats { flex-wrap: wrap; }
  .page-hero { padding: 40px 20px; }
  .page-hero h1 { font-size: 32px; }
  .search { display: none; }
  .top-actions .btn { display: none; }
  .person-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .tiles { grid-template-columns: 1fr; }
  .vault { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- Family tree page (tree.html + tree.js) ---------- */
.hidden { display: none !important; }
.tree-page .tree-toolbar { justify-content: space-between; }
.tree-toolbar-left, .tree-toolbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; padding: 4px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; background: var(--purple-50); color: var(--purple); }
.toolbar-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-size: 13px; font-weight: 600; }
.toolbar-btn:hover { border-color: var(--purple); color: var(--purple); }
.toolbar-btn .ti { font-size: 16px; }
.view-toggle { display: inline-flex; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 3px; }
.view-btn { padding: 5px 14px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--text-3); }
.view-btn.active { background: var(--purple); color: #fff; }

.tree-page .tree-canvas { position: relative; height: calc(100vh - 190px); min-height: 460px; padding: 0; overflow: hidden; }
.tree-page .tree-canvas > svg { width: 100%; height: 100%; cursor: grab; touch-action: none; }
.tree-node { cursor: pointer; }
.tree-node:focus { outline: none; }
.tree-node:focus-visible rect { stroke: var(--purple); stroke-width: 2.5; }
/* The person the tree opened on: a ring that fades */
.tree-node.focus-ping > rect:first-child { stroke: var(--purple); stroke-width: 3.5; animation: focus-ping 2.6s ease-out; }
@keyframes focus-ping { 0%, 60% { stroke-opacity: 1; } 100% { stroke-opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .tree-node.focus-ping > rect:first-child { animation: none; } }
.tree-loading { height: 100%; display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--text-3); font-size: 14px; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--border); border-top-color: var(--purple); display: inline-block; animation: kn-spin .8s linear infinite; vertical-align: middle; }
.spinner.light { border-color: rgba(255,255,255,.35); border-top-color: #fff; }
@keyframes kn-spin { to { transform: rotate(360deg); } }

.tree-page .tree-legend { position: absolute; left: 14px; bottom: 14px; display: flex; gap: 14px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 6px 14px; font-size: 12px; color: var(--text-3); }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot { width: 12px; height: 12px; border-radius: 4px; border: 1.5px solid transparent; }
.tree-page .zoom-controls { position: absolute; right: 14px; bottom: 14px; display: flex; gap: 6px; }
.zoom-btn { display: inline-flex; align-items: center; gap: 5px; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-size: 12px; font-weight: 600; box-shadow: 0 2px 6px rgba(0,0,0,.05); }
.zoom-btn:hover { border-color: var(--purple); color: var(--purple); }

.tree-empty { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 32px; gap: 10px; }
.tree-empty-icon { font-size: 44px; }
.tree-empty-title { font-family: var(--font-head); font-size: 22px; font-weight: 700; }
.tree-empty-sub { color: var(--text-3); max-width: 420px; font-size: 14px; }
.tree-empty-note { color: var(--text-3); font-size: 12px; margin-top: 4px; }
.empty-panel { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 40px 20px; color: var(--text-3); }
.empty-panel .ti { font-size: 32px; }
.empty-panel p { color: var(--text); font-weight: 600; }

.list-view { height: 100%; overflow-y: auto; padding: 8px; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-sm); cursor: pointer; }
.list-row:hover { background: var(--blue-grey-50); }
.list-avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 600; flex-shrink: 0; }
.list-row-name { font-weight: 600; }
.list-row-rel { font-size: 13px; color: var(--text-3); }

/* Buttons used by tree.js */
.add-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border-radius: 999px; background: var(--purple); color: #fff; font-weight: 600; font-size: 14px; }
.add-btn:hover { background: var(--purple-600); }
.add-btn.block { width: 100%; margin-top: 18px; }
.add-btn:disabled { opacity: .6; cursor: not-allowed; }

/* Click-a-person menu */
.node-menu { display: none; position: fixed; z-index: 60; min-width: 220px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: 0 12px 32px rgba(20,24,40,.16); padding: 6px; }
.node-menu-title { font-weight: 600; font-size: 13px; padding: 8px 10px 6px; color: var(--text); }
.nm-btn { display: flex; width: 100%; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; font-size: 14px; color: var(--text-2); text-align: left; }
.nm-btn:hover { background: var(--blue-grey-50); color: var(--text); }
.nm-btn.danger { color: #C0392B; }

/* Modals and forms */
.modal-overlay { position: fixed; inset: 0; z-index: 70; background: rgba(20,22,34,.45); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { position: relative; width: 100%; max-width: 460px; max-height: calc(100vh - 32px); overflow-y: auto; background: var(--surface); border-radius: var(--radius); padding: 24px; box-shadow: 0 24px 60px rgba(0,0,0,.2); }
.modal-title { font-size: 18px; margin-bottom: 8px; padding-right: 32px; }
.modal-close { position: absolute; top: 14px; right: 14px; width: 32px; height: 32px; border-radius: 50%; color: var(--text-3); display: grid; place-items: center; font-size: 18px; }
.modal-close:hover { background: var(--blue-grey-50); color: var(--text); }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin: 14px 0 6px; }
.form-label.first { margin-top: 4px; }
.form-input { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font-size: 14px; }
.form-input:focus { outline: none; border-color: var(--purple); box-shadow: 0 0 0 3px var(--purple-50); }
.form-input.file { padding: 8px; }
textarea.form-input { resize: vertical; }
.form-hint { font-size: 12px; color: var(--text-3); margin-top: 6px; }
.form-hint.success { color: var(--teal-ink); }
.form-toggle-link { display: inline-block; margin-top: 8px; font-size: 12px; color: var(--purple); cursor: pointer; text-decoration: underline; }
.form-card { margin-top: 16px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--blue-grey-50); }
.form-card-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.form-card-title { font-weight: 600; font-size: 14px; }
.form-card-fields { display: none; margin-top: 10px; }
.form-check { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; cursor: pointer; }
.tie-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tie-btn { display: flex; align-items: center; gap: 8px; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text-2); font-size: 13px; font-weight: 600; }
.tie-btn:hover { border-color: var(--purple); }
.tie-btn.selected { border-color: var(--purple); background: var(--purple-50); color: var(--purple); }
.switch { position: relative; display: inline-block; width: 40px; height: 22px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch-track { position: absolute; inset: 0; background: var(--border); border-radius: 999px; cursor: pointer; transition: background .15s; }
.switch-track::before { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + .switch-track { background: var(--purple); }
.switch input:checked + .switch-track::before { transform: translateX(18px); }
.invite-send-row, .invite-link-row { display: flex; gap: 8px; align-items: center; }
.invite-divider { display: flex; align-items: center; gap: 10px; margin: 18px 0 12px; font-size: 12px; color: var(--text-3); }
.invite-divider::before, .invite-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.invite-mailto { margin-top: 10px; }

/* Toast, claim banner, undo bar */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); z-index: 80; background: #1F1D2B; color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.claim-banner { display: none; position: fixed; left: 50%; top: 20px; transform: translateX(-50%); z-index: 65; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; box-shadow: 0 12px 32px rgba(20,24,40,.16); max-width: calc(100vw - 32px); }
.claim-emoji { font-size: 22px; }
.claim-body { font-size: 14px; }
.claim-dismiss { font-size: 20px; color: var(--text-3); padding: 0 4px; }
.undo-bar { display: none; position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 75; align-items: center; gap: 14px; background: #1F1D2B; color: #fff; padding: 10px 16px; border-radius: 999px; font-size: 14px; transition: opacity .3s; }
.undo-bar button { color: #fff; font-weight: 700; text-decoration: underline; }

@media (max-width: 900px) {
  .tree-page .tree-canvas { height: 70vh; }
  .tree-page .tree-legend { left: 8px; right: 8px; bottom: 56px; border-radius: var(--radius-sm); }
  .tree-page .zoom-controls { right: 8px; bottom: 8px; }
}

/* Keyboard users: "Skip to main content" appears only when tabbed to */
.skip-link { position: absolute; left: 12px; top: -48px; z-index: 100; background: var(--purple); color: #fff; padding: 8px 14px; border-radius: 999px; font-size: 14px; font-weight: 600; }
.skip-link:focus { top: 12px; }

/* Easy-editor photo bar (app.js attachPhotoTools) */
.rich-ed img, [contenteditable] img { cursor: pointer; }
img.picked { outline: 3px solid var(--purple); outline-offset: 2px; }
.photo-tools { position: absolute; z-index: 5; display: flex; gap: 4px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 4px; box-shadow: 0 8px 24px rgba(20,24,40,.18); }
.photo-tools[hidden] { display: none; }
.photo-tools button { padding: 6px 12px; border-radius: 999px; font-size: 12px; font-weight: 600; color: var(--text-2); }
.photo-tools button:hover { background: var(--blue-grey-50); color: var(--text); }
.photo-tools button.danger { color: #B3261E; }

/* ---------- Phone bottom tab bar (app.js renderMobileNav) ---------- */
.mobile-nav { display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 90; background: var(--surface); border-top: 1px solid var(--border); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); box-shadow: 0 -4px 18px rgba(20,24,40,.06); }
.mobile-nav-item { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; width: 20%; padding: 6px 0; border-radius: var(--radius-sm); font-size: 11px; font-weight: 600; color: var(--text-3); text-decoration: none; vertical-align: top; }
.mobile-nav-item svg { width: 22px; height: 22px; }
.mobile-nav-item.active { color: var(--purple); }
.drawer-scrim { display: none; position: fixed; inset: 0; z-index: 94; background: rgba(20,22,34,.4); }
@media (max-width: 820px) {
  .mobile-nav { display: block; }
  .tree-page .tree-legend { display: none; }
  .tree-page .tree-canvas { height: calc(100vh - 300px); min-height: 380px; }
}

.mobile-nav-item { position: relative; }
.mobile-nav-item .nav-badge { position: absolute; top: 2px; left: calc(50% + 6px); min-width: 17px; height: 17px; padding: 0 5px; border-radius: 999px; background: var(--purple); color: #fff; font-size: 10px; font-weight: 700; align-items: center; justify-content: center; }
.nav .count { align-items: center; justify-content: center; }

/* Reduce motion: your setting in Settings → Appearance, or your device's */
html.reduce-motion *, html.reduce-motion *::before, html.reduce-motion *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* Links inside grey helper text are underlined so they don't rely on colour alone */
.feed-empty a, .empty a, .muted-note a, .bio a, .sub a, .pf-hint a, .empty-list a, .ev-note a { text-decoration: underline; text-underline-offset: 2px; }

/* ---------- Site footer ---------- */
/* The main column fills the screen so the footer sits at the bottom of short pages */
.main:has(> .site-footer) { display: flex; flex-direction: column; min-height: 100vh; }
.main > .footer-spacer { flex: 1 0 56px; }
.site-footer { margin: 0; padding: 40px 0 4px; border-top: 1px solid var(--border); }
.footer-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 24px; }
/* 12 columns: blurb 4, space 2, then three link columns of 2 each */
.footer-blurb { grid-column: 1 / span 4; }
.footer-col:nth-of-type(1) { grid-column: 7 / span 2; }
.footer-col:nth-of-type(2) { grid-column: 9 / span 2; }
.footer-col:nth-of-type(3) { grid-column: 11 / span 2; }
.footer-blurb { font-size: 15px; line-height: 1.75; color: var(--text-2); margin: 0; max-width: 460px; }
.footer-blurb strong { color: var(--text); }
.footer-col { display: flex; flex-direction: column; gap: 12px; }
.footer-col a { font-size: 15px; color: var(--text-2); text-decoration: none; }
.footer-col a:hover { color: var(--purple); }
.site-copy { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 36px; padding-top: 18px; border-top: 1px solid var(--border); font-size: 13px; color: var(--text-3); }
.to-top { font-size: 13px; font-weight: 600; color: var(--text-2); padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); }
.to-top:hover { color: var(--purple); border-color: var(--purple); }
@media (max-width: 900px) {
  .footer-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .footer-blurb { grid-column: 1 / -1; }
  .footer-col:nth-of-type(n) { grid-column: auto / span 1; }
}
@media (max-width: 820px) {
  .site-footer { margin: 0; padding: 32px 0 4px; }
  .main > .footer-spacer { flex-basis: 40px; }
}
/* Standalone pages (sign in, welcome, legal, 404): copyright line */
.mini-copy { max-width: 1200px; margin: 32px auto 0; padding: 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 13px; color: var(--text-3); }
/* Centred sign-in style pages: the copyright line sits under the card */
body:has(> .mini-copy) { flex-direction: column; flex-wrap: nowrap; justify-content: center; }
body > .mini-copy { flex-basis: auto; width: 100%; max-width: 400px; flex-direction: column; justify-content: center; text-align: center; gap: 8px; margin-top: 20px; }


/* ═══════════════════════════════════════════════════════════
   v18 layout: a top bar instead of the side rail. The menu is a
   drawer opened by the hamburger on every screen size. Calm cards:
   one style everywhere, small capital labels instead of big titles.
   ═══════════════════════════════════════════════════════════ */
body { overflow-x: clip; }
.app { display: block; min-height: calc(100vh - 68px); }
.main { padding: 22px 28px 40px; }
.main:has(> .site-footer) { min-height: calc(100vh - 68px); }

/* ---------- Top bar ---------- */
.topnav { position: sticky; top: 0; z-index: 80; background: var(--surface); border-bottom: 1px solid var(--border); }
.topnav-in { max-width: 1240px; margin: 0 auto; height: 68px; padding: 0 20px; display: flex; align-items: center; gap: 18px; }
.tn-logo { display: flex; align-items: center; flex-shrink: 0; }
.tn-logo img { display: block; }
.tn-logo .logo-full { height: 31px; width: auto; }
.tn-logo .logo-mark { height: 40px; width: auto; display: none; }
.logo-dark { display: none !important; }
:root[data-theme="dark"] .logo-light { display: none !important; }
:root[data-theme="dark"] .logo-dark { display: block !important; }
.topnav-in > * { min-width: 0; }
.tn-search { flex: 0 1 260px; max-width: 260px; background: var(--blue-grey-50); border-color: transparent; padding: 9px 14px; }
.tn-search input { font-size: 14px; }
.tn-links { display: flex; gap: 2px; margin-left: auto; }
.tn-links a { padding: 8px 12px; border-radius: 8px; font-size: 14px; font-weight: 600; color: var(--text-2); white-space: nowrap; }
.tn-links a:hover { color: var(--purple); }
.tn-links a.active { color: var(--purple); }
.tn-icons { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.tn-icons .icon-btn, .tn-me { width: 44px; height: 44px; border-radius: 10px; background: var(--blue-grey-50); border: 0; color: var(--text-2); display: grid; place-items: center; position: relative; }
.tn-icons .icon-btn:hover { color: var(--purple); background: var(--purple-50); }
.tn-icons .icon-btn svg { width: 20px; height: 20px; }
.tn-icons .dot { top: 8px; right: 9px; background: #E5484D; }
.tn-icons .nav-badge { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: #E5484D; color: #fff; font-size: 10px; font-weight: 700; align-items: center; justify-content: center; }
.tn-me { padding: 0; overflow: hidden; }
.me-face { width: 100%; height: 100%; display: grid; place-items: center; font-size: 14px; font-weight: 700; color: var(--purple); background: var(--purple-50); border-radius: inherit; overflow: hidden; }
.tn-pop { position: relative; }
.tn-panel { position: absolute; right: 0; top: calc(100% + 10px); width: 340px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 16px 40px rgba(15,23,42,.16); z-index: 85; overflow: hidden; }
.tn-panel-head { display: flex; align-items: center; gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.tn-panel-head strong { font-size: 15px; }
.new-pill { font-size: 11px; font-weight: 700; color: #C2410C; background: #FFEDD5; padding: 2px 8px; border-radius: 999px; }
.link-btn { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--purple); }
.note-row { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; font-size: 13px; color: var(--text-2); }
.note-row:hover { background: var(--blue-grey-50); }
.note-row.unread { background: var(--purple-50); }
.note-av { width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center; background: var(--teal-50); color: var(--teal-ink); font-size: 12px; font-weight: 700; }
.note-text { flex: 1; line-height: 1.45; }
.note-row small { color: var(--text-3); font-size: 11px; white-space: nowrap; }
.note-empty { padding: 18px 16px; font-size: 13px; color: var(--text-3); }
.tn-panel-foot { display: block; text-align: center; padding: 12px; font-size: 13px; font-weight: 600; color: var(--purple); border-top: 1px solid var(--border); }
.tn-account { width: 270px; padding: 14px; }
.acct-head { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.acct-head .me-face.big { width: 48px; height: 48px; border-radius: 12px; flex-shrink: 0; }
.acct-head strong { display: block; font-size: 15px; }
.acct-head small { font-size: 12px; color: var(--text-3); }
.acct-view { display: block; text-align: center; padding: 8px; border-radius: 8px; background: var(--purple-50); color: var(--purple); font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.acct-link { display: flex; width: 100%; align-items: center; gap: 10px; padding: 9px 6px; font-size: 14px; color: var(--text-2); border-radius: 8px; text-align: left; }
.acct-link:hover { background: var(--blue-grey-50); color: var(--text); }
.acct-mode { display: flex; align-items: center; gap: 6px; border-top: 1px solid var(--border); margin-top: 8px; padding-top: 12px; font-size: 13px; color: var(--text-3); }
.acct-mode button { width: 36px; height: 32px; border-radius: 8px; display: grid; place-items: center; color: var(--text-2); }
.acct-mode button.active { background: var(--purple); color: #fff; }
:root[data-theme="dark"] .topnav { background: var(--side-bg); border-bottom-color: var(--side-border); }
:root[data-theme="dark"] .tn-links a { color: var(--side-text); }
:root[data-theme="dark"] .tn-links a.active, :root[data-theme="dark"] .tn-links a:hover { color: #fff; }
:root[data-theme="dark"] .tn-icons .icon-btn, :root[data-theme="dark"] .tn-search { background: rgba(255,255,255,.08); color: var(--side-text); }
:root[data-theme="dark"] .tn-search input { color: #fff; }

/* Page name, small and in capitals, at the top of the content */
.topbar { margin-bottom: 18px; min-height: 0; }
.page-name { font-family: var(--font-body); font-size: 12px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--text-3); }
.topbar .top-actions { margin-left: auto; }

/* ---------- Menu drawer ---------- */
.sidebar { position: fixed; inset: 0 auto 0 0; width: min(320px, 88vw); height: 100%; z-index: 95; display: flex; transform: translateX(-105%); visibility: hidden; transition: transform .22s ease, visibility .22s; box-shadow: 8px 0 30px rgba(15,23,42,.18); gap: 14px; padding: 18px 14px 24px; }
.sidebar.open { transform: none; visibility: visible; }
.drawer-scrim { display: none; position: fixed; inset: 0; z-index: 94; background: rgba(15,23,42,.42); }
.drawer-scrim.open { display: block; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 0 4px; }
.drawer-head .brand img { height: 28px; width: auto; display: block; }
.drawer-head .icon-btn { width: 40px; height: 40px; border: 0; background: var(--surface); }
:root[data-theme="dark"] .drawer-head .icon-btn { background: rgba(255,255,255,.08); color: #fff; }
.drawer-search { max-width: none; padding: 9px 14px; }
.nav a { padding: 7px 10px; }
.q-icon { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0; }
.q-icon svg { width: 17px; height: 17px; }
.tone-blue.q-icon { background: #E5EEFF; color: #2563EB; }
.tone-violet.q-icon { background: #EFE9FF; color: #7C3AED; }
.tone-amber.q-icon { background: #FEF3DC; color: #B45309; }
.tone-teal.q-icon { background: #DDF6F2; color: #0F766E; }
.tone-sky.q-icon { background: #E0F2FE; color: #0369A1; }
.tone-rose.q-icon { background: #FFE4EA; color: #BE123C; }
.tone-green.q-icon { background: #E3F7E8; color: #15803D; }
.tone-slate.q-icon { background: #E8EDF4; color: #475569; }

/* ---------- One calm card style ---------- */
.card { border-radius: var(--radius); border: 1px solid var(--border); box-shadow: none; padding: 20px; }
.card-head { margin-bottom: 14px; }
.card-head h2 { font-family: var(--font-body); font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); }
.card-head .link { font-size: 12px; }
.stack { gap: 18px; }
.grid { gap: 22px; }

/* ---------- Feed: compact, like a conversation ---------- */
.post { padding: 0; border-top: 0; }
.feed-list .post, .post.boxed { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; margin-top: 14px; }
.post-head { gap: 10px; margin-bottom: 10px; }
.post-head .avatar { width: 40px; height: 40px; }
.post-head strong { font-size: 14px; }
.post-body { font-size: 14px; line-height: 1.6; color: var(--text); margin-bottom: 10px; }
.post-photos { display: block; }
.post-photos img { width: 100%; border-radius: 10px; max-height: 420px; object-fit: cover; display: block; }
.post-actions { gap: 16px; padding: 8px 0 0; font-size: 13px; }
.post-actions .liked { color: var(--purple); }
.post-actions .liked svg { fill: currentColor; }
.c-row { display: flex; gap: 8px; margin-top: 10px; align-items: flex-start; }
.c-av { width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center; background: var(--purple-50); color: var(--purple); font-size: 11px; font-weight: 700; overflow: hidden; }
.c-av img { width: 100%; height: 100%; object-fit: cover; }
.c-bubble { background: var(--blue-grey-50); border-radius: 10px; padding: 8px 12px; font-size: 13px; line-height: 1.5; min-width: 0; }
.c-bubble b { display: block; font-size: 13px; color: var(--text); }
.c-bubble span { color: var(--text-2); }
.c-input { flex: 1; display: flex; align-items: center; background: var(--blue-grey-50); border-radius: 10px; padding: 0 6px 0 12px; }
.c-input input { flex: 1; min-width: 0; border: 0; background: none; padding: 9px 0; font-size: 13px; color: var(--text); outline: none; }
.c-input .send { width: 34px; height: 34px; display: grid; place-items: center; color: var(--purple); border-radius: 8px; }
.c-input .send:hover { background: var(--purple-50); }
.c-input .send svg { width: 17px; height: 17px; }

/* ---------- Full-width photo banner (Family History, blog categories) ---------- */
.bleed { width: 100vw; margin-left: calc(50% - 50vw); margin-right: calc(50% - 50vw); }

@media (max-width: 1100px) {
  .tn-links { display: none; }
  .tn-search { margin-right: auto; }
}
@media (max-width: 820px) {
  .main { padding: 14px 14px 32px; }
  .topnav-in { height: 60px; padding: 0 12px; gap: 8px; }
  .tn-logo .logo-full { display: none !important; }
  .tn-logo .logo-mark { display: block; height: 38px; }
  .tn-search { display: none; }
  .tn-icons { margin-left: auto; gap: 6px; }
  .tn-hide-sm { display: none !important; }
  .tn-panel { position: fixed; left: 10px; right: 10px; top: 66px; width: auto; }
  .app { min-height: calc(100vh - 60px); }
}

/* ═══════════════════════════════════════════════════════════
   v19: one look for everyone. Navy top bar with the white logo,
   purple accent (not Facebook blue), pages up to 1400px wide,
   flat white cards like the Family History page, banners that
   run edge to edge, a tinted footer.
   ═══════════════════════════════════════════════════════════ */
:root, :root[data-theme="dark"] {
  --purple: #534AB7;
  --purple-600: #433BA0;
  --purple-50: #F1F0FA;
  --navy: #1F3A5F;
  --bg: #F0F2FA;
  --base: #F0F2FA;
  --surface: #FFFFFF;
  --text: #1E293B;
  --text-2: #475569;
  --text-3: #5B6478;
  --blue-grey: #E3E6EF;
  --blue-grey-50: #F0F1F7;
  --border: #E3E6EF;
  --hero-grad: linear-gradient(120deg, #1F3A5F 0%, #3C3489 70%, #534AB7 130%);
  --brand-grad: linear-gradient(135deg, #534AB7, #1D9E75);
  --side-bg: #FFFFFF;
  --side-border: #E3E6EF;
  --side-text: #334155;
  --side-muted: #5B6478;
  --side-hover: #F4F5FA;
  --side-active-bg: #F1F0FA;
  --side-active-text: #433BA0;
  --side-label: #5B6478;
}
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.main { max-width: 1200px; }

/* ---------- Navy top bar ---------- */
.topnav, :root[data-theme="dark"] .topnav { background: #1F3A5F; border-bottom: 0; }
.topnav-in { max-width: 1260px; gap: 24px; }
.tn-logo .logo-full { height: 33px; }
.tn-links { margin-left: 6px; margin-right: auto; gap: 4px; align-items: center; }
.topnav .tn-links .tn-link { display: inline-flex; align-items: center; gap: 4px; padding: 9px 12px; border-radius: 8px; font-size: 14.5px; font-weight: 600; color: rgba(255,255,255,.82); background: none; white-space: nowrap; }
.tn-link svg { width: 14px; height: 14px; opacity: .8; }
.topnav .tn-links .tn-link:hover, .tn-drop:hover > .tn-link, .tn-drop.open > .tn-link { color: #fff; background: rgba(255,255,255,.08); }
.topnav .tn-links .tn-link.active, .tn-drop.active > .tn-link { color: #fff; box-shadow: inset 0 -2px 0 #A78BFA; border-radius: 8px 8px 0 0; }
.tn-drop { position: relative; }
.tn-menu { position: absolute; left: 0; top: calc(100% + 6px); min-width: 220px; background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 16px 40px rgba(15,23,42,.18); padding: 8px; display: none; z-index: 86; }
.tn-menu::before { content: ""; position: absolute; left: 0; right: 0; top: -8px; height: 8px; }
.tn-drop.open > .tn-menu { display: block; }
@media (hover: hover) and (min-width: 1101px) { .tn-drop:hover > .tn-menu { display: block; } }
.tn-menu a { display: block; padding: 8px 12px; border-radius: 6px; font-size: 14px; color: var(--text); }
.tn-menu a:hover { background: var(--purple-50); color: var(--purple-600); }
.tn-menu .tn-menu-cta { margin-top: 6px; border-top: 1px solid var(--border); border-radius: 0 0 6px 6px; color: var(--purple); font-weight: 600; }
.tn-icons .icon-btn, :root[data-theme="dark"] .tn-icons .icon-btn { background: rgba(255,255,255,.1); color: #fff; }
.tn-icons .icon-btn:hover { background: rgba(255,255,255,.2); color: #fff; }
.tn-me { background: rgba(255,255,255,.1); }
.me-face { color: #fff; background: var(--purple); }
.tn-panel .me-face, .me-card .me-face { color: var(--purple); background: var(--purple-50); }
.tn-icons .dot { border-color: #1F3A5F; }
.tn-search { display: none !important; }
.acct-storage { margin: 8px 6px 4px; color: var(--text-3); }
.acct-storage .storage-bar { background: var(--blue-grey-50); }

/* ---------- Menu drawer: plain icons, colour on hover ---------- */
.sidebar { background: #fff; }
.drawer-head .icon-btn { background: var(--blue-grey-50); }
.nav-label { display: none; }
.nav .q-icon { background: var(--blue-grey-50); color: var(--text-3); transition: background .15s, color .15s; }
.nav a:hover .tone-blue.q-icon, .nav a.active .tone-blue.q-icon { background: #E5EEFF; color: #2563EB; }
.nav a:hover .tone-violet.q-icon, .nav a.active .tone-violet.q-icon { background: #EFE9FF; color: #7C3AED; }
.nav a:hover .tone-amber.q-icon, .nav a.active .tone-amber.q-icon { background: #FEF3DC; color: #B45309; }
.nav a:hover .tone-teal.q-icon, .nav a.active .tone-teal.q-icon { background: #DDF6F2; color: #0F766E; }
.nav a:hover .tone-sky.q-icon, .nav a.active .tone-sky.q-icon { background: #E0F2FE; color: #0369A1; }
.nav a:hover .tone-rose.q-icon, .nav a.active .tone-rose.q-icon { background: #FFE4EA; color: #BE123C; }
.nav a:hover .tone-green.q-icon, .nav a.active .tone-green.q-icon { background: #E3F7E8; color: #15803D; }
.quick-links .q-icon { background: var(--blue-grey-50); color: var(--text-3); transition: background .15s, color .15s; }
.quick-links a:hover .tone-blue.q-icon { background: #E5EEFF; color: #2563EB; }
.quick-links a:hover .tone-violet.q-icon { background: #EFE9FF; color: #7C3AED; }
.quick-links a:hover .tone-amber.q-icon { background: #FEF3DC; color: #B45309; }
.quick-links a:hover .tone-teal.q-icon { background: #DDF6F2; color: #0F766E; }
.quick-links a:hover .tone-sky.q-icon { background: #E0F2FE; color: #0369A1; }
.quick-links a:hover .tone-rose.q-icon { background: #FFE4EA; color: #BE123C; }
.quick-links a:hover .tone-green.q-icon { background: #E3F7E8; color: #15803D; }

/* ---------- Flat white cards, like the Family History page ---------- */
.card, .post.boxed, .feed-list .post { border-radius: 0; border: 1px solid var(--border); box-shadow: none; }
.card-head h2 { font-size: 11px; letter-spacing: .08em; color: var(--text-3); font-weight: 600; }

/* ---------- Banners run edge to edge, straight under the top bar ---------- */
.main > .page-hero, .main > .dash-hero, .full-banner {
  width: 100vw; margin-left: calc(50% - 50vw); margin-right: calc(50% - 50vw); margin-top: -22px; border-radius: 0 !important;
}
.main > .page-hero { margin-bottom: 24px; }

/* ---------- Footer on a darker tint, edge to edge ---------- */
.site-footer { background: #E7E9F3; border-top: 0; box-shadow: 0 0 0 100vmax #E7E9F3; clip-path: inset(0 -100vmax); margin-top: 24px; padding: 40px 0 18px; }
.main:has(> .site-footer) { padding-bottom: 0; }

@media (max-width: 1100px) {
  .tn-links { display: none; }
}
@media (max-width: 820px) {
  .main > .page-hero, .main > .dash-hero, .full-banner { margin-top: -14px; }
  .tn-logo .logo-mark { height: 36px; }
}

/* ---------- Comment threads: Like · Reply, replies indented (comment-thread.js) ---------- */
.c-list { margin-top: 4px; }
.c-thread { margin-top: 10px; }
.c-item { display: flex; gap: 8px; align-items: flex-start; }
.c-item + .c-item, .c-replies .c-item { margin-top: 8px; }
.c-main { flex: 1; min-width: 0; }
.c-item .c-bubble { display: block; background: var(--blue-grey-50); border-radius: 10px; padding: 8px 12px; font-size: 13.5px; line-height: 1.5; color: var(--text-2); }
.c-top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.c-top b { font-size: 13px; color: var(--text); }
.c-top small { font-size: 11px; color: var(--text-3); white-space: nowrap; }
.c-acts { display: flex; gap: 6px; align-items: center; margin: 3px 0 0 4px; font-size: 12px; color: var(--text-3); }
.c-acts button { font-size: 12px; font-weight: 600; color: var(--text-3); padding: 2px 0; }
.c-acts button:hover, .c-acts button.on { color: var(--purple); }
.c-replies { margin-left: 40px; }
.c-replies .c-av { width: 28px; height: 28px; font-size: 10px; }
.c-more { margin: 8px 0 0 36px; font-size: 12px; font-weight: 600; color: var(--purple); }
.c-replybox { margin: 8px 0 0 40px; }

/* v20: top bar links sit on the right, next to the menu button; a simple colour change on hover */
.tn-logo .logo-full { height: 26px; }
.tn-links { margin-left: auto !important; margin-right: 0 !important; }
.topnav .tn-links .tn-link { color: rgba(255,255,255,.78); background: none; box-shadow: none; border-radius: 8px; }
.topnav .tn-links .tn-link:hover, .tn-drop:hover > .tn-link, .tn-drop.open > .tn-link { color: color-mix(in srgb, var(--purple) 40%, #fff); background: none; }
.topnav .tn-links .tn-link.active, .tn-drop.active > .tn-link { color: #fff; box-shadow: none; }
.tn-icons { margin-left: 4px; }
.drawer-head .brand img { height: 33px; width: auto; }

/* v20: page titles on pages without a photo banner */
.topbar { display: flex; align-items: center; gap: 12px; margin: 8px 0 22px; }
.topbar .page-name { font-family: var(--font-head); font-size: 32px; font-weight: 700; letter-spacing: -0.01em; text-transform: none; color: var(--navy); }
.topbar.has-banner:not(:has(.top-actions)) { display: none; }
.topbar.has-banner { margin: 0 0 14px; }
@media (max-width: 820px) { .topbar .page-name { font-size: 26px; } }

/* ═══════════════════════════════════════════════════════════
   v21: the top bar follows the colour style. Dark (default): a deep
   shade of the chosen colour. Light: a white bar with the colour logo.
   ═══════════════════════════════════════════════════════════ */
:root { --nav-bg: #1F3A5F; --nav-bg: color-mix(in srgb, var(--purple) 38%, #0B1020); }
.tn-logo .logo-full { height: 21px; }
.tn-logo .logo-mark { height: 30px; }
.on-light { display: none !important; }
.topnav, :root[data-theme="dark"] .topnav { background: var(--nav-bg); }
.tn-icons .dot { border-color: var(--nav-bg); }

/* Light top bar */
:root[data-nav="light"] .topnav { background: #fff; border-bottom: 1px solid var(--border); }
:root[data-nav="light"] .on-dark { display: none !important; }
:root[data-nav="light"] .tn-logo .logo-full.on-light { display: block !important; }
@media (max-width: 820px) {
  :root[data-nav="light"] .tn-logo .logo-full.on-light { display: none !important; }
  :root[data-nav="light"] .tn-logo .logo-mark.on-light { display: block !important; }
}
:root[data-nav="light"] .topnav .tn-links .tn-link { color: var(--text-2); }
:root[data-nav="light"] .topnav .tn-links .tn-link:hover,
:root[data-nav="light"] .tn-drop:hover > .tn-link,
:root[data-nav="light"] .tn-drop.open > .tn-link { color: var(--purple); }
:root[data-nav="light"] .topnav .tn-links .tn-link.active,
:root[data-nav="light"] .tn-drop.active > .tn-link { color: var(--purple); }
:root[data-nav="light"] .tn-icons .icon-btn { background: var(--blue-grey-50); color: var(--text-2); }
:root[data-nav="light"] .tn-icons .icon-btn:hover { background: var(--purple-50); color: var(--purple); }
:root[data-nav="light"] .tn-icons .dot { border-color: #fff; }

/* Light / Dark buttons in the account menu */
.acct-mode button { width: auto; padding: 0 10px; gap: 6px; display: inline-flex; align-items: center; font-size: 13px; }
.acct-mode button.active { background: var(--purple); color: #fff; }
.drawer-head .brand img { height: 24px; }

/* The "K" of the logo lines up with the page's left edge (titles, cards):
   the top bar uses the page's width and side padding, and on a wide screen
   the logo's mark hangs out into the margin by its own width (about 30px
   when the logo is 26px tall). */
@media (min-width: 821px) {
  .topnav-in { max-width: 1200px; padding: 0 28px; }
}
@media (min-width: 1280px) {
  .tn-logo { margin-left: -30px; }
}

/* v22: the menu button. On a wide screen it sits with the icons on the right;
   on a phone it is a plain icon first on the left, then the logo's mark at
   the same height as the square buttons. */
.tn-logo { order: 1; }
.tn-links { order: 2; }
.tn-burger { order: 3; }
.tn-icons { order: 4; }
.topnav .tn-burger { width: 44px; height: 44px; border-radius: 10px; background: rgba(255,255,255,.1); color: #fff; display: grid; place-items: center; flex-shrink: 0; margin-left: 4px; }
.topnav .tn-burger:hover { background: rgba(255,255,255,.2); }
:root[data-nav="light"] .topnav .tn-burger { background: var(--blue-grey-50); color: var(--text-2); }
@media (max-width: 820px) {
  .tn-burger { order: 0; }
  .topnav .tn-burger, :root[data-nav="light"] .topnav .tn-burger { background: none; width: 36px; margin: 0 2px 0 -6px; }
  .topnav .tn-burger svg { width: 26px; height: 26px; }
  .tn-logo .logo-mark { height: 44px !important; }
  .tn-icons { margin-left: auto; }
}

/* v22: bolder icons everywhere; a neutral grey footer */
svg[stroke="currentColor"] { stroke-width: 2.2; }
.site-footer { background: #EFF0F1; box-shadow: 0 0 0 100vmax #EFF0F1; }
.topnav .tn-burger { border: 0; }

/* v23: new logo; the logo sits on the page's edge (no hanging mark);
   a darker grey footer; phone top bar sizes */
.tn-logo .logo-full { height: 24px; }
@media (min-width: 1280px) { .tn-logo { margin-left: 0; } }
.site-footer { background: #E6EAEE; box-shadow: 0 0 0 100vmax #E6EAEE; }
.drawer-head .brand img { height: 24px; }
@media (max-width: 820px) {
  /* Same side margin as the page below (14px), so the menu icon and your
     photo line up with the content instead of hugging the screen edge.
     The icon sits at the left of its tap area rather than centred in it. */
  .topnav-in { padding: 0 14px; gap: 6px; }
  /* Even space either side of the menu icon (16px to the screen edge,
     16px to the logo), with the logo where it was */
  .topnav .tn-burger, :root[data-nav="light"] .topnav .tn-burger { width: 34px; height: 44px; margin: 0 0 0 2px; padding: 0; place-items: center start; }
  .topnav .tn-burger svg { width: 24px; height: 24px; }
  .tn-logo .logo-mark { height: 38px !important; }
  .tn-icons { gap: 5px; }
}
@media (max-width: 360px) {
  .tn-icons a.icon-btn[href="search.html"] { display: none; }
}
/* v23: the tree fits the screen under the top bar and title (legend fully visible) */
@media (min-width: 821px) { .tree-page .tree-canvas { height: calc(100vh - 240px); } }
/* Nothing wider than a phone screen: inputs and grid columns may shrink */
.composer input { min-width: 0; }
.composer > * { flex-shrink: 0; }
.composer > input { flex-shrink: 1; }

/* ── Footer: the landing page's layout, in the app's own colours ──
   Logo and blurb on the left, three headed link columns, a thin rule
   above the copyright line. */
/* The original 12-column positions: logo and blurb across the first
   four, then the three link columns together on the right. */
.footer-grid { grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 24px; }
.footer-brand { grid-column: 1 / span 4; }
.footer-brand .footer-blurb { grid-column: auto; max-width: 360px; font-size: 14.5px; line-height: 1.65; }
.footer-col:nth-of-type(1) { grid-column: 7 / span 2; }
.footer-col:nth-of-type(2) { grid-column: 9 / span 2; }
.footer-col:nth-of-type(3) { grid-column: 11 / span 2; }
.footer-logo img { height: 26px; width: auto; display: block; margin-bottom: 14px; }
.footer-col { gap: 9px; }
.footer-col h4 { font-size: 12.5px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--text); margin: 0 0 5px; }
.footer-col a { font-size: 14.5px; }
.site-copy { margin-top: 44px; }
@media (max-width: 900px) {
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 28px; }
  .footer-brand { grid-column: 1 / -1; }
  .footer-col:nth-of-type(n) { grid-column: auto; }
}

/* Account menu: a rule sets Sign out apart from everything above it */
.acct-link.acct-signout { border-radius: 8px; margin-top: 2px; }

/* Menu drawer: My Family and Family Life open to show their pages */
.nav-group { margin: 0; }
.nav-group > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 12px; }
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-caret { margin-left: auto; display: grid; transition: transform .15s; color: var(--text-3); }
.nav-group[open] > summary .nav-caret { transform: rotate(180deg); }
.nav-sub { display: flex; flex-direction: column; margin: 2px 0 6px 54px; border-left: 1px solid var(--border); }
.nav-sub a { padding: 7px 12px; font-size: 14px; color: var(--text-2); text-decoration: none; border-radius: 0 8px 8px 0; }
.nav-sub a:hover { background: var(--side-hover); color: var(--text); }
.nav-sub a.active { color: var(--purple); font-weight: 600; }
.nav-sub a.nav-cta { color: var(--purple); font-weight: 600; }
.nav-group > summary { padding: 7px 10px; border-radius: var(--radius-sm); color: var(--side-text); font-weight: 500; }
.nav-group > summary:hover { background: var(--side-hover); color: var(--text); }
.nav-group > summary.active { color: var(--side-active-text); }

/* Tree edit form: the relationship as the signed-in person sees it */
.rel-mine { margin: 14px 0 4px; padding: 12px 14px; border-radius: 10px; background: var(--purple-50); display: grid; gap: 2px; }
.rel-mine strong { font-size: 16px; color: var(--text); }
.rel-mine small { font-size: 12px; color: var(--text-3); }

/* Colour style dots in the account menu */
.acct-styles { display: flex; justify-content: space-between; gap: 6px; padding: 10px 6px 12px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.acct-styles button { width: 16px; height: 16px; padding: 0; border-radius: 50%; border: 0; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); transition: transform .12s; }
.acct-styles button:hover { transform: scale(1.12); }
.acct-styles button.active { box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px var(--text-3); }

/* ---------- Banners: one look on every page ----------
   Inside the content width, 40px below the top bar and 40px above
   whatever comes next, rounded on top and square on the bottom.
   (The dashboard's banner is the exception: full bleed.) */
:root { --hero-gap: 40px; --main-top: 22px; }
@media (max-width: 820px) { :root { --hero-gap: 20px; --main-top: 14px; } }
.main .page-hero, .main .pf-cover, .main .ftl-hero {
  width: auto; margin-left: 0; margin-right: 0;
  margin-top: calc(var(--hero-gap) - var(--main-top));
  margin-bottom: var(--hero-gap);
  border-radius: var(--radius) var(--radius) 0 0 !important;
}
.main .pf-cover { margin-bottom: 0; }
.main .ftl-page .ftl-body { margin-top: 0; }
/* The dashboard keeps its full-bleed banner, straight under the top bar,
   with the same 40px before the content below it */
.main > .dash-hero { margin-bottom: var(--hero-gap); }

/* ---------- Tree page: one header row just above the tree ---------- */
.main.tree-page { max-width: 1200px; }
.tree-page .topbar { flex-wrap: wrap; row-gap: 10px; margin: calc(var(--hero-gap) - var(--main-top)) 0 14px; }
.tree-page .topbar .page-name { margin: 0; }
.tree-page .topbar #member-count { align-self: center; }
.tree-page .topbar .top-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tree-page .topbar .tree-toolbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.phone-view-toggle { display: none !important; }
@media (max-width: 820px) {
  .phone-view-toggle { display: inline-flex !important; }
  .tree-page .topbar .top-actions { width: 100%; }
}
.export-wrap { position: relative; }
.export-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; width: 290px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 30px rgba(20,24,40,.14); padding: 6px; }
.export-menu button { display: flex; gap: 12px; align-items: flex-start; width: 100%; text-align: left; padding: 10px 12px; border-radius: 8px; background: none; border: 0; cursor: pointer; color: var(--text); font: inherit; }
.export-menu button:hover, .export-menu button:focus-visible { background: var(--purple-50); }
.export-menu i { font-size: 20px; color: var(--purple); margin-top: 1px; }
.export-menu strong { display: block; font-size: 14px; }
.export-menu small { display: block; font-size: 12px; color: var(--text-3); margin-top: 2px; line-height: 1.35; }
.phone-view-toggle.keep { display: inline-flex !important; }
/* Every control in the tree header the same height, centred on one line */
.tree-page .topbar .toolbar-btn,
.tree-page .topbar .view-toggle,
.tree-page .topbar .top-actions .btn-primary { height: 40px; box-sizing: border-box; display: inline-flex; align-items: center; font-size: 14px; }
.tree-page .topbar .toolbar-btn { padding: 0 16px; }
.tree-page .topbar .top-actions .btn-primary { padding: 0 18px; border-radius: 999px; gap: 6px; }
.tree-page .topbar .view-toggle { padding: 3px; }
.tree-page .topbar .view-btn { height: 32px; padding: 0 14px; display: inline-flex; align-items: center; font-size: 14px; }
.tree-page .topbar #member-count { height: 28px; display: inline-flex; align-items: center; }
/* The header lines up with the logo; the tree itself can use the full width */
@media (min-width: 1300px) {
  .tree-page .tree-canvas { width: calc(100vw - 56px); margin-left: calc(50% - 50vw + 28px); }
}

/* ---------- One logo size everywhere ----------
   Every Kinnected wordmark (top bar, sign-up, landing page, shared
   stories, legal pages) is 24px tall; the side menu, login screens and
   footers are 22px (below). The square mark used on its own on phones
   keeps its size. */
img[src$="kinnected-wordmark.svg"], img[src$="kinnected-wordmark-white.svg"] { height: 24px !important; width: auto !important; max-height: none !important; }
/* Smaller still in the side menu, on the login screens and in footers */
.drawer-head img[src*="kinnected-wordmark"], .auth-logo img[src*="kinnected-wordmark"],
.logo img[src*="kinnected-wordmark"], .site-footer img[src*="kinnected-wordmark"],
.lp-foot img[src*="kinnected-wordmark"] { height: 22px !important; }
/* Tree page: the member count stands out from the page background */
.tree-page .topbar #member-count { background: color-mix(in srgb, var(--purple) 12%, #fff); color: var(--purple); border: 1px solid color-mix(in srgb, var(--purple) 22%, #fff); padding: 0 12px; border-radius: 999px; font-weight: 600; font-size: 13px; }

/* ---------- Top bar drop-downs: Search, Messages, My Family ---------- */
.note-av { overflow: hidden; }
.note-text strong { color: var(--text); }
.tn-find-form { display: flex; align-items: center; gap: 8px; margin: 12px 12px 4px; padding: 0 12px; height: 42px; border: 1px solid var(--border); border-radius: 999px; color: var(--text-3); background: var(--surface); }
.tn-find-form:focus-within { border-color: var(--purple); box-shadow: 0 0 0 3px var(--purple-50); }
.tn-find-form input { flex: 1; border: 0; outline: 0; background: none; font: inherit; font-size: 14px; color: var(--text); min-width: 0; }
.tn-fam-link { display: block; padding: 12px 16px; font-size: 14px; color: var(--text); border-bottom: 1px solid var(--border); }
.tn-fam-link:hover { background: var(--purple-50); color: var(--purple); }
/* My Family as an icon only where the menu links are hidden */
.tn-fam-pop { display: none; }
@media (max-width: 1100px) { .tn-fam-pop { display: block; } }
/* Phone: smaller square icons so five fit beside the logo */
@media (max-width: 820px) {
  .tn-icons .icon-btn, .tn-me { width: 38px; height: 38px; border-radius: 9px; }
  .tn-icons .icon-btn svg { width: 18px; height: 18px; }
  .tn-icons { gap: 4px; }
}
/* Edit / Delete buttons: icon and words side by side */
.has-action-icon { display: inline-flex !important; align-items: center; gap: 6px; }
.has-action-icon .action-icon { flex-shrink: 0; }
@media (max-width: 820px) {
  /* 38px to look at, 44px to tap: the tap area reaches 3px past each edge */
  .tn-icons .icon-btn::after, .tn-me::after { content: ''; position: absolute; top: -3px; right: -3px; bottom: -3px; left: -3px; }
}
/* "•••" menus for Edit / Delete (app.js) */
.kebab-src { display: none !important; }
.more-wrap { position: relative; display: inline-flex; vertical-align: middle; }
.more-dots { min-width: 36px; height: 32px; padding: 0 8px; border-radius: 999px; border: 1px solid transparent; background: none; color: var(--text-2); font: inherit; font-size: 14px; font-weight: 700; letter-spacing: 1px; line-height: 1; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.more-dots:hover, .more-dots[aria-expanded="true"] { background: var(--purple-50); color: var(--purple); }
.more-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 60; min-width: 170px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 14px 34px rgba(15,23,42,.16); padding: 6px; }
.more-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border: 0; background: none; border-radius: 8px; font: inherit; font-size: 15px; color: var(--text-2); cursor: pointer; text-align: left; }
.more-menu button:hover, .more-menu button:focus-visible { background: var(--blue-grey-50); color: var(--text); outline: none; }
.more-menu button.danger { color: #2563EB; }
.more-menu button.danger:hover { color: #1D4ED8; }
.more-menu .action-icon { color: inherit; flex-shrink: 0; }
.answer .more-dots { color: #fff; } .answer .more-dots:hover, .answer .more-dots[aria-expanded="true"] { background: rgba(255,255,255,.18); color: #fff; }
/* Tree page: the "Link our trees" offer */
.link-trees { display: flex; align-items: center; gap: 14px; margin: 0 0 14px; padding: 14px 18px; background: var(--surface); border: 1px solid color-mix(in srgb, var(--purple) 30%, #fff); border-left: 4px solid var(--purple); border-radius: 12px; }
.link-trees[hidden] { display: none; }
.link-trees > i { font-size: 26px; color: var(--purple); flex-shrink: 0; }
.link-trees .lt-text { flex: 1; min-width: 0; font-size: 14px; color: var(--text-2); line-height: 1.5; }
.link-trees .lt-text strong { display: block; color: var(--text); font-size: 15px; }
.link-trees .lt-acts { display: flex; gap: 8px; flex-shrink: 0; }
.link-trees .lt-acts .btn, .link-trees .lt-acts .toolbar-btn { height: 40px; border-radius: 999px; }
/* Linking trees: check who is the same person first */
.lt-review { position: fixed; inset: 0; z-index: 300; background: rgba(15,23,42,.4); display: grid; place-items: center; padding: 16px; }
.lt-box { background: var(--surface); border-radius: 16px; width: min(640px, 100%); max-height: 88vh; overflow: auto; padding: 22px 24px; box-shadow: 0 24px 60px rgba(15,23,42,.28); }
.lt-box h3 { font-family: var(--font-head); font-weight: 500; font-size: 22px; margin: 0 0 6px; }
.lt-sub { font-size: 14px; color: var(--text-2); line-height: 1.5; margin: 0 0 14px; }
.lt-rows { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.lt-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; }
.lt-row.check { border-color: #E9B949; background: #FFF9EB; }
.lt-mine strong { display: block; font-size: 14px; }
.lt-mine span, .lt-pick small { font-size: 12px; color: var(--text-3); }
.lt-row.check .lt-pick small { color: #8A5A00; font-weight: 600; }
.lt-pick select { width: 100%; height: 38px; border: 1px solid var(--border); border-radius: 10px; padding: 0 10px; background: var(--surface); font: inherit; font-size: 13px; }
.lt-new { font-size: 14px; color: var(--text-2); margin: 0 0 12px; }
.lt-new summary { cursor: pointer; font-weight: 600; }
.lt-new p { margin: 6px 0 0; line-height: 1.5; }
.lt-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
@media (max-width: 560px) { .lt-row { grid-template-columns: 1fr; } }
@media (max-width: 820px) { .link-trees { flex-wrap: wrap; } .link-trees .lt-acts { width: 100%; justify-content: flex-end; } }

/* Headings: Playfair Display — h1 and banner titles at 500 (medium), h2 at 600 */
h2 { font-weight: 600 !important; }
h1, .page-name { font-weight: 500 !important; }

/* A message from Kinnected (admin → Site settings → Message bar) */
.site-announce { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 10px 16px; background: color-mix(in srgb, var(--purple) 12%, #fff); color: var(--text); font-size: 14px; text-align: center; border-bottom: 1px solid color-mix(in srgb, var(--purple) 22%, #fff); }
.site-announce a { color: var(--purple); font-weight: 600; }
.site-announce button { border: 0; background: none; cursor: pointer; color: var(--text-3); font-size: 14px; padding: 4px 6px; }

/* Phones: pages never slide sideways. Wide things scroll inside their own
   box (the tree, tables); the page itself stays put. */
html, body { overflow-x: hidden; }
@supports (overflow-x: clip) { html, body { overflow-x: clip; } }
.tree-page .tree-canvas, .tree-page .tree-canvas > svg { touch-action: none; }

/* Story edit menus (Family Blog stories, a family page's story): the
   dots and a small open square read as one button. The dots are drawn,
   not the ••• character, so they sit exactly level with the square. */
.more-wrap.with-square .more-dots { min-width: 0; height: 28px; padding: 0 8px; gap: 4px; }
.more-wrap.with-square .more-dots::after { content: ''; width: 8px; height: 8px; border: 1px solid currentColor; box-sizing: border-box; }
.more-wrap.with-square .more-dots > span { font-size: 0; width: 15px; height: 4px; background: radial-gradient(circle, currentColor 1.5px, transparent 1.9px) 0 50% / 5px 4px repeat-x; }
/* An invisible baseline in the button, level with the square's bottom, so
   a row set to line up baselines puts the square on the text's baseline */
.more-wrap.with-square .more-dots::before { content: '\200b'; font-size: 12px; line-height: 1; margin-right: -4px; }
