/* Vaunshaval — hand-written CSS (shared hosting, no build step).

   Look: a heritage family book. Warm ivory paper, deep banyan green,
   antique gold accents, a classic serif (Fraunces) for headings and Inter
   for everything you read and tap. Mobile first in spirit: every layout
   below is checked at 360–420px wide. */

:root {
  --bg: #fbf8f2;
  --bg-2: #f4eee3;
  --surface: #ffffff;
  --surface-2: #f3ede2;
  --border: #e7dece;
  --border-strong: #d8ccb6;
  --text: #221d16;
  --text-muted: #6a6152;
  --primary: #1f5a41;
  --primary-hover: #17472f;
  --primary-soft: #e3eee7;
  --primary-fg: #ffffff;
  --accent: #b9852b;
  --accent-soft: #f6ead1;
  --deep: #10261c;
  --male: #3f6f9e;
  --female: #b5586f;
  --other: #8a6fb0;
  --danger: #b3432b;
  --ring: #1f5a4140;
  --shadow: 38 30 16;
  --radius: 14px;
  --radius-sm: 10px;
  /* Storybook */
  --paper: #fffdf8;
  --paper-2: #f6efdf;
  --paper-edge: #e6dcc4;
  --ink: #2a241b;
  --ink-soft: #5c5244;
  --gold-ink: #94681b;
  --serif: "Cormorant Garamond", "Noto Serif Devanagari", Georgia, "Times New Roman", serif;
  --display: "Fraunces", "Noto Serif Devanagari", Georgia, "Times New Roman", serif;
  --sans: "Inter", "Noto Sans Devanagari", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --header-h: 68px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14120e;
    --bg-2: #1a1712;
    --surface: #1e1a14;
    --surface-2: #28231b;
    --border: #363026;
    --border-strong: #4a4234;
    --text: #f2ede2;
    --text-muted: #b2a891;
    --primary: #5aa77e;
    --primary-hover: #6dbb90;
    --primary-soft: #1f3329;
    --primary-fg: #0c1a12;
    --accent: #e0ac47;
    --accent-soft: #3a2e17;
    --deep: #0c1a13;
    --male: #7fb0dd;
    --female: #e090a4;
    --other: #b79fe0;
    --danger: #e08064;
    --ring: #5aa77e55;
    --shadow: 0 0 0;
    --paper: #1d1913;
    --paper-2: #26211a;
    --paper-edge: #3a3327;
    --ink: #efe7d6;
    --ink-soft: #bfb39b;
    --gold-ink: #e0ac47;
  }
}

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

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

/* NOTE: body must use min-height, never a fixed height:100%. It is a column
   flex container, so a fixed height makes every section a shrinkable flex
   item — and any section with `overflow:hidden` (e.g. .hero) loses its
   automatic minimum size and collapses to just its padding. */
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  display: flex;
  flex-direction: column;
  min-height: 100%;
  overflow-x: clip;
}
body > * { flex-shrink: 0; }

a { color: inherit; text-decoration: none; }
img, svg, video { max-width: 100%; display: block; }
/* Browsers give fieldsets a min-width of their content, which lets a wide
   table inside push the whole page sideways on a phone. */
fieldset { min-width: 0; }
::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.container { width: 100%; max-width: 1160px; margin-inline: auto; padding-inline: 1.25rem; }
.container-narrow { max-width: 720px; }
.container-mid { max-width: 960px; }

.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: .35rem; } .gap-2 { gap: .6rem; } .gap-3 { gap: .9rem; } .gap-4 { gap: 1.2rem; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.center { text-align: center; }
.muted { color: var(--text-muted); }
.small { font-size: .875rem; }
.tiny { font-size: .78rem; }
.bold { font-weight: 700; }
.mt-1{margin-top:.4rem}.mt-2{margin-top:.8rem}.mt-3{margin-top:1.2rem}.mt-4{margin-top:1.8rem}.mt-5{margin-top:2.5rem}
.mb-1{margin-bottom:.4rem}.mb-2{margin-bottom:.8rem}.mb-3{margin-bottom:1.2rem}.mb-4{margin-bottom:1.8rem}
/* Vertical only: these sit on .container, whose side padding must survive. */
.py-4 { padding-block: 2.5rem; } .py-6 { padding-block: 4rem; }

h1, h2 { font-family: var(--display); font-optical-sizing: auto; color: var(--text); }
h1 { font-size: clamp(1.9rem, 4.2vw, 2.5rem); font-weight: 600; letter-spacing: -.02em; line-height: 1.12; }
h2 { font-size: clamp(1.5rem, 3.2vw, 2rem); font-weight: 600; letter-spacing: -.015em; line-height: 1.2; }
h3 { font-size: 1.02rem; font-weight: 700; letter-spacing: -.005em; }
:lang(mr) h1, :lang(mr) h2, :lang(hi) h1, :lang(hi) h2 { font-family: "Noto Serif Devanagari", var(--display); letter-spacing: 0; }

.eyebrow {
  display: inline-flex; align-items: center; gap: .5rem;
  font-size: .74rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--gold-ink);
}
.eyebrow::before { content: ""; width: 22px; height: 1.5px; background: currentColor; opacity: .7; }
.section-head { max-width: 640px; margin-bottom: 2.4rem; }
.section-head.center { margin-inline: auto; }
.section-head.center .eyebrow::after { content: ""; width: 22px; height: 1.5px; background: currentColor; opacity: .7; }
.section-head h2 { margin-top: .6rem; }
.section-head p { margin-top: .7rem; color: var(--text-muted); font-size: 1.02rem; }

.ico { width: 1.15em; height: 1.15em; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; display: inline-block; vertical-align: -.2em; }

/* --- Components ------------------------------------------------------ */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgb(var(--shadow) / .05), 0 10px 30px -18px rgb(var(--shadow) / .18);
}
.card-pad { padding: 1.5rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 42px; border-radius: 999px; padding: .6rem 1.2rem;
  font: inherit; font-weight: 600; font-size: .9rem; line-height: 1.2; text-align: center;
  border: 1px solid transparent; cursor: pointer; white-space: nowrap;
  transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s, transform .1s;
}
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: var(--primary-fg); box-shadow: 0 6px 16px -8px color-mix(in srgb, var(--primary) 80%, transparent); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--surface-2); border-color: var(--text-muted); }
.btn-ghost { background: transparent; color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 60%, transparent); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-gold { background: linear-gradient(180deg, #e8c27a, #c99a45); color: #1c1606; }
.btn-gold:hover { filter: brightness(1.05); }
.btn-lg { min-height: 50px; padding: .8rem 1.6rem; font-size: 1rem; }
.btn-block { width: 100%; white-space: normal; }
.btn.tiny { min-height: 34px; padding: .35rem .8rem; font-size: .8rem; }
.btn.small { min-height: 36px; padding: .4rem .9rem; font-size: .85rem; }

.input, select.input, textarea.input {
  width: 100%; min-height: 44px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text);
  padding: .6rem .8rem; font: inherit; font-size: .95rem; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input::placeholder { color: color-mix(in srgb, var(--text-muted) 75%, transparent); }
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--ring); }
textarea.input { resize: vertical; line-height: 1.55; }

.label { display: block; font-size: .82rem; font-weight: 600; color: var(--text-muted); margin-bottom: .35rem; }

.badge {
  display: inline-flex; align-items: center; gap: .35rem;
  border-radius: 999px; padding: .28rem .75rem;
  font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  background: var(--primary-soft); color: var(--primary);
}

.alert { border-radius: var(--radius-sm); padding: .7rem .9rem; font-size: .9rem; margin-bottom: 1rem; }
.alert-error { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.alert-ok { background: var(--primary-soft); color: var(--primary); }

.code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--surface-2); border-radius: .35rem; padding: .15rem .45rem; font-size: .85em;
}

.avatar { border-radius: 999px; object-fit: cover; border: 1px solid var(--border); flex-shrink: 0; }
.avatar-fallback {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px; color: #fff; font-weight: 700; flex-shrink: 0;
}

.grid { display: grid; gap: 1.2rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 860px) { .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); } }

.divider { border: 0; border-top: 1px solid var(--border); margin: 1.5rem 0; }

/* Page title block used across app pages */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.6rem; }
.page-head p { color: var(--text-muted); margin-top: .35rem; }

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

