/* ═══════════════════════════════════════════════════════════════════
   Genea Azul — main.css
   Shared layout, components, and animations (theme-independent)
   ═══════════════════════════════════════════════════════════════════ */

/* ─── CSS Custom Properties (overridden by themes) ──────────────── */
:root {
  --ga-primary:        #1a365d;
  --ga-primary-hover:  #152b4a;
  --ga-primary-muted:  #537793;
  --ga-accent:         #c9a227;
  --ga-accent-hover:   #b08d1f;
  --ga-bg:             #faf8f0;
  --ga-card-bg:        #ffffff;
  --ga-text:           #2d2d2d;
  --ga-text-muted:     #6b5b4f;
  --ga-border:         #e0d5c5;
  --ga-shadow:         0 2px 12px rgba(26,54,93,.12);
  --ga-shadow-hover:   0 6px 24px rgba(26,54,93,.18);
  --ga-radius:         8px;
  --ga-radius-lg:      12px;
  --ga-font-heading:   'Playfair Display', Georgia, serif;
  --ga-font-body:      'Source Sans 3', 'Segoe UI', sans-serif;
  --ga-transition:     .2s ease;
  --ga-navbar-bg:      #1a365d;
  --ga-navbar-text:    rgba(255,255,255,.87);
  --ga-footer-bg:      #1a365d;
  --ga-footer-text:    rgba(255,255,255,.82);

  /* ── Cross-theme semantic colours (same across all themes) ── */
  --ga-curiosidades:       #2e7d32; /* timeline "curiosidades" category */
  --ga-curiosidades-hover: #256427; /* natural darker: same saturation, L 34%→27% */
  --ga-curiosidades-muted: #52975a; /* lighter variant: L 34%→45%, ~3.5:1 on white */
  --ga-sex-male:           #2c6fa0; /* teal-blue for male persons */
  --ga-sex-female:         #9b4c6e; /* wine-rose for female persons */
}

/* ─── Base ───────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

::placeholder { color: var(--ga-text-muted); opacity: .45; }
.form-control::placeholder,
.form-select::placeholder { color: var(--ga-text-muted); opacity: .45; }

.ga-search-wrap { position: relative; }
.ga-search-wrap .form-control { padding-right: 2rem; }
.ga-search-clear {
  position: absolute;
  right: 0.4rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--ga-text-muted);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0 0.15rem;
  display: none;
}
.ga-search-clear:hover { color: var(--ga-text); }

body {
  font-family: var(--ga-font-body);
  color: var(--ga-text);
  background-color: var(--ga-bg);
  line-height: 1.65;
}

h1,h2,h3,h4,h5,h6 {
  font-family: var(--ga-font-heading);
  color: var(--ga-primary);
  line-height: 1.25;
}

a { color: var(--ga-primary); }
a:hover { color: var(--ga-accent); }

/* ─── Navbar ─────────────────────────────────────────────────────── */
.ga-navbar {
  background-color: var(--ga-navbar-bg);
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
  padding: .6rem 0;
}

.ga-navbar .navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(255,255,255,0.87)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}
.ga-navbar .navbar-toggler[aria-expanded="true"] .navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(255,255,255,0.87)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M6 6l18 18M24 6L6 24'/%3e%3c/svg%3e");
}
.ga-navbar .navbar-toggler { color: var(--ga-navbar-text); }
.ga-navbar-menu-label { color: var(--ga-navbar-text); font-size: 0.8rem; letter-spacing: .04em; margin-left: 0.25rem; vertical-align: middle; }

.ga-brand { display: flex; align-items: center; gap: .5rem; }
/* White filter for dark navbar/footer backgrounds */
.ga-logo-nav {
  height: 52px;
  width: auto;
  filter: brightness(0) invert(1);
}

.ga-navbar .nav-link {
  color: var(--ga-navbar-text) !important;
  font-weight: 400;
  font-size: .95rem;
  padding: .4rem .75rem;
  margin: 0 .075rem;
  border-radius: var(--ga-radius);
  transition: background-color var(--ga-transition), color var(--ga-transition);
}
.ga-navbar .nav-link:hover,
.ga-navbar .nav-link.active {
  background-color: rgba(255,255,255,.24);
  color: #fff !important;
}
.ga-navbar .dropdown-menu {
  border: none;
  box-shadow: var(--ga-shadow-hover);
  border-radius: var(--ga-radius);
  background-color: var(--ga-card-bg);
  min-width: 14rem;
}
.ga-navbar .dropdown-item {
  font-size: .9rem;
  color: var(--ga-text);
  padding: .45rem .9rem;
}
.ga-navbar .dropdown-item:hover                { background-color: var(--ga-border); color: var(--ga-primary); }
.ga-navbar .dropdown-item.active               { background-color: var(--ga-primary-muted); color: #fff; }
.ga-navbar .dropdown-item.active:hover         { background-color: var(--ga-primary-hover); color: #fff; }

@media (max-width: 1199.98px) {
  .ga-navbar .dropdown-menu.show {
    animation: gaFadeIn .2s ease forwards;
  }
}

/* Navbar becomes slightly more opaque on scroll */
.ga-navbar.scrolled { box-shadow: 0 4px 16px rgba(0,0,0,.28); }

.ga-social-link {
  color: var(--ga-navbar-text);
  font-size: 1.1rem;
  padding: .25rem .35rem;
  border-radius: var(--ga-radius);
  transition: color var(--ga-transition);
  text-decoration: none;
}
.ga-social-link:hover { color: #fff; }

/* ─── Hero ───────────────────────────────────────────────────────── */
.ga-hero {
  padding: 4rem 0 2rem;
  position: relative;
  overflow: hidden;
}

.ga-logo-hero {
  height: 160px;
  width: auto;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,.15));
}

.ga-hero-title {
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-weight: 700;
  margin-bottom: .75rem;
  color: var(--ga-primary);
}

.ga-hero-subtitle {
  font-size: 1.1rem;
  color: var(--ga-text-muted);
  max-width: 600px;
  margin: 0 auto 1.5rem;
  line-height: 1.7;
}

.ga-cta-hero {
  font-size: 1.1rem;
  padding: .75rem 2rem;
}

/* ─── Stat cards ─────────────────────────────────────────────────── */
.ga-stat-card {
  background: var(--ga-card-bg);
  border-radius: var(--ga-radius-lg);
  padding: 1.5rem 1rem;
  box-shadow: var(--ga-shadow);
  border: 1px solid var(--ga-border);
  transition: box-shadow var(--ga-transition), transform var(--ga-transition);
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.ga-stat-card:hover { box-shadow: var(--ga-shadow-hover); transform: translateY(-2px); }
.ga-stat-card-link { cursor: pointer; display: block; color: inherit; }
.ga-stat-card-link:hover .ga-stat-number { color: var(--ga-accent); }

.ga-stat-number {
  font-family: var(--ga-font-heading);
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 700;
  color: var(--ga-primary);
  line-height: 1.1;
}
.ga-stat-pct {
  font-size: .78rem;
  color: var(--ga-text-muted);
  min-height: 1em;
}
.ga-stat-label {
  font-size: .85rem;
  color: var(--ga-text-muted);
  margin-top: .3rem;
  font-weight: 500;
}

/* ─── How it works ───────────────────────────────────────────────── */
.ga-step { padding: 1.5rem 1rem; }

.ga-step-icon {
  font-size: 2.4rem;
  color: var(--ga-accent);
  margin-bottom: 1rem;
}
.ga-step-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: .5rem;
  color: var(--ga-primary);
}
.ga-step-desc { font-size: .9rem; color: var(--ga-text-muted); margin: 0; }

/* ─── Highlights ─────────────────────────────────────────────────── */
.ga-highlight-card {
  background: var(--ga-card-bg);
  border: 1px solid var(--ga-border);
  border-radius: var(--ga-radius-lg);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--ga-shadow);
  height: 100%;
  display: flex;
  flex-direction: column;
}
.ga-highlight-header {
  font-family: var(--ga-font-heading);
  font-size: 1rem;
  font-weight: 600;
  color: var(--ga-primary);
  margin-bottom: .6rem;
}
a.ga-highlight-header:hover { color: var(--ga-accent); }

