/* Rodovid Heritage · 2026 | visual-only layer after all legacy breakpoints.
   Tree geometry 220 x 102 MUST match app.js CARD_W/H. No genealogy data is touched. */
:root{
  --heritage-serif:"Noto Serif",Georgia,"Times New Roman",serif;
  --heritage-ease:cubic-bezier(.22,1,.36,1);
  --heritage-focus:#1672ba;
  --heritage-card-hover:0 16px 35px rgba(20,45,68,.17);
}
:root[data-theme="archive"]{
  --rv-page:#eae0c9;--rv-panel:#fcf6e8;--rv-panel2:#f1e7d4;
  --rv-fg:#352d24;--rv-muted:#766b59;--rv-border:#d4c3a5;
  --rv-accent:#70562e;--rv-royal:#38392f;--rv-gold:#a37639;
  --rv-green:#607a65;--rv-shadow:0 10px 29px rgba(67,49,27,.12);
  --rv-card-avatar-bg:#e6d9bd;--rv-card-avatar-fg:#615440;
  --rv-card-male-avatar-bg:#d9e1d8;--rv-card-male-avatar-fg:#3e665e;
  --rv-card-female-avatar-bg:#efe0d8;--rv-card-female-avatar-fg:#926c60;
  --rv-card-event-bg:#eadbc3;--rv-card-event-fg:#705f47;
  --rv-card-male-border:#668d87;--rv-card-female-border:#a37764;
  --rv-card-unknown-border:#b7a487;
  color-scheme:light;
}
:root[data-theme="archive"] .sidebar{
  background:linear-gradient(160deg,#343b31,#57533d 62%,#34352c);
}
:root[data-theme="archive"] .canvas{
  background-color:var(--rv-page);
  background-image:radial-gradient(rgba(102,82,51,.12) .65px,transparent .65px);
  background-size:21px 21px;
}
:root[data-theme="archive"] .heading h1,
:root[data-theme="archive"] .section-header h2,
:root[data-theme="archive"] .identity h2,
:root[data-theme="archive"] .empty h2,
:root[data-theme="archive"] .auth-card h1{
  font-family:var(--heritage-serif);font-weight:700;letter-spacing:-.045em;
}
:root[data-theme="archive"] .person{box-shadow:0 9px 25px #54402219}
:root[data-theme="archive"] .panel-note{border-color:#d9c8a9}

/* Stable layout: do NOT override 220×102 physical card dimensions. */
#nodes .person{
  width:220px;height:102px;box-sizing:border-box;
  border-radius:13px;padding:10px 12px;position:absolute;
  border-width:1px 1px 1px 4px;box-shadow:0 7px 18px rgba(17,40,63,.095);
  transition:box-shadow .2s var(--heritage-ease),border-color .2s var(--heritage-ease);
  isolation:isolate;
}
#nodes .person:hover,#nodes .person:focus-within{
  box-shadow:var(--heritage-card-hover);z-index:2;
}
#nodes .person.selected{z-index:3;box-shadow:0 0 0 2.5px var(--rv-accent),var(--heritage-card-hover)}
#nodes .person .person-top{align-items:center;gap:9px}
#nodes .person .avatar{width:48px;height:48px;flex:0 0 48px;border-radius:13px}
#nodes .person .person-name{
  font-family:Manrope,system-ui,sans-serif;
  font-size:12.5px;line-height:1.32;font-weight:800;letter-spacing:-.18px;
  max-height:48px;text-overflow:ellipsis;
}
#nodes .person .person-years{font-size:10.5px;font-weight:650;letter-spacing:.01em;margin-top:4px}
#nodes .person .person-status{
  width:9px;height:9px;right:11px;bottom:11px;border:2px solid var(--rv-panel);
  box-shadow:0 0 0 1px var(--rv-border);
}
#nodes .person .person-add{transition:transform .18s ease,background .18s ease}
#nodes .person .person-add:hover{transform:scale(1.08)}
#nodes .person .person-life-event{font-size:9px}
#nodes .person.male,#nodes .person.female,#nodes .person.unknown{background:var(--rv-panel);color:var(--rv-fg)}
/* Different gender styles use subtle accent borders, never a garish entire-card fill. */
#nodes .person.possible{border-style:dashed}
#nodes .person button:focus-visible{outline:3px solid var(--rv-accent);outline-offset:3px}

