/* Genealogia da Família Roriz */
.page-genealogia .gene-hero {
  padding: 3.5rem 0 2rem;
}
.gene-hero__eyebrow {
  color: var(--c-accent, #7c9cff);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}
.gene-hero__title {
  font-family: var(--font-title, Georgia, serif);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  color: #fff;
  margin-bottom: 0.75rem;
}
.gene-hero__lead {
  color: var(--c-text2, #94a3b8);
  max-width: 42rem;
  margin-bottom: 1.5rem;
}
.gene-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}
.gene-pill {
  font-size: 0.72rem;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.12);
  color: #cbd5e1;
  background: rgba(255,255,255,0.04);
}
.gene-pill--confirmado_familia { border-color: rgba(34,197,94,0.45); color: #86efac; }
.gene-pill--fonte_historica { border-color: rgba(59,130,246,0.45); color: #93c5fd; }
.gene-pill--provavel { border-color: rgba(234,179,8,0.45); color: #fde68a; }
.gene-pill--hipotese { border-color: rgba(249,115,22,0.45); color: #fdba74; }
.gene-pill--desconhecido { border-color: rgba(148,163,184,0.35); color: #94a3b8; }

.gene-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.gene-tree-wrap {
  overflow: hidden;
  padding: 0.75rem 0 2rem;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  min-height: min(72vh, 720px);
  overscroll-behavior: contain;
  cursor: grab;
  touch-action: none;
  user-select: none;
}
.gene-tree-wrap.is-dragging {
  cursor: grabbing;
}
.gene-tree-scale {
  transform-origin: left center;
  width: max-content;
  max-width: none;
  will-change: transform;
}
.gene-tree,
.gene-tree ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.gene-tree {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
}
.gene-tree ul {
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
}
.gene-tree li {
  display: flex;
  flex-direction: row;
  align-items: center;
  position: relative;
  padding: 0.35rem 0 0.35rem 1.15rem;
  text-align: left;
}
/* Conector horizontal até o card + espinha vertical entre irmãos */
.gene-tree li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 1.15rem;
  border-top: 1px solid rgba(148,163,184,0.4);
}
.gene-tree li::after {
  content: '';
  position: absolute;
  left: 0;
  width: 0;
  border-left: 1px solid rgba(148,163,184,0.4);
}
.gene-tree li:first-child::after {
  top: 50%;
  bottom: 0;
  border-radius: 0 0 0 6px;
}
.gene-tree li:last-child::after {
  top: 0;
  height: 50%;
  border-radius: 0 0 0 6px;
}
.gene-tree li:not(:first-child):not(:last-child)::after {
  top: 0;
  bottom: 0;
}
.gene-tree li:only-child::after {
  display: none;
}
.gene-tree li:only-child {
  padding-left: 0.85rem;
}
.gene-tree li:only-child::before {
  width: 0.85rem;
}
.gene-tree > li {
  padding-left: 0;
}
.gene-tree > li::before,
.gene-tree > li::after {
  display: none !important;
}
.gene-tree li > .gene-card + ul {
  margin-left: 0.15rem;
}

.gene-card {
  display: inline-block;
  flex: 0 0 auto;
  width: 108px;
  min-width: 108px;
  max-width: 108px;
  padding: 0.45rem 0.4rem;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(30,41,59,0.95), rgba(15,23,42,0.98));
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 6px 16px rgba(0,0,0,0.22);
  text-align: left;
  color: inherit;
  text-decoration: none;
  transition: transform 0.2s ease, border-color 0.2s ease;
  vertical-align: top;
  cursor: pointer;
  font: inherit;
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  z-index: 1;
}
.gene-card:hover {
  transform: translateX(2px);
  border-color: rgba(26,79,214,0.55);
  color: inherit;
}
.gene-card--ref {
  opacity: 0.72;
  border-style: dashed;
  background: rgba(15,23,42,0.75);
}
.gene-card--ref .gene-card__meta {
  color: #a5b4fc;
  font-style: italic;
}
.gene-card__thumb {
  display: block;
  width: 38px;
  height: 38px;
  margin: 0 auto 0.35rem;
  border: 2px solid rgba(255,255,255,0.2);
  border-radius: 50%;
  object-fit: cover;
  object-position: center top;
  background: #0f172a;
  box-shadow: 0 3px 8px rgba(0,0,0,0.3);
}
.gene-card__name {
  font-size: 0.68rem;
  font-weight: 600;
  color: #f8fafc;
  line-height: 1.2;
  margin-bottom: 0.2rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.gene-card__meta {
  font-size: 0.58rem;
  color: #94a3b8;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gene-card__badge {
  display: inline-block;
  margin-top: 0.25rem;
  font-size: 0.55rem;
  padding: 0.1rem 0.35rem;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.12);
}
.gene-card--root {
  border-color: rgba(124,156,255,0.55);
  box-shadow: 0 0 0 1px rgba(124,156,255,0.2), 0 8px 20px rgba(26,79,214,0.25);
}
.gene-spouses {
  font-size: 0.55rem;
  color: #a5b4fc;
  margin-top: 0.2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gene-note {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 1.25rem 1.4rem;
  color: #94a3b8;
  font-size: 0.9rem;
  margin: 1rem 0 1.25rem;
}

body.gene-modal-open {
  overflow: hidden;
}
.gene-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.gene-modal[hidden] {
  display: none !important;
}
.gene-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(4px);
}
.gene-modal__dialog {
  position: relative;
  width: min(560px, 100%);
  max-height: min(88vh, 720px);
  overflow: auto;
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.45);
  padding: 1.4rem 1.5rem 1.6rem;
  color: #e2e8f0;
}
.gene-modal__close {
  position: absolute;
  top: 0.65rem;
  right: 0.75rem;
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  color: #cbd5e1;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}
.gene-modal__close:hover {
  background: rgba(255,255,255,0.12);
  color: #fff;
}
.gene-modal__title {
  font-family: var(--font-title, Georgia, serif);
  font-size: 1.35rem;
  color: #fff;
  margin: 0 1.5rem 0.5rem 0;
  line-height: 1.25;
}
.gene-modal__meta {
  color: #a5b4fc;
  font-size: 0.9rem;
  margin-bottom: 0.65rem;
}
.gene-modal__pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1rem;
}
.gene-modal__block {
  font-size: 0.9rem;
  color: #cbd5e1;
  margin-bottom: 0.85rem;
  line-height: 1.45;
}
.gene-modal__block strong {
  color: #f1f5f9;
}
.gene-modal__bio,
.gene-modal__obs,
.gene-modal__fontes {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.gene-modal__bio strong,
.gene-modal__obs strong,
.gene-modal__fontes strong {
  display: block;
  color: #f8fafc;
  margin-bottom: 0.4rem;
  font-size: 0.85rem;
}
.gene-modal__bio p,
.gene-modal__obs p {
  margin: 0;
  color: #94a3b8;
  font-size: 0.9rem;
  line-height: 1.55;
}
.gene-modal__fontes ul {
  margin: 0;
  padding-left: 1.1rem;
  color: #94a3b8;
  font-size: 0.85rem;
}
.gene-modal__fontes li {
  margin-bottom: 0.55rem;
}
.gene-modal__fontes a {
  color: #93c5fd;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.gene-modal__fonte-tipo {
  display: inline-block;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  margin-right: 0.25rem;
}
.gene-modal__fonte-trecho {
  font-size: 0.8rem;
  color: #64748b;
  margin-top: 0.15rem;
}
.gene-modal__person-link {
  background: none;
  border: 0;
  padding: 0;
  color: #93c5fd;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  font: inherit;
}
.gene-modal__person-link:hover {
  color: #bfdbfe;
}
.gene-modal__muted {
  color: #64748b;
}
.gene-modal__loading,
.gene-modal__error {
  color: #94a3b8;
  margin: 1rem 0;
}

.gene-modal__photo-wrap {
  float: right;
  width: 132px;
  margin: 0 0 1rem 1rem;
  text-align: center;
}
.gene-modal__photo {
  width: 132px;
  height: 160px;
  object-fit: cover;
  object-position: center top;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(15,23,42,0.8);
  display: block;
}
.gene-modal__photo-placeholder {
  width: 132px;
  height: 160px;
  border-radius: 12px;
  border: 1px dashed rgba(255,255,255,0.18);
  background: linear-gradient(160deg, rgba(30,58,138,0.45), rgba(15,23,42,0.9));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  font-weight: 600;
  color: #93c5fd;
  letter-spacing: 0.04em;
}
.gene-modal__photo-credit {
  margin-top: 0.35rem;
  font-size: 0.62rem;
  line-height: 1.3;
  color: #64748b;
}
.gene-modal__photo-credit a {
  color: #94a3b8;
  text-decoration: underline;
  text-underline-offset: 1px;
}
.gene-modal__body::after {
  content: '';
  display: table;
  clear: both;
}
@media (max-width: 520px) {
  .gene-modal__photo-wrap {
    float: none;
    margin: 0 auto 1rem;
  }
}

.gene-modal__trunk-panel {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(255,255,255,0.08);
  clear: both;
}
.gene-modal__trunk-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
  justify-content: center;
  padding: 0.65rem 0.9rem;
  border-radius: 10px;
  border: 1px solid rgba(124,156,255,0.35);
  background: rgba(26,79,214,0.18);
  color: #c7d2fe;
  font: inherit;
  font-size: 0.88rem;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.gene-modal__trunk-btn:hover {
  background: rgba(26,79,214,0.28);
  border-color: rgba(124,156,255,0.55);
  color: #fff;
}
.gene-modal__trunk {
  margin-top: 0.85rem;
}
.gene-modal__trunk-lead {
  margin: 0 0 0.65rem;
  font-size: 0.82rem;
  color: #94a3b8;
}
.gene-modal__trunk-list {
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
}
.gene-modal__trunk-list::before {
  content: '';
  position: absolute;
  left: 15px;
  top: 0.4rem;
  bottom: 0.4rem;
  width: 2px;
  background: linear-gradient(180deg, rgba(124,156,255,0.55), rgba(148,163,184,0.15));
}
.gene-modal__trunk-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  position: relative;
  padding: 0.35rem 0 0.55rem;
}
.gene-modal__trunk-gen {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 600;
  color: #c7d2fe;
  background: #0f172a;
  border: 1px solid rgba(124,156,255,0.45);
  z-index: 1;
}
.gene-modal__trunk-info {
  flex: 1;
  min-width: 0;
  padding-top: 0.25rem;
  font-size: 0.9rem;
  color: #e2e8f0;
  line-height: 1.35;
}
.gene-modal__trunk-item.is-self .gene-modal__trunk-gen {
  background: rgba(26,79,214,0.35);
  border-color: rgba(124,156,255,0.8);
  color: #fff;
}
.gene-modal__trunk-item.is-self .gene-modal__trunk-info strong {
  color: #fff;
}
.gene-modal__trunk-role {
  display: inline-block;
  margin-left: 0.45rem;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  vertical-align: middle;
}

.gene-modal__share {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(255,255,255,0.08);
  clear: both;
}
.gene-modal__share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0.65rem 0.9rem;
  border-radius: 10px;
  border: 1px solid rgba(34,197,94,0.35);
  background: rgba(22,163,74,0.16);
  color: #bbf7d0;
  font: inherit;
  font-size: 0.88rem;
  cursor: pointer;
}
.gene-modal__share-btn:hover {
  background: rgba(22,163,74,0.26);
  border-color: rgba(74,222,128,0.55);
  color: #fff;
}
.gene-modal__share-box {
  margin-top: 0.75rem;
}
.gene-modal__share-label {
  display: block;
  font-size: 0.78rem;
  color: #94a3b8;
  margin-bottom: 0.35rem;
}
.gene-modal__share-row {
  display: flex;
  gap: 0.45rem;
}
.gene-modal__share-input {
  flex: 1;
  min-width: 0;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(15,23,42,0.85);
  color: #e2e8f0;
  font: inherit;
  font-size: 0.78rem;
  padding: 0.55rem 0.65rem;
}
.gene-modal__share-copy {
  flex: 0 0 auto;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.06);
  color: #e2e8f0;
  font: inherit;
  font-size: 0.8rem;
  padding: 0.55rem 0.8rem;
  cursor: pointer;
}
.gene-modal__share-copy:hover {
  background: rgba(255,255,255,0.12);
}
.gene-modal__share-hint {
  margin: 0.45rem 0 0;
  font-size: 0.75rem;
  color: #64748b;
}
.gene-modal__share-status {
  margin: 0.4rem 0 0;
  font-size: 0.78rem;
  color: #86efac;
}

.gene-form .form-label { color: #cbd5e1; font-size: 0.85rem; }
.gene-form .form-control,
.gene-form .form-select {
  background: rgba(15,23,42,0.8);
  border-color: rgba(255,255,255,0.12);
  color: #e2e8f0;
}
.gene-form .form-control:focus,
.gene-form .form-select:focus {
  background: rgba(15,23,42,0.95);
  border-color: rgba(26,79,214,0.6);
  color: #fff;
  box-shadow: 0 0 0 0.2rem rgba(26,79,214,0.2);
}
.gene-people-list {
  max-height: 420px;
  overflow: auto;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
}
.gene-people-list a {
  display: block;
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  color: #cbd5e1;
  text-decoration: none;
  font-size: 0.9rem;
}
.gene-people-list a:hover,
.gene-people-list a.is-active {
  background: rgba(26,79,214,0.15);
  color: #fff;
}
@media (max-width: 991px) {
  .gene-card {
    width: 92px;
    min-width: 92px;
    max-width: 92px;
    padding: 0.35rem 0.3rem;
  }
  .gene-card__thumb {
    width: 32px;
    height: 32px;
    margin-bottom: 0.25rem;
  }
  .gene-card__name { font-size: 0.6rem; }
  .gene-tree li { padding-top: 0.28rem; padding-bottom: 0.28rem; padding-left: 0.95rem; }
  .gene-tree-wrap { min-height: min(62vh, 560px); }
}
