@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@600;700;900&family=Work+Sans:wght@400;500;600;700&display=swap');

:root {
  /* paleta baseada no brasão da família: fundo dourado/laranja com uma besta em preto (sable) */
  --marrom: #d9661a;        /* laranja principal (era marrom) */
  --marrom-escuro: #17120d; /* preto quente (era marrom escuro) */
  --marrom-claro: #f0904a;  /* laranja claro (era marrom claro) */
  --dourado: #c9891f;
  --bege: #f4efe4;
  --bege-claro: #fbf6ec;
  --creme: #fffdf8;
  --borda: #e2d3b0;
  --texto: #1c1714;
  --texto-suave: #6b5f4e;
  --linha: #ece3cf;
  --verde: #4a7a3a;
  --vermelho: #a33;
  --sombra: 0 2px 10px rgba(20, 14, 8, 0.10);
  --sombra-forte: 0 8px 28px rgba(12, 8, 5, 0.24);
  /* usa a maior parte da tela, mas com um teto — sem teto nenhum, os
     parágrafos (que ficam com uma largura de leitura confortável, ver
     --largura-leitura) sobram muito espaço vazio do lado direito em
     monitores grandes, e a página toda fica com "buracos". */
  --largura-max: clamp(320px, 92vw, 1600px);
  --largura-leitura: 74ch;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Work Sans', -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  color: var(--texto);
  background: var(--creme);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-align: justify;
  text-justify: inter-word;
}

/* campos de formulário não devem justificar o que a pessoa está digitando —
   um <textarea> com texto justificado enquanto se digita fica com espaços
   esquisitos entre as palavras. */
input, textarea, select, button {
  text-align: left;
}

a { color: var(--marrom); text-decoration: none; }
a:hover { color: var(--marrom-claro); text-decoration: underline; }

/* ---------- topo / navegação ---------- */
.topo {
  background: var(--marrom-escuro);
  border-bottom: 3px solid var(--marrom);
  color: white;
  box-shadow: 0 2px 14px rgba(0,0,0,0.28);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topo-conteudo {
  max-width: var(--largura-max);
  margin: 0 auto;
  padding: 16px clamp(16px, 3vw, 48px);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 28px;
}
.marca {
  color: white;
  font-family: 'Cinzel', Georgia, serif;
  font-weight: 700;
  font-size: 1.35rem;
  margin-right: auto;
  letter-spacing: .2px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-align: left;
}
.marca:hover { text-decoration: none; opacity: .92; }
.brasao-marca { height: 34px; width: auto; display: block; }
.topo nav { display: flex; flex-wrap: wrap; gap: 6px 20px; }
.topo nav a {
  color: rgba(255,255,255,.82);
  font-size: .92rem;
  font-weight: 500;
  padding: 6px 2px;
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
}
.topo nav a:hover { text-decoration: none; color: white; }
.topo nav a.ativo { color: white; border-bottom-color: var(--dourado); }

/* ---------- layout geral ---------- */
.conteudo {
  max-width: var(--largura-max);
  margin: 0 auto;
  padding: 40px clamp(16px, 3vw, 48px) 70px;
  min-height: 60vh;
}
/* parágrafos e listas soltos usam a mesma largura dos demais blocos da página
   (hero, avisos, tabelas) — nada de coluna estreita perdida num container largo */
.busca { max-width: 640px; }

h1 {
  font-family: 'Cinzel', Georgia, serif;
  color: var(--marrom-escuro);
  font-size: 2.15rem;
  line-height: 1.2;
  margin-top: 0;
  margin-bottom: .3em;
  text-align: left;
}
h2 {
  font-family: 'Cinzel', Georgia, serif;
  color: var(--marrom);
  font-size: 1.5rem;
  margin-top: 2.2em;
  padding-top: .3em;
  border-top: 1px solid var(--linha);
  text-align: left;
}
h2:first-of-type { border-top: none; padding-top: 0; }
h3 { color: var(--marrom-escuro); font-size: 1.12rem; margin-top: 1.6em; text-align: left; }

.lead { color: var(--texto-suave); font-size: 1.05rem; text-align: left; }
/* texto de apresentação de um widget largo (ex.: diagrama interativo) — não faz sentido
   ficar limitado à largura de leitura enquanto o componente logo abaixo usa a página toda */
.conteudo > p.lead-largo { max-width: none; }

p { margin: 0 0 1em; }
ul, ol { padding-left: 1.4em; }
li { margin-bottom: .5em; }

/* ---------- hero (índice / história) ---------- */
.hero {
  background: linear-gradient(135deg, var(--marrom) 0%, var(--marrom-claro) 100%);
  color: white;
  border-radius: 16px;
  border-bottom: 5px solid var(--marrom-escuro);
  padding: 44px 40px;
  margin-bottom: 32px;
  box-shadow: var(--sombra-forte);
  position: relative;
  overflow: hidden;
  text-align: center;
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 85% 20%, rgba(23,18,13,.28), transparent 55%);
  pointer-events: none;
}
.hero h1 { color: white; font-size: 2.3rem; position: relative; text-align: center; }
.hero .lead { color: rgba(255,255,255,.88); font-size: 1.08rem; max-width: 62ch; margin-left: auto; margin-right: auto; position: relative; text-align: center; }
.hero .acoes { justify-content: center; }
.brasao-hero {
  position: absolute;
  top: -18px;
  right: 26px;
  height: 190px;
  width: auto;
  opacity: .16;
  filter: brightness(0) invert(1);
  pointer-events: none;
}
@media (max-width: 640px) { .brasao-hero { display: none; } }