.site-header {
  position: sticky; top: 0; z-index: 40;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(12px); backdrop-filter: saturate(1.4) blur(12px);
}
.site-header .inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; height: var(--header-h); padding: 0 1.25rem; max-width: 1160px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: .65rem; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex-shrink: 0;
  background: radial-gradient(circle at 30% 25%, #2f7a58, var(--primary) 60%, #143b2a); color: #f6e7c4;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.12), 0 6px 14px -8px rgba(16,38,28,.8);
}
.brand-text { display: flex; flex-direction: column; line-height: 1; }
.brand-name { font-family: var(--display); font-size: 1.28rem; font-weight: 600; letter-spacing: -.01em; }
.brand-sub { font-size: .7rem; color: var(--gold-ink); margin-top: .2rem; font-weight: 500; }
.nav { display: flex; align-items: center; gap: .15rem; }
.nav a { padding: .45rem .8rem; border-radius: 999px; font-size: .9rem; font-weight: 500; color: var(--text-muted); transition: background .15s, color .15s; }
.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a.active { color: var(--primary); background: var(--primary-soft); }
.header-actions { display: flex; align-items: center; gap: .6rem; }

.lang-switch { display: inline-flex; border: 1px solid var(--border); background: var(--surface-2); border-radius: 999px; padding: 3px; font-size: .76rem; font-weight: 700; }
.lang-switch a { padding: .3rem .65rem; border-radius: 999px; color: var(--text-muted); }
.lang-switch a.on { background: var(--surface); color: var(--primary); box-shadow: 0 1px 3px rgb(var(--shadow) / .12); }

.menu-toggle { display: none; width: 44px; height: 44px; place-items: center; background: none; border: 1px solid var(--border); color: var(--text); cursor: pointer; border-radius: 12px; }
.menu-toggle:hover { background: var(--surface-2); }
.menu-toggle .ico-close { display: none; }
.menu-toggle[aria-expanded="true"] .ico-open { display: none; }
.menu-toggle[aria-expanded="true"] .ico-close { display: block; }

.mobile-menu { display: none; border-top: 1px solid var(--border); background: var(--bg); padding: .6rem 1.25rem 1.2rem; max-height: calc(100dvh - var(--header-h)); overflow-y: auto; }
.mobile-menu.open { display: block; animation: menu-in .18s ease-out; }
@keyframes menu-in { from { opacity: 0; transform: translateY(-6px); } }
.mobile-menu nav a { display: flex; align-items: center; gap: .8rem; padding: .85rem .4rem; font-weight: 600; font-size: 1rem; border-bottom: 1px solid var(--border); }
.mobile-menu nav a .ico { color: var(--primary); width: 1.25em; height: 1.25em; }
.mobile-menu nav a.active { color: var(--primary); }
.mobile-menu .menu-foot { display: flex; align-items: center; justify-content: space-between; gap: .8rem; flex-wrap: wrap; padding-top: 1rem; }

@media (max-width: 900px) {
  .nav, .header-actions { display: none; }
  .menu-toggle { display: grid; }
}
@media (max-width: 420px) {
  :root { --header-h: 62px; }
  .site-header .inner, .mobile-menu { padding-inline: 1rem; }
  .brand-mark { width: 34px; height: 34px; }
  .brand-name { font-size: 1.15rem; }
}

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