/* A genealogical document should read like an editorial product, not a form generator. */
.heading h1,.section-header h2,.empty h2{letter-spacing:-.045em;line-height:1.18}
.heading h1{font-size:clamp(20px,2vw,28px)}
.section-header h2,.empty h2{font-family:var(--heritage-serif);font-weight:700}
.section-header p,.empty p{font-size:13px;line-height:1.72}
.empty{max-width:min(530px,calc(100% - 24px));margin:auto}
.empty-icon{box-shadow:0 14px 39px rgba(28,49,70,.09)}
.auth-card{box-shadow:0 28px 84px rgba(3,19,39,.36);border:1px solid var(--rv-border)}
.auth-card h1{font-family:var(--heritage-serif);font-size:clamp(28px,3.2vw,40px);letter-spacing:-.055em}
.auth-wrap{
  background:radial-gradient(ellipse at 16% 18%,rgba(202,173,108,.22),transparent 34%),
   radial-gradient(ellipse at 84% 84%,rgba(72,130,131,.27),transparent 42%),
   linear-gradient(135deg,#152c3a,#172737 60%,#243d44);
}
.auth-wrap:before{content:"";position:fixed;inset:0;pointer-events:none;
 opacity:.25;background-image:radial-gradient(#e6d5b6 .65px,transparent .65px);background-size:30px 30px}
.auth-card .brand .mark,.sidebar .brand .mark{border-radius:14px}
.auth-card :is(input,button),.nav,.button,.theme-picker select{font-family:Manrope,system-ui,sans-serif}
.auth-card label{font-size:12px}
.auth-card input:focus-visible{outline:3px solid var(--rv-accent);outline-offset:2px}
.auth-hint{border-radius:10px;background:var(--rv-panel2);padding:10px 12px}
.nav{display:flex;align-items:center;gap:13px;border-radius:11px;font-size:12px;
 transition:background-color .18s ease,transform .18s ease}
.nav .rv-icon{width:18px;height:18px;flex:none;stroke:currentColor;stroke-width:1.85;fill:none;
 stroke-linecap:round;stroke-linejoin:round;opacity:.88}
.nav.active{background:rgba(226,198,144,.18)!important;border-color:rgba(226,198,144,.36)!important;
 box-shadow:inset 3px 0 var(--rv-gold)}
.nav.active .rv-icon{color:#e9cf97;opacity:1}
.nav:hover{transform:none;background:rgba(255,255,255,.09)}
.sidebar .menu-label{font-size:9px;letter-spacing:.13em}
.sidebar .menu{scrollbar-width:thin}
.sidebar .brand strong{letter-spacing:.13em}
.project,.help{border-radius:13px}
.button.primary{font-weight:800}
.button.secondary{font-weight:650}
.button:focus-visible,.nav:focus-visible,.close:focus-visible,
a:focus-visible,select:focus-visible,textarea:focus-visible,
input:focus-visible,[role="tab"]:focus-visible{
 outline:3px solid var(--rv-accent);outline-offset:3px;
}
:root[data-theme="dark"]{--heritage-focus:#92cdf5}
:root[data-theme="dark"] #nodes .person:hover{box-shadow:0 17px 34px rgba(0,0,0,.4)}
.list-view{animation:rv-surface-in .28s var(--heritage-ease)}
.detail:not([hidden]){animation:rv-detail-in .22s var(--heritage-ease)}
.stat,.list-person,.about-card,.release-card{transition:box-shadow .18s ease,transform .18s ease}
.stat:hover,.about-card:hover{box-shadow:0 13px 36px rgba(19,46,71,.12)}
#detail .identity h2{font-family:var(--heritage-serif);font-size:clamp(21px,2vw,29px);line-height:1.28}
#detail .profile-actions{gap:6px;flex-wrap:wrap}
#detail .profile-actions .button{min-height:36px}
#detail .panel-section h3{font-size:11px;letter-spacing:.065em;font-weight:800}
#detail .panel-note{border-radius:12px}
#detail .timeline{padding-left:17px;border-left:2px solid var(--rv-border);margin-left:12px}
#detail .timeline-event{position:relative;margin-left:-25px;border-bottom:0;padding:12px 5px}
#detail .timeline-icon{border:1px solid var(--rv-border);box-shadow:0 3px 8px #102a3813}
#detail .timeline-event b{font-size:12px}
#detail .timeline-event small{font-size:11px;line-height:1.65}
#detail .timeline-event a{text-decoration:underline;text-underline-offset:3px}

/* Dossier tabs never detach content or disable original family actions. */
.dossier-tabs{display:flex;gap:4px;overflow-x:auto;scrollbar-width:thin;
 padding:8px 0;margin:14px -1px 7px;position:sticky;top:0;background:var(--rv-panel);
 z-index:4;border-bottom:1px solid var(--rv-border)}
.dossier-tab{flex:0 0 auto;border:0;border-radius:9px 9px 0 0;padding:11px 11px;
 background:transparent;color:var(--rv-muted);font:700 11px/1.2 Manrope,system-ui;
 border-bottom:3px solid transparent;cursor:pointer}
.dossier-tab[aria-selected="true"]{background:var(--rv-panel2);border-bottom-color:var(--rv-accent);
 color:var(--rv-fg)}
#detail .panel-section[hidden]{display:none!important}
.dossier-meta{font:600 11px/1.55 Manrope,system-ui;color:var(--rv-muted);margin-top:7px}
.profile-copy-name{font-weight:700}
@keyframes rv-detail-in{from{opacity:.3;transform:translateX(10px)}to{opacity:1;transform:translateX(0)}}
@keyframes rv-surface-in{from{opacity:.55}to{opacity:1}}

/* Loading affordance without delaying Firebase operations. */
#sync-state{display:flex;gap:7px;align-items:center}
#sync-state[data-saving="true"]::before{
 content:"";width:9px;height:9px;border:2px solid currentColor;border-right-color:transparent;
 border-radius:50%;animation:rv-spin .8s linear infinite
}
@keyframes rv-spin{to{transform:rotate(360deg)}}
@media(max-width:700px){
 #detail .dossier-tabs{margin-inline:-3px;top:0}
 .dossier-tab{padding:11px 9px;font-size:10.5px}
 .heading h1{font-size:18px}
 .auth-wrap:before{position:absolute}
 #nodes .person{width:220px;height:102px}
}
@media(prefers-reduced-motion:reduce){
 .detail:not([hidden]),.list-view{animation:none!important}
 #sync-state[data-saving="true"]::before{animation:none!important}
 .nav,.person,.button{transition:none!important}
}

/* Protected, lazy gallery of profile photos and document links. */
.rv-gallery-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(130px,1fr));gap:12px}
.rv-gallery-item{display:flex;flex-direction:column;gap:7px;min-width:0;padding:8px;border:1px solid var(--rv-border);
 border-radius:12px;background:var(--rv-panel2);color:var(--rv-fg);text-decoration:none;font-size:11px;font-weight:650}
.rv-gallery-item img{display:block;width:100%;height:130px;object-fit:cover;border-radius:8px;
 background:var(--rv-card-avatar-bg)}
.rv-gallery-item:hover,.rv-gallery-item:focus-visible{outline-offset:3px;border-color:var(--rv-accent)}
.rv-gallery-item span{overflow-wrap:anywhere}
.rv-mobile-bar{display:none}
@media(max-width:700px){
 #app .rv-mobile-bar:not([hidden]){position:fixed;left:0;right:0;bottom:0;z-index:169;
  display:flex;justify-content:space-around;align-items:stretch;gap:2px;
  padding:5px 8px calc(5px + env(safe-area-inset-bottom,0px));
  border-top:1px solid var(--rv-border);
  background:var(--rv-panel);box-shadow:0 -9px 35px rgba(15,34,52,.13)}
 #app .rv-mobile-bar[hidden],#app.immersive-mode .rv-mobile-bar{display:none!important}
 .rv-mobile-action{min-height:49px;min-width:0;flex:1;display:flex;align-items:center;
  justify-content:center;flex-direction:column;gap:2px;border:0;border-radius:10px;
  background:transparent;color:var(--rv-muted);font:700 10px/1.1 Manrope,system-ui}
 .rv-mobile-action svg{width:20px;height:20px;fill:none;stroke:currentColor;
   stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
 .rv-mobile-action[aria-current="page"]{background:var(--rv-panel2);color:var(--rv-accent)}
 .rv-mobile-action:focus-visible{outline:3px solid var(--rv-accent);outline-offset:1px}
 #app .main{padding-bottom:calc(60px + env(safe-area-inset-bottom,0px))}
 #app.immersive-mode .main{padding-bottom:0}
 .rv-gallery-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
}

/* Explicit theme specificity guards: never leave old white cards in dark mode. */
:root[data-theme="light"] #nodes .person,
:root[data-theme="dark"] #nodes .person,
:root[data-theme="sepia"] #nodes .person,
:root[data-theme="archive"] #nodes .person{
  background-color:var(--rv-panel)!important;
  color:var(--rv-fg)!important;
}
:root[data-theme="dark"] #nodes .person .avatar,
:root[data-theme="archive"] #nodes .person .avatar,
:root[data-theme="sepia"] #nodes .person .avatar{
  background-color:var(--rv-card-avatar-bg);
  color:var(--rv-card-avatar-fg);
}
:root[data-theme="dark"] #nodes .person .avatar.male,
:root[data-theme="archive"] #nodes .person .avatar.male,
:root[data-theme="sepia"] #nodes .person .avatar.male{
  background-color:var(--rv-card-male-avatar-bg);
  color:var(--rv-card-male-avatar-fg);
}
:root[data-theme="dark"] #nodes .person .avatar.female,
:root[data-theme="archive"] #nodes .person .avatar.female,
:root[data-theme="sepia"] #nodes .person .avatar.female{
  background-color:var(--rv-card-female-avatar-bg);
  color:var(--rv-card-female-avatar-fg);
}

