/* Classical — design-system tokens and component classes. This file is the source of truth for the system's look; retune it here and see readme.md. */
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,400;0,500;0,600;1,400;1,500&family=Inter:wght@400;500;600&display=swap');

:root {
  /* "Living Archive" palette — parchment/ink/gold. Layered on top of the
     --color-* tokens below (still used by the shared component classes);
     these drive the glass entry surfaces and heritage interior. */
  --page-bg: #f4f1ea;
  --cream: #fbf8f1;
  --ink: #0f0d0a;
  --ink-soft: #2e2a22;
  --gold: #b0762a;
  --line: rgba(43, 38, 32, .14);
  --glass: rgba(251, 248, 241, .55);
  --glass-strong: rgba(251, 248, 241, .78);
  --glass-border: rgba(43, 38, 32, .12);
  --glass-blur: 24px;
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  /* Serif carries the emotion (display + editorial body); sans is
     reserved for UI chrome only (nav, buttons, labels, inputs). */
  --font-ui: "Inter", system-ui, sans-serif;

  --color-bg: #f3f2f2;
  --color-surface: #eae9e9;
  --color-text: #100f0e;
  --color-accent: #b68235;
  --color-accent-2: #ac803e;
  --color-divider: color-mix(in srgb, #201f1d 16%, transparent);

  /* Tonal ramps — generated in OKLCH on one shared lightness scale, so the
     same step of any role matches the others in visual value. */
  --color-neutral-100: #f8f4f4;
  --color-neutral-200: #eae7e7;
  --color-neutral-300: #d7d3d3;
  --color-neutral-400: #bab6b6;
  --color-neutral-500: #9b9797;
  --color-neutral-600: #7d7979;
  --color-neutral-700: #605d5d;
  --color-neutral-800: #444141;
  --color-neutral-900: #2d2b2b;

  --color-accent-100: #fff3e4;
  --color-accent-200: #ffe3bf;
  --color-accent-300: #facb8d;
  --color-accent-400: #e1ad66;
  --color-accent-500: #c28d41;
  --color-accent-600: #a06f24;
  --color-accent-700: #7d5411;
  --color-accent-800: #5a3b0a;
  --color-accent-900: #3a270d;

  --color-accent-2-100: #fff3e4;
  --color-accent-2-200: #ffe3be;
  --color-accent-2-300: #f5cd96;
  --color-accent-2-400: #dbaf70;
  --color-accent-2-500: #bc8f4e;
  --color-accent-2-600: #9b7232;
  --color-accent-2-700: #79561f;
  --color-accent-2-800: #573d14;
  --color-accent-2-900: #382810;

  --font-heading: "Cormorant Garamond", system-ui, sans-serif;
  --font-heading-weight: 600; /* review round 3: bold retired — semibold is the
     interface headings' ceiling (they need the weight at small sizes); display
     text goes lighter still, to the normal cut (see the deck) */
  --font-body: "Cormorant Garamond", system-ui, serif;

  --space-1: 4.6px;
  --space-2: 9.2px;
  --space-3: 13.8px;
  --space-4: 18.4px;
  --space-6: 27.6px;
  --space-8: 36.8px;

  --radius-sm: 2px;
  --radius-md: 4px;
  --radius-lg: 7px;

  /* Elevation — derived from the ground: soft ink-tinted shadows on a
     light theme, a hairline edge + ambient darkness on a dark one. */
  --shadow-sm: 0 1px 2px color-mix(in srgb, #2d2b2b 14%, transparent);
  --shadow-md: 0 3px 10px color-mix(in srgb, #2d2b2b 16%, transparent);
  --shadow-lg: 0 12px 32px color-mix(in srgb, #2d2b2b 22%, transparent);
}

body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
}
h1, h2, h3, h4 { font-family: var(--font-heading); font-weight: var(--font-heading-weight); }

.plate{filter:sepia(0.22) saturate(0.82) contrast(1.05);box-sizing:border-box;
  border:6px solid var(--color-surface);outline:1px solid var(--color-divider)}

/* ══════════════════════════════════════════════════════════════════════════
   Components — built with the tokens above. Plain CSS
   on plain HTML: no JavaScript, no build step. Each class is documented in
   readme.md and demonstrated in foundations/ and components/.
   ══════════════════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font-size: 19px; line-height: 1.65; font-weight: 400; }
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading); font-weight: var(--font-heading-weight);
  line-height: 1.12; letter-spacing: -0.015em; margin: 0 0 var(--space-2);
}
h1 { font-size: 42px; }
h2 { font-size: 32px; }
h3 { font-size: 25px; }
h4 { font-size: 20px; }
h5 { font-size: 18px; }
h6 { font-size: 15px; }
h6 { letter-spacing: 0.08em; text-transform: uppercase; }
p { margin: 0 0 var(--space-3); }
a { color: var(--color-accent); text-underline-offset: 3px; }
img { display: block; max-width: 100%; }
figure { margin: 0; }
figcaption {
  font-size: 11px; margin-top: var(--space-1);
  color: color-mix(in srgb, var(--color-text) 55%, transparent);
}
.text-muted { color: color-mix(in srgb, var(--color-text) 92%, transparent); }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
::selection { background: color-mix(in srgb, var(--color-accent) 30%, transparent); }

/* — rules — */
.hr {
  height: 1px; border: 0; margin: var(--space-4) 0;
  background: var(--color-divider);
}

/* — buttons — */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  cursor: pointer; text-decoration: none;
  font-family: var(--font-ui); font-weight: 500;
  font-size: 14px; line-height: 1.2; color: var(--color-text); /* matches the .input's 14px —
     the pair sits side by side in sign-up rows */
  background: transparent; border: 1px solid transparent;
  padding: var(--space-2) calc(var(--space-3) * 1.2);
  border-radius: var(--radius-md);
}
.btn svg { display: block; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { color: var(--color-accent); border-color: var(--color-accent); }
.btn-primary:hover { background: color-mix(in srgb, var(--color-accent) 12%, transparent); }
.btn-primary:active { background: color-mix(in srgb, var(--color-accent) 22%, transparent); }
.btn-secondary { border-color: var(--color-divider); }
.btn-secondary:hover { background: color-mix(in srgb, var(--color-text) 7%, transparent); }
.btn-secondary:active { background: color-mix(in srgb, var(--color-text) 14%, transparent); }
.btn-ghost { color: var(--color-accent); padding-inline: var(--space-1); }
.btn-ghost:hover { background: color-mix(in srgb, var(--color-accent) 10%, transparent); }
.btn-ghost:active { background: color-mix(in srgb, var(--color-accent) 18%, transparent); }
.btn-icon { width: 36px; height: 36px; padding: 0; }
.btn-block { width: 100%; margin-top: var(--space-2); }

/* — forms — */
.field > label {
  display: block; font-size: 12px; margin-bottom: 5px; font-family: var(--font-ui);
  color: color-mix(in srgb, var(--color-text) 70%, transparent);
}
.input {
  width: 100%; min-height: 36px; padding: 6px 10px; font-family: var(--font-ui);
  font-size: 14px; color: var(--color-text); caret-color: var(--color-accent);
  background: transparent;
  border: 1px solid var(--color-divider); border-radius: var(--radius-md);
}
.input:hover { border-color: color-mix(in srgb, var(--color-text) 45%, transparent); }
.input:focus-visible { border-color: var(--color-accent); outline-offset: 0; }
textarea.input { min-height: 90px; resize: vertical; }
.radio { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; font-family: var(--font-ui); }
.radio input, .seg-opt input {
  position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none;
}
.radio .dot {
  width: 16px; height: 16px; flex: none; border-radius: 50%;
  border: 1.5px solid var(--color-divider);
}
.radio:hover .dot { border-color: var(--color-accent); }
.radio input:checked + .dot {
  border-color: var(--color-accent); background: var(--color-accent);
  box-shadow: inset 0 0 0 4px var(--color-bg);
}
.radio input:focus-visible + .dot { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.seg {
  display: inline-flex; overflow: hidden;
  border: 1px solid var(--color-divider); border-radius: var(--radius-md);
}
.seg-opt {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; font-size: 13px; font-family: var(--font-ui); cursor: pointer;
}
.seg-opt + .seg-opt { border-left: 1px solid var(--color-divider); }
.seg-opt:has(input:checked) { color: var(--color-accent); box-shadow: inset 0 0 0 1px var(--color-accent); }
.seg-opt:not(:has(input:checked)):hover { background: color-mix(in srgb, var(--color-text) 7%, transparent); }
.seg-opt:has(input:focus-visible) { outline: 2px solid var(--color-accent); outline-offset: -2px; }

/* — cards — */
.card {
  display: flex; flex-direction: column; gap: var(--space-2);
  padding: var(--space-3); border-radius: var(--radius-md); background: transparent; border: 1px solid var(--color-divider);
}
.card-kicker { font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--color-accent); }
.card-title {
  font-family: var(--font-heading); font-weight: var(--font-heading-weight);
  font-size: 17px; line-height: 1.2;
}
.card-body { margin: 0; font-size: 13px; opacity: 0.8; flex: 1; }
.card-meta {
  display: flex; align-items: center; gap: 6px; font-size: 11px; font-family: var(--font-ui);
  color: color-mix(in srgb, var(--color-text) 50%, transparent);
}
.elev-sm { box-shadow: var(--shadow-sm); }
.elev-md { box-shadow: var(--shadow-md); }
.elev-lg { box-shadow: var(--shadow-lg); }

/* — tags — */
.tag {
  display: inline-flex; align-items: center; font-size: 11px; font-family: var(--font-ui);
  letter-spacing: 0.02em; padding: 3px 10px;
  border-radius: calc(var(--radius-md) * 0.75);
}
.tag-accent { background: var(--color-accent-100); color: var(--color-accent-800); }
.tag-accent-2 { background: var(--color-accent-2-100); color: var(--color-accent-2-800); }
.tag-neutral { background: var(--color-neutral-100); color: var(--color-neutral-800); }
.tag-outline { border: 1px solid var(--color-accent); color: var(--color-accent); }

/* — navigation — */
.nav {
  display: flex; align-items: center; gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-divider);
}
.nav-brand {
  font-family: var(--font-heading); font-weight: var(--font-heading-weight);
  font-size: 18px; margin-right: auto;
}
.nav a { color: inherit; text-decoration: none; font-size: 14px; font-family: var(--font-ui); }
.nav a:hover, .nav a[aria-current='page'] { color: var(--color-accent); }

/* — tables — */
.table { width: 100%; border-collapse: collapse; font-size: 14px; font-family: var(--font-ui); }
.table th {
  text-align: left; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  color: color-mix(in srgb, var(--color-text) 60%, transparent);
  padding: var(--space-2); border-bottom: 1px solid var(--color-divider);
}
.table td {
  padding: var(--space-2);
  border-bottom: 1px solid var(--color-divider);
}
.table tbody tr:hover { background: color-mix(in srgb, var(--color-text) 4%, transparent); }

/* — dialog — */
.dialog-backdrop {
  position: fixed; inset: 0; display: grid; place-items: center;
  padding: var(--space-4);
  background: color-mix(in srgb, var(--color-neutral-900) 50%, transparent);
}
.dialog {
  width: min(440px, 100%); display: flex; flex-direction: column; gap: var(--space-3);
  padding: var(--space-4); border-radius: var(--radius-lg);
  background: var(--color-surface); box-shadow: var(--shadow-lg); border: 1px solid var(--color-divider);
}
.dialog-title {
  font-family: var(--font-heading); font-weight: var(--font-heading-weight);
  font-size: 20px;
}
.dialog-body { font-size: 14px; opacity: 0.85; }
.dialog-actions { display: flex; justify-content: flex-end; gap: var(--space-2); margin-top: var(--space-2); }

/* ══════════════════════════════════════════════════════════════════════════
   "Living Archive" — glass entry surfaces (landing hero, login) +
   heritage interior (everything else). See README "Design notes".
   backdrop-filter is used ONLY inside .hero-shell (the two entry
   surfaces) — nowhere else in the site.
   ══════════════════════════════════════════════════════════════════════ */

/* — reveal utility: [data-reveal="fade-up|mask|draw"], stagger via --i,
   IntersectionObserver-driven (reveal.js), animates transform/opacity
   only, once per element. — */
[data-reveal] { opacity: 0; }
[data-reveal="fade-up"] { transform: translateY(18px); }
[data-reveal="mask"] { transform: translateY(6px); clip-path: inset(0 0 100% 0); }
[data-reveal="draw"] { transform: scaleX(0); transform-origin: left; opacity: 1; }
[data-reveal].is-revealed {
  opacity: 1; transform: none; clip-path: inset(0 0 0% 0);
  transition: opacity .6s var(--ease-out), transform .6s var(--ease-out), clip-path .6s var(--ease-out);
  transition-delay: calc(var(--i, 0) * 90ms);
}
[data-reveal="draw"].is-revealed { transform: scaleX(1); }
@media (prefers-reduced-motion: reduce) {
  [data-reveal] { opacity: 1 !important; transform: none !important; clip-path: none !important; transition: none !important; }
}

/* — glass buttons (entry surfaces only) — */
.btn-glass-primary {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-ui); font-weight: 600; font-size: 14px;
  color: var(--cream); background: var(--ink); border: none;
  padding: 8px 20px 8px 8px; border-radius: 999px; cursor: pointer;
  transition: transform .2s var(--ease-out);
}
.btn-glass-primary .icon-circle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  background: rgba(251, 248, 241, .18);
}
.btn-glass-primary:hover { transform: scale(1.02); }
.btn-glass-primary:active { transform: scale(.98); }

