/* ═══════════════════════════════════════════════════════════════
   FAMILY ARCHIVE — styles
   Colours are defined once at the top; light mode overrides them.
   ═══════════════════════════════════════════════════════════════ */

:root {
  --bg: #0f0e0c;
  --bg-2: #141310;
  --surface: #1a1814;
  --surface-2: #221f1a;
  --surface-3: #2a2620;
  --border: #2e2a24;
  --border-strong: #3d372f;
  --ink: #f2ecdc;
  --ink-2: #c9c0ad;
  --muted: #8f8573;
  --dim: #5a5348;
  --accent: #c9a84c;
  --accent-2: #e2c46f;
  --accent-ink: #15120b;
  --accent-soft: rgba(201, 168, 76, 0.12);
  --marriage: #b5606a;
  --male: #7fa3c8;
  --female: #cc8a9b;
  --unknown: #7d766a;
  --male-soft: rgba(111, 147, 184, 0.16);
  --female-soft: rgba(192, 122, 140, 0.16);
  --unknown-soft: rgba(125, 118, 106, 0.16);
  --nav-bg: rgba(26, 24, 20, 0.94);
  --danger: #d9776d;
  --ok: #7fb38a;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.3);
  --radius: 14px;
  --radius-sm: 9px;
  --nav-h: 60px;
  --serif: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --sans: 'Outfit', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
  --arabic: 'Noto Naskh Arabic', 'Geeza Pro', 'Arial', sans-serif;
  color-scheme: dark;
}

html.light {
  --bg: #f6f1e7;
  --bg-2: #efe8da;
  --surface: #fffdf8;
  --surface-2: #f4eee2;
  --surface-3: #ebe3d3;
  --border: #e0d6c3;
  --border-strong: #cfc2aa;
  --ink: #1d1913;
  --ink-2: #3f382d;
  --muted: #6f6555;
  --dim: #a59a87;
  --accent: #87651a;
  --accent-2: #7d5d16;
  --accent-ink: #fffdf8;
  --accent-soft: rgba(150, 113, 31, 0.1);
  --marriage: #a8505b;
  --male: #3d6590;
  --female: #944759;
  --unknown: #8d8473;
  --male-soft: rgba(76, 116, 160, 0.13);
  --female-soft: rgba(168, 90, 111, 0.13);
  --unknown-soft: rgba(141, 132, 115, 0.13);
  --nav-bg: rgba(255, 253, 248, 0.95);
  --shadow: 0 10px 40px rgba(60, 45, 20, 0.15);
  --shadow-sm: 0 2px 10px rgba(60, 45, 20, 0.08);
  color-scheme: light;
}

/* ── Base ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  transition: background .25s ease, color .25s ease;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-2); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
img { max-width: 100%; display: block; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.15; letter-spacing: .005em; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.ar { font-family: var(--arabic); direction: rtl; unicode-bidi: isolate; }

/* The tree mark used in a few places */
.boot-mark, .lock-mark, .hero-mark, .brand-mark {
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Cg fill='none' stroke='black' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M32 58V30M32 40l-11-9M32 36l12-10M21 31l-7 3M21 31l-2-8M44 26l7 2M44 26l1-8'/%3E%3Ccircle cx='32' cy='16' r='9'/%3E%3Ccircle cx='13' cy='35' r='5'/%3E%3Ccircle cx='18' cy='20' r='4.5'/%3E%3Ccircle cx='52' cy='29' r='5'/%3E%3Ccircle cx='46' cy='15' r='4.5'/%3E%3Cpath d='M22 58h20'/%3E%3C/g%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Cg fill='none' stroke='black' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M32 58V30M32 40l-11-9M32 36l12-10M21 31l-7 3M21 31l-2-8M44 26l7 2M44 26l1-8'/%3E%3Ccircle cx='32' cy='16' r='9'/%3E%3Ccircle cx='13' cy='35' r='5'/%3E%3Ccircle cx='18' cy='20' r='4.5'/%3E%3Ccircle cx='52' cy='29' r='5'/%3E%3Ccircle cx='46' cy='15' r='4.5'/%3E%3Cpath d='M22 58h20'/%3E%3C/g%3E%3C/svg%3E") center / contain no-repeat;
  color: var(--accent);
  display: inline-block;
}

/* ── Buttons & inputs ─────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 22px; border-radius: 999px;
  font-weight: 600; font-size: .9rem; letter-spacing: .02em;
  border: 1px solid var(--border-strong); color: var(--ink);
  background: var(--surface); transition: all .18s ease; white-space: nowrap;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-2); border-color: var(--accent-2); color: var(--accent-ink); transform: translateY(-1px); }
.btn-ghost { background: transparent; }
.btn-small { padding: 7px 14px; font-size: .8rem; }
.btn-group { display: flex; gap: 6px; flex-wrap: wrap; }

input[type="search"], input[type="text"], input[type="password"], select {
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 10px 14px; font-size: .92rem; color: var(--ink); outline: none; width: 100%;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input::placeholder { color: var(--dim); }
select { appearance: none; padding-right: 34px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: .85rem; color: var(--muted); cursor: pointer; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; }

/* ── Boot & lock screens ──────────────────────────────────── */
.boot { position: fixed; inset: 0; display: grid; place-content: center; justify-items: center; gap: 18px; background: var(--bg); z-index: 50; }
.boot-mark { width: 56px; height: 56px; animation: pulse 1.6s ease-in-out infinite; }
.boot-text { color: var(--muted); font-size: .9rem; letter-spacing: .04em; }
@keyframes pulse { 50% { opacity: .35; transform: scale(.96); } }