/* Evidence links: readable, keyboard accessible, theme-independent and safe to wrap. */
.rv-person-document-links{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,230px),1fr));gap:10px}
.rv-person-document-link{display:flex;flex-direction:column;gap:4px;border:1px solid var(--rv-border);
 border-radius:12px;padding:12px 13px;background:var(--rv-panel2);color:var(--rv-fg);
 font-size:12px;line-height:1.5;text-decoration:none;overflow-wrap:anywhere}
.rv-person-document-link strong{font-size:12px;line-height:1.45}
.rv-person-document-link span{font-size:11px;color:var(--rv-muted)}
.rv-person-document-link:hover{border-color:var(--rv-accent);box-shadow:var(--rv-shadow)}
.rv-person-document-link:focus-visible{outline:3px solid var(--rv-accent);outline-offset:2px}
.rv-gallery-unavailable{display:block;font-size:11px;line-height:1.5;color:var(--rv-muted);
 padding:25px 12px;background:var(--rv-panel2);border-radius:10px}


/* Drive is the only source of archival image bytes; no Google login popups or
   external Drive navigation during image/PDF viewing. */
.rv-gallery-item.rv-archive-open{cursor:pointer;font:inherit;text-align:left;width:100%}
.rv-gallery-item.rv-archive-open:focus-visible{outline:3px solid var(--rv-accent)}
.rv-archive-search{display:flex;flex-direction:column;gap:7px;font-size:12px;font-weight:700;
 color:var(--rv-muted);margin-top:14px;max-width:600px}