.btn-glass-secondary {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-ui); font-weight: 500; font-size: 14px;
  color: var(--ink); background: transparent; border: 1px solid var(--line);
  padding: 10px 22px; border-radius: 999px; cursor: pointer;
  transition: transform .2s var(--ease-out), background-color .2s var(--ease-out);
}
.btn-glass-secondary:hover { transform: scale(1.02); background: color-mix(in srgb, var(--ink) 5%, transparent); }
.btn-glass-secondary:active { transform: scale(.98); }

/* — navbar (shared, auth-aware) — */
.site-nav {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: var(--space-6);
  padding: 18px var(--space-6);
  background: transparent; border-bottom: 1px solid transparent;
  transition: background-color .3s var(--ease-out), border-color .3s var(--ease-out), backdrop-filter .3s var(--ease-out);
}
.site-nav.scrolled {
  background: color-mix(in srgb, var(--page-bg) 88%, transparent);
  border-bottom-color: var(--line);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.wordmark {
  font-family: var(--font-heading); font-variant: small-caps; letter-spacing: .15em;
  font-size: 24px; font-weight: 600; color: #000; margin-right: auto; display: flex; align-items: center; gap: 8px;
  text-decoration: none; cursor: pointer; background: none; border: none; padding: 0;
}
.site-nav-menu { display: flex; align-items: center; gap: 28px; }
.nav-link {
  position: relative; font-family: var(--font-ui); font-size: 14px; font-weight: 500;
  color: var(--ink-soft); text-decoration: none; cursor: pointer; background: none; border: none;
  padding: 4px 0;
}
.nav-link::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -2px; height: 1.5px;
  background: var(--gold); transform: scaleX(0); transform-origin: left;
  transition: transform .25s var(--ease-out);
}
.nav-link:hover, .nav-link[aria-current="page"] { color: var(--ink); }
.nav-link:hover::after, .nav-link[aria-current="page"]::after { transform: scaleX(1); }
.nav-dropdown { position: relative; display: inline-flex; }
.nav-dropdown-menu {
  position: absolute; top: calc(100% + 12px); left: 50%; transform: translateX(-50%) translateY(4px);
  min-width: 200px; padding: 8px; border-radius: 14px;
  background: var(--glass-strong); border: 1px solid var(--glass-border);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none;
  transition: opacity .18s var(--ease-out), transform .18s var(--ease-out);
}
.nav-dropdown:hover .nav-dropdown-menu, .nav-dropdown:focus-within .nav-dropdown-menu {
  opacity: 1; pointer-events: auto; transform: translateX(-50%) translateY(0);
}
.nav-dropdown-menu a, .nav-dropdown-menu button {
  display: block; width: 100%; text-align: left; font-family: var(--font-ui); font-size: 13px;
  color: var(--ink); text-decoration: none; background: none; border: none; cursor: pointer;
  padding: 9px 12px; border-radius: 8px;
}
.nav-dropdown-menu a:hover, .nav-dropdown-menu button:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.nav-cta {
  display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-ui);
  font-weight: 600; font-size: 13px; color: var(--cream); background: var(--ink);
  border: none; border-radius: 999px; padding: 9px 18px; cursor: pointer;
  transition: transform .2s var(--ease-out);
}
.nav-cta:hover { transform: scale(1.03); }
.nav-hamburger {
  display: none; flex-direction: column; gap: 4px; background: none; border: none; cursor: pointer; padding: 6px;
}
.nav-hamburger span { width: 20px; height: 1.5px; background: var(--ink); display: block; }
.mobile-nav-sheet {
  position: fixed; inset: 0; z-index: 40; display: flex; flex-direction: column;
  background: var(--glass-strong); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  padding: var(--space-6); gap: var(--space-4);
}
.mobile-nav-sheet a, .mobile-nav-sheet button.nav-link {
  font-family: var(--font-heading); font-size: 22px; color: var(--ink); text-align: left;
}
.add-person-layout { display: grid; grid-template-columns: minmax(0, 620px) minmax(280px, 1fr); gap: var(--space-6); align-items: start; }
.add-person-tree-preview { position: sticky; top: 90px; }
.add-person-tree-viewport { height: 460px; width: 100%; }
@media (max-width: 900px) {
  .add-person-layout { grid-template-columns: 1fr; }
  .add-person-tree-preview { position: static; margin-top: var(--space-2); }
  .add-person-tree-viewport { height: 320px; }
}
@media (max-width: 860px) {
  .site-nav-menu { display: none; }
  .nav-hamburger { display: flex; }
  /* user tag / CTA / logout are duplicated in the mobile sheet — keep the
     collapsed bar to just wordmark + hamburger so it never overflows */
  .site-nav .tag, .site-nav .nav-cta, .site-nav > .btn-ghost { display: none; }
  .site-nav { gap: var(--space-3); padding: 14px var(--space-4); }
}