.lock { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(1200px 600px at 50% -10%, var(--accent-soft), transparent 70%), var(--bg); }
.lock-card { width: 100%; max-width: 420px; text-align: center; padding: 44px 32px 32px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 22px; box-shadow: var(--shadow); }
.lock-mark { width: 64px; height: 64px; margin-bottom: 14px; }
.lock-title { font-size: 2.3rem; font-style: italic; color: var(--accent); margin-bottom: 10px; }
.lock-sub { color: var(--muted); font-size: .95rem; margin-bottom: 26px; }
.lock-form { display: flex; gap: 8px; margin-bottom: 14px; }
.lock-form input { flex: 1; text-align: center; font-size: 1rem; padding: 13px 14px; border-radius: 999px; }
.lock-error { min-height: 22px; color: var(--danger); font-size: .88rem; margin-top: 10px; }
.lock-note { color: var(--muted); font-size: .78rem; margin-top: 8px; }
.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }

.preview-banner { background: #3a2f12; color: #f3dfa2; font-size: .82rem; padding: 8px 18px; text-align: center; }
html.light .preview-banner { background: #f3e2b0; color: #4f3d0b; }

/* ── Navigation ───────────────────────────────────────────── */
.nav { position: sticky; top: 0; z-index: 30; height: var(--nav-h); display: flex; align-items: center; gap: 14px;
  padding: 0 max(20px, env(safe-area-inset-right)) 0 max(20px, env(safe-area-inset-left)); background: var(--nav-bg); backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
.nav-brand { display: flex; align-items: center; gap: 10px; font-family: var(--serif); font-size: 1.25rem; font-weight: 600; color: var(--accent); white-space: nowrap; }
.brand-mark { width: 24px; height: 24px; }
.nav-links { display: flex; gap: 2px; margin-inline-start: 10px; }
.nav-links a { color: var(--muted); font-size: .88rem; font-weight: 500; padding: 8px 12px; border-radius: 8px; transition: all .15s ease; }
.nav-links a:hover { color: var(--ink); background: var(--surface-2); }
.nav-links a.active { color: var(--accent); background: var(--accent-soft); }
.nav-right { margin-inline-start: auto; display: flex; align-items: center; gap: 8px; }
.search-trigger { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px 0 12px; border: 1px solid var(--border-strong);
  border-radius: 999px; color: var(--muted); font-size: .85rem; min-width: 170px; transition: border-color .15s; background: var(--surface); }
.search-trigger:hover { border-color: var(--accent); color: var(--ink); }
.search-trigger svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; }
.search-trigger kbd { margin-inline-start: auto; font-family: var(--sans); font-size: .7rem; border: 1px solid var(--border-strong); border-radius: 5px; padding: 0 6px; color: var(--dim); }
.icon-btn { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); border: 1px solid var(--border-strong); background: var(--surface); transition: all .15s; }
.icon-btn:hover { color: var(--accent); border-color: var(--accent); }
.icon-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
#menu-btn svg { fill: currentColor; stroke: none; }
.i-sun { display: none; } html.light .i-sun { display: block; } html.light .i-moon { display: none; }
.nav-burger { display: none; width: 36px; height: 36px; flex-direction: column; justify-content: center; gap: 4px; padding: 0 8px; }
.nav-burger span { height: 2px; background: var(--ink-2); border-radius: 2px; transition: .2s; }
.nav-scrim { display: none; }

.menu-wrap { position: relative; }
.menu { position: absolute; inset-inline-end: 0; top: calc(100% + 10px); width: 280px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 8px; z-index: 40; }
.menu-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 10px; font-size: .88rem; color: var(--ink-2); }
.menu-toggle { cursor: pointer; border-radius: 8px; } .menu-toggle:hover { background: var(--surface-2); }
.menu-toggle input { accent-color: var(--accent); width: 17px; height: 17px; }
.menu-item { display: block; width: 100%; text-align: start; padding: 10px; border-radius: 8px; font-size: .88rem; color: var(--ink-2); }
.menu-item:hover { background: var(--surface-2); color: var(--accent); }
.seg { display: flex; border: 1px solid var(--border-strong); border-radius: 8px; overflow: hidden; }
.seg button { padding: 4px 10px; font-size: .8rem; color: var(--muted); }
.seg button + button { border-left: 1px solid var(--border-strong); }
.seg button:hover { background: var(--surface-2); color: var(--accent); }