.rv-archive-search input{width:100%;border-radius:11px;border:1px solid var(--rv-border);
 background:var(--rv-panel2);color:var(--rv-fg);padding:12px 14px;font:inherit}
.rv-archive-search input:focus-visible{outline:3px solid var(--rv-accent);outline-offset:2px}
.rv-media-more{margin:2px 0 18px}
.rv-drive-viewer{background:var(--rv-panel);color:var(--rv-fg);border:1px solid var(--rv-border);
 border-radius:18px;padding:18px}
.rv-drive-pdf{border:0;width:100%;min-height:58dvh;max-height:76dvh}
.rv-drive-viewer .rv-image-viewport{height:min(70dvh,760px)}
#rv-drive-provenance{font-size:12px;overflow-wrap:anywhere;line-height:1.55}
@media(max-width:600px){
 .rv-drive-viewer{width:calc(100vw - 12px);max-height:94dvh;padding:12px}
 .rv-drive-viewer .rv-image-viewport{height:min(66dvh,680px)}
}


.rv-drive-text{box-sizing:border-box;display:block;width:100%;max-height:70dvh;overflow:auto;
 white-space:pre-wrap;overflow-wrap:anywhere;word-break:normal;text-align:left;
 padding:18px;margin:0;background:var(--rv-panel2);color:var(--rv-fg);
 font:13px/1.7 ui-monospace,SFMono-Regular,Consolas,monospace}