/* — HeroBase shell (landing + login only) — */
.hero-outer {
  width: 100%; min-height: 100svh; display: flex; align-items: center; justify-content: center;
  padding: 12px; background: var(--page-bg);
}
@media (min-width: 768px) { .hero-outer { padding: 20px; } }
.hero-shell {
  position: relative; width: 100%; max-width: 1536px; min-height: calc(100svh - 24px);
  border-radius: 1.5rem; overflow: hidden; border: 1px solid var(--glass-border);
  background: var(--glass); backdrop-filter: blur(var(--glass-blur)); -webkit-backdrop-filter: blur(var(--glass-blur));
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column;
}
@media (min-width: 768px) { .hero-shell { border-radius: 3rem; } }
.hero-media { position: absolute; inset: 0; z-index: 0; }
.hero-media video, .hero-media img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 65%;
  filter: sepia(.35) saturate(.85) brightness(.95);
}
@media (min-width: 1024px) { .hero-media video, .hero-media img { object-position: center; } }
.hero-overlay {
  position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(180deg, rgba(244, 241, 234, .5) 0%, rgba(244, 241, 234, .78) 100%);
}
.hero-corner { position: absolute; z-index: 2; pointer-events: none; width: 1.5rem; height: 1.5rem; }
.hero-corner.tr { top: -1.5rem; right: 0; }
.hero-corner.bl { bottom: -1.5rem; left: 0; }
@media (min-width: 640px) {
  .hero-corner { width: 2rem; height: 2rem; }
  .hero-corner.tr { top: -2rem; }
  .hero-corner.bl { bottom: -2rem; }
}
@media (min-width: 768px) {
  .hero-corner { width: 3.5rem; height: 3.5rem; }
  .hero-corner.tr { top: -3.5rem; }
  .hero-corner.bl { bottom: -3.5rem; }
}
.hero-content { position: relative; z-index: 10; flex: 1; display: flex; flex-direction: column; padding: 100px 24px 40px; }
@media (min-width: 768px) { .hero-content { padding: 120px 56px 56px; } }