/* ── Pages ────────────────────────────────────────────────── */
main { min-height: calc(100vh - var(--nav-h) - 70px); }
.page { display: none; max-width: 1080px; margin: 0 auto; padding: 48px 28px 72px; animation: fadeUp .35s ease both; }
.page.active { display: block; }
.page-wide { max-width: none; padding: 18px 20px 20px; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.page-head { margin-bottom: 28px; }
.page-head h1 { font-size: 2.6rem; color: var(--accent); margin-bottom: 6px; }
.section { margin-top: 56px; }
.section-title { font-size: 1.55rem; color: var(--ink); margin-bottom: 18px; display: flex; align-items: center; gap: 12px; }
.section-title::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.empty { text-align: center; padding: 56px 20px; border: 1px dashed var(--border-strong); border-radius: var(--radius); color: var(--muted); }
.empty h3, .empty h2 { color: var(--ink-2); font-size: 1.35rem; margin-bottom: 8px; }
.empty p { max-width: 460px; margin: 0 auto; font-size: .92rem; }
.empty code { background: var(--surface-2); padding: 2px 6px; border-radius: 5px; font-size: .85em; color: var(--accent); }

/* ── Home ─────────────────────────────────────────────────── */
.hero { text-align: center; padding: 34px 0 10px; }
.hero-mark { width: 62px; height: 62px; margin-bottom: 18px; }
.hero-title { font-size: clamp(2.6rem, 6vw, 4.2rem); font-style: italic; color: var(--accent); margin-bottom: 14px; }
.hero-sub { color: var(--muted); max-width: 560px; margin: 0 auto 34px; font-size: 1.05rem; }
.hero-stats { display: flex; justify-content: center; gap: clamp(22px, 6vw, 64px); margin-bottom: 36px; flex-wrap: wrap; }
.hero-stat-num { font-family: var(--serif); font-size: 2.6rem; font-weight: 600; color: var(--ink); line-height: 1; }
.hero-stat-label { font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-top: 6px; }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.home-me { margin-top: 44px; }
.me-card { display: flex; align-items: center; gap: 18px; padding: 20px 22px; border-radius: var(--radius);
  background: linear-gradient(120deg, var(--accent-soft), transparent 70%), var(--surface); border: 1px solid var(--border); }
.me-card p { color: var(--muted); font-size: .92rem; }
.me-card h3, .me-card h2 { font-size: 1.3rem; }
.me-card .btn { margin-inline-start: auto; }

.branch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.branch-card { text-align: start; padding: 20px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border);
  position: relative; overflow: hidden; transition: all .18s ease; display: block; width: 100%; }
.branch-card::before { content: ''; position: absolute; inset-inline-start: 0; top: 0; bottom: 0; width: 4px; background: var(--branch, var(--accent)); }
.branch-card:hover { border-color: var(--branch, var(--accent)); transform: translateY(-2px); }
.branch-card h3 { font-size: 1.3rem; color: var(--ink); margin-bottom: 4px; }
.branch-card p { color: var(--muted); font-size: .84rem; }
.branch-card .count { font-size: .78rem; color: var(--branch, var(--accent)); font-weight: 600; letter-spacing: .04em; margin-top: 10px; }
.branch-card.locked { opacity: .75; }
.branch-card.locked h3::after { content: ' 🔒'; font-size: .9rem; }

.spot { display: flex; gap: 18px; padding: 22px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); cursor: pointer; transition: border-color .15s; text-align: start; width: 100%; }
.spot:hover { border-color: var(--accent); }
.spot h3 { font-size: 1.35rem; }
.spot .meta { color: var(--muted); font-size: .85rem; margin: 4px 0 8px; }
.spot .bio { color: var(--ink-2); font-size: .9rem; }
.spot-actions { margin-top: 10px; }
.help-card { padding: 22px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); }
.help-card .big { font-family: var(--serif); font-size: 2.3rem; color: var(--accent); line-height: 1; }
.help-card p { color: var(--muted); font-size: .9rem; margin: 8px 0 14px; }
.help-list { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.stat-card { padding: 20px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); }
.stat-card .v { font-family: var(--serif); font-size: 1.7rem; font-weight: 600; color: var(--accent); line-height: 1.15; }
.stat-card .l { font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-top: 6px; }
.stat-card .s { font-size: .82rem; color: var(--ink-2); margin-top: 4px; }

/* ── Avatars & chips ──────────────────────────────────────── */
.avatar { flex-shrink: 0; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 600; font-size: .85rem; letter-spacing: .02em; color: var(--unknown); background: var(--unknown-soft);
  border: 1.5px solid var(--unknown); overflow: hidden; white-space: nowrap; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.m { color: var(--male); background: var(--male-soft); border-color: var(--male); }
.avatar.f { color: var(--female); background: var(--female-soft); border-color: var(--female); }
.avatar.lg { width: 72px; height: 72px; font-size: 1.3rem; }
.avatar.xl { width: 96px; height: 96px; font-size: 1.7rem; }
.avatar.deceased { filter: saturate(.4); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px; font-size: .8rem;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--ink-2); cursor: pointer; transition: all .15s; }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.tag { display: inline-block; font-size: .68rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; padding: 2px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.tag-accent { background: var(--accent-soft); color: var(--accent); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c, var(--accent)); display: inline-block; flex-shrink: 0; }

/* ── Tree ─────────────────────────────────────────────────── */
.tree-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab { padding: 8px 16px; border-radius: 999px; font-size: .85rem; font-weight: 600; border: 1px solid var(--border-strong); color: var(--muted); background: var(--surface); display: inline-flex; align-items: center; gap: 8px; transition: all .15s; }
.tab:hover { color: var(--ink); border-color: var(--c, var(--accent)); }
.tab.active { color: var(--ink); border-color: var(--c, var(--accent)); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--c, var(--accent)); }
.tab .n { font-weight: 500; color: var(--muted); font-size: .78rem; }
.tab.locked { opacity: .6; }
.tree-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.tree-tools .combo { width: 260px; }
.tree-stage { position: relative; height: calc(100vh - var(--nav-h) - 96px); height: calc(100dvh - var(--nav-h) - 96px); min-height: 460px; border-radius: var(--radius); overflow: hidden;
  background: radial-gradient(circle at 1px 1px, var(--border) 1px, transparent 0) 0 0 / 26px 26px, var(--bg-2); border: 1px solid var(--border); }
