/* ==========================================================================
   Chethuvelil Design System  —  "Heritage, but make it now"
   Tokens → Base → Layout → Components → Pages → Utilities
   ========================================================================== */

/* ---------- 1. Tokens ---------- */
:root {
  --brand: #6d4aff;          /* electric violet (overridable from admin) */
  --accent: #ff6b4a;         /* coral (overridable from admin) */
  --lime: #c6f432;
  --sky: #5ad1ff;
  --gold: #ffc94a;

  --bg: #f7f5f0;
  --surface: #ffffff;
  --surface-2: #efece4;
  --ink: #15131a;
  --text: #2a2730;
  --muted: #6c6875;
  --border: rgba(21, 19, 26, .1);
  --border-strong: rgba(21, 19, 26, .2);
  --shadow-sm: 0 1px 2px rgba(20, 16, 40, .06), 0 2px 8px rgba(20, 16, 40, .05);
  --shadow: 0 10px 30px -12px rgba(20, 16, 40, .25);
  --shadow-lg: 0 30px 60px -20px rgba(20, 16, 40, .35);

  --font-display: "Bricolage Grotesque", "Inter", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-serif: "Instrument Serif", Georgia, serif;

  --r-sm: 10px; --r: 18px; --r-lg: 28px; --r-pill: 999px;
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px; --s-6: 32px; --s-7: 48px; --s-8: 72px; --s-9: 112px;
  --container: 1200px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0d0c11; --surface: #17151d; --surface-2: #211e29; --ink: #f6f4fb; --text: #dcd8e6; --muted: #9a95a8;
  --border: rgba(255, 255, 255, .09); --border-strong: rgba(255, 255, 255, .18);
  --shadow: 0 10px 30px -12px rgba(0, 0, 0, .7); --shadow-lg: 0 30px 60px -20px rgba(0, 0, 0, .8);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d0c11; --surface: #17151d; --surface-2: #211e29; --ink: #f6f4fb; --text: #dcd8e6; --muted: #9a95a8;
    --border: rgba(255, 255, 255, .09); --border-strong: rgba(255, 255, 255, .18);
    --shadow: 0 10px 30px -12px rgba(0, 0, 0, .7); --shadow-lg: 0 30px 60px -20px rgba(0, 0, 0, .8);
    color-scheme: dark;
  }
}

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 16px/1.65 var(--font-body); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
img, video { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
h1, h2, h3, h4 { font-family: var(--font-display); color: var(--ink); line-height: 1.08; letter-spacing: -.02em; margin: 0 0 var(--s-4); font-weight: 700; }
h1 { font-size: clamp(2.4rem, 5vw, 4rem); } h2 { font-size: clamp(1.8rem, 3.5vw, 2.6rem); } h3 { font-size: 1.3rem; }
p { margin: 0 0 var(--s-4); }
em, .serif { font-family: var(--font-serif); font-style: italic; font-weight: 400; letter-spacing: 0; }
::selection { background: var(--lime); color: #111; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: 8px; z-index: 999; }
.skip:focus { left: 8px; }
hr { border: 0; border-top: 1px solid var(--border); margin: var(--s-6) 0; }

/* ---------- 3. Layout ---------- */
.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 20px; }
.container-sm { max-width: 820px; }
.section { padding: var(--s-8) 0; }
.section-tight { padding: var(--s-7) 0; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: var(--s-4); margin-bottom: var(--s-6); flex-wrap: wrap; }
.section-head h2 { margin: 0; }
.grid { display: grid; gap: var(--s-5); }
.grid-2 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); }
.split { display: grid; grid-template-columns: 1.2fr 1fr; gap: var(--s-7); align-items: start; }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; gap: var(--s-6); } }