.ga-anchor-link {
  font-size: 0.9rem;
  color: var(--ga-text-muted);
  opacity: 0;
  text-decoration: none;
  vertical-align: middle;
  transition: opacity 0.15s;
}

.ga-highlight-header:hover .ga-anchor-link,
h2:hover .ga-anchor-link,
h3:hover .ga-anchor-link,
.ga-tl-year-header:hover .ga-anchor-link,
.ga-anchor-link:focus {
  opacity: 1;
}

.ga-anchor-link:hover {
  color: var(--ga-primary);
}

/* Offset scroll-to-anchor so sticky navbar doesn't cover the card header */
.ga-anchor-section {
  scroll-margin-top: calc(var(--ga-navbar-h, 56px) + 1rem);
}

.ga-highlight-body {
  font-size: .9rem;
  color: var(--ga-text-muted);
  flex: 1;
  margin-bottom: .75rem;
  line-height: 1.6;
}
.ga-highlight-link {
  font-size: .85rem;
  font-weight: 600;
  color: var(--ga-accent);
  text-decoration: none;
}
.ga-highlight-link:hover { color: var(--ga-accent-hover); text-decoration: underline; }

/* ─── CTA text ───────────────────────────────────────────────────── */
.ga-cta-text {
  font-family: var(--ga-font-heading);
  font-size: 1.4rem;
  color: var(--ga-text-muted);
  margin-bottom: .5rem;
}

/* ─── Buttons ────────────────────────────────────────────────────── */
.ga-btn-primary {
  background-color: var(--ga-primary);
  border-color: var(--ga-primary);
  color: #fff;
  border-radius: 50px;
  font-weight: 600;
  letter-spacing: .02em;
  transition: background-color var(--ga-transition), transform var(--ga-transition), box-shadow var(--ga-transition);
}
.ga-btn-primary:hover, .ga-btn-primary:focus {
  background-color: var(--ga-primary-hover);
  border-color: var(--ga-primary-hover);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(26,54,93,.3);
}


/* ─── Page content (lazy-loaded area) ───────────────────────────── */
.ga-page-content {
  min-height: 60vh;
}

/* fade-in animation when pages load */
.ga-page-fade-in {
  animation: gaFadeIn .25s ease forwards;
}
@keyframes gaFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0);   }
}

/* ─── Page section wrapper ───────────────────────────────────────── */
.ga-section {
  padding: 3rem 0;
}
.ga-section-title {
  font-size: clamp(1.6rem, 3vw, 2.25rem);
  font-weight: 700;
  color: var(--ga-primary);
  margin-bottom: .5rem;
}
.ga-section-subtitle {
  color: var(--ga-text-muted);
  font-size: 1rem;
  margin-bottom: 2.5rem;
}

/* ─── Page loading spinner ───────────────────────────────────────── */
.ga-page-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40vh;
  color: var(--ga-text-muted);
  gap: .75rem;
}
.ga-page-loading .spinner-border { color: var(--ga-primary); }