#tree-svg { width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
#tree-svg:active { cursor: grabbing; }
.tree-zoom { position: absolute; inset-inline-end: 14px; top: 14px; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow-sm); }
.tree-zoom button { width: 38px; height: 38px; font-size: 1.2rem; color: var(--ink-2); display: grid; place-items: center; }
.tree-zoom button + button { border-top: 1px solid var(--border); }
.tree-zoom button:hover { color: var(--accent); background: var(--surface-2); }
.tree-zoom svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.tree-legend { position: absolute; inset-inline-start: 14px; bottom: 12px; display: flex; gap: 14px; flex-wrap: wrap; font-size: .74rem; color: var(--muted);
  background: var(--surface); padding: 7px 12px; border-radius: 10px; border: 1px solid var(--border); pointer-events: none; }
.tree-legend span { display: inline-flex; align-items: center; gap: 6px; }
.lgd { display: inline-block; width: 20px; height: 0; border-top: 2px solid var(--accent); }
.lgd-marriage { border-top-color: var(--marriage); }
.lgd-link { border-top: 2px dashed var(--muted); }
.lgd-plus { width: 16px; height: 16px; border: 1px solid var(--accent); border-radius: 50%; display: inline-grid; place-items: center; font-style: normal; font-size: 11px; color: var(--accent); }
.tree-empty { position: absolute; inset: 0; display: grid; place-items: center; padding: 30px; }

/* SVG tree pieces */
.t-link { fill: none; stroke: var(--accent); stroke-width: 1.6; opacity: .55; }
.t-marriage { fill: none; stroke: var(--marriage); stroke-width: 2.2; opacity: .8; }
.t-link.hl { opacity: 1; stroke-width: 2.6; }
.t-node { cursor: pointer; }
.t-card { fill: var(--surface); stroke: var(--border-strong); stroke-width: 1.2; transition: stroke .15s; }
.t-node:hover .t-card { stroke: var(--accent); }
.t-node.ghost .t-card { stroke-dasharray: 5 4; fill: var(--bg-2); }
.t-node.placeholder .t-card { fill: var(--bg-2); }
.t-node.selected .t-card { stroke: var(--accent); stroke-width: 2.6; }
.t-node.me .t-card { stroke: var(--accent); stroke-width: 2; }
.t-node.flash .t-card { animation: flash 1.4s ease 2; }
@keyframes flash { 50% { stroke: var(--accent-2); stroke-width: 5; } }
.t-node.dim { opacity: .35; }
.t-bar { pointer-events: none; }
.t-name { font-family: var(--sans); font-size: 13px; font-weight: 600; fill: var(--ink); }
.t-node.placeholder .t-name, .t-node.ghost .t-name { font-style: italic; font-weight: 500; fill: var(--ink-2); }
.t-sub { font-family: var(--sans); font-size: 11px; fill: var(--muted); }
.t-ar { font-family: var(--arabic); font-size: 11.5px; fill: var(--accent); }
.t-av { stroke-width: 1.5; }
.t-ini { font-family: var(--sans); font-size: 12px; font-weight: 600; text-anchor: middle; dominant-baseline: central; }
.t-toggle { cursor: pointer; }
.t-toggle circle, .t-toggle rect { fill: var(--surface); stroke: var(--accent); stroke-width: 1.4; }
.t-toggle text { fill: var(--accent); font-family: var(--sans); font-size: 11px; font-weight: 700; text-anchor: middle; dominant-baseline: central; }
.t-toggle:hover circle, .t-toggle:hover rect { fill: var(--accent); } .t-toggle:hover text { fill: var(--accent-ink); }
.t-badge { font-size: 11px; fill: var(--muted); }
.t-me-badge rect { fill: var(--accent); } .t-me-badge text { fill: var(--accent-ink); font-size: 9.5px; font-weight: 700; font-family: var(--sans); letter-spacing: .08em; text-anchor: middle; dominant-baseline: central; }
.t-root-label { font-family: var(--serif); font-size: 15px; fill: var(--muted); font-style: italic; }

/* ── Combo box (autocomplete) ─────────────────────────────── */
.combo { position: relative; }
.combo-list { position: absolute; top: calc(100% + 6px); left: 0; right: 0; max-height: 320px; overflow-y: auto; z-index: 25;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: 5px; }
.opt { display: flex; align-items: center; gap: 10px; padding: 8px 9px; border-radius: 7px; cursor: pointer; }
.opt .avatar { width: 32px; height: 32px; font-size: .72rem; }
.opt:hover, .opt.on { background: var(--surface-2); }
.opt-name { font-size: .9rem; font-weight: 500; }
.opt-meta { font-size: .76rem; color: var(--muted); }
.opt-text { min-width: 0; }
.opt-other { margin-inline-start: auto; color: var(--accent); font-size: .85rem; white-space: nowrap; }
.opt-empty { padding: 12px; color: var(--muted); font-size: .85rem; text-align: center; }