.hero-historia {
  background: linear-gradient(135deg, var(--bege) 0%, var(--bege-claro) 100%);
  border: 1px solid var(--borda);
  border-radius: 16px;
  padding: 40px 40px 34px;
  margin-bottom: 28px;
}
.hero-historia h1 { font-size: 2.1rem; }

/* ---------- botões ---------- */
.botao {
  display: inline-block;
  background: linear-gradient(135deg, var(--marrom), var(--marrom-claro));
  color: white;
  padding: 11px 22px;
  border-radius: 8px;
  font-size: .95rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(217,102,26,.30);
  transition: transform .12s, box-shadow .12s;
}
.botao:hover { text-decoration: none; transform: translateY(-1px); box-shadow: 0 5px 14px rgba(217,102,26,.38); }
.botao.secundario {
  background: white;
  color: var(--marrom);
  border: 1.5px solid var(--marrom);
  box-shadow: none;
}
.botao.secundario:hover { background: var(--bege-claro); }
.botao.perigo {
  background: white;
  color: var(--vermelho);
  border: 1.5px solid var(--vermelho);
  box-shadow: none;
}
.botao.perigo:hover { background: #fdeeee; }

.acoes { display: flex; gap: 12px; flex-wrap: wrap; margin: 22px 0; }

/* ---------- cartões de estatística ---------- */
.cartoes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin: 24px 0 34px;
}
.cartao {
  background: white;
  border: 1px solid var(--linha);
  border-left: 4px solid var(--dourado);
  border-radius: 10px;
  padding: 16px 18px;
  box-shadow: var(--sombra);
  transition: transform .12s;
}
.cartao:hover { transform: translateY(-2px); }
.cartao .numero { font-family: 'Cinzel', Georgia, serif; font-size: 1.9rem; font-weight: 700; color: var(--marrom); line-height: 1; }
.cartao .rotulo { font-size: .85rem; color: var(--texto-suave); margin-top: 4px; text-align: left; }

/* ---------- busca ---------- */
.busca {
  display: flex;
  gap: 10px;
  margin: 22px 0 30px;
  flex-wrap: wrap;
}
.busca input[type=text] {
  flex: 1;
  min-width: 220px;
  padding: 12px 16px;
  border: 1px solid var(--borda);
  border-radius: 8px;
  font-size: 1rem;
  background: white;
}
.busca input[type=text]:focus { outline: 2px solid var(--dourado); outline-offset: 1px; }