/* ---------- 4. Components ---------- */
/* Eyebrow / kicker */
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font: 600 12px/1 var(--font-body); text-transform: uppercase; letter-spacing: .14em; color: var(--muted); margin-bottom: var(--s-4); }
.eyebrow::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent); }
.display { font-size: clamp(3rem, 9vw, 7.5rem); line-height: .92; letter-spacing: -.045em; font-weight: 800; }
.display-sm { font-size: clamp(2rem, 5vw, 3.6rem); line-height: 1; letter-spacing: -.035em; font-weight: 800; }
.lead { font-size: clamp(1.05rem, 1.6vw, 1.25rem); color: var(--muted); max-width: 60ch; }
.muted { color: var(--muted); }
.grad-text { background: linear-gradient(100deg, var(--brand), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* Buttons */
.btn { --b: var(--brand); display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 13px 22px; border-radius: var(--r-pill); border: 1.5px solid transparent; background: var(--b); color: #fff; font: 600 15px/1 var(--font-body); text-decoration: none; cursor: pointer; transition: transform .2s var(--ease), box-shadow .2s var(--ease), background .2s; white-space: nowrap; }
.btn:hover { transform: translateY(-2px); box-shadow: 0 10px 24px -10px var(--b); }
.btn:active { transform: translateY(0); }
.btn-sm { padding: 9px 16px; font-size: 14px; }
.btn-dark { background: var(--ink); color: var(--bg); --b: var(--ink); }
.btn-light { background: #fff; color: #111; --b: #fff; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--surface); box-shadow: none; }
.btn-accent { --b: var(--accent); }
.btn-lime { background: var(--lime); color: #111; --b: var(--lime); }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); color: var(--ink); cursor: pointer; }
.icon-btn:hover { border-color: var(--border-strong); }

/* Chips & badges */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: var(--r-pill); background: var(--surface); border: 1px solid var(--border); font-size: 13px; font-weight: 500; color: var(--text); text-decoration: none; }
.chip.is-active, a.chip:hover { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.badge { display: inline-block; padding: 4px 10px; border-radius: var(--r-pill); font: 600 11px/1.2 var(--font-body); text-transform: uppercase; letter-spacing: .08em; background: color-mix(in srgb, var(--brand) 14%, transparent); color: var(--brand); }
.badge-accent { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.badge-lime { background: var(--lime); color: #1d2400; }
.badge-dark { background: var(--ink); color: var(--bg); }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--s-5); box-shadow: var(--shadow-sm); position: relative; overflow: hidden; }
.card-link { text-decoration: none; display: block; transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .25s; }
.card-link:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.card-media { margin: calc(var(--s-5) * -1) calc(var(--s-5) * -1) var(--s-4); aspect-ratio: 16/10; background: var(--surface-2); overflow: hidden; }
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease); }
.card-link:hover .card-media img { transform: scale(1.05); }
.card h3 { margin-bottom: 6px; }
.card-meta { font-size: 13px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.placeholder-art { width: 100%; height: 100%; display: grid; place-items: center; font: 800 3rem/1 var(--font-display); color: rgba(255,255,255,.9); background: radial-gradient(circle at 20% 20%, var(--accent), transparent 55%), radial-gradient(circle at 80% 70%, var(--sky), transparent 50%), var(--brand); }

/* Avatars */
.avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; flex: none; }
.avatar-fallback { display: inline-grid; place-items: center; background: linear-gradient(135deg, var(--brand), var(--accent)); color: #fff; font: 700 15px/1 var(--font-display); }
.avatar-xl { width: 160px; height: 160px; border-radius: 40px; font-size: 48px; box-shadow: var(--shadow); }

/* Toasts */
.toasts { position: fixed; right: 16px; top: 84px; z-index: 200; display: grid; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast { display: flex; align-items: start; justify-content: space-between; gap: 12px; padding: 14px 16px; border-radius: 14px; background: var(--ink); color: var(--bg); box-shadow: var(--shadow-lg); font-size: 14px; animation: toastIn .4s var(--ease); }
.toast-error { background: #d8342b; color: #fff; }
.toast-success { background: #127a4a; color: #fff; }
.toast-x { background: none; border: 0; color: inherit; font-size: 20px; line-height: 1; cursor: pointer; opacity: .8; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } }

/* Forms */
.form { display: grid; gap: var(--s-4); }
.field label, .label { display: block; font-weight: 600; font-size: 14px; color: var(--ink); margin-bottom: 6px; }
.input, .field input:not([type=checkbox]):not([type=radio]), .field select, .field textarea { width: 100%; padding: 13px 15px; border-radius: 14px; border: 1.5px solid var(--border); background: var(--surface); color: var(--ink); font: 400 15px/1.4 var(--font-body); transition: border-color .2s, box-shadow .2s; }
.field textarea { min-height: 140px; resize: vertical; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 18%, transparent); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-4); }
@media (max-width: 640px) { .field-row { grid-template-columns: 1fr; } }
.hp { position: absolute; left: -9999px; }

/* Pager */
.pager { display: flex; gap: 6px; justify-content: center; margin-top: var(--s-6); flex-wrap: wrap; }
.pager a { min-width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; border: 1px solid var(--border); text-decoration: none; background: var(--surface); }
.pager a.is-active { background: var(--ink); color: var(--bg); }

/* Empty state */
.empty { text-align: center; padding: var(--s-8) var(--s-5); border: 1.5px dashed var(--border-strong); border-radius: var(--r-lg); color: var(--muted); }
.empty-emoji { font-size: 40px; margin-bottom: 8px; }

/* Prose */
.prose { font-size: 17px; line-height: 1.8; }
.prose h2 { font-size: 1.8rem; margin-top: var(--s-6); } .prose h3 { margin-top: var(--s-5); }
.prose img { border-radius: var(--r); margin: var(--s-5) 0; }
.prose blockquote { margin: var(--s-5) 0; padding: var(--s-4) var(--s-5); border-left: 4px solid var(--accent); background: var(--surface); border-radius: 0 var(--r) var(--r) 0; font-family: var(--font-serif); font-size: 1.35rem; font-style: italic; }
.prose a { color: var(--brand); }
.prose .ql-align-center { text-align: center; } .prose .ql-align-right { text-align: right; }

/* ---------- 5. Header ---------- */
.site-header { position: sticky; top: 0; z-index: 100; backdrop-filter: saturate(180%) blur(16px); -webkit-backdrop-filter: saturate(180%) blur(16px); background: color-mix(in srgb, var(--bg) 78%, transparent); border-bottom: 1px solid var(--border); }
.nav-wrap { display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); height: 70px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand-mark { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font: 800 20px/1 var(--font-display); color: #fff; background: conic-gradient(from 210deg, var(--brand), var(--accent), var(--gold), var(--brand)); box-shadow: inset 0 0 0 2px rgba(255,255,255,.25); }
.brand-logo { height: 40px; width: auto; }
.brand-text { font: 800 20px/1 var(--font-display); letter-spacing: -.03em; }
.main-nav { display: flex; gap: 2px; align-items: center; }
.main-nav a { padding: 8px 12px; border-radius: var(--r-pill); text-decoration: none; font-size: 14.5px; font-weight: 500; color: var(--text); transition: background .2s; white-space: nowrap; }
.main-nav a:hover { background: var(--surface); }
.main-nav a.is-active { background: var(--ink); color: var(--bg); }
.nav-actions { display: flex; align-items: center; gap: 8px; }
.nav-burger { display: none; }
.nav-burger span { display: block; width: 16px; height: 2px; background: currentColor; border-radius: 2px; transition: transform .3s; }
.nav-burger span + span { margin-top: -10px; transform: translateY(5px); }
.nav-burger span:first-child { transform: translateY(-3px); }
[data-theme-toggle] .i-moon { display: none; }
:root[data-theme="dark"] [data-theme-toggle] .i-sun { display: none; }
:root[data-theme="dark"] [data-theme-toggle] .i-moon { display: block; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) [data-theme-toggle] .i-sun { display: none; } :root:not([data-theme="light"]) [data-theme-toggle] .i-moon { display: block; } }
.nav-login-mobile { display: none; }
@media (min-width: 1321px) { .main-nav .nav-home { display: none; } }
html[lang="ml"] .main-nav a { font-size: 13.5px; padding: 8px 9px; }
@media (max-width: 1320px) {
  .nav-burger { display: inline-grid; }
  .nav-login-mobile { display: block; margin-top: 8px; background: var(--ink); color: var(--bg) !important; text-align: center; }
  .main-nav { position: fixed; inset: 70px 0 auto 0; flex-direction: column; align-items: stretch; padding: 16px 20px 24px; background: var(--bg); border-bottom: 1px solid var(--border); box-shadow: var(--shadow-lg); transform: translateY(-120%); transition: transform .35s var(--ease); max-height: calc(100vh - 70px); overflow-y: auto; }
  .main-nav.is-open { transform: none; }
  .main-nav a { padding: 14px 16px; font-size: 17px; }
  .nav-actions .nav-login { display: none; }
}
/* Malayalam menu labels are longer: collapse the menu earlier */
@media (max-width: 1600px) {
  html[lang="ml"] .nav-burger { display: inline-grid; }
  html[lang="ml"] .nav-login-mobile { display: block; margin-top: 8px; background: var(--ink); color: var(--bg) !important; text-align: center; }
  html[lang="ml"] .main-nav { position: fixed; inset: 70px 0 auto 0; flex-direction: column; align-items: stretch; padding: 16px 20px 24px; background: var(--bg); border-bottom: 1px solid var(--border); box-shadow: var(--shadow-lg); transform: translateY(-120%); transition: transform .35s var(--ease); max-height: calc(100vh - 70px); overflow-y: auto; }
  html[lang="ml"] .main-nav.is-open { transform: none; }
  html[lang="ml"] .main-nav a { padding: 14px 16px; font-size: 17px; }
  html[lang="ml"] .nav-actions .nav-login { display: none; }
  html[lang="ml"] .main-nav .nav-home { display: block; }
}

/* ---------- 6. Hero ---------- */
.hero { position: relative; padding: clamp(48px, 9vw, 120px) 0 var(--s-8); overflow: hidden; isolation: isolate; }
.hero-blob { position: absolute; z-index: -1; border-radius: 50%; filter: blur(70px); opacity: .55; animation: float 16s ease-in-out infinite alternate; }
.hero-blob.b1 { width: 520px; height: 520px; background: var(--brand); top: -160px; right: -120px; }
.hero-blob.b2 { width: 380px; height: 380px; background: var(--accent); bottom: -140px; left: -80px; animation-delay: -6s; }
.hero-blob.b3 { width: 260px; height: 260px; background: var(--lime); top: 40%; right: 30%; opacity: .35; animation-delay: -10s; }
@keyframes float { to { transform: translate(40px, 30px) scale(1.08); } }
.hero-grid { display: grid; grid-template-columns: 1.25fr 1fr; gap: var(--s-7); align-items: center; }
.hero .display { margin-bottom: var(--s-5); }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: var(--s-6); }
.hero-visual { position: relative; aspect-ratio: 4/5; border-radius: 36px; overflow: hidden; box-shadow: var(--shadow-lg); transform: rotate(2deg); }
.hero-visual img { width: 100%; height: 100%; object-fit: cover; }
.hero-sticker { position: absolute; padding: 10px 16px; border-radius: var(--r-pill); font: 700 14px/1 var(--font-display); box-shadow: var(--shadow); }
.hero-sticker.s1 { background: var(--lime); color: #111; left: -12px; top: 12%; transform: rotate(-6deg); }
.hero-sticker.s2 { background: var(--surface); color: var(--ink); right: -10px; bottom: 14%; transform: rotate(5deg); }
@media (max-width: 900px) { .hero-grid { grid-template-columns: 1fr; } .hero-visual { max-width: 420px; transform: none; } }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); overflow: hidden; }
.stat { padding: var(--s-5); border-right: 1px solid var(--border); }
.stat:last-child { border-right: 0; }
.stat-num { font: 800 clamp(2rem, 4vw, 3rem)/1 var(--font-display); letter-spacing: -.04em; color: var(--ink); }
.stat-label { font-size: 13px; color: var(--muted); margin-top: 6px; text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
@media (max-width: 720px) { .stats { grid-template-columns: 1fr 1fr; } .stat:nth-child(2) { border-right: 0; } .stat:nth-child(-n+2) { border-bottom: 1px solid var(--border); } }

/* Marquee */
.marquee { overflow: hidden; border-block: 1px solid var(--border); background: var(--ink); color: var(--bg); padding: 18px 0; }
.marquee-track { display: flex; gap: 48px; width: max-content; animation: marquee 40s linear infinite; font: 700 clamp(1.4rem, 3vw, 2.2rem)/1 var(--font-display); letter-spacing: -.02em; }
.marquee-track span { display: inline-flex; align-items: center; gap: 48px; white-space: nowrap; }
.marquee-track span::after { content: "✦"; color: var(--lime); }
@keyframes marquee { to { transform: translateX(-50%); } }

/* Bento */
.bento { display: grid; grid-template-columns: repeat(6, 1fr); grid-auto-rows: minmax(180px, auto); gap: var(--s-4); }
.bento > * { border-radius: var(--r-lg); padding: var(--s-6); position: relative; overflow: hidden; text-decoration: none; }
.bento .b-wide { grid-column: span 4; } .bento .b-half { grid-column: span 3; } .bento .b-third { grid-column: span 2; } .bento .b-tall { grid-row: span 2; }
.bento .b-brand { background: var(--brand); color: #fff; } .bento .b-brand h3, .bento .b-brand h2 { color: #fff; }
.bento .b-accent { background: var(--accent); color: #fff; } .bento .b-accent h3 { color: #fff; }
.bento .b-lime { background: var(--lime); color: #1a1f00; } .bento .b-lime h3, .bento .b-lime h2 { color: #111; }
.bento .b-ink { background: var(--ink); color: var(--bg); } .bento .b-ink h3, .bento .b-ink h2 { color: var(--bg); }
.bento .b-surface { background: var(--surface); border: 1px solid var(--border); }
.bento .b-img { padding: 0; min-height: 260px; } .bento .b-img img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.bento .b-img .b-label { position: absolute; left: 16px; bottom: 16px; }
.b-big-num { font: 800 clamp(3rem, 7vw, 5.5rem)/.9 var(--font-display); letter-spacing: -.05em; }
.b-arrow { position: absolute; right: 22px; top: 22px; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.2); font-size: 20px; transition: transform .3s var(--ease); }
a.bento-link:hover .b-arrow { transform: rotate(-45deg); }
@media (max-width: 900px) { .bento { grid-template-columns: 1fr 1fr; } .bento > * { grid-column: span 2 !important; } .bento .b-third { grid-column: span 1 !important; } .bento .b-tall { grid-row: auto; } }
@media (max-width: 560px) { .bento .b-third { grid-column: span 2 !important; } }

/* Family branch card */
.fam-card { display: flex; flex-direction: column; text-decoration: none; border-radius: var(--r-lg); overflow: hidden; background: var(--surface); border: 1px solid var(--border); transition: transform .25s var(--ease), box-shadow .25s; }
.fam-card:hover { transform: translateY(-5px) rotate(-.4deg); box-shadow: var(--shadow); }
.fam-cover { aspect-ratio: 16/9; position: relative; overflow: hidden; background: var(--surface-2); }
.fam-cover img { width: 100%; height: 100%; object-fit: cover; }
.fam-body { padding: var(--s-5); display: flex; flex-direction: column; gap: 6px; flex: 1; }
.fam-body h3 { margin: 0; font-size: 1.45rem; }
.fam-stats { display: flex; gap: 14px; font-size: 13px; color: var(--muted); margin-top: auto; padding-top: 10px; }
.fam-stats b { color: var(--ink); }

/* Page hero (inner pages) */
.page-hero { padding: var(--s-8) 0 var(--s-6); position: relative; overflow: hidden; isolation: isolate; }
.page-hero::after { content: ""; position: absolute; z-index: -1; width: 600px; height: 600px; right: -200px; top: -300px; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--brand) 40%, transparent), transparent 70%); }
.page-hero h1 { font-size: clamp(2.6rem, 7vw, 5.2rem); letter-spacing: -.045em; font-weight: 800; line-height: .95; }
.cover-hero { position: relative; min-height: 440px; display: flex; align-items: end; color: #fff; isolation: isolate; border-radius: 0 0 var(--r-lg) var(--r-lg); overflow: hidden; }
.cover-hero > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2; }
.cover-hero::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, rgba(0,0,0,.05) 20%, rgba(0,0,0,.78)); }
.cover-hero h1 { color: #fff; }
.cover-hero .container { padding-bottom: var(--s-7); padding-top: var(--s-8); }
.cover-hero .lead { color: rgba(255,255,255,.85); }
.cover-hero .placeholder-art { position: absolute; inset: 0; z-index: -2; font-size: 0; }

/* Tabs-ish sub nav */
.subnav { display: flex; gap: 8px; flex-wrap: wrap; position: sticky; top: 70px; z-index: 50; padding: 12px 0; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(10px); }

/* People list */
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 12px; }
.person-chip { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--border); text-decoration: none; transition: border-color .2s, transform .2s; }
.person-chip:hover { border-color: var(--brand); transform: translateY(-2px); }
.person-chip .pc-name { font-weight: 600; color: var(--ink); display: block; line-height: 1.3; }
.person-chip .pc-meta { font-size: 13px; color: var(--muted); }