.rv-source-in-app{font:inherit;text-align:left;cursor:pointer;appearance:none;width:100%}
.rv-source-in-app:hover,.rv-source-in-app:focus-visible{text-decoration:none}

/* Universally readable family graph. Cards stay 220 × 102 so the SVG
   coordinates remain exact on desktop and mobile. All themes use tokens. */
#nodes .person{
  border-radius:14px;
  border-color:var(--rv-border,#d9e2e8);
  background:var(--rv-panel,#fff);
  box-shadow:0 3px 7px rgba(15,37,60,.045),0 10px 22px rgba(15,37,60,.08);
  outline:1px solid color-mix(in srgb,var(--rv-border,#d9e2e8) 35%,transparent);
  outline-offset:0;
}
#nodes .person.male{border-color:var(--rv-border,#d9e2e8);border-left-color:var(--rv-card-male-border,#1bb4d3)}
#nodes .person.female{border-color:var(--rv-border,#d9e2e8);border-left-color:var(--rv-card-female-border,#f48992)}
#nodes .person.unknown{border-color:var(--rv-border,#d9e2e8);border-left-color:var(--rv-card-unknown-border,#b5c0c9)}
#nodes .person:hover{transform:none;box-shadow:0 7px 19px rgba(15,37,60,.15),0 16px 30px rgba(15,37,60,.1)}
#nodes .person.selected{outline:2px solid var(--rv-accent,#245a8c);outline-offset:2px;box-shadow:0 7px 24px rgba(17,55,91,.18)}
#nodes .person .person-top{gap:11px}
#nodes .person .person-name{font-weight:800;letter-spacing:-.12px;line-height:1.29}
#nodes .person .person-years{font-variant-numeric:tabular-nums;letter-spacing:.05px}
#nodes .person .person-add{background:var(--rv-panel,#fff);border:1.5px solid var(--rv-border,#d9e2e8);box-shadow:0 3px 10px rgba(17,42,65,.14)}
#edges .rv-tree-connector{pointer-events:none;vector-effect:non-scaling-stroke}
#edges .rv-tree-connector[data-kind="family-couple"],
#edges .rv-tree-connector[data-kind="sibling-bus"]{stroke-width:2.3px}
#edges .rv-tree-connector[data-kind="partner"]{stroke-width:2.6px}
#edges .rv-tree-connector[data-kind="partner-alternative"]{opacity:.58;stroke-dasharray:5 6}
#edges .rv-tree-connector[data-kind="placeholder"]{opacity:.58}
@media (prefers-reduced-motion:reduce){#nodes .person{transition:none}}