/* ---------- tabelas ---------- */
.tabela-scroll { overflow-x: auto; margin: 14px 0 26px; -webkit-overflow-scrolling: touch; }
table.lista {
  width: 100%;
  /* sem teto — a tabela acompanha a mesma largura do texto e dos demais
     blocos da página (parágrafos e avisos também não têm mais teto). */
  border-collapse: collapse;
  margin: 10px 0 24px;
  font-size: .92rem;
  background: white;
  box-shadow: var(--sombra);
  border-radius: 10px;
  overflow: hidden;
}
.tabela-scroll table.lista { margin: 0; min-width: 520px; }
table.lista th, table.lista td {
  border-bottom: 1px solid var(--linha);
  padding: 10px 14px;
  text-align: left;
  vertical-align: top;
}
table.lista th {
  background: var(--marrom);
  color: white;
  font-weight: 600;
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}
table.lista tr:hover td { background: var(--bege-claro); }
table.lista tr:last-child td { border-bottom: none; }
.tabela-compacta { font-size: .85rem; }
.tabela-historia td:first-child { font-weight: 600; color: var(--marrom-escuro); width: 18%; }

/* a tabela da árvore completa tem uma coluna (Filhos) cujo conteúdo varia
   muito de pessoa pra pessoa — sem um teto, o navegador alarga essa coluna
   até caber a linha mais longa de todas, e as demais linhas ficam com um
   nome ou dois perdidos numa coluna enorme e vazia. Um teto por coluna deixa
   a tabela com uma proporção mais equilibrada. */
.tabela-genealogia td:nth-child(3),
.tabela-genealogia td:nth-child(4),
.tabela-genealogia td:nth-child(5) {
  max-width: 320px;
}
.tabela-log td:last-child {
  max-width: 420px;
}