/* ── People ───────────────────────────────────────────────── */
.filters { display: grid; grid-template-columns: 2fr repeat(4, 1fr); gap: 10px; margin-bottom: 18px; }
.filters-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.people-list { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.prow { display: grid; grid-template-columns: 44px minmax(0, 3fr) minmax(0, 1.3fr) 64px; align-items: center; gap: 14px; padding: 11px 16px; border-top: 1px solid var(--border); cursor: pointer; text-align: start; width: 100%; transition: background .12s; }
.prow:first-child { border-top: 0; }
.prow:hover { background: var(--surface-2); }
.prow-name { font-weight: 600; font-size: .95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prow-main { display: flex; flex-direction: column; min-width: 0; }
.prow-other { font-weight: 400; color: var(--accent); font-size: .85rem; margin-inline-start: 8px; }
.prow-sub, .prow-loc { font-size: .82rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prow-gen { font-size: .76rem; color: var(--muted); text-align: end; }
.prow .yrs { color: var(--muted); font-weight: 400; font-size: .82rem; margin-left: 6px; }
.more-row { padding: 14px; text-align: center; border-top: 1px solid var(--border); }

/* ── Relations ────────────────────────────────────────────── */
.rel-pickers { display: grid; grid-template-columns: 1fr auto 1fr; gap: 14px; align-items: end; margin-bottom: 24px; }
.rel-picker label { display: block; font-size: .74rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.rel-swap { width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--border-strong); color: var(--accent); font-size: 1.1rem; background: var(--surface); }
.rel-swap:hover { border-color: var(--accent); }
.rel-quick { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.rel-result { border-radius: var(--radius); }
.rel-card { padding: 34px 28px; text-align: center; background: var(--surface); border: 1px solid var(--accent); border-radius: var(--radius); }
.rel-sentence { font-family: var(--serif); font-size: clamp(1.5rem, 3.4vw, 2.2rem); line-height: 1.3; }
.rel-sentence b { color: var(--accent); font-weight: 600; }
.rel-reverse { color: var(--muted); margin-top: 10px; }
.rel-path { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px 4px; margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--border); }
.rel-path .chip { background: var(--surface-2); }
.rel-step { font-size: .74rem; color: var(--muted); padding: 0 4px; }
.rel-path-title { width: 100%; font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }

/* ── Places ───────────────────────────────────────────────── */
.country { margin-bottom: 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.country-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.country-head .flag { font-size: 1.6rem; line-height: 1; }
.country-head h3, .country-head h2 { font-size: 1.4rem; }
.country-head .n { margin-inline-start: auto; color: var(--muted); font-size: .85rem; }
.city { padding: 14px 20px; border-top: 1px solid var(--border); display: grid; grid-template-columns: 170px 1fr; gap: 12px; }
.city:first-of-type { border-top: 0; }
.city-name { font-weight: 600; font-size: .9rem; }
.city-name span { display: block; font-weight: 400; color: var(--muted); font-size: .78rem; }
.city-people { display: flex; flex-wrap: wrap; gap: 6px; }
.places-bar { display: flex; height: 10px; border-radius: 999px; overflow: hidden; margin: 6px 0 26px; background: var(--surface-2); }
.places-bar i { display: block; height: 100%; }
.places-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: .82rem; color: var(--muted); margin-bottom: 8px; }
.places-legend span { display: inline-flex; align-items: center; gap: 6px; }

/* ── History ──────────────────────────────────────────────── */
.timeline { position: relative; padding-inline-start: 30px; }
.timeline::before { content: ''; position: absolute; inset-inline-start: 7px; top: 6px; bottom: 6px; width: 2px; background: linear-gradient(var(--accent), var(--border) 80%, transparent); }
.tl-item { position: relative; margin-bottom: 18px; }
.tl-item::before { content: ''; position: absolute; inset-inline-start: -29px; top: 20px; width: 12px; height: 12px; border-radius: 50%; background: var(--bg); border: 2px solid var(--c, var(--accent)); }
.tl-card { padding: 16px 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); transition: border-color .15s; }
.tl-card.clickable { cursor: pointer; } .tl-card.clickable:hover { border-color: var(--accent); }
.tl-year { font-size: .74rem; font-weight: 700; letter-spacing: .12em; color: var(--accent); }
.tl-title { font-family: var(--serif); font-size: 1.25rem; margin: 2px 0 4px; }
.tl-text { font-size: .9rem; color: var(--muted); }
.tl-item.auto .tl-card { padding: 11px 18px; }
.tl-item.auto .tl-title { font-size: 1.05rem; font-family: var(--sans); font-weight: 500; }
.tl-decade { font-family: var(--serif); font-size: 1.5rem; color: var(--ink-2); margin: 28px 0 12px; }
.tl-decade:first-child { margin-top: 0; }

/* ── Gallery ──────────────────────────────────────────────── */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.g-item { border-radius: var(--radius); overflow: hidden; background: var(--surface); border: 1px solid var(--border); cursor: zoom-in; text-align: start; transition: transform .18s, border-color .18s; }
.g-item:hover { transform: translateY(-2px); border-color: var(--accent); }
.g-item img { width: 100%; aspect-ratio: 4/3; object-fit: cover; background: var(--surface-2); }
.g-cap { padding: 10px 14px; font-size: .84rem; color: var(--ink-2); }
.g-cap span { color: var(--muted); }
.lightbox { position: fixed; inset: 0; z-index: 90; background: rgba(5, 5, 4, .94); display: grid; place-items: center; padding: 40px 70px; }
.lightbox figure { max-width: 100%; max-height: 100%; text-align: center; }
.lightbox img { max-height: 80vh; max-width: 100%; border-radius: 10px; margin: 0 auto; }
.lightbox figcaption { color: #cfc6b2; margin-top: 14px; font-size: .92rem; }
.lb-btn { position: absolute; color: #e8dfca; font-size: 2rem; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; }
.lb-btn:hover { background: rgba(255, 255, 255, .08); }
.lb-close { top: 16px; right: 16px; font-size: 1.3rem; } .lb-prev { left: 12px; top: 50%; transform: translateY(-50%); } .lb-next { right: 12px; top: 50%; transform: translateY(-50%); }

/* ── About ────────────────────────────────────────────────── */
.about-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.about-card { padding: 22px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.about-card h3, .about-card h2 { font-size: 1.3rem; color: var(--accent); margin-bottom: 8px; }
.about-card p, .about-card li { font-size: .9rem; color: var(--ink-2); }
.about-card ul { padding-inline-start: 18px; }
.about-card kbd { font-family: var(--sans); font-size: .76rem; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 5px; padding: 0 6px; color: var(--accent); }

/* ── Profile drawer ───────────────────────────────────────── */
.drawer-scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 60; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.drawer { position: fixed; top: 0; inset-inline-end: 0; bottom: 0; width: min(440px, 100vw); z-index: 61; background: var(--surface); border-inline-start: 1px solid var(--border);
  box-shadow: var(--shadow); transform: translateX(105%); transition: transform .28s cubic-bezier(.2, .8, .2, 1); display: flex; flex-direction: column; }
.drawer.open { transform: none; }
.drawer-close { position: absolute; top: max(14px, env(safe-area-inset-top)); inset-inline-end: 14px; width: 34px; height: 34px; border-radius: 50%; color: var(--muted); border: 1px solid var(--border-strong); z-index: 2; background: var(--surface); }
.drawer-close:hover { color: var(--accent); border-color: var(--accent); }
.drawer-body { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 30px 26px calc(40px + env(safe-area-inset-bottom)); flex: 1; overscroll-behavior: contain; }
.pf-head { display: flex; gap: 18px; align-items: center; margin-bottom: 14px; padding-inline-end: 34px; }
.pf-name { font-size: 1.75rem; line-height: 1.15; }
.pf-other { font-size: 1.05rem; color: var(--accent); margin-top: 4px; }
.pf-meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 16px; }
.pf-rel { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--ink); font-size: .92rem; margin-bottom: 16px; }
.pf-rel b { color: var(--accent); }
.pf-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 18px; }
.pf-fact { padding: 10px 12px; background: var(--surface-2); border-radius: var(--radius-sm); }
.pf-fact .k { font-size: .66rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.pf-fact .v { font-size: .9rem; margin-top: 2px; }
.pf-bio { color: var(--ink-2); font-size: .94rem; margin-bottom: 18px; white-space: pre-line; }
.pf-section { margin-top: 20px; }
.pf-section h4 { font-family: var(--sans); font-size: .7rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); margin-bottom: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.pf-person { display: flex; align-items: center; gap: 11px; width: 100%; text-align: start; padding: 7px 8px; border-radius: var(--radius-sm); transition: background .12s; }
.pf-person:hover { background: var(--surface-2); }
.pf-person .avatar { width: 36px; height: 36px; font-size: .76rem; }
.pf-person-name { font-size: .92rem; font-weight: 500; }
.pf-person-sub { font-size: .76rem; color: var(--muted); }
.pf-person.missing { cursor: default; opacity: .7; } .pf-person.missing:hover { background: none; }
.pf-group-label { font-size: .76rem; color: var(--muted); margin-block: 8px 2px; margin-inline-start: 8px; }
.pf-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.pf-list { padding-inline-start: 18px; color: var(--ink-2); font-size: .9rem; }
.pf-correct { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pf-correct span { font-size: .82rem; color: var(--muted); }

/* ── Search modal / dialog ────────────────────────────────── */
.modal { position: fixed; inset: 0; z-index: 70; display: flex; justify-content: center; align-items: flex-start; padding: 10vh 16px 16px; }
.modal-scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, .5); backdrop-filter: blur(3px); animation: fade .15s; }
.search-box { position: relative; width: 100%; max-width: 580px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; animation: fadeUp .18s; }
.search-box input { border: 0; border-bottom: 1px solid var(--border); border-radius: 0; padding: 18px 20px; font-size: 1.05rem; box-shadow: none !important; background: transparent; }
.search-results { max-height: 55vh; overflow-y: auto; padding: 6px; }
.search-hint { font-size: .74rem; color: var(--muted); padding: 9px 16px; border-top: 1px solid var(--border); }
.dialog { position: relative; width: 100%; max-width: 480px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 18px; box-shadow: var(--shadow); padding: 30px 28px 26px; animation: fadeUp .18s; max-height: 80vh; overflow-y: auto; }
.dialog h2 { font-size: 1.7rem; color: var(--accent); margin-bottom: 8px; }
.dialog p { color: var(--muted); font-size: .92rem; margin-bottom: 16px; }
.dialog-close { position: absolute; top: 14px; inset-inline-end: 14px; width: 32px; height: 32px; border-radius: 50%; color: var(--muted); }
.dialog-close:hover { color: var(--accent); }
.dialog .lock-form { margin-top: 6px; }
.welcome-tips { display: grid; gap: 10px; margin: 18px 0 22px; text-align: start; }
.welcome-tip { display: flex; gap: 12px; align-items: flex-start; font-size: .92rem; color: var(--ink-2); }
.welcome-tip b { color: var(--ink); }
.welcome-tip i { font-style: normal; width: 28px; height: 28px; flex-shrink: 0; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 700; font-size: .8rem; }

/* ── Toast & footer ───────────────────────────────────────── */
.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); z-index: 95; background: var(--surface); color: var(--ink);
  border: 1px solid var(--accent); border-radius: 999px; padding: 10px 20px; font-size: .86rem; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: all .25s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.footer { border-top: 1px solid var(--border); padding: 22px; text-align: center; font-size: .78rem; color: var(--muted); letter-spacing: .05em; }

/* ── Phones & tablets ─────────────────────────────────────── */
@media (max-width: 980px) {
  .nav { backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--surface); }
  .nav-burger { display: flex; }
  .nav-links { position: fixed; top: var(--nav-h); inset-inline-start: 0; bottom: 0; width: 260px; margin: 0; flex-direction: column; gap: 2px; padding: 14px;
    background: var(--surface); border-inline-end: 1px solid var(--border); transform: translateX(-100%); transition: transform .25s ease; z-index: 31; }
  .nav-links a { padding: 13px 14px; font-size: 1rem; }
  body.nav-open .nav-links { transform: none; }
  body.nav-open .nav-scrim { display: block; position: fixed; inset: var(--nav-h) 0 0 0; background: rgba(0, 0, 0, .45); z-index: 29; }
  .search-trigger { min-width: 0; padding: 0 10px; }
  input[type="search"], input[type="text"], input[type="password"], select { font-size: 16px; }
  .search-trigger-text, .search-trigger kbd { display: none; }
  .filters { grid-template-columns: 1fr 1fr; }
  .filters input { grid-column: 1 / -1; }
  .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .nav { padding: 0 12px; gap: 8px; }
  .nav-brand { font-size: 1.1rem; }
  .page { padding: 30px 16px 56px; }
  .page-wide { padding: 10px 8px 8px; }
  .page-head h1 { font-size: 2.1rem; }
  .tree-tools { width: 100%; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; width: 100%; padding-bottom: 2px; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex-shrink: 0; }
  .tree-head { gap: 8px; }
  .tree-stage { height: calc(100vh - var(--nav-h) - 118px); height: calc(100dvh - var(--nav-h) - 118px); min-height: 360px; }
  .tree-legend { display: none; }
  .prow { grid-template-columns: 40px minmax(0, 1fr); gap: 12px; }
  .prow-loc, .prow-gen, .prow-other { display: none; }
  .prow-main { min-width: 0; }
  .rel-pickers { grid-template-columns: 1fr; }
  .rel-swap { justify-self: center; transform: rotate(90deg); }
  .city { grid-template-columns: 1fr; gap: 6px; }
  .me-card { flex-wrap: wrap; } .me-card .btn { margin-left: 0; }
  .drawer { width: 100vw; border-left: 0; }
  .pf-facts { grid-template-columns: 1fr; }
  .lock-form { flex-direction: column; }
  .lightbox { padding: 20px 8px; }
  .lb-prev, .lb-next { top: auto; bottom: 16px; transform: none; }
}

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