/* Gallery */
.masonry { columns: 4 260px; column-gap: 14px; }
.masonry > * { break-inside: avoid; margin-bottom: 14px; }
.m-item { position: relative; display: block; border-radius: var(--r); overflow: hidden; background: var(--surface-2); cursor: zoom-in; border: 0; padding: 0; width: 100%; text-align: left; }
.m-item img { width: 100%; transition: transform .5s var(--ease); }
.m-item:hover img { transform: scale(1.04); }
.m-item .m-play { position: absolute; inset: 0; display: grid; place-items: center; }
.m-item .m-play span { width: 64px; height: 64px; border-radius: 50%; background: rgba(255,255,255,.92); color: #111; display: grid; place-items: center; font-size: 22px; padding-left: 4px; box-shadow: var(--shadow); }
.m-item .m-cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 30px 12px 10px; color: #fff; font-size: 13px; background: linear-gradient(transparent, rgba(0,0,0,.7)); opacity: 0; transition: opacity .3s; }
.m-item:hover .m-cap { opacity: 1; }
.video-ph { aspect-ratio: 16/10; background: linear-gradient(135deg, var(--ink), var(--brand)); }

/* Lightbox */
.lightbox { position: fixed; inset: 0; z-index: 300; background: rgba(8, 7, 12, .94); display: grid; place-items: center; padding: 60px 70px; }
.lightbox[hidden] { display: none; }
.lb-stage { max-width: 100%; max-height: 100%; display: grid; place-items: center; }
.lb-stage img, .lb-stage video { max-height: calc(100vh - 140px); max-width: min(1400px, calc(100vw - 140px)); width: auto; border-radius: 12px; }
.lb-stage iframe { width: min(1100px, calc(100vw - 140px)); aspect-ratio: 16/9; border: 0; border-radius: 12px; }
.lightbox button { position: absolute; background: rgba(255,255,255,.1); color: #fff; border: 0; width: 48px; height: 48px; border-radius: 50%; font-size: 28px; cursor: pointer; display: grid; place-items: center; }
.lightbox button:hover { background: rgba(255,255,255,.22); }
.lb-close { top: 16px; right: 16px; } .lb-prev { left: 12px; top: 50%; } .lb-next { right: 12px; top: 50%; }
.lb-caption { position: absolute; bottom: 16px; left: 0; right: 0; text-align: center; color: rgba(255,255,255,.85); font-size: 14px; padding: 0 20px; }
@media (max-width: 640px) { .lightbox { padding: 60px 8px; } .lb-stage img, .lb-stage video, .lb-stage iframe { max-width: calc(100vw - 16px); width: calc(100vw - 16px); } .lb-prev, .lb-next { top: auto !important; bottom: 50px; } }

/* Events */
.event-row { display: grid; grid-template-columns: 92px 1fr auto; gap: var(--s-5); align-items: center; padding: var(--s-5); border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--border); text-decoration: none; transition: transform .2s var(--ease), border-color .2s; }
.event-row:hover { transform: translateX(4px); border-color: var(--brand); }
.event-date { text-align: center; border-radius: 18px; padding: 12px 6px; background: var(--ink); color: var(--bg); }
.event-date .d { font: 800 2rem/1 var(--font-display); display: block; }
.event-date .m { font-size: 12px; text-transform: uppercase; letter-spacing: .12em; font-weight: 600; }
.event-row h3 { margin: 0 0 4px; }
.event-row.is-past .event-date { background: var(--surface-2); color: var(--muted); }
@media (max-width: 640px) { .event-row { grid-template-columns: 72px 1fr; } .event-row .btn { display: none; } }

/* Family tree — heritage chart style */
:root { --wood: #7a5233; --wood-dark: #5a3a22; --parchment: #f6f0e1; --parchment-2: #ece3cc; --gold-1: #f3d27a; --gold-2: #b8862b; --t-ink: #2b2118; }
.tree-toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; justify-content: space-between; margin-bottom: var(--s-4); }
.tree-toolbar .input { max-width: 320px; padding: 11px 15px; border-radius: var(--r-pill); }
.tree-tools { display: flex; gap: 6px; flex-wrap: wrap; }
.tree-viewport { position: relative; height: min(82vh, 980px); border-radius: var(--r-lg); border: 1px solid #d9ccad; overflow: hidden; cursor: grab; touch-action: none; isolation: isolate;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255,255,255,.75), transparent 60%),
    radial-gradient(ellipse at 0% 100%, rgba(134,168,86,.28), transparent 45%),
    radial-gradient(ellipse at 100% 100%, rgba(134,168,86,.28), transparent 45%),
    linear-gradient(180deg, var(--parchment), var(--parchment-2)); }
.tree-viewport::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 70px; z-index: -1; pointer-events: none;
  background: linear-gradient(180deg, transparent, rgba(110,150,70,.35)); }