.vazio, .ambiguo { color: #a89b85; font-size: .92em; }

/* ---------- árvore (listas expansíveis) ---------- */
details.ramo {
  border: 1px solid var(--linha);
  border-radius: 12px;
  margin-bottom: 16px;
  background: white;
  box-shadow: var(--sombra);
  overflow: hidden;
}
details.ramo > summary {
  cursor: pointer;
  padding: 15px 20px;
  font-weight: 700;
  color: var(--marrom-escuro);
  background: linear-gradient(120deg, var(--bege), var(--bege-claro));
  list-style: none;
}
details.ramo > summary::-webkit-details-marker { display: none; }
details.ramo > summary::before { content: "▸ "; color: var(--dourado); }
details.ramo[open] > summary::before { content: "▾ "; }
details.geracao { margin: 12px 18px 16px; }
details.geracao > summary {
  cursor: pointer;
  padding: 8px 4px;
  font-weight: 600;
  color: var(--marrom);
}

/* ---------- ficha de pessoa ---------- */
.ficha {
  background: white;
  border: 1px solid var(--linha);
  border-radius: 14px;
  padding: 26px 30px;
  max-width: 720px;
  box-shadow: var(--sombra);
}
.ficha dl { display: grid; grid-template-columns: 170px 1fr; gap: 10px 16px; margin: 0; }
.ficha dt { color: var(--texto-suave); font-size: .87rem; font-weight: 600; }
/* listas de nomes (pais/cônjuges/filhos) não devem justificar — vira uma
   lista com vírgulas, não um texto corrido, e justificado fica com espaços
   esquisitos entre os nomes quando quebra linha. */
.ficha dd { margin: 0; text-align: left; }

/* ---------- formulários ---------- */
form.formulario {
  max-width: 660px;
  margin: 0 auto;
  background: white;
  border: 1px solid var(--linha);
  border-radius: 14px;
  padding: 28px 32px;
  box-shadow: var(--sombra);
}
form.formulario label {
  display: block;
  font-weight: 600;
  margin: 18px 0 5px;
  font-size: .92rem;
  color: var(--marrom-escuro);
  text-align: left;
}
form.formulario .dica {
  font-weight: 400;
  color: var(--texto-suave);
  font-size: .85rem;
  display: block;
  margin-top: 2px;
}
form.formulario input[type=text],
form.formulario input[type=password],
form.formulario input[type=date],
form.formulario select,
form.formulario textarea {
  width: 100%;
  padding: 10px 13px;
  border: 1px solid var(--borda);
  border-radius: 7px;
  font-size: .97rem;
  font-family: inherit;
  background: var(--creme);
}
form.formulario input:focus, form.formulario select:focus, form.formulario textarea:focus {
  outline: 2px solid var(--dourado);
  outline-offset: 1px;
  background: white;
}
form.formulario textarea { min-height: 70px; resize: vertical; }
form.formulario .linha2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.campo-honeypot { position: absolute; left: -9999px; opacity: 0; }

/* ---------- avisos ---------- */
.aviso {
  background: var(--bege-claro);
  border: 1px solid var(--borda);
  border-left: 4px solid var(--dourado);
  border-radius: 10px;
  padding: 16px 20px;
  margin: 20px 0;
  font-size: .93rem;
}
.aviso.sucesso { border-left-color: var(--verde); background: #eef6ea; }
.aviso.erro { border-left-color: var(--vermelho); background: #fdeeee; }

/* ---------- rodapé ---------- */
.rodape {
  max-width: var(--largura-max);
  margin: 0 auto;
  padding: 26px clamp(16px, 3vw, 48px) 50px;
  color: #000;
  font-size: .85rem;
  border-top: 1px solid var(--linha);
  text-align: center;
}
.rodape .copyright {
  margin-top: 14px;
  font-size: .78rem;
  opacity: .6;
}

/* ---------- diagrama / mapas ---------- */
img.diagrama {
  max-width: 100%;
  border: 1px solid var(--linha);
  border-radius: 10px;
  box-shadow: var(--sombra);
}
figure.mapa {
  margin: 20px 0 30px;
  text-align: center;
}
figure.mapa img {
  max-width: 100%;
  border-radius: 10px;
  border: 1px solid var(--linha);
  box-shadow: var(--sombra);
}
figure.mapa figcaption {
  font-size: .85rem;
  color: var(--texto-suave);
  margin-top: 8px;
  max-width: 70ch;
  margin-left: auto;
  margin-right: auto;
}

/* ---------- galeria de fotos e vídeos ---------- */
.galeria-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 22px;
  margin: 26px 0 40px;
}
.galeria-card {
  background: white;
  border: 1px solid var(--linha);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--sombra);
  display: flex;
  flex-direction: column;
  transition: transform .12s;
}
.galeria-card:hover { transform: translateY(-2px); }
.galeria-midia {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: var(--marrom-escuro);
}
a.galeria-midia img { width: 100%; height: 100%; object-fit: cover; display: block; }
video.galeria-midia { object-fit: contain; background: #000; }
.galeria-video-embed { position: relative; }
.galeria-video-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.galeria-info { padding: 14px 16px 16px; }
.galeria-info h3 {
  margin: 0 0 6px;
  font-family: 'Cinzel', Georgia, serif;
  color: var(--marrom-escuro);
  font-size: 1.02rem;
}
.galeria-descricao { font-size: .9rem; color: var(--texto-suave); margin: 0 0 8px; }
.galeria-meta { font-size: .78rem; color: var(--texto-suave); opacity: .8; margin: 0 0 6px; }
.galeria-excluir { font-size: .78rem; color: var(--vermelho); }

/* ---------- linha do tempo ---------- */
.timeline {
  position: relative;
  margin: 24px 0 10px;
  padding-left: 26px;
  border-left: 3px solid var(--borda);
}
.timeline .fato { text-align: left; }
.timeline-item { position: relative; padding-bottom: 22px; }
.timeline-item::before {
  content: "";
  position: absolute;
  left: -32px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--dourado);
  border: 2px solid white;
  box-shadow: 0 0 0 2px var(--marrom-claro);
}
.timeline .ano {
  font-family: 'Cinzel', Georgia, serif;
  font-weight: 700;
  color: var(--marrom);
  font-size: 1.05rem;
}
.timeline .fato { color: var(--texto); margin-top: 2px; }
.tag-fato, .tag-hipotese {
  display: inline-block;
  font-size: .72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  margin-left: 6px;
  vertical-align: middle;
}
.tag-fato { background: #e7f2e2; color: #3d6b30; }
.tag-hipotese { background: #fbeecb; color: #8a5a10; }

/* ---------- diagrama interativo (SVG) ---------- */
.arvore-visual-wrap {
  background: white;
  border: 1px solid var(--linha);
  border-radius: 14px;
  box-shadow: var(--sombra);
  padding: 6px;
  margin: 18px 0 28px;
}
.arvore-visual-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--linha);
  flex-wrap: wrap;
}
.arvore-visual-toolbar button {
  background: var(--bege-claro);
  border: 1px solid var(--borda);
  color: var(--marrom-escuro);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: .85rem;
  cursor: pointer;
  white-space: nowrap;
}
.arvore-visual-toolbar button:hover { background: var(--bege); }
.arvore-visual-toolbar .av-zoom-btns { display: inline-flex; gap: 6px; }
.av-busca-wrap { display: inline-flex; gap: 6px; align-items: center; }
.av-busca-wrap input {
  border: 1px solid var(--borda);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: .85rem;
  font-family: 'Work Sans', sans-serif;
  width: 210px;
  background: white;
  transition: box-shadow .15s;
}
.av-busca-wrap input:focus { outline: none; box-shadow: 0 0 0 3px rgba(201,137,31,.25); }
.av-busca-wrap input.av-busca-erro { box-shadow: 0 0 0 3px rgba(178,58,46,.3); }
.arvore-visual-toolbar .legenda { margin-left: auto; display: flex; gap: 12px; flex-wrap: wrap; font-size: .78rem; color: var(--texto-suave); }
.arvore-visual-toolbar .legenda span { display: inline-flex; align-items: center; gap: 5px; }
.arvore-visual-toolbar .ponto { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
#av-foco-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 16px;
  background: linear-gradient(180deg, #fbf3e4, #f7ecd8);
  border-bottom: 1px solid var(--linha);
  font-size: .92rem;
}
#av-foco-info .av-foco-nome { font-weight: 600; color: var(--marrom-escuro); font-family: 'Cinzel', serif; }
#av-foco-info a { font-size: .85rem; white-space: nowrap; }
#arvore-svg-container {
  width: 100%;
  height: min(640px, 72vh);
  overflow: hidden;
  cursor: grab;
  border-radius: 0 0 12px 12px;
  background:
    radial-gradient(circle at 1px 1px, var(--linha) 1px, transparent 0) 0 0/22px 22px,
    var(--creme);
}
#arvore-svg-container:active { cursor: grabbing; }

/* linhas de parentesco */
.av-linha { stroke: #b5a284; stroke-width: 1.6; }
.av-linha-casamento { stroke: var(--dourado); stroke-width: 2; stroke-dasharray: 3 3; }

/* cartões — modo compacto (visão geral) */
.no-pessoa.compacto rect {
  stroke-width: 1.3;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.12));
}
.no-pessoa.compacto text {
  font-family: 'Work Sans', sans-serif;
  pointer-events: none;
}
.no-pessoa.compacto .nome { font-size: 11px; font-weight: 600; fill: #2b241d; }
.no-pessoa.compacto .datas { font-size: 9.5px; fill: #6b6255; }
.no-pessoa.compacto:hover rect { stroke: var(--marrom); stroke-width: 2.2; }

/* cartões — modo foco (estilo FamilySearch) */
.no-pessoa.grande { cursor: pointer; }
.no-pessoa.grande .cartao-fundo {
  fill: white;
  stroke: var(--borda);
  stroke-width: 1.3;
  filter: drop-shadow(0 2px 5px rgba(74,44,26,.16));
  transition: filter .15s, stroke .15s;
}
.no-pessoa.grande:hover .cartao-fundo { stroke: var(--dourado); filter: drop-shadow(0 4px 10px rgba(74,44,26,.24)); }
.no-pessoa.grande.foco-atual .cartao-fundo { fill: #fdf6e8; stroke: var(--marrom); stroke-width: 2.4; }
.no-pessoa.grande text { font-family: 'Work Sans', sans-serif; pointer-events: none; }
.no-pessoa.grande .nome { font-size: 13.5px; font-weight: 700; fill: #2b241d; }
.no-pessoa.grande.foco-atual .nome { fill: var(--marrom-escuro); }
.no-pessoa.grande .datas { font-size: 11px; fill: #6b6255; }
.no-pessoa.grande .marca-desc { font-size: 15px; fill: var(--dourado); font-weight: 700; pointer-events: none; }

.no-pessoa { cursor: pointer; }
.arvore-loading { padding: 60px 20px; text-align: center; color: var(--texto-suave); }

@media (max-width: 900px) {
  .conteudo { padding: 28px 16px 50px; }
  .topo-conteudo { padding: 12px 16px; gap: 8px 16px; }
  .topo nav { gap: 4px 14px; }
  .topo nav a { font-size: .87rem; }
}

@media (max-width: 640px) {
  .hero, .hero-historia { padding: 24px 20px; }
  form.formulario { padding: 22px 20px; }
  form.formulario .linha2 { grid-template-columns: 1fr; }
  .ficha { padding: 20px 22px; }
  .ficha dl { grid-template-columns: 1fr; }
  .ficha dt { margin-top: 10px; }
  table.lista { font-size: .85rem; }
  table.lista th, table.lista td { padding: 8px 10px; }
  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.25rem; }
  .cartoes { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
  .cartao { padding: 12px 14px; }
  .cartao .numero { font-size: 1.5rem; }
  .acoes { gap: 8px; }
  .acoes .botao { flex: 1 1 auto; text-align: center; }
  #arvore-svg-container { height: min(460px, 60vh); }
  .arvore-visual-toolbar { padding: 8px; gap: 6px; }
  .av-busca-wrap { width: 100%; order: 10; }
  .av-busca-wrap input { width: 100%; flex: 1; }
  .arvore-visual-toolbar .legenda { margin-left: 0; }
  #av-foco-info { font-size: .85rem; padding: 8px 12px; }
  #av-foco-info a { width: 100%; }
}

/* ---------- vínculos (adicionar filho / cônjuge a partir da ficha) ---------- */
.add-vinculo {
  display: inline-block;
  margin-left: 8px;
  font-size: .78rem;
  font-weight: 600;
  color: var(--marrom);
  border: 1px solid var(--borda);
  border-radius: 999px;
  padding: 1px 10px;
  background: var(--bege-claro);
  white-space: nowrap;
  vertical-align: 1px;
}
.add-vinculo:hover { text-decoration: none; background: white; border-color: var(--marrom); }

.lead-secundaria {
  color: var(--texto-suave);
  font-size: .92rem;
  text-align: left;
  margin-top: -.4em;
}

form.formulario label.linha-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-weight: 400;
  font-size: .9rem;
  color: var(--texto-suave);
  background: var(--bege-claro);
  border: 1px solid var(--borda);
  border-radius: 10px;
  padding: 12px 14px;
}
form.formulario label.linha-check input[type=checkbox] { width: auto; margin-top: 3px; flex: none; }

/* carinhas de masculino/feminino nos cartões do diagrama e na legenda */
.arvore-visual-toolbar .av-avatar-legenda { flex: none; display: block; }
.no-pessoa .av-avatar { pointer-events: none; }

/* ---------- resumo do vínculo no cadastro enxuto ---------- */
.vinculo-resumo {
  background: var(--bege-claro);
  border: 1px solid var(--borda);
  border-left: 4px solid var(--dourado);
  border-radius: 10px;
  padding: 14px 18px 16px;
  margin-bottom: 8px;
}
.vinculo-resumo-linha { margin: 0 0 4px; text-align: left; font-size: 1rem; }
.vinculo-resumo-rotulo {
  color: var(--texto-suave);
  font-size: .78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-right: 6px;
}
.vinculo-resumo-extra { color: var(--texto); }
.vinculo-resumo-auto { margin: 10px 0 0; font-size: .82rem; color: var(--texto-suave); text-align: left; }
.vinculo-resumo .linha-check { margin: 10px 0 0; background: white; }

form.formulario .linha3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 18px; }
@media (max-width: 620px) {
  form.formulario .linha3 { grid-template-columns: 1fr; }
}

/* ---------- abertura da página inicial ---------- */
html.abertura-aberta { overflow: hidden; }

.abertura {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(120% 90% at 50% 12%, #2a1c10 0%, #17120d 55%, #0b0806 100%);
  animation: abertura-entra .5s ease both;
}
.abertura.saindo { animation: abertura-sai .7s ease forwards; }

@keyframes abertura-entra { from { opacity: 0; } to { opacity: 1; } }
@keyframes abertura-sai   { to { opacity: 0; visibility: hidden; } }

.abertura-palco { text-align: center; max-width: 560px; }

/* --- o brasão --- */
.abertura-brasao {
  position: relative;
  display: inline-block;
  animation: brasao-chega 1.4s cubic-bezier(.16,.9,.3,1) both,
             brasao-flutua 5s ease-in-out 1.4s infinite;
}
.abertura-brasao img {
  display: block;
  height: min(46vh, 340px);
  width: auto;
  filter: drop-shadow(0 18px 34px rgba(0,0,0,.75));
}

@keyframes brasao-chega {
  from { opacity: 0; transform: scale(.72) translateY(26px) rotate(-4deg); }
  to   { opacity: 1; transform: scale(1)   translateY(0)    rotate(0); }
}
@keyframes brasao-flutua {
  0%, 100% { transform: translateY(0)    scale(1); }
  50%      { transform: translateY(-12px) scale(1.015); }
}

/* brilho que varre o brasão — recortado pela própria silhueta, para não
   aparecer um retângulo claro por cima do fundo transparente */
.abertura-brilho {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(105deg,
      transparent 38%, rgba(255,255,255,.78) 50%, transparent 62%);
  background-size: 260% 100%;
  background-repeat: no-repeat;
  -webkit-mask-image: url('brasao.png');
          mask-image: url('brasao.png');
  -webkit-mask-size: contain; mask-size: contain;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-position: center; mask-position: center;
  animation: brasao-brilho 3.6s ease-in-out 1.6s infinite;
}
@keyframes brasao-brilho {
  0%       { background-position: 190% 0; }
  55%,100% { background-position: -90% 0; }
}

/* --- textos --- */
.abertura-nome {
  font-family: 'Cinzel', Georgia, serif;
  color: #f6e3c0;
  font-size: clamp(1.3rem, 4.2vw, 2.1rem);
  margin: 26px 0 6px;
  letter-spacing: .04em;
  text-align: center;
  animation: sobe .9s ease .7s both;
}
.abertura-linha {
  color: #bda880;
  font-size: .92rem;
  margin: 0;
  text-align: center;
  animation: sobe .9s ease .95s both;
}
@keyframes sobe {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* --- botão de pular --- */
.abertura-contador {
  margin: 22px 0 0;
  color: #bda880;
  font-size: .88rem;
  text-align: center;
  animation: sobe .9s ease 1.1s both;
}
.abertura-contador strong { color: #f6e3c0; font-size: 1.15rem; font-weight: 700; }
.abertura-contador span { opacity: .7; font-size: .82rem; }

.abertura-entrar {
  display: inline-block;
  text-decoration: none;
  margin-top: 24px;
  background: linear-gradient(135deg, var(--marrom), var(--marrom-claro));
  color: #fff;
  border: 0;
  border-radius: 999px;
  padding: 14px 46px;
  font-size: 1.02rem;
  font-weight: 700;
  font-family: inherit;
  letter-spacing: .03em;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(217,102,26,.42);
  transition: transform .15s, box-shadow .15s, filter .15s;
  animation: sobe .9s ease 1.2s both, entrar-pulsa 2.8s ease-in-out 2.4s infinite;
}
.abertura-entrar:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(217,102,26,.55); filter: brightness(1.06); }
.abertura-entrar:focus-visible { outline: 3px solid #f6e3c0; outline-offset: 3px; }
@keyframes entrar-pulsa {
  0%, 100% { box-shadow: 0 8px 22px rgba(217,102,26,.42); }
  50%      { box-shadow: 0 8px 30px rgba(217,102,26,.72); }
}

/* quem pediu menos movimento no sistema recebe a abertura parada */
.abertura.sem-animacao .abertura-brasao,
.abertura.sem-animacao .abertura-brilho,
.abertura.sem-animacao .abertura-nome,
.abertura.sem-animacao .abertura-linha,
.abertura.sem-animacao .abertura-entrar { animation: none; opacity: 1; transform: none; }

@media (max-width: 480px) {
  .abertura-brasao img { height: min(38vh, 250px); }
}

/* créditos no rodapé da abertura */
.abertura-creditos {
  margin-top: 26px;
  animation: sobe .9s ease 1.5s both;
}
.abertura-creditos-titulo {
  display: block;
  color: #8d7c60;
  font-size: .76rem;
  letter-spacing: .02em;
}
.abertura-contatos {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 20px;
  margin-top: 8px;
}
.abertura-contatos a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #bda880;
  font-size: .8rem;
  text-decoration: none;
  padding: 4px 2px;
  border-bottom: 1px solid transparent;
  transition: color .15s, border-color .15s;
}
.abertura-contatos a:hover { color: #f0904a; border-bottom-color: rgba(240,144,74,.5); }
.abertura-contatos svg { width: 15px; height: 15px; fill: currentColor; flex: none; }

@media (max-width: 420px) {
  .abertura-contatos { flex-direction: column; gap: 6px; }
}

/* ------------------------------------------------------------------
   Documentos na ficha da pessoa (fontes do FamilySearch)
   ------------------------------------------------------------------ */

.documentos {
  margin: 2.4rem 0 1.6rem;
}

.documentos h2 {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin: 0 0 .35rem;
  font-size: 1.25rem;
}

.documentos h2 .contagem {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.9rem;
  padding: .1rem .5rem;
  border-radius: 999px;
  background: var(--marrom);
  color: #fff;
  font-size: .78rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.documentos-nota {
  max-width: var(--largura-leitura);
  margin: 0 0 1.1rem;
  color: var(--texto-suave);
  font-size: .9rem;
  line-height: 1.5;
}

.lista-documentos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: .85rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.lista-documentos li {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  padding: .85rem .95rem;
  border: 1px solid var(--borda);
  border-left: 3px solid var(--dourado);
  border-radius: 6px;
  background: var(--creme);
}

.doc-topo {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .6rem;
}

.doc-tipo {
  text-transform: uppercase;
  letter-spacing: .06em;
  font-size: .7rem;
  font-weight: 700;
  color: var(--marrom);
}

.doc-data {
  font-size: .8rem;
  color: var(--texto-suave);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.doc-nome {
  font-weight: 600;
  line-height: 1.3;
}

.doc-local,
.doc-colecao {
  font-size: .8rem;
  color: var(--texto-suave);
  line-height: 1.35;
}

.doc-colecao {
  font-style: italic;
}

.doc-link {
  margin-top: .25rem;
  font-size: .82rem;
  font-weight: 600;
}

@media (max-width: 520px) {
  .lista-documentos { grid-template-columns: 1fr; }
}

.script-colheita {
  width: 100%;
  padding: .9rem 1rem;
  border: 1px solid var(--borda);
  border-radius: 6px;
  background: var(--marrom-escuro);
  color: #f4efe4;
  font-family: ui-monospace, "SFMono-Regular", "Cascadia Mono", Menlo, Consolas, monospace;
  font-size: .78rem;
  line-height: 1.45;
  white-space: pre;
  overflow: auto;
  resize: vertical;
}

.passos {
  max-width: var(--largura-leitura);
  line-height: 1.6;
}

.passos kbd {
  padding: .05rem .35rem;
  border: 1px solid var(--borda);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--bege-claro);
  font-family: inherit;
  font-size: .85em;
}

/* O corpo do site é justificado; nos cartões estreitos isso abre rios de
   espaço no meio das linhas. */
.lista-documentos li,
.lista-documentos li * {
  text-align: left;
  hyphens: auto;
}

/* Rótulos da ficha são curtos; justificados eles abrem buracos ao quebrar. */
.ficha dt { text-align: left; }