/* ── Printing ─────────────────────────────────────────────── */
@media print {
  :root, html.light { --bg: #fff; --surface: #fff; --surface-2: #f3f3f3; --ink: #000; --ink-2: #222; --muted: #555; --border: #ccc; --accent: #6b5214; }
  body { background: #fff; }
  .nav, .footer, .tree-zoom, .tree-legend, .tree-tools, .filters, .hero-actions, .drawer-close, .pf-actions, .preview-banner, .toast, .drawer-scrim { display: none !important; }
  .page { padding: 0; animation: none; }
  .drawer.open { position: static; transform: none; width: auto; box-shadow: none; border: 0; }
  body.printing-profile #app { display: none !important; }
  .people-list, .prow, .country, .stat-card, .tl-card { break-inside: avoid; }
}

/* ── New pieces ───────────────────────────────────────────── */
.small { font-size: .82rem; margin-top: 12px; }
.help-card p:first-child { margin-top: 0; }
.lang-btn { height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink-2); font-size: .85rem; font-weight: 600; font-family: var(--arabic), var(--sans); }
.lang-btn:hover { color: var(--accent); border-color: var(--accent); }
html[lang="ar"] .lang-btn { font-family: var(--sans); }
.lock { position: relative; }
.lock-lang { position: absolute; top: max(16px, env(safe-area-inset-top)); inset-inline-end: 16px; }
.seg-lg { border-radius: 999px; }
.seg-lg button { padding: 7px 14px; font-size: .82rem; font-weight: 600; }
.seg button.on { background: var(--accent); color: var(--accent-ink); }
.tree-hint { pointer-events: none; }
.t-av { stroke-width: 1.5; }
.t-av.m { fill: var(--male-soft); stroke: var(--male); } .t-av.f { fill: var(--female-soft); stroke: var(--female); } .t-av.u { fill: var(--unknown-soft); stroke: var(--unknown); }
.t-ini.m { fill: var(--male); } .t-ini.f { fill: var(--female); } .t-ini.u { fill: var(--unknown); }
.t-link.dashed { stroke-dasharray: 5 4; }
.t-node.focus .t-card { stroke: var(--accent); stroke-width: 2.6; fill: var(--surface-2); }
.spot-text { display: flex; flex-direction: column; min-width: 0; }
.spot-name { font-family: var(--serif); font-size: 1.35rem; font-weight: 600; color: var(--ink); }
.spot-other { color: var(--accent); }
.spot .meta, .spot .bio { display: block; }
.pf-person-text { display: flex; flex-direction: column; min-width: 0; }
.pf-person-sub { font-size: .76rem; color: var(--muted); }
.tag-branch { display: inline-flex; gap: 6px; align-items: center; }
.btn:disabled { opacity: .45; cursor: default; }
.tl-item.auto .tl-card { padding: 11px 18px; }

/* ── Arabic (right-to-left) ───────────────────────────────── */
html[lang="ar"] { --sans: 'Noto Naskh Arabic', 'Outfit', system-ui, sans-serif; --serif: 'Noto Naskh Arabic', 'Cormorant Garamond', serif; }
html[lang="ar"] body { font-size: 1.04em; }
html[lang="ar"] .hero-title, html[lang="ar"] .lock-title { font-style: normal; font-weight: 600; }
html[lang="ar"] .hero-stat-label, html[lang="ar"] .stat-card .l, html[lang="ar"] .pf-fact .k, html[lang="ar"] .pf-section h4,
html[lang="ar"] .rel-picker label, html[lang="ar"] .rel-path-title, html[lang="ar"] .tag, html[lang="ar"] .tl-year { letter-spacing: 0; text-transform: none; }
html[lang="ar"] .t-name { font-family: var(--arabic); font-size: 13.5px; }
html[lang="ar"] .t-sub { font-family: var(--arabic); }
html[dir="rtl"] .drawer { transform: translateX(-105%); }
html[dir="rtl"] .drawer.open { transform: none; }
html[dir="rtl"] select { background-position: 18px 50%, 13px 50%; padding: 10px 14px 10px 34px; }
html[dir="rtl"] .rel-swap { transform: scaleX(-1); }
@media (max-width: 980px) {
  html[dir="rtl"] .nav-links { transform: translateX(100%); }
  html[dir="rtl"] body.nav-open .nav-links { transform: none; }
}
@media (max-width: 680px) {
  html[dir="rtl"] .rel-swap { transform: rotate(90deg); }
  .tree-tools { gap: 8px; }
  .seg-lg { flex: 1; } .seg-lg button { flex: 1; padding: 8px 6px; }
  #tree-search-combo { display: none; }
  .tree-tools { flex-wrap: nowrap; }
  #full-tools { flex-wrap: nowrap; }
  #full-tools .btn { padding: 7px 10px; }
  #tree-save { display: none; }
  .tree-hint { display: block; font-size: .72rem; inset-inline-end: 14px; text-align: center; }
  .lang-btn { padding: 0 10px; }
  .nav-right { gap: 6px; }
}

/* ── Suggest a new family member ──────────────────────────── */
.dialog { max-width: 560px; }
.sug-form { display: flex; flex-direction: column; gap: 12px; }
.sug-form label > span, .sug-row > legend { display: block; font-size: .78rem; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.sug-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sug-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.sug-row { border: 0; padding: 0; margin: 0; min-width: 0; }
.sug-row > legend { margin: 0 0 4px; padding: 0; width: 100%; }
.sug-row .check { margin: 0; }
.sug-form textarea, .sug-copy { width: 100%; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 10px 14px; color: var(--ink); font: inherit; font-size: .92rem; resize: vertical; }
.sug-form .btn-primary { align-self: flex-start; }
@media (max-width: 680px) { .sug-grid { grid-template-columns: 1fr; } .sug-form textarea { font-size: 16px; } }

/* ── Show me, version line, English under Arabic on cards ── */
.btn-me { border-color: var(--accent); color: var(--accent); }
.btn-me::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); display: inline-block; margin-inline-end: 7px; vertical-align: middle; }
.footer-version { font-size: .72rem; }
.t-en { font-family: var(--sans) !important; font-size: 11px; fill: var(--accent) !important; }
.preview-banner a { color: inherit; text-decoration: underline; }
.preview-banner #preview-sites:not(:empty) { margin-inline-start: 8px; white-space: nowrap; }