.tree-viewport.is-dragging { cursor: grabbing; }
.tree-canvas { position: absolute; left: 0; top: 0; width: max-content; min-width: 100%; transform-origin: 0 0; padding: 40px 60px 80px; will-change: transform; color: var(--t-ink); }
.tree-quote { position: absolute; z-index: 2; pointer-events: none; color: #4a3b2a; }
.tree-quote.q-left { left: 28px; top: 24px; max-width: 250px; font: 400 15px/1.5 var(--font-serif); }
.tree-quote.q-right { right: 32px; top: 18px; font: 400 30px/1.15 "Great Vibes", var(--font-serif); text-align: right; transform: rotate(-6deg); color: #5a3a22; }
.tree-quote.q-right::after { content: "♥"; display: block; text-align: center; font: 18px/1 serif; color: #7a3a22; margin-top: 4px; }
.tree-badge { position: absolute; z-index: 2; pointer-events: none; }
.tree-badge.b-stone { left: 50%; bottom: 14px; transform: translateX(-50%); padding: 10px 26px; border-radius: 40% 46% 38% 44%; background: linear-gradient(160deg, #6f6a64, #3f3b37); color: #f1ece4; font: 400 22px/1.1 "Great Vibes", var(--font-serif); box-shadow: 0 8px 18px rgba(0,0,0,.25); text-align: center; }
.tree-badge.b-plaque { right: 22px; bottom: 16px; padding: 12px 20px; border-radius: 10px; background: linear-gradient(160deg, #f1dfb8, #d8bd88); border: 2px solid #a37b45; color: #3d2b18; font: 500 14px/1.45 "Cormorant Garamond", var(--font-serif); text-align: center; box-shadow: 0 6px 14px rgba(90,58,34,.25); }
@media (max-width: 900px) { .tree-quote, .tree-badge { display: none; } }

/* Wooden title sign */
.tree-sign { display: table; margin: 0 auto 26px; position: relative; padding: 14px 54px 12px; text-align: center; border-radius: 14px;
  background: linear-gradient(180deg, #e8cf9d, #d2b07a 55%, #c49b62); border: 3px solid #8a6236; box-shadow: inset 0 2px 0 rgba(255,255,255,.5), 0 8px 18px rgba(90,58,34,.3); }
.tree-sign::before, .tree-sign::after { content: ""; position: absolute; top: 50%; width: 120px; height: 60px; transform: translateY(-50%); background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 60'%3E%3Cg fill='%235f8f3a'%3E%3Cpath d='M60 58C58 40 40 30 18 32c10 12 24 20 42 26z'/%3E%3Cpath d='M60 58c2-18 20-28 42-26-10 12-24 20-42 26z' fill='%237aa84a'/%3E%3Cpath d='M60 56C50 40 52 20 62 6c8 16 6 34-2 50z' fill='%2387b856'/%3E%3Cpath d='M40 40C30 30 14 30 4 38c12 6 24 6 36 2z' fill='%23709e44'/%3E%3Cpath d='M80 40c10-10 26-10 36-2-12 6-24 6-36 2z' fill='%235a8a36'/%3E%3C/g%3E%3C/svg%3E") center/contain no-repeat; }
.tree-sign::before { left: -96px; transform: translateY(-50%) rotate(-80deg); }
.tree-sign::after { right: -96px; transform: translateY(-50%) rotate(80deg) scaleX(-1); }
.tree-sign h2 { margin: 0; font: 700 clamp(26px, 3vw, 42px)/1 "Cinzel", var(--font-serif); letter-spacing: .04em; color: #2b1c10; text-transform: uppercase; }
.tree-sign p { margin: 4px 0 0; font: 600 13px/1 "Cinzel", var(--font-serif); letter-spacing: .32em; color: #3d2b18; text-transform: uppercase; }

/* Branch connectors (wood) */
.ftree ul { display: flex; justify-content: center; padding-top: 40px; margin: 0; padding-left: 0; position: relative; list-style: none; }
.ftree > ul { padding-top: 0; gap: 70px; }
.ftree li { position: relative; padding: 40px 5px 0; display: flex; flex-direction: column; align-items: center; }
.ftree > ul > li { padding-top: 0; }
.ftree li::before, .ftree li::after { content: ""; position: absolute; top: 0; right: 50%; width: 50%; height: 40px; border-top: 4px solid var(--wood); }
.ftree li::after { right: auto; left: 50%; border-left: 4px solid var(--wood); }
.ftree li:only-child::before, .ftree li:only-child::after { display: none; }
.ftree li:only-child > .tnode::before { content: ""; position: absolute; top: -40px; left: 50%; height: 40px; margin-left: -2px; border-left: 4px solid var(--wood); }
.ftree > ul > li::before, .ftree > ul > li::after, .ftree > ul > li:only-child > .tnode::before { display: none; }
.ftree li:first-child::before, .ftree li:last-child::after { border: 0 none; }
.ftree li:last-child::before { border-right: 4px solid var(--wood); border-radius: 0 18px 0 0; }
.ftree li:first-child::after { border-radius: 18px 0 0 0; }
.ftree ul ul::before { content: ""; position: absolute; top: 0; left: 50%; height: 40px; margin-left: -2px; border-left: 4px solid var(--wood); }
/* thicker limbs near the trunk */
.ftree > ul > li > ul::before { border-left-width: 10px; margin-left: -5px; border-color: var(--wood-dark); }
.ftree > ul > li > ul > li::before, .ftree > ul > li > ul > li::after { border-top-width: 7px; border-color: var(--wood-dark); }
.ftree > ul > li > ul > li::after { border-left-width: 6px; }
.ftree > ul > li > ul > li:last-child::before { border-right-width: 6px; }
.ftree li.is-collapsed > ul { display: none; }

/* Person node: gold frame + coloured label */
.tnode { position: relative; display: flex; flex-direction: column; align-items: center; width: 160px; }
.tnode.is-root { width: 240px; }
.tnode.d2 { width: 140px; }
.tnode.d3 { width: 124px; }
.d1 > .frame::after, .is-root > .frame::after { content: ""; position: absolute; z-index: -1; top: -30px; left: -70px; width: 110px; height: 55px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 60'%3E%3Cg fill='%235f8f3a'%3E%3Cpath d='M60 58C58 40 40 30 18 32c10 12 24 20 42 26z'/%3E%3Cpath d='M60 58c2-18 20-28 42-26-10 12-24 20-42 26z' fill='%237aa84a'/%3E%3Cpath d='M60 56C50 40 52 20 62 6c8 16 6 34-2 50z' fill='%2387b856'/%3E%3Cpath d='M40 40C30 30 14 30 4 38c12 6 24 6 36 2z' fill='%23709e44'/%3E%3Cpath d='M80 40c10-10 26-10 36-2-12 6-24 6-36 2z' fill='%235a8a36'/%3E%3C/g%3E%3C/svg%3E") center/contain no-repeat; transform: rotate(-35deg); pointer-events: none; }
.d1 > .frame::before, .is-root > .frame::before { content: ""; position: absolute; z-index: -1; top: -30px; right: -70px; width: 110px; height: 55px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 60'%3E%3Cg fill='%235f8f3a'%3E%3Cpath d='M60 58C58 40 40 30 18 32c10 12 24 20 42 26z'/%3E%3Cpath d='M60 58c2-18 20-28 42-26-10 12-24 20-42 26z' fill='%237aa84a'/%3E%3Cpath d='M60 56C50 40 52 20 62 6c8 16 6 34-2 50z' fill='%2387b856'/%3E%3Cpath d='M40 40C30 30 14 30 4 38c12 6 24 6 36 2z' fill='%23709e44'/%3E%3Cpath d='M80 40c10-10 26-10 36-2-12 6-24 6-36 2z' fill='%235a8a36'/%3E%3C/g%3E%3C/svg%3E") center/contain no-repeat; transform: rotate(35deg) scaleX(-1); pointer-events: none; }
.is-root > .frame::after, .is-root > .frame::before { width: 160px; height: 80px; top: -36px; }
.is-root > .frame::after { left: -120px; } .is-root > .frame::before { right: -120px; }
.frame { position: relative; z-index: 1; display: block; width: 68px; height: 68px; padding: 5px; border-radius: 4px; margin-bottom: -6px;
  background: linear-gradient(135deg, var(--gold-1), var(--gold-2) 45%, #f6dc8f 60%, #9b6d22); box-shadow: 0 4px 10px rgba(60,40,10,.35), inset 0 0 0 1px rgba(255,255,255,.45); }
.frame img, .frame svg { width: 100%; height: 100%; object-fit: cover; display: block; border: 2px solid #fff8e6; }
.frame-lg { width: 108px; height: 108px; padding: 7px; }
.t-label { position: relative; z-index: 1; width: 100%; padding: 10px 10px 12px; text-align: center; border-radius: 8px;
  background: hsl(var(--h, 40) 72% 93%); border: 1.5px solid hsl(var(--h, 40) 45% 74%); box-shadow: 0 3px 8px rgba(60,40,10,.12); display: flex; flex-direction: column; gap: 2px;
  font-family: "Cormorant Garamond", var(--font-serif); color: var(--t-ink); }
.no-hue .t-label { background: #fffaf0; border-color: #d8c7a3; }
.is-root .t-label { background: linear-gradient(180deg, #f8ecd2, #edd9b0); border: 2px solid #a37b45; padding: 12px 16px; }
.t-name { font: 700 17px/1.2 "Cormorant Garamond", var(--font-serif); color: #20180f; text-decoration: none; }
.t-name:hover { text-decoration: underline; }
.is-root .t-name { font-size: 22px; }
.d1 .t-name { font-size: 19px; }
.d3 .t-name { font-size: 15.5px; }
.t-num { font-weight: 700; }
.t-nick { font-weight: 600; }
.t-house { font-size: 15px; font-weight: 500; }
.is-root .t-house { font-size: 18px; border-top: 1px solid rgba(90,58,34,.35); padding-top: 3px; margin-top: 2px; }
.t-spouse, .t-kids, .t-note, .t-years { font: 500 13.5px/1.3 "Cormorant Garamond", var(--font-serif); color: #3a2e22; }
.t-spouse { margin-top: 4px; }
.t-spouse a { color: inherit; text-decoration: none; font-weight: 700; }
.t-spouse a:hover { text-decoration: underline; }
.t-note { font-style: italic; color: #5b4c3c; }
.tnode.is-match .t-label { outline: 3px solid #e2b93b; outline-offset: 3px; animation: pulse 1.2s ease 2; }
@keyframes pulse { 50% { transform: scale(1.05); } }
.kids-toggle { position: absolute; bottom: -12px; left: 50%; transform: translateX(-50%); z-index: 3; min-width: 24px; height: 24px; padding: 0 7px; border-radius: 12px; border: 2px solid var(--parchment); background: var(--wood); color: #fff; font: 700 11px/1 var(--font-body); cursor: pointer; }
li.is-collapsed > .tnode .kids-toggle { background: #3f7a2c; }
.tree-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-top: 12px; }


/* Tree: names, branches, relations */
.t-known { font: italic 600 15px/1.2 "Cormorant Garamond", var(--font-serif); color: #6a4a2a; }
.t-known-inline { font-style: italic; }
.t-from { color: #5b4c3c; }
.t-years { color: #4a3d30; letter-spacing: .02em; }
.t-branch { margin: 6px auto 0; display: inline-block; padding: 3px 10px; border-radius: 999px; background: #5a3a22; color: #fbe9c6 !important; font: 600 11.5px/1.4 var(--font-body); text-decoration: none; }
.t-branch:hover { background: #3f2615; }
.t-rel { position: relative; z-index: 2; margin-bottom: 6px; padding: 2px 10px; border-radius: 999px; background: #fff8ea; border: 1px solid #c9b48c; font: 600 11px/1.4 var(--font-body); color: #5a3a22; text-transform: uppercase; letter-spacing: .08em; }

/* Tree: memorial style for the departed */
.ribbon { position: absolute; top: -4px; right: -4px; width: 30px; height: 30px; overflow: hidden; z-index: 2; pointer-events: none; }
.ribbon::before { content: ""; position: absolute; top: 8px; right: -10px; width: 44px; height: 7px; background: linear-gradient(#2a2a2a, #000); transform: rotate(45deg); box-shadow: 0 1px 2px rgba(0,0,0,.4); }
.tnode.is-late .frame { background: linear-gradient(135deg, #e8e8e8, #8c8c8c 45%, #f2f2f2 60%, #5a5a5a); }
.tnode.is-late .frame img, .tnode.is-late .frame svg { filter: grayscale(1) sepia(.18) contrast(.95); }
.tnode.is-late .t-label { background: #f2efea; border-color: #a49c90; border-top: 4px solid #2f2a26; }
.tnode.is-late .t-name { color: #2f2a26; }
.t-memorial { align-self: center; margin-bottom: 2px; padding: 1px 9px; border-radius: 999px; background: #2f2a26; color: #f3efe8; font: 600 10.5px/1.5 var(--font-body); letter-spacing: .06em; text-transform: uppercase; }
.t-late-mini { font-size: 11px; font-weight: 600; color: #5d554c; }

/* People lists */
.pc-av { position: relative; flex: none; display: inline-flex; }
.pc-known { display: block; font-family: var(--font-serif); font-style: italic; font-size: 15px; color: var(--muted); line-height: 1.2; }
.person-chip.is-late { background: color-mix(in srgb, var(--surface) 88%, #6b6359); border-color: color-mix(in srgb, var(--border) 60%, #6b6359); }
.person-chip.is-late .avatar { filter: grayscale(1); }
.person-chip .ribbon { top: -3px; right: -3px; width: 22px; height: 22px; }
.person-chip .ribbon::before { top: 6px; right: -8px; width: 32px; height: 5px; }
.late-tag { display: inline-block; padding: 0 7px; border-radius: 999px; background: var(--ink); color: var(--bg); font-size: 11px; font-weight: 600; margin-right: 4px; }

/* Profile */
.memorial-hero { background: linear-gradient(180deg, #1d1a17, #2c2621); color: #eee6da; border-radius: 0 0 var(--r-lg) var(--r-lg); }
.memorial-hero h1, .memorial-hero .lead { color: #f6efe4; }
.memorial-hero .eyebrow { color: #cfc3b1; } .memorial-hero .eyebrow::before { background: #e9c46a; box-shadow: 0 0 0 4px rgba(233,196,106,.25); }
.memorial-hero .chip { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.18); color: #eee6da; }
.memorial-hero .btn-ghost { color: #f6efe4; border-color: rgba(255,255,255,.35); }
.memorial-photo { position: relative; display: inline-block; }
.memorial-photo .avatar-xl { filter: grayscale(1) sepia(.15); border: 6px solid #d8d2c8; }
.memorial-photo .ribbon { width: 52px; height: 52px; top: -2px; right: -2px; }
.memorial-photo .ribbon::before { top: 14px; right: -16px; width: 76px; height: 12px; }
.candle { display: inline-block; width: 10px; height: 26px; margin-right: 10px; vertical-align: -6px; border-radius: 3px; background: linear-gradient(#f4ecd8, #d9ccb0); position: relative; }
.candle::before { content: ""; position: absolute; left: 50%; top: -14px; width: 8px; height: 13px; margin-left: -4px; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; background: radial-gradient(circle at 50% 70%, #fff6c8, #ffb547 60%, #ff7a1a); animation: flicker 2.2s ease-in-out infinite alternate; }
@keyframes flicker { 50% { transform: scale(.92) rotate(-3deg); opacity: .85; } }
.known-as { font-family: var(--font-serif); font-style: italic; font-size: clamp(1.3rem, 2.4vw, 1.8rem); color: var(--muted); margin: 6px 0 0; }
.memorial-hero .known-as { color: #cfc3b1; }
.detail-group { margin-top: var(--s-6); }
.detail-group h2 { font-size: 1.35rem; }
.dl { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 12px; margin: 0; }
.dl > div { padding: 14px 16px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--border); }
.dl dt { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 600; }
.dl dd { margin: 2px 0 0; font-weight: 600; color: var(--ink); }
.spouse-card { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center; padding: 18px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--border); }
@media (max-width: 520px) { .spouse-card { grid-template-columns: 1fr; } }
.breadcrumb { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 14px; color: var(--muted); margin-bottom: 12px; }
.breadcrumb a { color: inherit; }
.cover-hero .breadcrumb { color: rgba(255,255,255,.8); }

/* Branch hierarchy (families page) */
.branch-tree, .branch-tree ul { list-style: none; margin: 0; padding: 0; }
.branch-tree ul { margin-left: 22px; padding-left: 18px; border-left: 3px solid var(--wood); }
.branch-tree li { position: relative; padding: 8px 0; }
.branch-tree ul > li::before { content: ""; position: absolute; left: -18px; top: 32px; width: 16px; border-top: 3px solid var(--wood); }
.branch-row { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--border); text-decoration: none; transition: border-color .2s, transform .2s; max-width: 640px; }
.branch-row:hover { border-color: var(--brand); transform: translateX(3px); }
.branch-row .avatar { border-radius: 12px; }
.branch-row b { display: block; color: var(--ink); font-size: 1.05rem; }
.branch-row small { color: var(--muted); }

/* Language switch */
.lang-switch { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); padding: 3px; }
.lang-switch a { padding: 5px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; text-decoration: none; color: var(--muted); line-height: 1.2; }
.lang-switch a.is-active { background: var(--ink); color: var(--bg); }
@media (max-width: 400px) { .lang-switch a { padding: 5px 8px; } }

/* Malayalam typography */
:root { --font-ml: "Noto Sans Malayalam", "Manjari", "Inter", system-ui, sans-serif; --font-ml-display: "Anek Malayalam", "Noto Sans Malayalam", sans-serif; }
html[lang="ml"] body { font-family: var(--font-ml); line-height: 1.75; }
html[lang="ml"] h1, html[lang="ml"] h2, html[lang="ml"] h3, html[lang="ml"] h4, html[lang="ml"] .display, html[lang="ml"] .display-sm,
html[lang="ml"] .brand-text, html[lang="ml"] .stat-num, html[lang="ml"] .b-big-num { font-family: var(--font-ml-display); letter-spacing: 0; line-height: 1.2; }
html[lang="ml"] .display { font-size: clamp(2.4rem, 7vw, 5.6rem); line-height: 1.1; }
html[lang="ml"] .page-hero h1 { letter-spacing: 0; line-height: 1.15; font-size: clamp(2.2rem, 6vw, 4.2rem); }
html[lang="ml"] em, html[lang="ml"] .serif { font-family: var(--font-ml); font-style: normal; font-weight: 600; }
html[lang="ml"] .eyebrow, html[lang="ml"] .stat-label, html[lang="ml"] .footer-h, html[lang="ml"] .badge { letter-spacing: .02em; text-transform: none; }
html[lang="ml"] .main-nav a { font-size: 14px; padding: 8px 10px; }
html[lang="ml"] .t-label, html[lang="ml"] .t-name, html[lang="ml"] .t-known, html[lang="ml"] .t-spouse, html[lang="ml"] .t-kids, html[lang="ml"] .t-note, html[lang="ml"] .t-house { font-family: var(--font-ml); font-style: normal; }
html[lang="ml"] .t-name { font-size: 15px; } html[lang="ml"] .is-root .t-name { font-size: 19px; }
html[lang="ml"] .t-spouse, html[lang="ml"] .t-kids, html[lang="ml"] .t-note { font-size: 12px; }
html[lang="ml"] .tree-quote.q-left, html[lang="ml"] .tree-badge { font-family: var(--font-ml); }
html[lang="ml"] .tree-quote.q-right { font-family: var(--font-ml-display); font-size: 22px; transform: none; }

/* Person profile */
.profile-head { display: grid; grid-template-columns: auto 1fr; gap: var(--s-6); align-items: center; }
@media (max-width: 640px) { .profile-head { grid-template-columns: 1fr; } }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin: var(--s-5) 0; }
.fact { padding: 14px 16px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--border); }
.fact .k { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 600; }
.fact .v { font-weight: 600; color: var(--ink); }

/* Post card */
.post-card .badge { margin-bottom: 10px; }
.post-obit { border-color: var(--border-strong); }
.post-obit .card-media img { filter: grayscale(1); }
.article-cover { border-radius: var(--r-lg); overflow: hidden; margin: var(--s-5) 0 var(--s-6); box-shadow: var(--shadow); }

/* Footer */
.site-footer { margin-top: var(--s-8); background: var(--ink); color: color-mix(in srgb, var(--bg) 75%, transparent); padding: var(--s-8) 0 var(--s-5); border-radius: var(--r-lg) var(--r-lg) 0 0; }
.site-footer a { color: var(--bg); text-decoration: none; display: block; padding: 3px 0; opacity: .8; }
.site-footer .lang-switch { background: transparent; border-color: rgba(127,127,127,.4); }
.site-footer .lang-switch a { display: inline-block; padding: 5px 10px; }
.site-footer .lang-switch a.is-active { background: var(--bg); color: var(--ink); opacity: 1; }
.site-footer a:hover { opacity: 1; }
.site-footer .muted { color: color-mix(in srgb, var(--bg) 60%, transparent); }
.footer-cta { display: grid; grid-template-columns: 1.4fr 1fr auto; gap: var(--s-5); align-items: end; padding-bottom: var(--s-7); border-bottom: 1px solid rgba(127,127,127,.25); }
.footer-cta h2 { color: var(--bg); margin: 0; } .footer-cta em { color: var(--lime); }
.footer-cta p { margin: 0; }
.footer-cta .btn { display: inline-flex; opacity: 1; color: #111; justify-self: start; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: var(--s-6); padding: var(--s-7) 0; }
.footer-h { color: var(--bg); font-size: 13px; text-transform: uppercase; letter-spacing: .12em; font-family: var(--font-body); }
.brand-footer { display: inline-flex !important; margin-bottom: 12px; opacity: 1 !important; }
.footer-bottom { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 13px; padding-top: var(--s-5); border-top: 1px solid rgba(127,127,127,.25); }
.footer-bottom a { display: inline; }
@media (max-width: 900px) { .footer-cta, .footer-grid { grid-template-columns: 1fr 1fr; } .footer-cta h2 { grid-column: 1 / -1; } }
@media (max-width: 560px) { .footer-cta, .footer-grid { grid-template-columns: 1fr; } }

/* Auth */
.auth-wrap { min-height: calc(100vh - 70px); display: grid; place-items: center; padding: var(--s-7) 20px; }
.auth-card { width: 100%; max-width: 440px; padding: var(--s-7) var(--s-6); border-radius: 32px; }

/* Reveal on scroll */
.js .reveal { opacity: 0; transform: translateY(24px); transition: opacity .8s var(--ease), transform .8s var(--ease); }
.js .reveal.is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } .js .reveal { opacity: 1; transform: none; } html { scroll-behavior: auto; } }

/* Utilities */
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; } .mt-4 { margin-top: var(--s-4); } .mt-6 { margin-top: var(--s-6); } .mb-6 { margin-bottom: var(--s-6); }
.flex { display: flex; } .gap-2 { gap: 8px; } .gap-4 { gap: 16px; } .wrap { flex-wrap: wrap; } .items-center { align-items: center; } .between { justify-content: space-between; }
.text-center { text-align: center; } .w-full { width: 100%; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Businesses */
.biz-card { display: flex; flex-direction: column; text-decoration: none; border-radius: var(--r-lg); overflow: hidden; background: var(--surface); border: 1px solid var(--border); transition: transform .25s var(--ease), box-shadow .25s; }
.biz-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.biz-cover { position: relative; aspect-ratio: 16/8; background: var(--surface-2); }
.biz-cover img { width: 100%; height: 100%; object-fit: cover; }
.biz-logo { position: absolute; left: 16px; bottom: -22px; padding: 3px; border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-sm); }
.biz-logo .avatar { width: 52px; height: 52px; border-radius: 13px; }
.biz-body { padding: 32px 20px 20px; display: flex; flex-direction: column; gap: 6px; }
.biz-body h3 { margin: 4px 0 0; }
.biz-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.biz-offer { padding: 14px 16px; border-radius: var(--r); background: color-mix(in srgb, var(--lime) 35%, var(--surface)); border: 1px solid color-mix(in srgb, var(--lime) 60%, transparent); color: var(--ink); }

/* Professional profile (CV) on person page */
.cv-headline { font-size: clamp(1.05rem, 1.8vw, 1.3rem); color: var(--muted); margin: 6px 0 0; }
.memorial-hero .cv-headline { color: #cfc3b1; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.timeline li { position: relative; padding: 16px 18px 16px 22px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--border); }
.timeline li::before { content: ""; position: absolute; left: 0; top: 16px; bottom: 16px; width: 4px; border-radius: 4px; background: var(--brand); }
.timeline .tl-title { font-weight: 700; color: var(--ink); }
.timeline .tl-org { color: var(--text); }
.timeline .tl-meta { font-size: 13px; color: var(--muted); }
.timeline .tl-desc { margin-top: 6px; white-space: pre-line; font-size: 15px; }
.skill-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.skill-chips span { padding: 6px 12px; border-radius: 999px; background: color-mix(in srgb, var(--brand) 12%, var(--surface)); color: var(--ink); font-size: 14px; font-weight: 500; }

/* ---------- Media protection (public visitors) ---------- */
.is-protected img, .is-protected video { -webkit-user-drag: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.is-protected .m-item, .is-protected .lightbox, .is-protected .hero-visual, .is-protected .card-media, .is-protected .fam-cover, .is-protected .biz-cover { -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; }
.lb-stage { position: relative; }
.wm-overlay { position: absolute; inset: 0; pointer-events: none; background-repeat: repeat; z-index: 2; }
.is-protected .lb-stage img { pointer-events: none; }
.is-shielded img, .is-shielded video, .is-shielded .lb-stage, .is-shielded .placeholder-art { filter: blur(28px) grayscale(1) !important; transition: filter .05s; }
@media print {
  .is-protected img, .is-protected video, .is-protected .lightbox { visibility: hidden !important; }
  .is-protected main::before { content: "Photos and videos of the family are not available for printing."; display: block; padding: 24px; font-size: 18px; }
}