.hero-badge {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 999px;
  background: var(--glass-strong); border: 1px solid var(--glass-border); font-family: var(--font-ui);
  font-size: 12px; color: var(--ink-soft); width: fit-content; margin: 0 auto var(--space-6);
}
.hero-card {
  background: var(--glass-strong); border: 1px solid var(--glass-border);
  border-radius: 22px; padding: 22px 26px; max-width: 340px;
}
.hero-card-label {
  font-family: var(--font-ui); font-size: 10px; text-transform: uppercase;
  letter-spacing: .07em; color: var(--ink-soft); margin-top: 2px;
}
.hero-card-row { display: flex; gap: var(--space-5); margin-bottom: var(--space-4); }
.hero-card-icon {
  display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px;
  border-radius: 50%; background: rgba(176, 118, 42, .14); color: var(--gold); flex: none;
}

/* — heritage stats band — */
.stats-band { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-4); text-align: center; }
.stats-band .stat-num { font-family: var(--font-heading); font-size: 44px; font-variant-numeric: tabular-nums; color: var(--ink); }
.stats-band .stat-label { font-family: var(--font-ui); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-soft); margin-top: 4px; }
.gold-rule { height: 1px; background: var(--gold); margin: var(--space-6) auto; max-width: 120px; }

/* — generations timeline — */
.timeline { position: relative; max-width: 760px; margin: 0 auto; padding: var(--space-6) 0; }
.timeline-spine {
  position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; margin-left: -1px;
  background: var(--line); transform: scaleY(0); transform-origin: top;
  transition: transform 1.1s var(--ease-out);
}
.timeline-spine.is-revealed { transform: scaleY(1); }
.timeline-row { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-6); padding: var(--space-4) 0; align-items: center; }
.timeline-row.flip .timeline-card { grid-column: 2; }
.timeline-row.flip .timeline-portrait { grid-column: 1; grid-row: 1; }
.timeline-dot {
  position: absolute; left: 50%; top: 50%; width: 12px; height: 12px; margin: -6px 0 0 -6px;
  border-radius: 50%; background: var(--gold); border: 3px solid var(--page-bg); z-index: 2;
}
.timeline-portrait {
  width: 88px; height: 88px; border-radius: 50%; overflow: hidden; justify-self: end;
  border: 1px solid var(--line); background: var(--cream);
}
.timeline-row.flip .timeline-portrait { justify-self: start; }
.timeline-portrait img { width: 100%; height: 100%; object-fit: cover; transition: transform 6s var(--ease-out); }
.timeline-portrait:hover img { transform: scale(1.12); }
.timeline-portrait .initials-fallback {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-heading); font-size: 26px; color: var(--ink-soft);
}
.timeline-card { }
.timeline-year { font-family: var(--font-ui); font-size: 11px; letter-spacing: .06em; color: var(--gold); text-transform: uppercase; }
.timeline-name { font-family: var(--font-heading); font-size: 22px; margin: 2px 0 4px; }
.timeline-desc { color: var(--ink-soft); font-size: 15px; }
@media (max-width: 640px) {
  .timeline-spine { left: 28px; }
  .timeline-row, .timeline-row.flip { grid-template-columns: 56px 1fr; }
  .timeline-row .timeline-card, .timeline-row.flip .timeline-card { grid-column: 2; }
  .timeline-row .timeline-portrait, .timeline-row.flip .timeline-portrait { grid-column: 1; width: 56px; height: 56px; justify-self: start; }
  .timeline-dot { left: 28px; }
}