.site-footer { position: relative; margin-top: auto; background: var(--deep); color: rgba(246,240,226,.78); overflow: hidden; }
.site-footer::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .14;
  background: center 30% / cover no-repeat url("/assets/hero-family.jpg?v=1");
  -webkit-mask-image: linear-gradient(to bottom, #000, transparent 80%); mask-image: linear-gradient(to bottom, #000, transparent 80%);
}
.site-footer .inner { position: relative; max-width: 1160px; margin: 0 auto; padding: 3.5rem 1.25rem 2rem; }
.site-footer .brand-name { color: #fbf4e4; }
.site-footer .brand-sub { color: #e3bd6e; }
.footer-cols { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1.3fr; gap: 2.2rem; }
.footer-cols h4 { font-size: .74rem; letter-spacing: .14em; text-transform: uppercase; color: #e3bd6e; margin-bottom: .9rem; font-weight: 700; }
.footer-cols ul { list-style: none; display: grid; gap: .55rem; font-size: .92rem; }
.footer-cols a { color: rgba(246,240,226,.78); transition: color .15s; }
.footer-cols a:hover { color: #fff; }
.footer-blurb { font-size: .92rem; max-width: 34ch; margin-top: 1rem; line-height: 1.6; }
.footer-note { display: flex; gap: .6rem; font-size: .9rem; line-height: 1.55; }
.footer-note .ico { color: #e3bd6e; margin-top: .15rem; }
.footer-bottom { display: flex; justify-content: space-between; gap: .6rem 1rem; flex-wrap: wrap; border-top: 1px solid rgba(246,240,226,.14); margin-top: 2.6rem; padding-top: 1.4rem; font-size: .82rem; color: rgba(246,240,226,.58); }
@media (max-width: 860px) { .footer-cols { grid-template-columns: 1fr 1fr; } .footer-cols > :first-child, .footer-cols > :last-child { grid-column: 1 / -1; } }

/* --- Landing --------------------------------------------------------- */

/* Hero sits on a photograph, so its text is light in both themes and an
   overlay guarantees contrast wherever the words land. */
.hero {
  position: relative; overflow: hidden; isolation: isolate;
  padding: clamp(4.5rem, 10vw, 7.5rem) 0 clamp(4rem, 8vw, 6.5rem);
  background: #1a160f center / cover no-repeat;
  background-image: url("/assets/hero-family.jpg?v=1");
  color: #fdfbf6;
}
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    linear-gradient(100deg, rgba(12,22,16,.94) 0%, rgba(12,22,16,.80) 40%, rgba(12,22,16,.35) 70%, rgba(12,22,16,.12) 100%),
    linear-gradient(to top, rgba(12,22,16,.6), transparent 45%);
}
.hero .inner { position: relative; }
.hero h1 { max-width: 17ch; font-size: clamp(2.3rem, 5.6vw, 3.7rem); line-height: 1.05; color: #fdfbf6; margin-top: 1.1rem; }
.hero h1 em { font-style: italic; color: #f0cf8a; }
.hero p.lead { max-width: 54ch; font-size: clamp(1rem, 1.6vw, 1.12rem); color: rgba(253,251,246,.86); margin-top: 1.2rem; line-height: 1.65; }
.hero .badge { background: rgba(253,251,246,.12); color: #f6e5bd; border: 1px solid rgba(240,207,138,.35); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.hero .btn-secondary { background: rgba(253,251,246,.08); color: #fdfbf6; border-color: rgba(253,251,246,.4); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.hero .btn-secondary:hover { background: rgba(253,251,246,.18); }
.hero-actions { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: 2rem; }
.hero-points { display: flex; flex-wrap: wrap; gap: .5rem 1.4rem; margin-top: 1.8rem; list-style: none; font-size: .9rem; color: rgba(253,251,246,.82); }
.hero-points li { display: flex; align-items: center; gap: .45rem; }
.hero-points .ico { color: #f0cf8a; }
@media (max-width: 700px) {
  .hero { background-position: 72% center; padding: 3.6rem 0 3.2rem; }
  .hero::before { background: linear-gradient(180deg, rgba(12,22,16,.55) 0%, rgba(12,22,16,.82) 45%, rgba(12,22,16,.95) 100%); }
  .hero-actions .btn { flex: 1 1 100%; }
}

.mandala { position: absolute; pointer-events: none; opacity: .08; color: currentColor; }

.trust-strip { background: var(--surface); border-bottom: 1px solid var(--border); }
.trust-strip .inner { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .8rem 1.5rem; padding: 1.2rem 1.25rem; max-width: 1160px; margin: 0 auto; }
.trust-item { display: flex; align-items: center; gap: .65rem; font-size: .9rem; font-weight: 600; color: var(--text); }
.trust-item .ico-tile { width: 36px; height: 36px; }
@media (max-width: 860px) { .trust-strip .inner { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 380px) { .trust-item { font-size: .84rem; } }

.ico-tile {
  width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; flex-shrink: 0;
  background: var(--primary-soft); color: var(--primary);
}
.ico-tile .ico { width: 1.3em; height: 1.3em; }
.ico-tile.gold { background: var(--accent-soft); color: var(--gold-ink); }

.feature-card { padding: 1.6rem; transition: transform .2s, box-shadow .2s, border-color .2s; }
.feature-card:hover { transform: translateY(-3px); border-color: var(--border-strong); box-shadow: 0 2px 4px rgb(var(--shadow) / .05), 0 22px 40px -22px rgb(var(--shadow) / .3); }
.feature-card h3 { margin-top: 1.1rem; font-size: 1.08rem; }
.feature-card p { margin-top: .45rem; color: var(--text-muted); font-size: .93rem; line-height: 1.6; }

/* --- Video showcase -------------------------------------------------- */

.showcase { position: relative; background: radial-gradient(ellipse 80% 60% at 50% 0%, #1d3a2c 0%, var(--deep) 60%); color: #fdfbf6; overflow: hidden; }
.showcase .inner { position: relative; padding: 5rem 1.25rem; max-width: 1160px; margin: 0 auto; text-align: center; }
.showcase h2 { color: #fdfbf6; }
.showcase .eyebrow { color: #e3bd6e; }
.showcase p { color: rgba(253,251,246,.75); max-width: 60ch; margin: .8rem auto 0; }
.video-frame {
  position: relative; margin: 2.4rem auto 0; max-width: 940px;
  border-radius: 18px; overflow: hidden;
  border: 1px solid rgba(240,207,138,.25);
  box-shadow: 0 40px 90px -30px rgba(0,0,0,.9);
  background: #000;
  aspect-ratio: 16 / 9;
}
.video-frame video { width: 100%; height: 100%; object-fit: cover; display: block; }
.video-play {
  position: absolute; inset: 0; display: none; align-items: center; justify-content: center;
  background: rgba(0,0,0,.3); border: 0; cursor: pointer; color: #fff;
}
.video-play span {
  width: 72px; height: 72px; border-radius: 999px; display: grid; place-items: center;
  background: rgba(253,251,246,.94); color: #0e0c08; font-size: 1.4rem; padding-left: 5px;
  box-shadow: 0 0 0 10px rgba(253,251,246,.18);
}
.video-frame.paused .video-play { display: flex; }
@media (max-width: 700px) { .showcase .inner { padding: 3.5rem 1rem; } .video-frame { border-radius: 12px; } }

/* --- How it works ---------------------------------------------------- */

.steps-band { background: var(--bg-2); border-block: 1px solid var(--border); }
.steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2rem; counter-reset: step; position: relative; }
.steps::before { content: ""; position: absolute; top: 23px; left: 8%; right: 8%; height: 2px; background: repeating-linear-gradient(90deg, var(--border-strong) 0 8px, transparent 8px 14px); }
.step { position: relative; }
.step-num {
  position: relative; width: 48px; height: 48px; border-radius: 999px; display: grid; place-items: center; margin-bottom: 1.1rem;
  background: var(--primary); color: var(--primary-fg); font-family: var(--display); font-weight: 600; font-size: 1.2rem;
  box-shadow: 0 0 0 6px var(--bg-2);
}
.step h3 { font-size: 1.08rem; }
.step p { margin-top: .4rem; color: var(--text-muted); font-size: .93rem; line-height: 1.6; }
@media (max-width: 760px) {
  .steps { grid-template-columns: minmax(0, 1fr); gap: 1.6rem; padding-left: 0; }
  .steps::before { top: 24px; bottom: 24px; left: 23px; right: auto; width: 2px; height: auto; background: repeating-linear-gradient(180deg, var(--border-strong) 0 8px, transparent 8px 14px); }
  .step { display: grid; grid-template-columns: 48px minmax(0, 1fr); column-gap: 1rem; }
  .step-num { grid-row: span 2; margin: 0; }
}

/* --- FAQ ------------------------------------------------------------- */

.faq { display: grid; gap: .7rem; max-width: 780px; margin: 0 auto; }
.faq details { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0 1.3rem; transition: border-color .15s, box-shadow .15s; }
.faq details[open] { border-color: var(--border-strong); box-shadow: 0 14px 30px -24px rgb(var(--shadow) / .35); }
.faq summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.1rem 0; font-weight: 600; font-size: 1rem; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; flex-shrink: 0; width: 28px; height: 28px; border-radius: 999px; display: grid; place-items: center; background: var(--surface-2); color: var(--primary); font-size: 1.1rem; font-weight: 500; transition: transform .2s; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { padding: 0 0 1.2rem; color: var(--text-muted); line-height: 1.65; }

/* --- Closing call to action ------------------------------------------ */

.cta-band {
  position: relative; overflow: hidden; border-radius: 22px; text-align: center; color: #fdfbf6;
  padding: clamp(2.6rem, 6vw, 4rem) 1.5rem;
  background: radial-gradient(ellipse 70% 90% at 50% 0%, #2c6a4c 0%, #163d2b 55%, #0f2a1e 100%);
  box-shadow: 0 30px 60px -30px rgba(16,38,28,.7);
}
.cta-band h2 { color: #fdfbf6; max-width: 22ch; margin-inline: auto; }
.cta-band p { color: rgba(253,251,246,.8); margin: .8rem auto 0; max-width: 52ch; }
.cta-band .btn { margin-top: 1.8rem; }
.cta-band .mandala { color: #f0cf8a; opacity: .13; }

/* --- Tree ------------------------------------------------------------ */
/* Night-blue canvas, round portraits with gold rings, glowing gold curves
   and drifting bokeh — always dark, whatever the page theme. */

#tree-canvas {
  --t-bg: #0b1428;
  --t-gold: #e3bd6e;
  --t-gold-hi: #fff0c4;
  --t-ink: #f3e8cc;
  --t-ink-2: #9fb0cc;
  position: relative; width: 100%; height: 76vh; min-height: 460px;
  overflow: hidden; border: 1px solid #1d2a45; border-radius: 1.1rem;
  background:
    radial-gradient(ellipse 70% 60% at 50% 38%, #18284a 0%, rgba(14,24,46,0) 70%),
    radial-gradient(ellipse at 50% 120%, #1a1730 0%, rgba(0,0,0,0) 60%),
    linear-gradient(180deg, #0d1730 0%, #08101f 100%);
  box-shadow: inset 0 0 120px rgba(0,0,0,.55), 0 20px 50px -25px rgba(8,16,31,.6);
  color: var(--t-ink);
  cursor: grab; touch-action: none; isolation: isolate;
}
#tree-canvas.dragging { cursor: grabbing; }
#tree-grid {
  position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    linear-gradient(rgba(227,189,110,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(227,189,110,.045) 1px, transparent 1px);
  background-size: 64px 64px;
}
#tree-bokeh { position: absolute; inset: -10%; pointer-events: none; z-index: 0; }
#tree-bokeh span {
  position: absolute; border-radius: 999px;
  animation: bokeh-drift ease-in-out infinite alternate;
}
@keyframes bokeh-drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(18px, -26px, 0) scale(1.12); }
}
#tree-world { position: relative; transform-origin: 0 0; z-index: 1; }

/* Connectors */
.tree-lines { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.tree-lines path { fill: none; stroke-linecap: round; }
.ln-glow path { stroke: #f0c76f; stroke-width: 7; opacity: .32; }
.ln-core path { stroke: var(--t-gold); stroke-width: 1.8; }
.ln-bond path { stroke: var(--t-gold); stroke-width: 1.4; }
.ln-bond rect { fill: var(--t-bg); stroke: var(--t-gold-hi); stroke-width: 1.6; }
.ln-flow path {
  stroke: var(--t-gold-hi); stroke-width: 2.2; stroke-dasharray: 1.5 26; opacity: .75;
  animation: line-flow 2.4s linear infinite;
}
@keyframes line-flow { to { stroke-dashoffset: -55; } }
.tree-lines.intro .ln-core path { stroke-dasharray: 1; stroke-dashoffset: 1; animation: line-draw 1.4s cubic-bezier(.4,0,.2,1) forwards; }
.tree-lines.intro .ln-glow, .tree-lines.intro .ln-flow, .tree-lines.intro .ln-sparks { animation: fade-in 1.2s ease 1.1s both; }
@keyframes line-draw { to { stroke-dashoffset: 0; } }
@keyframes fade-in { from { opacity: 0; } }

/* Person nodes */
.node { position: absolute; }
.tnode {
  position: relative; display: flex; flex-direction: column; align-items: center;
  width: 100%; min-height: 100%; text-align: center; color: var(--t-ink);
  text-decoration: none; -webkit-user-drag: none;
}
.tphoto {
  position: relative; display: block; flex-shrink: 0; border-radius: 999px; padding: 3px;
  background: linear-gradient(150deg, #fbe7b0 0%, #c99a45 45%, #8a6220 100%);
  box-shadow:
    0 0 0 4px var(--t-bg),
    0 0 0 5px rgba(227,189,110,.45),
    0 0 26px 2px rgba(240,196,110,.22),
    0 10px 24px -8px rgba(0,0,0,.8);
  transition: transform .25s cubic-bezier(.2,.8,.2,1), box-shadow .25s;
}
.tphoto img, .tinitial {
  display: block; width: 100%; height: 100%; border-radius: 999px; object-fit: cover;
}
.tphoto img { filter: sepia(.18) saturate(.92) contrast(1.04); }
.tinitial {
  display: grid; place-items: center;
  background: radial-gradient(circle at 35% 28%, #2c3f66 0%, #142039 70%);
  color: var(--t-gold); font-family: 'Cormorant Garamond', Georgia, serif; font-weight: 700; font-size: 1.85rem; letter-spacing: .02em;
}
.tdot { position: absolute; right: 4px; bottom: 6px; width: 13px; height: 13px; border-radius: 999px; border: 2.5px solid var(--t-bg); }
.tnode > * { flex-shrink: 0; }
.tname {
  margin-top: .65rem; padding: 0 .1rem .18rem; max-width: 100%;
  font-family: 'Cormorant Garamond', Georgia, serif; font-weight: 700; font-size: 1.06rem; line-height: 1.08;
  color: var(--t-ink); text-shadow: 0 1px 10px rgba(0,0,0,.7);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  border-bottom: 1px solid rgba(227,189,110,.4);
}
.tmeta { margin-top: .22rem; font-size: .68rem; letter-spacing: .06em; color: var(--t-ink-2); }
.tnode:hover .tphoto, .tnode:focus-visible .tphoto {
  transform: scale(1.07);
  box-shadow: 0 0 0 4px var(--t-bg), 0 0 0 5.5px rgba(255,230,170,.85), 0 0 40px 6px rgba(240,196,110,.45), 0 12px 28px -8px rgba(0,0,0,.8);
}
.tnode:hover .tname { color: #fff; }
.tnode.is-dead .tphoto img { filter: grayscale(1) sepia(.25) contrast(1.05); }
.tnode.is-dead .tname { color: #d9d1bd; }
.tnode.is-me .tphoto { animation: me-pulse 2.6s ease-in-out infinite; }
@keyframes me-pulse {
  0%, 100% { box-shadow: 0 0 0 4px var(--t-bg), 0 0 0 6px rgba(255,226,150,.95), 0 0 30px 4px rgba(240,196,110,.45); }
  50%      { box-shadow: 0 0 0 4px var(--t-bg), 0 0 0 6px rgba(255,226,150,.55), 0 0 52px 12px rgba(240,196,110,.6); }
}
.tnode.is-hit .tphoto { box-shadow: 0 0 0 4px var(--t-bg), 0 0 0 7px #fff3c9, 0 0 60px 16px rgba(255,214,120,.75); transform: scale(1.1); }
.tnode .you-tag {
  position: absolute; top: -6px; left: 50%; transform: translateX(-50%);
  background: linear-gradient(180deg, #f7dc96, #c99a45); color: #1c1606;
  font-size: .56rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em;
  border-radius: 999px; padding: .12rem .45rem; box-shadow: 0 2px 10px rgba(0,0,0,.5);
}

.tree-btn {
  position: absolute; z-index: 10; display: grid; place-items: center;
  width: 20px; height: 20px; border-radius: 999px;
  background: var(--t-bg); border: 1.5px solid var(--t-gold); color: var(--t-gold);
  font-size: .78rem; font-weight: 700; line-height: 1; cursor: pointer;
  transform: translate(-50%, -50%); opacity: .75; transition: opacity .15s, box-shadow .15s;
}
.tree-btn:hover { opacity: 1; box-shadow: 0 0 14px rgba(240,196,110,.6); }
.tree-badge {
  position: absolute; z-index: 10; transform: translateX(-50%);
  background: linear-gradient(180deg, #f3d48a, #c99a45); color: #1c1606; border: 0;
  border-radius: 999px; padding: .25rem .7rem; font-size: .7rem; font-weight: 800;
  cursor: pointer; white-space: nowrap; box-shadow: 0 0 18px rgba(240,196,110,.45);
}

/* Overlay controls: dark glass */
#tree-canvas .tree-hint, #tree-canvas .tree-zoom button, #tree-canvas .tree-search input, #tree-canvas .tree-results {
  background: rgba(10,18,36,.72); color: var(--t-ink); border: 1px solid rgba(227,189,110,.28);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.tree-hint { position: absolute; z-index: 5; left: 12px; top: 12px; border-radius: 999px; padding: .28rem .8rem; font-size: .74rem; pointer-events: none; }
#tree-canvas .tree-hint { color: var(--t-ink-2); }
.tree-zoom { position: absolute; z-index: 5; right: 12px; bottom: 12px; display: flex; flex-direction: column; gap: .35rem; }
.tree-zoom button { width: 34px; height: 34px; padding: 0; }
#tree-canvas .tree-zoom button:hover { border-color: var(--t-gold); color: var(--t-gold-hi); box-shadow: 0 0 14px rgba(240,196,110,.35); }
.tree-search { position: absolute; z-index: 5; right: 12px; top: 12px; width: 220px; }
#tree-canvas .tree-search input::placeholder { color: var(--t-ink-2); }
#tree-canvas .tree-search input:focus { border-color: var(--t-gold); box-shadow: 0 0 0 3px rgba(227,189,110,.2); }
/* On narrow screens the hint and the search box would sit on top of each
   other — the search is the useful one, so the hint stands down. */
@media (max-width: 700px) {
  .tree-hint { display: none; }
  .tree-search { width: calc(100% - 24px); }
}
.tree-results { position: absolute; left: 0; right: 0; top: 42px; border-radius: .7rem; box-shadow: 0 10px 30px -10px rgba(0,0,0,.6); max-height: 260px; overflow-y: auto; }
.tree-results button { display: flex; align-items: center; gap: .5rem; width: 100%; padding: .5rem .7rem; background: none; border: 0; font: inherit; text-align: left; cursor: pointer; color: inherit; }
.tree-results button:hover { background: rgba(227,189,110,.12); }

@keyframes node-in { from { opacity: 0; transform: translateY(10px) scale(.9); filter: blur(3px); } to { opacity: 1; transform: none; filter: none; } }
.node { animation: node-in .6s cubic-bezier(.16,1,.3,1) both; }
@media (prefers-reduced-motion: reduce) {
  .node, #tree-bokeh span, .tnode.is-me .tphoto, .ln-flow path { animation: none !important; }
}

/* "Show full tree" bar */
.tree-scope { position: absolute; z-index: 5; left: 12px; bottom: 12px; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; max-width: calc(100% - 70px); }
#tree-canvas .tree-scope .tiny { background: rgba(10,18,36,.85); color: var(--t-ink-2); border-radius: 999px; padding: .28rem .7rem; }

/* Plain mode for slower connections and devices: same tree, no glow,
   blur, pulsing or entrance animation, so it draws and pans quickly. */
#tree-canvas.fx-lite { box-shadow: none; }
#tree-canvas.fx-lite .node,
#tree-canvas.fx-lite .tnode.is-me .tphoto { animation: none; }
#tree-canvas.fx-lite .tphoto { box-shadow: 0 0 0 4px var(--t-bg), 0 0 0 5px rgba(227,189,110,.45); transition: none; }
#tree-canvas.fx-lite .tnode.is-me .tphoto { box-shadow: 0 0 0 4px var(--t-bg), 0 0 0 6px rgba(255,226,150,.95); }
#tree-canvas.fx-lite .tphoto img { filter: none; }
#tree-canvas.fx-lite .tnode.is-dead .tphoto img { filter: grayscale(1); }
#tree-canvas.fx-lite .tname { text-shadow: none; }
#tree-canvas.fx-lite .tree-hint, #tree-canvas.fx-lite .tree-zoom button,
#tree-canvas.fx-lite .tree-search input, #tree-canvas.fx-lite .tree-results {
  -webkit-backdrop-filter: none; backdrop-filter: none; background: rgba(10,18,36,.94);
}
#tree-canvas.fx-lite .tree-badge, #tree-canvas.fx-lite .tree-btn:hover { box-shadow: none; }

/* --- Forms: sections, tables ----------------------------------------- */

.form-section { border: 1px solid var(--border); border-radius: .8rem; padding: .9rem 1rem 1rem; margin: 1.2rem 0; }
.form-section legend { padding: 0 .4rem; font-size: .82rem; font-weight: 700; color: var(--text); }
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.data-table { width: 100%; border-collapse: collapse; font-size: .86rem; }
.data-table th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); font-weight: 700; padding: .5rem .55rem; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.data-table td { padding: .55rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.data-table tr:last-child td { border-bottom: 0; }
.act-thumb { width: 52px; height: 52px; object-fit: cover; border-radius: .45rem; border: 1px solid var(--border); display: block; }
.match-list { display: flex; flex-direction: column; gap: .4rem; max-height: 340px; overflow-y: auto; }
.match-row { display: flex; align-items: center; gap: .7rem; border: 1px solid var(--border); border-radius: .7rem; padding: .55rem .75rem; cursor: pointer; }
.match-row:hover { background: var(--surface-2); }
.match-row:has(input:checked) { border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
.match-row input { accent-color: var(--primary); width: 16px; height: 16px; flex-shrink: 0; }
.name-parts { display: flex; flex-wrap: wrap; gap: .3rem 1rem; margin-top: .2rem; }

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

.profile-banner { height: 96px; background: linear-gradient(90deg, var(--primary), var(--accent)); }
.profile-avatar-wrap { margin-top: -48px; border: 4px solid var(--surface); border-radius: 999px; display: inline-block; }

/* --- Print ----------------------------------------------------------- */

@media print {
  body { background: #fff; }
  .read-progress, .story-toc, .sample-ribbon, .chapter-empty, .next-chapter { display: none !important; }
  .story-layout { display: block; }
  .story-pages { box-shadow: none; border: 0; }
  body.reveal-on .chapter.reveal { opacity: 1 !important; transform: none !important; }
  .chapter { break-inside: auto; }
  .chapter-head, .kin-chip, .timeline li, .fact-box { break-inside: avoid; }
  .site-header, .site-footer, .tree-zoom, .tree-search, .tree-hint, .tree-scope, .no-print { display: none !important; }
  #tree-canvas { height: auto; overflow: visible; border: 0; border-radius: 0; background: #fff; box-shadow: none; --t-bg: #fff; --t-ink: #2b2620; --t-ink-2: #6b6355; }
  #tree-bokeh, #tree-grid, .ln-flow, .ln-sparks, .ln-glow, .tree-btn { display: none !important; }
  .tname { text-shadow: none; }
}


/* --- Writing language, story fields, access levels (person form) ------ */

.lang-bar {
  display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: .8rem; padding: .6rem .8rem;
}
details.form-section > summary { cursor: pointer; font-size: .9rem; font-weight: 700; list-style: none; }
details.form-section > summary::-webkit-details-marker { display: none; }
details.form-section > summary::before { content: "▸ "; color: var(--primary); }
details.form-section[open] > summary::before { content: "▾ "; }
.story-area textarea { font-size: .95rem; line-height: 1.6; }
.vis-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .45rem; }
.vis-row { display: flex; align-items: flex-start; gap: .55rem; border: 1px solid var(--border); border-radius: .7rem; padding: .55rem .7rem; cursor: pointer; }
.vis-row:hover { background: var(--surface-2); }
.vis-row:has(input:checked) { border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
.vis-row input { accent-color: var(--primary); margin-top: .2rem; flex-shrink: 0; }
.vis-icon { font-size: 1.05rem; line-height: 1.3; }
:lang(mr), :lang(hi) { font-family: "Noto Sans Devanagari", "Inter", system-ui, sans-serif; }

/* --- Storybook profile ------------------------------------------------ */

.read-progress {
  position: fixed; left: 0; top: 0; right: 0; height: 3px; z-index: 60;
  background: linear-gradient(90deg, var(--accent), var(--primary));
  transform-origin: 0 50%; transform: scaleX(0);
}
.storybook { color: var(--ink); }
.sample-ribbon { background: color-mix(in srgb, var(--accent) 16%, var(--surface)); border-bottom: 1px solid var(--border); font-size: .88rem; padding: .55rem 0; }

.story-cover {
  position: relative; text-align: center; padding: 3.2rem 0 2.4rem;
  background:
    radial-gradient(ellipse 60% 70% at 50% 0%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 70%),
    linear-gradient(180deg, var(--paper-2), var(--bg));
  border-bottom: 1px solid var(--paper-edge);
}
.cover-inner { display: flex; flex-direction: column; align-items: center; }
.cover-portrait {
  border-radius: 999px; padding: 6px;
  background: linear-gradient(150deg, #fbe7b0 0%, #c99a45 45%, #8a6220 100%);
  box-shadow: 0 0 0 6px var(--paper-2), 0 0 0 7px color-mix(in srgb, var(--gold-ink) 45%, transparent), 0 18px 40px -18px rgb(var(--shadow) / .55);
}
.cover-portrait .avatar, .cover-portrait .avatar-fallback { border: 0; font-family: var(--serif); }
.cover-kicker { margin-top: 1.3rem; font-size: .75rem; letter-spacing: .22em; text-transform: uppercase; color: var(--gold-ink); font-weight: 700; }
.cover-name { font-family: var(--serif); font-weight: 700; font-size: clamp(2.3rem, 6vw, 3.6rem); letter-spacing: -.01em; line-height: 1.05; margin-top: .4rem; }
.cover-local { font-family: "Noto Serif Devanagari", var(--serif); font-size: clamp(1.25rem, 3vw, 1.6rem); color: var(--ink-soft); margin-top: .35rem; }
.ornament { color: var(--gold-ink); font-size: 1.5rem; margin: .5rem 0 .2rem; opacity: .85; }
.cover-life { font-family: var(--serif); font-size: 1.2rem; color: var(--ink-soft); letter-spacing: .04em; }
.cover-tagline { font-family: var(--serif); font-style: italic; font-size: 1.3rem; max-width: 40ch; margin-top: .5rem; }
.cover-meta { display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem 1.1rem; margin-top: 1rem; font-size: .85rem; color: var(--ink-soft); }
.vis-badge { display: inline-flex; gap: .3rem; align-items: center; border: 1px solid var(--paper-edge); background: var(--paper); border-radius: 999px; padding: .12rem .65rem; font-weight: 600; }
.cover-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; margin-top: 1.4rem; }

.story-layout { display: grid; grid-template-columns: 210px minmax(0, 760px); gap: 2.2rem; justify-content: center; padding-top: 2.2rem; padding-bottom: 3rem; }
.story-toc { position: sticky; top: calc(var(--header-h) + 20px); align-self: start; font-size: .88rem; }
.toc-title { font-size: .7rem; letter-spacing: .2em; text-transform: uppercase; font-weight: 700; color: var(--gold-ink); margin-bottom: .6rem; }
.story-toc ol { list-style: none; border-left: 1px solid var(--paper-edge); }
.story-toc a { display: flex; gap: .55rem; padding: .32rem .8rem; margin-left: -1px; border-left: 2px solid transparent; color: var(--ink-soft); }
.story-toc a:hover { color: var(--ink); }
.story-toc a.on { border-left-color: var(--gold-ink); color: var(--ink); font-weight: 600; }
.toc-num { font-family: var(--serif); font-weight: 700; color: var(--gold-ink); min-width: 1.8em; }

.story-pages {
  background: var(--paper); border: 1px solid var(--paper-edge); border-radius: .4rem 1rem 1rem .4rem;
  box-shadow: -6px 0 0 -3px var(--paper-2), -10px 0 0 -6px var(--paper-edge), 0 24px 50px -30px rgb(var(--shadow) / .45);
  padding: 1rem clamp(1.1rem, 4vw, 3.2rem) 2.4rem;
}
.chapter { padding: 2.2rem 0 1.6rem; border-bottom: 1px solid var(--paper-edge); scroll-margin-top: 80px; }
.chapter:last-of-type { border-bottom: 0; }
.chapter-head { text-align: center; margin-bottom: 1.4rem; }
.chapter-num { font-size: .72rem; letter-spacing: .24em; text-transform: uppercase; font-weight: 700; color: var(--gold-ink); }
#prologue .chapter-num { text-align: center; margin-bottom: 1rem; }
.chapter-title { font-family: var(--serif); font-size: clamp(1.7rem, 4vw, 2.2rem); font-weight: 700; margin-top: .25rem; }
.chapter-title::after { content: "❦"; display: block; font-size: 1rem; color: var(--gold-ink); margin-top: .35rem; opacity: .8; }
.chapter-head .copy-tpl { margin-top: .5rem; }

.prose { font-family: var(--serif); font-size: 1.22rem; line-height: 1.8; color: var(--ink); }
.prose:lang(mr), .prose:lang(hi) { font-family: "Noto Serif Devanagari", var(--serif); font-size: 1.08rem; line-height: 1.95; }
.prose p + p { margin-top: 1em; text-indent: 1.5em; }
.prose:lang(en) .drop-cap::first-letter {
  float: left; font-size: 3.6em; line-height: .82; padding: .08em .1em 0 0; font-weight: 700; color: var(--gold-ink);
}

.fact-box { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .7rem 1.4rem; margin: 0 0 1.4rem; padding: .9rem 1.1rem; background: var(--paper-2); border-left: 3px solid var(--gold-ink); border-radius: .2rem .7rem .7rem .2rem; }
.fact-box dt { font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; font-weight: 700; color: var(--ink-soft); }
.fact-box dd { font-family: var(--serif); font-size: 1.1rem; font-weight: 600; }

.kin-list { display: flex; flex-wrap: wrap; gap: .5rem; }
.kin-chip { display: inline-flex; align-items: center; gap: .55rem; padding: .35rem .8rem .35rem .35rem; border: 1px solid var(--paper-edge); border-radius: 999px; background: var(--paper); transition: border-color .15s, transform .15s; }
a.kin-chip:hover { border-color: var(--gold-ink); transform: translateY(-1px); }
.kin-chip > span:last-child { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.kin-name { font-size: .9rem; font-weight: 600; }
.kin-local { font-size: .8rem; color: var(--ink-soft); }
.kin-life { font-size: .72rem; color: var(--ink-soft); }
.kin-chip.is-private { opacity: .7; }
.lineage-label { font-size: .68rem; letter-spacing: .16em; text-transform: uppercase; font-weight: 700; color: var(--gold-ink); margin-bottom: .45rem; }

.lineage, .generations { position: relative; margin-top: 1.6rem; padding-left: 1.4rem; }
.lineage::before, .generations::before { content: ""; position: absolute; left: .35rem; top: .4rem; bottom: .8rem; width: 2px; background: linear-gradient(var(--paper-edge), var(--gold-ink), var(--paper-edge)); }
.lineage-row, .gen-row { position: relative; padding-bottom: 1.1rem; }
.lineage-row::before, .gen-row::before { content: ""; position: absolute; left: -1.33rem; top: .25rem; width: 10px; height: 10px; border-radius: 999px; background: var(--paper); border: 2px solid var(--gold-ink); }
.lineage-row.is-self::before, .gen-row.is-self::before { background: var(--gold-ink); box-shadow: 0 0 0 4px color-mix(in srgb, var(--gold-ink) 22%, transparent); }

.timeline { list-style: none; margin-top: 1.2rem; position: relative; }
.timeline::before { content: ""; position: absolute; left: 6px; top: .4rem; bottom: .4rem; width: 2px; background: var(--paper-edge); }
.timeline li { position: relative; display: flex; gap: .9rem; padding-bottom: 1rem; }
.tl-dot { flex-shrink: 0; width: 14px; height: 14px; border-radius: 999px; margin-top: .25rem; background: var(--paper); border: 2px solid var(--gold-ink); position: relative; z-index: 1; }
.tl-meta { font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; font-weight: 700; color: var(--gold-ink); }
.tl-text { font-family: var(--serif); font-size: 1.12rem; line-height: 1.5; }
.tl-photo { margin-top: .45rem; width: 120px; height: 84px; object-fit: cover; border-radius: .4rem; border: 3px solid #fff; box-shadow: 0 6px 16px -8px rgb(var(--shadow) / .6); transform: rotate(-1.5deg); }

.honours { list-style: none; display: grid; gap: .55rem; }
.honours li { position: relative; padding-left: 1.6rem; font-family: var(--serif); font-size: 1.15rem; }
.honours li::before { content: "✦"; position: absolute; left: 0; color: var(--gold-ink); }

.pull-quote { position: relative; margin: 1.8rem auto 0; max-width: 34ch; text-align: center; font-family: var(--serif); font-style: italic; font-size: 1.5rem; line-height: 1.4; color: var(--ink); }
.pull-quote::before { content: "“"; display: block; font-size: 3.2rem; line-height: .6; color: var(--gold-ink); }

.chapter-empty { display: block; border: 1.5px dashed var(--paper-edge); border-radius: .8rem; padding: .9rem 1rem; color: var(--ink-soft); font-size: .9rem; margin-top: .8rem; }
.chapter-empty:hover { border-color: var(--gold-ink); color: var(--ink); }
.next-chapter { display: block; text-align: right; margin-top: 1.4rem; font-size: .85rem; font-weight: 600; color: var(--gold-ink); }
.the-end { text-align: center; color: var(--gold-ink); font-size: 1.8rem; margin: 1.6rem 0 .4rem; }
.story-start { border: 1px solid var(--paper-edge); background: var(--paper-2); border-radius: .9rem; padding: 1.1rem 1.2rem; margin-top: 1.2rem; }

.make-own { margin-top: 2rem; padding: 1.6rem; border-radius: 1rem; background: color-mix(in srgb, var(--primary) 8%, var(--paper)); border: 1px solid color-mix(in srgb, var(--primary) 30%, var(--paper-edge)); }
.make-own h2 { font-family: var(--serif); font-size: 1.9rem; }
.make-steps { padding-left: 1.2rem; display: grid; gap: .3rem; }
.template-preview { white-space: pre-wrap; font-family: inherit; font-size: .85rem; line-height: 1.6; background: var(--paper); border: 1px solid var(--paper-edge); border-radius: .6rem; padding: 1rem; margin-top: .6rem; max-height: 360px; overflow: auto; }

.story-locked .lock-seal { width: 64px; height: 64px; margin: 0 auto; border-radius: 999px; display: grid; place-items: center; font-size: 1.7rem; background: var(--surface-2); border: 1px solid var(--border); }

body.reveal-on .chapter.reveal { opacity: 0; transform: translateY(22px); transition: opacity .7s ease, transform .7s cubic-bezier(.16,1,.3,1); }
body.reveal-on .chapter.reveal.in { opacity: 1; transform: none; }

@media (max-width: 900px) {
  .story-layout { grid-template-columns: minmax(0, 1fr); gap: 1rem; padding-top: 1rem; }
  .story-toc { position: sticky; top: var(--header-h); z-index: 30; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(6px); margin: 0 -1.25rem; padding: .5rem 1.25rem; border-bottom: 1px solid var(--paper-edge); }
  .toc-title { display: none; }
  .story-toc ol { display: flex; gap: .3rem; overflow-x: auto; border-left: 0; scrollbar-width: none; }
  .story-toc a { white-space: nowrap; border-left: 0; border-bottom: 2px solid transparent; padding: .25rem .55rem; }
  .story-toc a.on { border-bottom-color: var(--gold-ink); }
  .story-pages { border-radius: .8rem; box-shadow: 0 16px 40px -28px rgb(var(--shadow) / .5); }
  .prose { font-size: 1.12rem; }
}

/* --- Sample banners --------------------------------------------------- */

.sample-card { display: flex; align-items: center; gap: .9rem; padding: .9rem 1rem; background: linear-gradient(100deg, var(--paper-2), var(--surface)); }
.sample-card-book { font-size: 1.8rem; }
@media (max-width: 600px) { .sample-card .btn { display: none; } }

.story-teaser { border-block: 1px solid var(--border); background: linear-gradient(180deg, var(--paper-2), var(--bg)); }
.story-teaser-inner { display: grid; grid-template-columns: 1fr 1.2fr; gap: 3rem; align-items: center; padding-top: 4rem; padding-bottom: 4rem; }
.teaser-book { perspective: 1200px; display: grid; place-items: center; }
.teaser-page {
  width: min(320px, 100%); aspect-ratio: 3 / 4; padding: 2rem 1.8rem; text-align: center;
  background: var(--paper); border: 1px solid var(--paper-edge); border-radius: .3rem 1rem 1rem .3rem;
  box-shadow: -8px 0 0 -4px var(--paper-2), -14px 0 0 -8px var(--paper-edge), 0 30px 60px -30px rgb(var(--shadow) / .6);
  transform: rotateY(-12deg) rotateZ(-1.5deg); color: var(--ink);
}
.teaser-chapter { font-size: .7rem; letter-spacing: .24em; text-transform: uppercase; font-weight: 700; color: var(--gold-ink); }
.teaser-title { font-family: var(--serif); font-size: 1.9rem; font-weight: 700; margin: .3rem 0 1rem; }
.teaser-line { font-family: var(--serif); font-size: 1.15rem; line-height: 1.6; text-align: left; }
.teaser-line.muted { font-style: italic; margin-top: .6rem; text-align: right; }
.teaser-orn { color: var(--gold-ink); font-size: 1.4rem; margin-top: 1.4rem; }
.teaser-points { list-style: none; display: grid; gap: .4rem; }
@media (max-width: 800px) { .story-teaser-inner { grid-template-columns: 1fr; gap: 2rem; } .teaser-page { transform: none; } }

/* --- Tree: generations, minimap, locked nodes, full screen ------------ */

.gen-stripe { position: absolute; left: 0; pointer-events: none; background: rgba(227,189,110,.025); border-top: 1px dashed rgba(227,189,110,.09); }
.gen-stripe.alt { background: rgba(140,170,215,.035); }
.tree-gens { position: absolute; left: 0; top: 0; z-index: 4; pointer-events: none; }
.gen-label {
  position: absolute; left: 0; top: 0; white-space: nowrap;
  padding: .3rem 1.6rem .3rem .75rem; display: flex; flex-direction: column; line-height: 1.15;
  background: linear-gradient(90deg, rgba(8,16,31,.88) 55%, rgba(8,16,31,0));
  color: var(--t-gold); font-size: .68rem; letter-spacing: .1em; text-transform: uppercase;
}
.gen-label b { font-weight: 800; }
.gen-label span { color: var(--t-ink-2); letter-spacing: .04em; text-transform: none; font-size: .72rem; }
.tlocal { margin-top: .12rem; font-size: .74rem; color: var(--t-ink-2); font-family: "Noto Sans Devanagari", sans-serif; }
.tlock { font-size: 1.6rem !important; filter: grayscale(.3); }
.tnode.is-locked .tphoto { background: linear-gradient(150deg, #8a8f9c, #4b5262); }
.tnode.is-locked .tname { color: var(--t-ink-2); }

.tree-minimap {
  position: absolute; z-index: 5; right: 58px; bottom: 12px; width: 180px; height: 120px;
  border-radius: .6rem; border: 1px solid rgba(227,189,110,.28); background: rgba(10,18,36,.78);
  cursor: crosshair; touch-action: none;
}
@media (max-width: 900px) { #tree-canvas:not(.is-full) .tree-minimap { display: none; } }
@media (max-width: 700px) { .tree-minimap { width: 120px; height: 80px; } .gen-label span { display: none; } }

.tree-fullbar { display: none; }
#tree-canvas.is-full {
  position: fixed; inset: 0; z-index: 1000; width: 100vw; height: 100vh; height: 100dvh; min-height: 0;
  border: 0; border-radius: 0;
}
#tree-canvas:fullscreen { width: 100vw; height: 100vh; border-radius: 0; border: 0; }
body.tree-full-open { overflow: hidden; }
#tree-canvas.is-full .tree-hint { display: none; }
#tree-canvas.is-full .tree-fullbar {
  position: absolute; z-index: 6; left: 12px; top: 12px; display: flex; align-items: center; gap: .8rem; flex-wrap: wrap;
  max-width: calc(100% - 260px);
}
#tree-canvas.is-full .tree-fullbar .btn { background: rgba(10,18,36,.85); color: var(--t-ink); border-color: rgba(227,189,110,.4); }
#tree-canvas.is-full .tree-fullbar .btn:hover { border-color: var(--t-gold); color: var(--t-gold-hi); }
.tree-fulltitle { font-family: 'Cormorant Garamond', Georgia, serif; font-weight: 700; font-size: 1.2rem; color: var(--t-ink); text-shadow: 0 1px 10px rgba(0,0,0,.7); }
.tree-keys { font-size: .72rem; color: var(--t-ink-2); }
#tree-canvas.is-full .tree-gens { top: 0; }
#tree-canvas:focus-visible { outline: 2px solid var(--t-gold); outline-offset: 2px; }
@media (max-width: 700px) {
  #tree-canvas.is-full .tree-fullbar { max-width: calc(100% - 24px); }
  #tree-canvas.is-full .tree-search { top: 58px; }
  .tree-keys, .tree-fulltitle { display: none; }
}

/* View-only share links */
.share-banner { background: color-mix(in srgb, var(--primary) 12%, var(--surface)); border-bottom: 1px solid var(--border); font-size: .88rem; padding: .55rem 0; }
.share-banner a { color: var(--primary); }
.share-url { display: flex; gap: .5rem; flex-wrap: wrap; }
.share-url .input { flex: 1 1 260px; min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem; }
.share-new { border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
.share-list { display: grid; gap: .6rem; }
.share-item { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
.share-item.is-new { border-color: var(--primary); }
.share-item form { display: inline; }
@media print { .share-banner { display: none !important; } }

/* --- Landing: story teaser points ------------------------------------ */
.teaser-points { gap: .75rem; font-size: .95rem; }
.teaser-points li { display: flex; align-items: center; gap: .75rem; }
.teaser-points .ico-tile { width: 36px; height: 36px; border-radius: 10px; }
.story-teaser .eyebrow { margin-top: 0; }

/* --- Dashboard ------------------------------------------------------- */
.dash-hero { display: flex; align-items: center; justify-content: space-between; gap: 1.2rem 2rem; flex-wrap: wrap; padding: 1.5rem 1.6rem;
  background: linear-gradient(110deg, var(--surface) 40%, color-mix(in srgb, var(--accent-soft) 70%, var(--surface))); }
.dash-me { display: flex; align-items: center; gap: 1.1rem; min-width: 0; flex: 1 1 340px; }
.dash-me .avatar, .dash-me .avatar-fallback { box-shadow: 0 0 0 3px var(--surface), 0 0 0 4.5px color-mix(in srgb, var(--accent) 55%, transparent); }
.dash-me h1 { font-size: clamp(1.6rem, 3.6vw, 2.1rem); }
.dash-actions { display: flex; flex-wrap: wrap; gap: .55rem; }
.dash-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 1.2rem; align-items: start; }
.dash-title { font-size: 1.3rem; margin-bottom: 1.2rem; }
.dash-label { font-size: .72rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--gold-ink); margin-bottom: .55rem; }
.rel-chip { display: flex; align-items: center; gap: .65rem; padding: .45rem .8rem .45rem .45rem; margin-bottom: .45rem; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); transition: border-color .15s, transform .15s; }
.rel-chip:hover { border-color: var(--accent); transform: translateY(-1px); }
.rel-add { display: flex; align-items: center; gap: .5rem; padding: .6rem .85rem; border: 1.5px dashed var(--border-strong); border-radius: 999px; font-size: .86rem; color: var(--text-muted); }
.rel-add:hover { border-color: var(--primary); color: var(--primary); }
@media (max-width: 860px) { .dash-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 600px) {
  .dash-hero { padding: 1.2rem; }
  .dash-me .avatar, .dash-me .avatar-fallback { width: 56px !important; height: 56px !important; }
  .dash-actions { width: 100%; }
  .dash-actions .btn { flex: 1 1 100%; }
}

/* --- Tree page ------------------------------------------------------- */
.tree-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem 1.5rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.tree-legend { display: flex; gap: .9rem; margin-top: .55rem; }
.tree-legend span { display: inline-flex; align-items: center; gap: .35rem; }
.tree-legend i { width: 10px; height: 10px; border-radius: 999px; display: inline-block; }
.tree-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
@media (max-width: 700px) {
  .tree-page { padding-top: 1.4rem; }
  /* One swipeable row of compact buttons instead of three wrapped rows. */
  .tree-actions { flex-wrap: nowrap; overflow-x: auto; width: calc(100% + 2.5rem); margin: 0 -1.25rem; padding: 0 1.25rem .25rem; scrollbar-width: none; }
  .tree-actions::-webkit-scrollbar { display: none; }
  .tree-actions .btn { min-height: 38px; padding: .45rem .9rem; font-size: .84rem; flex-shrink: 0; }
  #tree-canvas { height: 68vh; height: 68dvh; min-height: 420px; border-radius: 14px; }
  .tree-zoom button { width: 40px; height: 40px; }
}

/* --- Directory, login, simple pages ---------------------------------- */
.person-card { display: flex; align-items: center; gap: .9rem; padding: .95rem 1rem; transition: border-color .15s, transform .15s, box-shadow .15s; }
.person-card:hover { border-color: var(--border-strong); transform: translateY(-2px); box-shadow: 0 16px 30px -22px rgb(var(--shadow) / .35); }
.search-box { position: relative; }
.search-box .ico { position: absolute; left: .95rem; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.search-box .input { padding-left: 2.7rem; min-height: 50px; border-radius: 999px; font-size: 1rem; }
.sample-card { display: flex; align-items: center; gap: 1rem; padding: 1rem 1.1rem; background: linear-gradient(100deg, var(--accent-soft), var(--surface) 70%); }
.sample-card .ico-tile { width: 44px; height: 44px; }
.auth-card { padding: 2rem 1.75rem; }
.auth-card .brand-mark { width: 52px; height: 52px; border-radius: 15px; margin: 0 auto 1rem; }
@media (max-width: 600px) { .sample-card .btn { display: none; } .auth-card { padding: 1.6rem 1.25rem; } }

/* --- Forms on phones ------------------------------------------------- */
@media (max-width: 700px) {
  /* 16px stops iOS Safari zooming the page whenever a field is tapped. */
  .input, select.input, textarea.input { font-size: 16px; }
  .card-pad { padding: 1.2rem; }
  .form-section { padding: .8rem .85rem .9rem; }
  .vis-list { grid-template-columns: minmax(0, 1fr); }
  .py-4 { padding-block: 1.8rem; } .py-6 { padding-block: 3rem; }
  .section-head { margin-bottom: 1.8rem; }
  .page-head .btn { flex: 1 1 auto; }
  .share-item > .flex { width: 100%; }
}

/* --- Storybook on phones ---------------------------------------------- */
@media (max-width: 600px) {
  .story-cover { padding: 2.2rem 0 1.8rem; }
  .cover-portrait .avatar, .cover-portrait .avatar-fallback { width: 120px !important; height: 120px !important; font-size: 48px !important; }
  .cover-actions { display: grid; grid-template-columns: 1fr 1fr; width: 100%; max-width: 420px; }
  .cover-actions .btn { white-space: normal; }
  .cover-actions .btn:first-child:nth-last-child(odd) { grid-column: 1 / -1; }
  .story-pages { padding: .6rem 1.1rem 1.8rem; }
  .chapter { padding: 1.6rem 0 1.2rem; }
  .kin-chip { padding-right: .65rem; }
  .sample-ribbon .container { font-size: .84rem; }
  .fact-box { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
.share-banner .container, .sample-ribbon .container { padding-block: .1rem; }

/* --- Tree on touch screens ------------------------------------------- */
#tree-world { will-change: transform; }
#tree-canvas, #tree-canvas * { -webkit-tap-highlight-color: transparent; }
#tree-canvas { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; overscroll-behavior: contain; }
#tree-canvas .tnode img { -webkit-user-drag: none; pointer-events: none; }
#tree-canvas .tree-search input { -webkit-user-select: text; user-select: text; }
.tree-hint.is-touch {
  display: block; top: auto; bottom: 14px; left: 50%; transform: translateX(-50%);
  max-width: calc(100% - 120px); text-align: center; white-space: normal; line-height: 1.35;
  font-size: .78rem; padding: .45rem .9rem; transition: opacity .5s ease;
}
.tree-hint.is-touch.is-gone { opacity: 0; }
@media (max-width: 700px) {
  /* Zoom controls as one compact row in the corner, so they don't cover a
     column of portraits; the gesture hint moves up under the search box. */
  .tree-zoom { flex-direction: row; right: 10px; bottom: 10px; gap: 0; padding: 3px; border-radius: 14px;
    background: rgba(10,18,36,.82); border: 1px solid rgba(227,189,110,.3); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
  #tree-canvas .tree-zoom button { width: 42px; height: 42px; font-size: 1.15rem; border: 0; background: transparent; box-shadow: none; border-radius: 11px; }
  #tree-canvas .tree-zoom button:active { background: rgba(227,189,110,.18); }
  .tree-hint.is-touch { bottom: auto; top: 62px; max-width: calc(100% - 24px); }
  #tree-canvas.is-full .tree-hint.is-touch { top: calc(112px + env(safe-area-inset-top)); }
  #tree-canvas.is-full .tree-zoom { bottom: calc(12px + env(safe-area-inset-bottom)); right: calc(10px + env(safe-area-inset-right)); }
  #tree-canvas.is-full .tree-fullbar { top: calc(12px + env(safe-area-inset-top)); }
  #tree-canvas.is-full .tree-search { top: calc(58px + env(safe-area-inset-top)); }
}
#tree-canvas.is-full .tree-hint.is-touch { display: block; }

/* --- Admin panel ---------------------------------------------------------- */
.admin-stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .75rem; }
.admin-stats .card { padding: .9rem 1rem; display: flex; flex-direction: column; gap: .15rem; }
.admin-stats b { font-family: var(--display); font-size: 1.6rem; line-height: 1.1; color: var(--primary); }
.admin-stats span { font-size: .78rem; color: var(--text-muted); }
.admin-stats .is-new { background: var(--accent-soft); border-color: transparent; }
.admin-stats .is-new b { color: var(--gold-ink); font-size: 1.25rem; }
.admin-tabs { display: flex; gap: .35rem; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.admin-tabs::-webkit-scrollbar { display: none; }
.admin-tabs a { padding: .65rem 1rem; font-weight: 600; font-size: .92rem; color: var(--text-muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; text-decoration: none; }
.admin-tabs a.active { color: var(--primary); border-bottom-color: var(--primary); }
.admin-list { display: flex; flex-direction: column; gap: .6rem; }
.admin-row { display: flex; align-items: center; gap: .9rem; padding: .85rem 1rem; }
.admin-main { flex: 1; min-width: 0; }
.admin-main .bold { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.admin-main .tiny { overflow-wrap: anywhere; }
.admin-actions { display: flex; flex-wrap: wrap; gap: .4rem; justify-content: flex-end; }
.admin-actions form { margin: 0; }
.admin-actions .btn.small { min-height: 36px; padding: .35rem .8rem; font-size: .82rem; }
.admin-pager { display: flex; align-items: center; justify-content: center; gap: 1rem; }
.pill-new { background: var(--accent-soft); color: var(--gold-ink); border-radius: 999px; padding: .1rem .55rem; font-size: .68rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.badge-admin { display: inline-flex; align-items: center; gap: .25rem; background: var(--primary-soft); color: var(--primary); border-radius: 999px; padding: .1rem .55rem; font-size: .7rem; font-weight: 700; }
.badge-admin .ico { width: 1em; height: 1em; }
@media (max-width: 860px) {
  .admin-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-stats .is-new { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .admin-row { flex-wrap: wrap; }
  .admin-main { flex-basis: calc(100% - 60px); }
  .admin-actions { width: 100%; justify-content: flex-start; padding-left: 0; }
}

/* --- Tree: hierarchy start node ------------------------------------------- */
.tree-root { display: flex; align-items: center; gap: .6rem; margin: .9rem 0 .75rem; flex-wrap: wrap; }
.tree-root label { display: inline-flex; align-items: center; gap: .4rem; font-weight: 600; font-size: .9rem; color: var(--text-muted); white-space: nowrap; }
.tree-root select.input { width: auto; min-width: 240px; max-width: 100%; flex: 0 1 380px; min-height: 42px; padding-block: .4rem; }
@media (max-width: 700px) {
  .tree-root select.input { flex: 1 1 100%; min-width: 0; font-size: 16px; }
}