/* ── Comfortable tap targets on phones and tablets (44px) ── */
@media (max-width: 980px) {
  .icon-btn, .nav-burger, .drawer-close, .dialog-close { min-width: 44px; min-height: 44px; }
  .lang-btn, .search-trigger { min-height: 44px; }
  .tree-zoom button { width: 44px; height: 44px; }
  .seg button { min-height: 44px; }
  .tree-tools .btn-small, .pf-actions .btn-small, .pf-correct .btn-small { min-height: 44px; }
  .pf-person, .prow, .opt { min-height: 48px; }
}
@media (max-width: 680px) {
  .btn-me { padding: 7px 10px; white-space: nowrap; }
  .btn-me::before { margin-inline-end: 5px; }
  .icon-btn, .nav-burger { min-width: 40px; min-height: 40px; width: 40px; height: 40px; }
  .lang-btn { min-height: 40px; height: 40px; }
}

/* ── Narrow phones: keep the header and tree buttons inside the screen ── */
.nav-brand { min-width: 0; }
#brand-title { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
@media (max-width: 680px) {
  .nav-inner, .nav > div:first-child { min-width: 0; }
  #fam-back { padding-inline: 12px; }
}
@media (max-width: 440px) {
  #brand-title { display: none; }
  .nav-brand { min-width: 40px; min-height: 44px; justify-content: center; }
  .seg-lg button { padding: 8px 4px; font-size: .8rem; }
  .btn-me, #fam-back { padding-inline: 9px; font-size: .8rem; }
  .btn-me::before { display: none; }
  .tree-tools { gap: 6px; }
}
@media (max-width: 440px) { .seg-lg button { white-space: nowrap; } }
@media (max-width: 350px) { .seg-lg button, .btn-me, #fam-back { font-size: .74rem; padding-inline: 6px; } }

/* Links inside sentences are underlined so they stand out from the text */
.about-card a, .help-card p a, .pf-rel a, .lock-sub a { text-decoration: underline; text-underline-offset: 2px; }
/* Shown only if JavaScript is switched off */
.noscript { max-width: 460px; margin: 18vh auto 0; padding: 24px; text-align: center; color: #f2ecdc; background: #1a1814; border: 1px solid #3d372f; border-radius: 16px; font: 16px/1.6 system-ui, sans-serif; }