/* — featured relatives (archive index cards) — */
.archive-card {
  background: var(--cream); border: 1px solid var(--line); border-radius: 4px; padding: var(--space-4);
  cursor: pointer; transition: transform .25s var(--ease-out), box-shadow .25s var(--ease-out);
  box-shadow: var(--shadow-sm);
}
.archive-card:hover { transform: rotate(0deg) translateY(-4px); box-shadow: var(--shadow-md); }
.archive-card .monogram {
  width: 52px; height: 52px; border-radius: 50%; border: 1.5px solid var(--gold);
  display: flex; align-items: center; justify-content: center; font-family: var(--font-heading);
  font-size: 17px; color: var(--gold); margin-bottom: var(--space-2); overflow: hidden;
}
.archive-card .monogram img { width: 100%; height: 100%; object-fit: cover; }

/* — memories: postcard masonry + lightbox — */
.postcard-grid { columns: 3 260px; column-gap: var(--space-4); }
.postcard {
  break-inside: avoid; margin-bottom: var(--space-4); background: var(--cream); padding: 10px 10px 34px;
  border: 1px solid var(--line); box-shadow: var(--shadow-sm); cursor: pointer;
  transition: transform .2s var(--ease-out), box-shadow .2s var(--ease-out); position: relative;
}
.postcard:hover { transform: translateY(-4px) rotate(0deg); box-shadow: var(--shadow-md); }
.postcard img { width: 100%; display: block; background: var(--line); }
.postcard-caption { font-family: var(--font-ui); font-size: 12px; color: var(--ink-soft); margin-top: 8px; padding: 0 2px; }
.postcard-tape {
  position: absolute; top: -8px; left: 50%; transform: translateX(-50%) rotate(-2deg);
  width: 56px; height: 18px; background: rgba(176, 118, 42, .18); border: 1px solid rgba(176, 118, 42, .25);
}
.memory-empty {
  border: 1px dashed var(--line); border-radius: 4px; padding: var(--space-8); text-align: center;
}
.lightbox-backdrop {
  position: fixed; inset: 0; z-index: 50; background: rgba(43, 38, 32, .82);
  display: flex; align-items: center; justify-content: center; padding: var(--space-4);
}
.lightbox-card {
  background: var(--cream); border-radius: 8px; max-width: 640px; width: 100%; overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.lightbox-card img { width: 100%; display: block; max-height: 60vh; object-fit: contain; background: var(--ink); }

/* — login split (inside HeroBase) — */
.login-split { display: flex; flex-direction: column; gap: var(--space-8); flex: 1; justify-content: center; max-width: 1000px; margin: 0 auto; width: 100%; }
@media (min-width: 860px) { .login-split { flex-direction: row; align-items: center; gap: 64px; } }
.login-copy { flex: 1; }
.login-copy h1 { font-size: clamp(32px, 5vw, 48px); font-weight: 400; margin-bottom: var(--space-3); }
.login-copy p { color: var(--ink-soft); font-size: 18px; max-width: 40ch; }
.login-card {
  flex: 1; max-width: 420px; background: var(--glass-strong); border: 1px solid var(--glass-border);
  backdrop-filter: blur(var(--glass-blur)); -webkit-backdrop-filter: blur(var(--glass-blur));
  border-radius: 20px; padding: var(--space-6); box-shadow: var(--shadow-lg);
}
.glass-field { margin-bottom: var(--space-4); }
.glass-field label { display: block; font-family: var(--font-ui); font-size: 12px; color: var(--ink-soft); margin-bottom: 6px; }
.glass-input {
  width: 100%; min-height: 42px; padding: 8px 14px; font-family: var(--font-ui); font-size: 14px;
  background: rgba(255, 255, 255, .4); border: 1px solid var(--glass-border); border-radius: 10px;
  color: var(--ink); transition: border-color .15s var(--ease-out), box-shadow .15s var(--ease-out);
}
.glass-input:focus-visible { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(176, 118, 42, .18); }
.login-divider { display: flex; align-items: center; gap: 12px; margin: var(--space-5) 0; font-family: var(--font-ui); font-size: 12px; color: var(--ink-soft); }
.login-divider::before, .login-divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.lightbox-body { padding: var(--space-4) var(--space-5); }

/* — tree: hover highlight, drawer, legend — */
.tree-node { transition: transform .15s ease, opacity .2s ease; }
.tree-node.is-dimmed { opacity: .35; }
.tree-node:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 8px; }
.tree-legend {
  display: flex; flex-wrap: wrap; gap: 14px; padding: 10px var(--space-6);
  border-bottom: 1px solid var(--line); font-family: var(--font-ui); font-size: 12px; color: var(--ink-soft);
}
.tree-legend-item { display: flex; align-items: center; gap: 6px; }
.tree-legend-dot { width: 10px; height: 10px; border-radius: 50%; }
.tree-drawer-backdrop { position: fixed; inset: 0; z-index: 45; background: rgba(43, 38, 32, .3); }
.tree-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 46; width: min(380px, 100vw);
  background: var(--cream); box-shadow: var(--shadow-lg); overflow-y: auto; padding: var(--space-6);
  transform: translateX(0); transition: transform .3s var(--ease-out);
}
.tree-drawer-photo { width: 96px; height: 96px; border-radius: 50%; overflow: hidden; margin-bottom: var(--space-3); border: 1px solid var(--line); }
.tree-drawer-photo img { width: 100%; height: 100%; object-fit: cover; }
.tree-drawer-photo .initials-fallback { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-family: var(--font-heading); font-size: 28px; color: var(--ink-soft); background: var(--page-bg); }