/* ─── Search result person cards ─────────────────────────────────── */
.ga-result-card {
  border-radius: var(--ga-radius-lg);
  box-shadow: var(--ga-shadow);
  margin-bottom: 1rem;
  overflow: hidden;
}
.ga-result-card .card-header {
  font-weight: 600;
  font-size: .9rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.ga-result-card .card-body { font-size: .88rem; line-height: 1.6; }

/* Shared primary card header (matches ga-person-form-card header) */
.ga-card-header-primary {
  background-color: var(--ga-primary);
  color: #fff;
  border-bottom-color: rgba(255,255,255,.15);
}
.ga-card-header-muted {
  background-color: var(--ga-primary-muted);
  color: #fff;
  border-bottom-color: rgba(255,255,255,.15);
}

/* Connection chain card */
.ga-connection-step {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .6rem .5rem;
  border-radius: var(--ga-radius);
  margin-bottom: .4rem;
  background: var(--ga-card-bg);
  border: 1px solid var(--ga-border);
}
.ga-connection-label {
  font-size: .78rem;
  color: var(--ga-text-muted);
  white-space: nowrap;
  min-width: 5rem;
  text-align: right;
  padding-top: .1rem;
}
.ga-connection-name { font-weight: 600; color: var(--ga-primary-muted); font-size: .9rem; }
.ga-connection-data { font-size: .8rem; color: var(--ga-text-muted); }
.ga-connection-arrow {
  text-align: center;
  color: var(--ga-accent);
  font-size: 1rem;
  padding: .25rem 0;
}

/* ─── Person form cards ──────────────────────────────────────────── */
/* Default: navy header */
.ga-person-form-card > .card-header {
  background-color: var(--ga-primary);
  color: #fff;
  border-bottom-color: rgba(255,255,255,.15);
}
/* Sex selected: male = teal-blue, female = wine-rose */
.ga-person-form-card.ga-sex-male  > .card-header { background-color: var(--ga-sex-male); }
.ga-person-form-card.ga-sex-female > .card-header { background-color: var(--ga-sex-female); }
/* Border accent */
.ga-person-form-card.ga-sex-male  { border-color: var(--ga-sex-male) !important; }
.ga-person-form-card.ga-sex-female { border-color: var(--ga-sex-female) !important; }
/* Static male/female headers (padre, madre, abuelos, result cards) */
.ga-card-header-male   { background-color: var(--ga-sex-male); color: #fff; border-bottom-color: rgba(255,255,255,.15); }
.ga-card-header-female { background-color: var(--ga-sex-female); color: #fff; border-bottom-color: rgba(255,255,255,.15); }
/* Result card border accent by sex */
.ga-result-card-male   { border-color: var(--ga-sex-male) !important; }
.ga-result-card-female { border-color: var(--ga-sex-female) !important; }

/* Scroll-fade indicator — gradient at bottom of scrollable result panels */
.ga-scroll-fade { position: relative; overflow: hidden; }
.ga-scroll-fade::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3.5rem;
  background: linear-gradient(to bottom, transparent, rgba(255,255,255,.93));
  pointer-events: none;
  border-radius: 0 0 var(--ga-radius) var(--ga-radius);
  transition: opacity .25s;
}
.ga-scroll-fade.ga-scroll-at-bottom::after { opacity: 0; }

/* Result feedback alerts */
.ga-result-alert { border-radius: var(--ga-radius); font-size: .93rem; }
.ga-result-alert p:last-child { margin-bottom: 0; }

/* Tree builder CTA */
.ga-btn-tree {
  color: var(--ga-primary);
  border: 2px solid var(--ga-primary);
  border-radius: 50px;
  padding: .5rem 1.75rem;
  font-weight: 600;
  font-size: .92rem;
  transition: background-color var(--ga-transition), color var(--ga-transition);
}
.ga-btn-tree:hover, .ga-btn-tree:focus {
  background-color: var(--ga-primary);
  color: #fff;
}

/* Sex toggle buttons inside card header */
.ga-switch-lg {
  padding-left: 3.25rem;
  min-height: 1.75rem;
  display: flex;
  align-items: center;
}
.ga-switch-lg .form-check-input {
  width: 2.75rem;
  height: 1.5rem;
  margin-left: -3.25rem;
  margin-top: 0;
  flex-shrink: 0;
  cursor: pointer;
}
.ga-switch-lg .form-check-label {
  font-size: 1.05rem;
  cursor: pointer;
}

.ga-sex-toggle .btn-outline-light {
  padding: .2rem .55rem;
  font-size: .85rem;
  border-radius: 50px;
}
.ga-sex-toggle .btn-check:checked + .btn-outline-light {
  background-color: rgba(255,255,255,.25);
  border-color: #fff;
  color: #fff;
}

/* ─── Family story article ───────────────────────────────────────── */
.ga-story-article {
  max-width: 760px;
  margin: 0 auto;
  font-size: 1.05rem;
  line-height: 1.8;
}
.ga-story-article p { text-align: justify; }
.ga-story-article h1 { font-size: 2rem; margin-bottom: .3rem; }
.ga-story-article h2 { font-size: 1.4rem; margin-top: 2rem; }
.ga-story-article h3 { font-size: 1.15rem; margin-top: 1.5rem; }
.ga-story-article a { color: var(--ga-primary-muted); text-decoration: none; }
.ga-story-article a:hover { color: var(--ga-accent); }
.ga-story-article blockquote {
  border-left: 4px solid var(--ga-accent);
  padding: .5rem 1.2rem;
  color: var(--ga-text-muted);
  margin: 1.5rem 0;
  font-style: italic;
  background: var(--ga-bg);
  border-radius: 0 var(--ga-radius) var(--ga-radius) 0;
}

/* ─── Testimonial cards ──────────────────────────────────────────── */
.ga-testimonial {
  background: var(--ga-card-bg);
  border: 1px solid var(--ga-border);
  border-radius: var(--ga-radius-lg);
  padding: 1.5rem;
  box-shadow: var(--ga-shadow);
  position: relative;
}
.ga-testimonial::before {
  content: '\201C';
  font-family: var(--ga-font-heading);
  font-size: 5rem;
  color: var(--ga-accent);
  opacity: .25;
  position: absolute;
  top: -.5rem;
  left: .75rem;
  line-height: 1;
}
.ga-testimonial-text { font-size: 1rem; font-style: italic; line-height: 1.7; color: var(--ga-text); margin-bottom: .75rem; }
.ga-testimonial-author { font-size: .85rem; font-weight: 600; color: var(--ga-text-muted); }

/* ─── Contribute cards ───────────────────────────────────────────── */
.ga-contribute-card {
  background: var(--ga-card-bg);
  border: 1px solid var(--ga-border);
  border-radius: var(--ga-radius-lg);
  padding: 2rem 1.5rem;
  text-align: center;
  box-shadow: var(--ga-shadow);
  height: 100%;
  display: flex;
  flex-direction: column;
  transition: box-shadow var(--ga-transition), transform var(--ga-transition);
}
.ga-contribute-card:hover { box-shadow: var(--ga-shadow-hover); transform: translateY(-3px); }
.ga-contribute-icon { font-size: 2.8rem; color: var(--ga-accent); margin-bottom: 1rem; display: block; }
.ga-contribute-title { font-size: 1.1rem; font-weight: 700; color: var(--ga-primary); margin-bottom: .5rem; }
.ga-contribute-desc { font-size: .9rem; color: var(--ga-text-muted); margin-bottom: 1.25rem; flex: 1; }

/* ─── Tooltips ───────────────────────────────────────────────────── */
abbr[title], abbr[data-bs-title] { text-decoration: none; }
.ga-tooltip { cursor: default; border-bottom: 1px dotted var(--ga-text-muted); }
.ga-nickname { margin-right: 0.15em; }
.ga-pers-label { font-size: 0.7em; vertical-align: middle; background-color: var(--ga-border); color: var(--ga-text-muted); }
.ga-pers-labels { margin-left: 0.25rem; }
@media (max-width: 575.98px) {
  .ga-pers-labels { display: block; margin-left: 0; margin-top: 0.2rem; }
}

/* ─── Shared list header (matches ga-table thead) ───────────────── */
.ga-list-header {
  background-color: var(--ga-primary);
  color: #fff;
  border-radius: var(--ga-radius) var(--ga-radius) 0 0;
  padding: .45rem .5rem;
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .03em;
}

/* ─── Shared table styles ────────────────────────────────────────── */
.ga-table thead th {
  background-color: var(--ga-primary);
  color: #fff;
  border-color: rgba(255,255,255,.15);
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .03em;
  white-space: nowrap;
}
.ga-table thead th,
.ga-table tbody td {
  padding-left: .5rem;
  padding-right: .5rem;
}
/* Expandable rows (mobile surname reveal) */
.ga-expandable-row { cursor: pointer; user-select: none; }
.ga-expandable-row:hover { background-color: rgba(0,0,0,.03); }
.ga-expand-icon { opacity: .45; font-size: .75rem; vertical-align: middle; transition: transform .2s; }
.ga-expand-row td {
  border-top: none !important;
  background-color: rgba(0,0,0,.025) !important;
  font-style: italic;
}

/* ─── Stats page ─────────────────────────────────────────────────── */
.ga-stats-group-heading {
  font-family: var(--ga-font-heading);
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--ga-primary);
  border-bottom: 2px solid var(--ga-accent);
  padding-bottom: .25rem;
  display: inline-block;
  margin-bottom: .75rem;
}

.ga-surnames-td {
  max-width: 0;
  overflow: hidden;
}
@media (min-width: 768px) {
  #immigration-list table { table-layout: fixed; }
  .ga-imm-col-idx     { width: 2.5rem; }
  .ga-imm-col-country { width: 15rem; }
  .ga-imm-col-persons { width: 5rem; }
  .ga-imm-col-pct     { width: 9rem; }
}
.ga-surnames-fade {
  white-space: nowrap;
  overflow: hidden;
  width: 100%;
  -webkit-mask-image: linear-gradient(to right, black 70%, transparent 100%);
  mask-image: linear-gradient(to right, black 70%, transparent 100%);
}
.ga-immigration-bar { background: var(--ga-border); border-radius: 50px; height: 8px; overflow: hidden; margin-top: .35rem; }
#immigration-list .ga-immigration-bar { max-width: 180px; }
.ga-immigration-bar-fill { height: 100%; border-radius: 50px; background: var(--ga-accent); transition: width .6s ease; }

/* ─── Recursos page ─────────────────────────────────────────────── */
.ga-resource-card {
  background: var(--ga-card-bg);
  border: 1px solid var(--ga-border);
  border-radius: var(--ga-radius);
  padding: 1rem 1.1rem;
  height: 100%;
  display: flex;
  flex-direction: column;
  box-shadow: var(--ga-shadow);
}
.ga-resource-link {
  font-size: .85rem;
  font-weight: 600;
  color: var(--ga-primary-muted);
  text-decoration: none;
  margin-top: auto;
}
.ga-resource-link:hover { color: var(--ga-accent); }

.ga-logo-download-card {
  background: var(--ga-card-bg);
  border: 1px solid var(--ga-border);
  border-radius: var(--ga-radius);
  padding: .75rem;
  display: flex;
  flex-direction: column;
  box-shadow: var(--ga-shadow);
  gap: .5rem;
}
.ga-logo-download-preview {
  border-radius: calc(var(--ga-radius) - 2px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: .75rem;
  min-height: 90px;
}
.ga-logo-preview-light { background: var(--ga-bg); }
.ga-logo-preview-white { background: #fff; }
.ga-logo-download-preview img { max-height: 70px; max-width: 100%; object-fit: contain; }
.ga-logo-download-info { line-height: 1.4; }

/* ─── Map page ───────────────────────────────────────────────────── */
.ga-leaflet-wrap { position: relative; border-radius: var(--ga-radius-lg); overflow: hidden; box-shadow: var(--ga-shadow); }

.ga-map-loading {
  position: absolute;
  inset: 0;
  z-index: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(2px);
  pointer-events: none;
}
#map-container { height: 440px; }
@media (max-width: 575.98px) { #map-container { height: 300px; } }
/* Leaflet popup style overrides to match theme */
.leaflet-popup-content-wrapper { border-radius: var(--ga-radius); box-shadow: var(--ga-shadow-hover); }
.leaflet-popup-content { font-family: var(--ga-font-body); font-size: .88rem; margin: .6rem .75rem; }
.leaflet-control-attribution { font-size: .65rem; }
.ga-map-tooltip {
  position: absolute;
  background: rgba(26,54,93,.95);
  color: #fff;
  font-size: .8rem;
  padding: .5rem .75rem;
  border-radius: var(--ga-radius);
  pointer-events: none;
  white-space: nowrap;
  z-index: 100;
  display: none;
  max-width: 220px;
  white-space: normal;
}

/* ─── Footer ─────────────────────────────────────────────────────── */
.ga-footer {
  background-color: var(--ga-footer-bg);
  color: var(--ga-footer-text);
  padding: 3rem 0 1.5rem;
  margin-top: 4rem;
}
.ga-footer a { color: var(--ga-footer-text); text-decoration: none; }
.ga-footer a:hover { color: #fff; }
.ga-footer-heading {
  font-family: var(--ga-font-heading);
  color: #fff;
  font-weight: 600;
  font-size: .8rem;
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: .07em;
}
.ga-footer-desc { font-size: .88rem; line-height: 1.65; margin-bottom: .75rem; }
.ga-footer-declaration { opacity: .75; line-height: 1.5; }
.ga-footer-cta { color: var(--ga-accent); font-weight: 500; }
.ga-footer-nav { display: flex; flex-direction: column; gap: .3rem; }
.ga-footer-nav a { font-size: .88rem; opacity: .8; }
.ga-footer-nav a:hover { opacity: 1; }
.ga-footer-social { display: flex; flex-direction: column; gap: .6rem; }
.ga-footer-social-link { font-size: .9rem; opacity: .85; display: flex; align-items: center; }
.ga-footer-social-link:hover { opacity: 1; color: #fff; }
.ga-footer-divider { border-color: rgba(255,255,255,.12); margin: 1.5rem 0 1rem; }
.ga-footer-copy { opacity: .55; }
.ga-logo-footer { height: 48px; width: auto; filter: brightness(0) invert(1); opacity: .9; }

/* ─── Theme toggle ───────────────────────────────────────────────── */
.ga-theme-toggle { display: flex; align-items: center; gap: .3rem; }
.ga-theme-btn { font-size: .75rem; padding: .2rem .6rem; color: rgba(255,255,255,.6); border-color: rgba(255,255,255,.2); background: transparent; border-radius: 50px; }
.ga-theme-btn:hover, .ga-theme-btn.active { color: #fff; border-color: rgba(255,255,255,.6); background: rgba(255,255,255,.1); }


/* ─── Loading states ─────────────────────────────────────────────── */
.ga-server-status {
  border-radius: var(--ga-radius-lg);
  padding: 1.5rem;
  text-align: center;
}

/* ─── Profile picture small ──────────────────────────────────────── */
.profile-picture-small {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: 50%;
}

/* ─── Birthday card ──────────────────────────────────────────────── */
.ga-birthday-item {
  padding: 0.5rem 0.25rem;
}

.ga-birthday-photo {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 50%;
  display: block;
  margin: 0 auto 0.4rem;
  border: 2px solid var(--ga-border);
}

.ga-birthday-photo-placeholder {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.4rem;
  background: var(--ga-bg);
  font-size: 1.75rem;
  color: var(--ga-text-muted);
}

.ga-birthday-name {
  font-size: 0.82rem;
  line-height: 1.3;
  color: var(--ga-text);
  word-break: break-word;
}

.ga-birthday-year {
  color: var(--ga-text-muted);
  font-size: 0.78rem;
  white-space: nowrap;
}

.ga-birthday-date-row {
  margin-left: 0.4rem;
}
.ga-birthday-date {
  font-size: 0.85rem;
  font-weight: 400;
  opacity: 0.75;
}
@media (max-width: 575px) {
  .ga-birthday-date-row {
    display: block;
    margin-left: 0;
    margin-top: 0.15rem;
  }
  .ga-anchor-link { opacity: 1; }
}

.ga-birthday-footer {
  padding: 0.8rem 1rem 0;
  font-size: 0.8rem;
  color: var(--ga-text-muted);
  border-top: 1px solid var(--ga-border);
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.ga-birthday-footer-link {
  color: var(--ga-text-muted);
  font-size: 1rem;
  line-height: 1;
  text-decoration: none;
  transition: color 0.15s;
}

.ga-birthday-footer-link:hover {
  color: var(--ga-text);
}

/* ─── Efemérides ─────────────────────────────────────────────────── */

/* Constrains overlays to the 64 px photo circle — no spill into adjacent cards */
.ga-ephem-photo-wrap {
  position: relative;
  width: 64px;
  margin: 0 auto 0.4rem;
}

/* Day number: small pill centred at the top edge of the circle */
.ga-ephem-day-badge {
  position: absolute;
  top: -7px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1.5;
  padding: 0 5px;
  border-radius: 6px;
  background: var(--ga-bg);
  border: 1px solid var(--ga-border);
  color: var(--ga-text-muted);
  white-space: nowrap;
  pointer-events: none;
}

/* Event-type badge: small circle at the bottom-right of the photo */
.ga-ephem-type-badge {
  position: absolute;
  bottom: -2px;
  right: -4px;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: var(--ga-bg);
  border: 1px solid var(--ga-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  line-height: 1;
  font-style: normal;
}

.ga-ephem-birth {
  color: #b8860b; /* decorative birthday star gold — intentionally fixed, not theme-dependent */
}

.ga-ephem-death {
  color: var(--ga-text-muted);
}

/* Highlight entries whose event falls on today */
.ga-ephem-today .ga-ephem-photo-wrap {
  outline: 2px solid var(--ga-accent);
  outline-offset: 3px;
  border-radius: 50%;
}

.ga-ephem-today .ga-ephem-day-badge {
  background: var(--ga-accent);
  border-color: var(--ga-accent);
  color: #fff;
}

/* ─── Responsive tweaks ──────────────────────────────────────────── */

/* Give every lazy-loaded section consistent inset on all screens narrower than xl
   (container-xl is full-width below 1200px, so Bootstrap's 12px gutter is not enough) */
@media (max-width: 1199.98px) {
  .ga-section.container-xl { padding-left: 1.25rem !important; padding-right: 1.25rem !important; }
}

@media (max-width: 575.98px) {
  .ga-hero { padding: 2.5rem 0 1.5rem; }
  .ga-logo-hero { height: 110px; }
  .ga-footer { padding: 2rem 0 1rem; }
  .ga-section { padding: 2rem 0; }
  .ga-step { padding: 1rem .5rem; }
  .ga-section.container-xl { padding-left: 1rem !important; padding-right: 1rem !important; }
  /* Immigration table: hide bars on mobile, keep percentage text */
  .ga-immigration-bar { display: none !important; }
  #immigration-list td[style] { min-width: 0 !important; }
}

/* ── Cronología timeline ───────────────────────────────────────── */
.ga-tl-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 1rem;
}

.ga-tl-search-wrap {
  max-width: 24rem;
  margin: 0 auto 1.5rem;
}

.ga-tl-filter-btn {
  border: 1px solid var(--ga-border);
  background: var(--ga-card-bg);
  color: var(--ga-text);
  border-radius: 1rem;
  padding: 0.25rem 0.875rem;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background-color var(--ga-transition), color var(--ga-transition), border-color var(--ga-transition);
}

.ga-tl-filter-btn[data-filter="all"]                 { color: var(--ga-text-muted);border-color: var(--ga-text-muted); }
.ga-tl-filter-btn[data-filter="all"]:hover,
.ga-tl-filter-btn[data-filter="all"].active          { background: var(--ga-text-muted); }
.ga-tl-filter-btn[data-filter="historia"]            { color: var(--ga-primary); border-color: var(--ga-primary); }
.ga-tl-filter-btn[data-filter="historia"]:hover,
.ga-tl-filter-btn[data-filter="historia"].active     { background: var(--ga-primary); }
.ga-tl-filter-btn[data-filter="genealogia"]          { color: var(--ga-accent);border-color: var(--ga-accent); }
.ga-tl-filter-btn[data-filter="genealogia"]:hover,
.ga-tl-filter-btn[data-filter="genealogia"].active   { background: var(--ga-accent); }
.ga-tl-filter-btn[data-filter="curiosidades"]        { color: var(--ga-curiosidades); border-color: var(--ga-curiosidades); }
.ga-tl-filter-btn[data-filter="curiosidades"]:hover,
.ga-tl-filter-btn[data-filter="curiosidades"].active { background: var(--ga-curiosidades); }

.ga-tl-filter-btn:hover,
.ga-tl-filter-btn.active {
  color: #fff;
}

.ga-tl-filter-btn[data-label="all"]                    { color: var(--ga-text-muted); border-color: var(--ga-text-muted); }
.ga-tl-filter-btn[data-label="all"]:hover,
.ga-tl-filter-btn[data-label="all"].active             { background: var(--ga-text-muted); color: #fff; }
.ga-tl-filter-btn[data-label]:not([data-label="all"])  { color: var(--ga-primary); border-color: var(--ga-primary); }
.ga-tl-filter-btn[data-label]:not([data-label="all"]):hover,
.ga-tl-filter-btn[data-label]:not([data-label="all"]).active { background: var(--ga-primary); color: #fff; }

.ga-tl-list {
  position: relative;
  --ga-tl-dot-col: 1.5rem;
}

.ga-tl-year-header {
  position: sticky;
  top: var(--ga-navbar-h, 56px);
  z-index: 2;
  background: var(--ga-bg);
  padding: 0.4rem 0 0.4rem calc(var(--ga-tl-dot-col) + 0.75rem);
  margin: 1.5rem 0 0.5rem;
  font-family: var(--ga-font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ga-text-muted);
  border-bottom: 1px solid var(--ga-border);
}

.ga-tl-year-header:first-child {
  margin-top: 0;
}

.ga-tl-year-header.d-none {
  display: none !important;
}

.ga-tl-empty {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--ga-text-muted);
  font-size: 0.9rem;
}
.ga-tl-empty-reset {
  color: var(--ga-primary);
  text-decoration: underline;
  vertical-align: baseline;
}
.ga-tl-empty-reset:hover { color: var(--ga-accent); }

.ga-tl-list::before { /* vertical spine */
  content: '';
  position: absolute;
  left: calc(var(--ga-tl-dot-col) / 2 - 1px);
  top: 0.75rem;
  bottom: 0;
  width: 2px;
  background: var(--ga-border);
}

.ga-tl-entry {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  margin-bottom: 1.5rem;
}

.ga-tl-entry.d-none {
  display: none !important;
}

.ga-tl-dot-wrap {
  width: var(--ga-tl-dot-col);
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  padding-top: 0.3rem;
  position: relative;
  z-index: 1;
}

.ga-tl-dot {
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
  border: 2px solid var(--ga-bg);
  flex-shrink: 0;
}

.ga-tl-dot-historia      { background: var(--ga-primary); }
.ga-tl-dot-genealogia    { background: var(--ga-accent); }
.ga-tl-dot-curiosidades  { background: var(--ga-curiosidades); /* green, decorative */ }

.ga-tl-content {
  flex: 1;
  min-width: 0;
}

.ga-tl-meta {
  font-size: 0.85rem;
  color: var(--ga-text-muted);
  margin-bottom: 0.25rem;
}

.ga-tl-card {
  background: var(--ga-card-bg);
  border: 1px solid var(--ga-border);
  border-left-width: 3px;
  border-radius: 0.375rem;
  padding: 0.625rem 0.875rem;
}

.ga-tl-card-historia      { border-left-color: var(--ga-primary); }
.ga-tl-card-genealogia    { border-left-color: var(--ga-accent); }
.ga-tl-card-curiosidades  { border-left-color: var(--ga-curiosidades); }

.ga-tl-card-historia .ga-tl-title      { color: var(--ga-primary); }
.ga-tl-card-genealogia .ga-tl-title    { color: var(--ga-accent); }
.ga-tl-card-curiosidades .ga-tl-title  { color: var(--ga-curiosidades); }

.ga-tl-img {
  float: right;
  width: 3rem;
  height: auto;
  margin: 0 0 0.375rem 0.75rem;
  border-radius: 2px;
  border: 1px solid var(--ga-border);
  display: block;
}

.ga-tl-title {
  font-weight: 600;
  color: var(--ga-text);
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.ga-tl-body {
  font-size: 0.875rem;
  color: var(--ga-text-muted);
  margin-top: 0.25rem;
}

.ga-tl-source-link {
  font-size: 0.75rem;
  color: var(--ga-primary-muted);
  margin-top: 0.375rem;
  display: inline-block;
}

.ga-tl-source-link:hover {
  color: var(--ga-accent);
}

.ga-tl-source-text {
  font-size: 0.75rem;
  color: var(--ga-primary-muted);
  margin-top: 0.375rem;
  display: inline-block;
}

.ga-tl-story-link {
  font-size: 0.75rem;
  color: var(--ga-accent);
  margin-top: 0.25rem;
  display: inline-block;
}

.ga-tl-story-link:hover {
  text-decoration: underline;
}

/* ─── Biblioteca Digital de Azul — directory tree ────────────── */
.ga-bda-tree {
  background: #fff; /* white panel per design */
  border: 1px solid var(--ga-border);
  border-radius: var(--ga-radius);
  padding: 1rem 1.25rem 0.5rem;
  font-size: 0.875rem;
}

.ga-bda-category {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
  padding: 0.55rem 0 0.2rem;
  color: var(--ga-text);
}

.ga-bda-category:first-child { padding-top: 0; }

.ga-bda-folder-icon {
  color: var(--ga-accent);
  font-size: 1rem;
  flex-shrink: 0;
}

.ga-bda-category-empty .ga-bda-folder-icon,
.ga-bda-category-empty > span:not(.badge) {
  color: var(--ga-text-muted);
}

.ga-bda-files {
  list-style: none;
  margin: 0 0 0 0.5rem;
  padding: 0 0 0.65rem 1.5rem;
  border-left: 1px solid var(--ga-border);
}

.ga-bda-files:last-child { padding-bottom: 0.25rem; }

.ga-bda-files li {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0;
  line-height: 1.45;
  position: relative;
}

.ga-bda-files li::before {
  content: '';
  position: absolute;
  left: -1.5rem;
  top: 50%;
  width: 0.75rem;
  height: 1px;
  background: var(--ga-border);
}

.ga-bda-files li i {
  flex-shrink: 0;
  font-size: 1rem;
}

.ga-bda-files a {
  color: var(--ga-primary);
  text-decoration: none;
}

.ga-bda-files a:hover {
  color: var(--ga-accent);
  text-decoration: underline;
}

.ga-bda-icon-yt  { color: #FF0000; } /* YouTube red */
.ga-bda-icon-pdf { color: #c0392b; } /* PDF red     */
.ga-bda-icon-img { color: #2471a3; } /* image blue  */

/* ── Family tree action buttons ──────────────────────────────────
   Three distinct actions: download list (muted), 2D tree (primary
   navy), 3D tree (accent gold). Shared hover lift animation. */
.ga-btn-family-tree {
  display: inline-flex;
  align-items: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.ga-btn-family-tree i {
  line-height: 1;
}
.ga-btn-family-tree:not(:disabled):not(.disabled):hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.20);
}

.ga-btn-tree-download {
  background-color: var(--ga-text-muted);
  border-color: var(--ga-text-muted);
  color: #fff;
}
.ga-btn-tree-download:not(:disabled):not(.disabled):hover,
.ga-btn-tree-download:not(:disabled):not(.disabled):focus {
  background-color: #5a4c42;
  border-color: #5a4c42;
  color: #fff;
}

.ga-btn-tree-2d {
  background-color: var(--ga-primary);
  border-color: var(--ga-primary);
  color: #fff;
}
.ga-btn-tree-2d:not(:disabled):not(.disabled):hover,
.ga-btn-tree-2d:not(:disabled):not(.disabled):focus {
  background-color: var(--ga-primary-hover);
  border-color: var(--ga-primary-hover);
  color: #fff;
}

.ga-btn-tree-3d {
  background-color: var(--ga-curiosidades);
  border-color: var(--ga-curiosidades);
  color: #fff;
}
.ga-btn-tree-3d:not(:disabled):not(.disabled):hover,
.ga-btn-tree-3d:not(:disabled):not(.disabled):focus {
  background-color: var(--ga-curiosidades-hover);
  border-color: var(--ga-curiosidades-hover);
  color: #fff;
}

/* ── 3D Family Tree Modal ─────────────────────────────────────── */
.ga-tree3d-beta-badge {
  display: inline-block;
  padding: 0.2em 0.6em;
  font-size: 10px;
  font-weight: 600;
  background: var(--ga-border);
  color: var(--ga-text-muted);
  border-radius: 10rem;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

/* ─── 3D family tree modal ──────────────────────────────────────────
   The modal palette is deliberately pinned to a cream/gold scheme that
   matches the WebGL scene background (family-tree-3d-scene.js sets
   _scene.background = 0xf0e4c8 and the logo walls use the same tone).
   These locals centralise the palette so the hex values are not
   scattered — the modal does NOT follow the site theme switcher because
   the 3D canvas cannot recolour at runtime. */
.ga-tree3d-modal {
  --ga-tree3d-bg:         #f0e4c8;
  --ga-tree3d-text:       #3a2000;
  --ga-tree3d-text-mid:   #5a3800;
  --ga-tree3d-text-soft:  #7a5a30;
  --ga-tree3d-text-dim:   #9a6a30;
  --ga-tree3d-text-warn:  #7a2010;
  --ga-tree3d-text-muted: #7a5020;
  --ga-tree3d-title:      #4a3000;
  --ga-tree3d-trunc:      #6a4010;
  --ga-tree3d-home:       #7a4800;
  --ga-tree3d-ctrl-label: #7a5a30;
  --ga-tree3d-legend:     #5a4020;
  position: fixed;
  inset: 0;
  z-index: 1050;
  background: var(--ga-tree3d-bg);
  display: flex;
  align-items: stretch;
}

.ga-tree3d-canvas-wrap {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.ga-tree3d-canvas-wrap canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.ga-tree3d-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 11;
  background: rgba(240, 228, 200, 0.93);
  border: 1px solid rgba(120, 90, 30, 0.25);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: 16px;
  color: var(--ga-tree3d-text-mid);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ga-tree3d-download {
  position: absolute;
  top: 14px;
  right: 106px;
  z-index: 11;
  background: rgba(240, 228, 200, 0.93);
  border: 1px solid rgba(120, 90, 30, 0.25);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: 15px;
  color: var(--ga-tree3d-text-mid);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ga-tree3d-download:hover { background: rgba(210, 180, 120, 0.9); }

/* Cinematic mode — fade UI out, keep only exit controls dimly visible */
.ga-tree3d-ctrl-panel,
.ga-tree3d-hint,
.ga-tree3d-mobile-reset,
.ga-tree3d-brand,
.ga-tree3d-title,
.ga-tree3d-truncated,
.ga-tree3d-download,
.ga-tree3d-close,
.ga-tree3d-error {
  transition: opacity 0.5s ease;
}
.ga-tree3d-modal--cinematic .ga-tree3d-ctrl-panel,
.ga-tree3d-modal--cinematic .ga-tree3d-hint,
.ga-tree3d-modal--cinematic .ga-tree3d-mobile-reset,
.ga-tree3d-modal--cinematic .ga-tree3d-brand,
.ga-tree3d-modal--cinematic .ga-tree3d-title,
.ga-tree3d-modal--cinematic .ga-tree3d-truncated,
.ga-tree3d-modal--cinematic .ga-tree3d-download,
.ga-tree3d-modal--cinematic .ga-tree3d-error {
  opacity: 0;
  pointer-events: none;
}
/* Buttons are non-functional until the scene is live. Gate them visibly so
   taps are not silent no-ops while the Three.js module loads. */
.ga-tree3d-modal:not(.ga-tree3d-modal--ready) .ga-tree3d-download,
.ga-tree3d-modal:not(.ga-tree3d-modal--ready) .ga-tree3d-cinematic {
  opacity: 0.4;
  pointer-events: none;
}

.ga-tree3d-retry-link {
  color: var(--ga-tree3d-text-warn, #7a2010);
  text-decoration: underline;
  margin-left: 8px;
  font-weight: 600;
  cursor: pointer;
}
.ga-tree3d-retry-link:hover { color: var(--ga-tree3d-text, #3a2000); }

.ga-tree3d-modal--cinematic .ga-tree3d-close,
.ga-tree3d-modal--cinematic .ga-tree3d-cinematic { opacity: 0.25; }
.ga-tree3d-modal--cinematic .ga-tree3d-close:hover,
.ga-tree3d-modal--cinematic .ga-tree3d-cinematic:hover { opacity: 1; }
.ga-tree3d-modal--cinematic .ga-tree3d-cinematic.ga-active { opacity: 0.45; }
.ga-tree3d-modal--cinematic .ga-tree3d-cinematic.ga-active:hover { opacity: 0.85; }

.ga-tree3d-cinematic {
  position: absolute;
  top: 14px;
  right: 60px;
  z-index: 11;
  background: rgba(240, 228, 200, 0.93);
  border: 1px solid rgba(120, 90, 30, 0.25);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: 15px;
  color: var(--ga-tree3d-text-mid);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s, opacity 0.5s ease;
}
.ga-tree3d-cinematic:hover { background: rgba(210, 180, 120, 0.9); }
.ga-tree3d-cinematic.ga-active {
  background: rgba(90, 56, 0, 0.45);
  color: var(--ga-tree3d-bg);
  border-color: rgba(120, 90, 30, 0.5);
}

.ga-tree3d-person-card {
  position: absolute;
  bottom: 68px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(245, 235, 210, 0.97);
  border: 1px solid rgba(120, 90, 30, 0.28);
  border-radius: 14px;
  padding: 10px 44px 10px 18px;
  z-index: 12;
  max-width: 300px;
  max-width: min(300px, calc(100vw - 80px));
  pointer-events: auto;
}
.ga-tree3d-person-card-rel {
  font-family: Georgia, serif;
  font-size: 11px;
  color: var(--ga-tree3d-text-dim);
  text-transform: lowercase;
  letter-spacing: 0.4px;
  margin-bottom: 2px;
}
.ga-tree3d-person-card-name {
  font-family: Georgia, serif;
  font-size: 14px;
  font-weight: bold;
  color: var(--ga-tree3d-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ga-tree3d-person-card-years {
  font-family: Georgia, serif;
  font-size: 12px;
  color: var(--ga-tree3d-text-muted);
  margin-top: 2px;
}
.ga-tree3d-person-card-close {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  font-size: 13px;
  color: var(--ga-tree3d-text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}
.ga-tree3d-person-card-close:hover { background: rgba(120, 80, 20, 0.12); }

.ga-tree3d-title {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(240, 228, 200, 0.93);
  border: 1px solid rgba(120, 90, 30, 0.18);
  border-radius: 24px;
  padding: 6px 20px;
  font-size: 14px;
  font-family: Georgia, serif;
  color: var(--ga-tree3d-title);
  z-index: 10;
  white-space: nowrap;
  pointer-events: none;
  max-width: 55%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ga-tree3d-ctrl-panel {
  position: absolute;
  left: 14px;
  bottom: 52px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 6px;
  user-select: none;
}

.ga-tree3d-legend {
  background: rgba(240, 228, 200, 0.93);
  border: 1px solid rgba(120, 90, 30, 0.18);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 11px;
  color: var(--ga-tree3d-legend);
  font-family: Georgia, serif;
  line-height: 2;
}

.ga-tree3d-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}

.ga-tree3d-hint {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(240, 228, 200, 0.9);
  border: 1px solid rgba(120, 90, 30, 0.18);
  border-radius: 30px;
  padding: 7px 20px;
  font-size: 11px;
  color: var(--ga-tree3d-ctrl-label);
  pointer-events: none;
  white-space: nowrap;
  z-index: 10;
}

.ga-tree3d-brand {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  font-family: Georgia, serif;
  color: rgba(90, 56, 0, 0.52);
  pointer-events: none;
  white-space: nowrap;
  z-index: 10;
  letter-spacing: 0.3px;
}

.ga-tree3d-truncated {
  position: absolute;
  top: 54px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(180, 140, 60, 0.15);
  border: 1px solid rgba(180, 140, 60, 0.4);
  border-radius: 8px;
  padding: 6px 16px;
  font-size: 11px;
  color: var(--ga-tree3d-trunc);
  font-family: Georgia, serif;
  z-index: 10;
  white-space: nowrap;
}

.ga-tree3d-error {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(240, 228, 200, 0.95);
  border: 1px solid rgba(180, 60, 30, 0.35);
  border-radius: 10px;
  padding: 14px 24px;
  font-size: 13px;
  color: var(--ga-tree3d-text-warn);
  font-family: Georgia, serif;
  z-index: 10;
  text-align: center;
}

.ga-tree3d-controls {
  background: rgba(240, 228, 200, 0.93);
  border: 1px solid rgba(120, 90, 30, 0.18);
  border-radius: 10px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.ga-tree3d-ctrl-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 5px 4px 4px;
  border-radius: 6px;
  background: rgba(220, 205, 170, 0.35);
}

.ga-tree3d-ctrl-group + .ga-tree3d-ctrl-group {
  margin-top: 3px;
}

.ga-tree3d-ctrl-label {
  font-size: 9px;
  font-family: Georgia, serif;
  color: var(--ga-tree3d-ctrl-label);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  line-height: 1;
  text-align: center;
}

.ga-tree3d-ctrl-row {
  display: flex;
  justify-content: center;
  gap: 3px;
}

.ga-tree3d-ctrl-cross {
  display: grid;
  grid-template-columns: repeat(3, 28px);
  grid-template-rows: repeat(3, 28px);
  gap: 2px;
}

.ga-tree3d-ctrl-n { grid-area: 1 / 2; }
.ga-tree3d-ctrl-w { grid-area: 2 / 1; }
.ga-tree3d-ctrl-center {
  grid-area: 2 / 2;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: rgba(90, 56, 0, 0.45);
  pointer-events: none;
}
.ga-tree3d-ctrl-e { grid-area: 2 / 3; }
.ga-tree3d-ctrl-s { grid-area: 3 / 2; }

.ga-tree3d-ctrl-btn {
  width: 28px;
  height: 28px;
  border: 1px solid rgba(120, 90, 30, 0.22);
  border-radius: 6px;
  background: rgba(248, 238, 215, 0.9);
  color: var(--ga-tree3d-text-mid);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.08s, border-color 0.08s;
  -webkit-tap-highlight-color: transparent;
}

.ga-tree3d-ctrl-btn:hover {
  background: rgba(210, 180, 120, 0.85);
  border-color: rgba(120, 90, 30, 0.4);
}

.ga-tree3d-ctrl-btn:active {
  background: rgba(170, 130, 70, 0.85);
}

.ga-tree3d-ctrl-home {
  width: 100%;
  height: auto;
  margin-top: 4px;
  padding: 6px 8px;
  font-size: 10px;
  font-family: Georgia, serif;
  letter-spacing: 0.5px;
  color: var(--ga-tree3d-home);
  border-color: rgba(150, 100, 20, 0.35);
  background: rgba(230, 200, 140, 0.7);
}

.ga-tree3d-ctrl-home:hover {
  background: rgba(200, 160, 80, 0.85);
}

.ga-tree3d-loader {
  position: absolute;
  inset: 0;
  background: var(--ga-tree3d-bg, #f0e4c8);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 5;
  transition: opacity 0.8s;
}

.ga-tree3d-loader p {
  color: var(--ga-tree3d-text-muted, #7a5a20);
  font-size: 12px;
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 14px;
  font-family: Georgia, serif;
}

.ga-tree3d-bar {
  width: 160px;
  height: 1px;
  background: rgba(120, 90, 30, 0.2);
  position: relative;
  overflow: hidden;
}

.ga-tree3d-bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: -60px;
  width: 60px;
  height: 1px;
  background: var(--ga-tree3d-home, #8b6914);
  animation: ga-tree3d-slide 1.2s ease-in-out infinite;
}

@keyframes ga-tree3d-slide {
  0%   { left: -60px; }
  100% { left: 220px; }
}

.ga-tree3d-mobile-reset {
  display: none;
  position: absolute;
  bottom: 68px;
  left: 14px;
  width: auto !important;
  height: auto !important;
  padding: 7px 14px !important;
  background: rgba(230, 200, 140, 0.88) !important;
  border: 1px solid rgba(140, 100, 20, 0.38) !important;
  border-radius: 10px !important;
  font-size: 13px !important;
  font-family: Georgia, serif !important;
  letter-spacing: 0.3px !important;
  color: var(--ga-tree3d-home, #7a4800) !important;
  cursor: pointer;
  z-index: 10;
  white-space: nowrap;
}

@media (max-width: 767px) {
  .ga-tree3d-ctrl-panel { display: none; }
  .ga-tree3d-mobile-reset { display: flex; }
  .ga-tree3d-person-card { bottom: 118px; }
  /* Stack cinematic then download below the X button instead of beside it */
  .ga-tree3d-cinematic { top: 60px;  right: 14px; }
  .ga-tree3d-download  { top: 106px; right: 14px; }
  /* Title only needs to clear the single X button on the right */
  .ga-tree3d-title {
    left: 10px;
    right: 60px;
    transform: none;
    text-align: center;
    max-width: none;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   Tree Builder — /agregar-familia
   ═══════════════════════════════════════════════════════════════════ */

.ga-tree-canvas {
  background: var(--ga-card-bg);
  border: 1px solid var(--ga-border);
  border-radius: 8px;
  padding: 1rem;
  overflow-x: auto;
  --ga-tree-node-w: 86px;
  --ga-tree-node-gap: 6px;
  --ga-tree-spacer-lg-w: 24px;
  --ga-tree-parents-spacer-w: 80px;
}

.ga-tree-grid {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  min-width: max-content;
}

.ga-tree-row {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: var(--ga-tree-node-gap);
}

.ga-tree-node-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.ga-tree-node-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.4px;
  color: var(--ga-text-muted);
  text-align: center;
  max-width: 90px;
}

.ga-tree-node-label-ego {
  color: var(--ga-primary);
}

.ga-tree-node {
  border-radius: 6px;
  min-width: var(--ga-tree-node-w);
  max-width: 120px;
  text-align: center;
  cursor: pointer;
  padding: 6px 8px;
  transition: box-shadow 0.15s, border-color 0.15s;
  word-break: break-word;
}

.ga-tree-node:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.ga-tree-node:focus-visible {
  outline: 2px solid var(--ga-primary);
  outline-offset: 2px;
}

.ga-tree-node-empty {
  border: 1.5px dashed var(--ga-border);
  color: var(--ga-text-muted);
  background: var(--ga-bg);
}

.ga-tree-node-empty:hover {
  border-color: var(--ga-primary);
  color: var(--ga-primary);
}

.ga-tree-node-filled {
  border: 1.5px solid var(--ga-primary);
  background: var(--ga-card-bg);
  color: var(--ga-text);
}

@keyframes ga-ego-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(42, 62, 97, 0.35); }
  50%       { box-shadow: 0 0 0 7px rgba(42, 62, 97, 0); }
}

.ga-tree-node-ego.ga-tree-node-empty {
  border-width: 2px;
  border-color: var(--ga-primary);
  color: var(--ga-primary);
  animation: ga-ego-pulse 2s ease-in-out infinite;
}

.ga-tree-node-ego.ga-tree-node-filled {
  border-width: 2.5px;
  box-shadow: 0 0 0 3px var(--ga-primary-muted);
}

.ga-tree-node-child.ga-tree-node-filled {
  border-color: var(--ga-curiosidades);
  background: #f0fdf4; /* light green bg, decorative */
}

.ga-tree-node-plus {
  font-size: 1.1rem;
  line-height: 1;
  margin-bottom: 1px;
}

.ga-tree-node-hint {
  font-size: 0.65rem;
}

.ga-tree-node-name {
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
}

.ga-tree-node-birth {
  font-size: 0.65rem;
  color: var(--ga-text-muted);
  margin-top: 1px;
}

.ga-tree-node-death {
  font-size: 0.65rem;
  margin-top: 1px;
}

/* Connector rows — vertical lines + horizontal brackets */

.ga-tree-connector-v {
  width: 2px;
  height: 18px;
  background: var(--ga-border);
}

.ga-tree-connector-bracket-wrap {
  display: flex;
  justify-content: center;
  gap: var(--ga-tree-node-gap);
  height: 18px;
  width: 100%;
}

/* Each bracket spans two sibling nodes: 2 × node-width + inner gap */
.ga-tree-connector-bracket {
  width: calc(2 * var(--ga-tree-node-w) + var(--ga-tree-node-gap));
  border-bottom: 2px solid var(--ga-border);
  border-left: 2px solid var(--ga-border);
  border-right: 2px solid var(--ga-border);
  border-radius: 0 0 3px 3px;
}

.ga-tree-spacer-lg {
  width: var(--ga-tree-spacer-lg-w);
}

.ga-tree-parents-spacer {
  width: var(--ga-tree-parents-spacer-w);
}

.ga-tree-partner-sep {
  position: relative;
  align-self: center;
  width: var(--ga-tree-parents-spacer-w);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ga-text-muted);
  font-size: 0.85rem;
}

.ga-tree-partner-sep::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--ga-border);
}

.ga-tree-partner-sep i {
  position: relative;
  z-index: 1;
  padding: 0 4px;
  background: var(--ga-card-bg);
}

@media (max-width: 500px) {
  .ga-tree-canvas {
    --ga-tree-node-w: 64px;
    --ga-tree-node-gap: 4px;
    --ga-tree-spacer-lg-w: 16px;
    --ga-tree-parents-spacer-w: 56px;
    padding: 0.75rem;
  }
  .ga-tree-node-name { font-size: 0.65rem; }
  .ga-tree-node-plus { font-size: 0.9rem; }
  .ga-tree-node-label { font-size: 0.6rem; max-width: 64px; }
}

.ga-tree-add-child-node {
  border-color: var(--ga-curiosidades-muted);
  color: var(--ga-curiosidades);
}

.ga-tree-add-child-node:hover {
  border-color: var(--ga-curiosidades);
}

/* Results panel */
.ga-tree-results-card .card-body {
  max-height: 70vh;
  overflow-y: auto;
}