/* — profile page — */
.profile-overline { font-family: var(--font-ui); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--gold); margin-bottom: 6px; }
.profile-layout { display: grid; grid-template-columns: 140px 1fr; gap: var(--space-6); align-items: start; }
.profile-nav { position: sticky; top: 90px; display: flex; flex-direction: column; gap: 4px; }
.profile-nav a { font-family: var(--font-ui); font-size: 13px; color: var(--ink-soft); text-decoration: none; padding: 6px 0; border-left: 2px solid transparent; padding-left: 10px; }
.profile-nav a:hover { color: var(--ink); }
.profile-body { max-width: 68ch; font-size: 18px; line-height: 1.65; color: var(--ink); }
.profile-photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: var(--space-3); }
.profile-prevnext { display: flex; justify-content: space-between; gap: var(--space-4); margin-top: var(--space-8); padding-top: var(--space-4); border-top: 1px solid var(--line); }
.profile-prevnext a { font-family: var(--font-ui); font-size: 13px; color: var(--ink-soft); text-decoration: none; cursor: pointer; }
.profile-prevnext a:hover { color: var(--gold); }
@media (max-width: 700px) {
  .profile-layout { grid-template-columns: 1fr; }
  .profile-nav { position: static; flex-direction: row; flex-wrap: wrap; }
}
.tree-drawer-close { position: absolute; top: var(--space-4); right: var(--space-4); background: none; border: none; cursor: pointer; color: var(--ink-soft); padding: 6px; }

/* — perf: skip painting off-screen sections until they're scrolled near —
   .timeline is excluded: content-visibility:auto skips layout for its
   content-fitted children until "relevant", which raced with the
   IntersectionObserver-driven .timeline-spine reveal (data-reveal="draw")
   and left the connecting line stuck at scaleY(0) forever. */
.postcard-grid, #memories, .stats-band { content-visibility: auto; contain-intrinsic-size: 800px; }

/* — reduced motion: catch-all, disables every transition/animation
   site-wide (video is swapped for a static image separately in the
   template; this covers hover states, reveal transitions, Ken Burns,
   drawer slide-in, nav dropdown, everything else). — */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

.toast-message { position: fixed; bottom: var(--space-6); left: 50%; transform: translateX(-50%); z-index: 60; }
