/* Arbre familial – affichage public */
.af-app {
	--af-accent: #dd3333;
	--af-ink: #2a2622;
	--af-muted: #7d756c;
	--af-line: #cfc6bb;
	--af-paper: #f8f5f0;
	--af-card: #ffffff;
	--af-border: #e6dfd6;
	--af-m: #4a7fb5;
	--af-m-soft: #e7eff8;
	--af-f: #c4577f;
	--af-f-soft: #f8e9ef;
	--af-u: #9a948c;
	--af-u-soft: #efedea;
	--af-radius: 12px;
	--af-chart-h: 620px;
	color: var(--af-ink);
	font-size: 15px;
	line-height: 1.5;
	margin: 0 0 40px;
	text-align: left;
}
.af-app *, .af-app *::before, .af-app *::after { box-sizing: border-box; }
.af-app a { text-decoration: none; }
.af-app button { font: inherit; cursor: pointer; }
.af-app ul, .af-app ol { list-style: none; margin: 0; padding: 0; }
.af-app li { margin: 0; padding: 0; list-style: none; }
.af-hidden { display: none !important; }
.af-muted { color: var(--af-muted); }

.af-loading, .af-error, .af-empty { padding: 60px 20px; text-align: center; color: var(--af-muted); background: var(--af-paper); border-radius: var(--af-radius); }
.af-error { color: #a32323; }
.af-spinner { display: inline-block; width: 18px; height: 18px; margin-right: 10px; vertical-align: -3px; border: 2px solid var(--af-line); border-top-color: var(--af-accent); border-radius: 50%; animation: af-spin .8s linear infinite; }
@keyframes af-spin { to { transform: rotate(360deg); } }

/* En-tête */
.af-top { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px 24px; margin-bottom: 14px; }
.af-title { font-size: 28px; line-height: 1.2; font-weight: 300; letter-spacing: .01em; color: var(--af-ink); }
.af-sub { font-size: 13px; color: var(--af-muted); margin-top: 2px; }
.af-desc { color: var(--af-muted); margin: -4px 0 14px; max-width: 760px; }
.af-desc p { margin: 0 0 6px; }

.af-search { position: relative; width: 320px; max-width: 100%; }
.af-app input[type=search] {
	width: 100%; height: 40px; margin: 0; padding: 0 14px 0 38px; font: inherit; font-size: 14px; color: var(--af-ink);
	background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%237d756c' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='7' cy='7' r='5'/%3E%3Cpath d='M11 11l3.5 3.5'/%3E%3C/svg%3E") no-repeat 13px 50%;
	border: 1px solid var(--af-border); border-radius: 999px; box-shadow: none; outline: none; -webkit-appearance: none; appearance: none;
	transition: border-color .2s, box-shadow .2s;
}
.af-app input[type=search]:focus { border-color: var(--af-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--af-accent) 15%, transparent); }
.af-results { position: absolute; z-index: 50; top: calc(100% + 6px); left: 0; right: 0; display: none; max-height: 360px; overflow-y: auto; background: #fff; border: 1px solid var(--af-border); border-radius: 10px; box-shadow: 0 12px 32px rgba(40, 30, 20, .14); padding: 6px; }
.af-results.af-open { display: block; }
.af-result { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 6px; color: var(--af-ink) !important; }
.af-result small { margin-left: auto; color: var(--af-muted); white-space: nowrap; }
.af-result:hover, .af-result.af-sel { background: var(--af-paper); }
.af-noresult { padding: 10px; color: var(--af-muted); }

/* Onglets */
.af-tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--af-border); margin-bottom: 18px; }
.af-tabs a { padding: 10px 16px; margin-bottom: -1px; font-size: 14px; font-weight: 600; color: var(--af-muted) !important; border-bottom: 2px solid transparent; transition: color .2s, border-color .2s; }
.af-tabs a:hover { color: var(--af-ink) !important; }
.af-tabs a.af-active { color: var(--af-ink) !important; border-bottom-color: var(--af-accent); }

/* Pastilles de sexe */
.af-dot { display: inline-block; flex-shrink: 0; width: 8px; height: 8px; border-radius: 50%; background: var(--af-u); }
.af-m .af-dot { background: var(--af-m); }
.af-f .af-dot { background: var(--af-f); }

/* Fil d'Ariane (retour à la personne de départ) */
.af-trail { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: -6px 0 12px; font-size: 14px; color: var(--af-muted); }
.af-trail a { color: var(--af-ink) !important; border-bottom: 1px dotted var(--af-line); }
.af-trail a:hover { color: var(--af-accent) !important; border-bottom-color: var(--af-accent); }
.af-trail-home { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.af-trail-sep { color: var(--af-line); }
.af-trail-cur { font-weight: 600; color: var(--af-ink); }
.af-trail .af-trail-reset { margin-left: auto; padding: 5px 14px; font-size: 13px; font-weight: 600; color: #fff !important; background: var(--af-accent); border: 0; border-radius: 999px; }
.af-trail .af-trail-reset:hover { color: #fff !important; opacity: .9; }
.af-home-ico { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }

/* ------------------------------------------------------------ Graphique */
.af-chart { position: relative; background: var(--af-paper); border: 1px solid var(--af-border); border-radius: var(--af-radius); overflow: hidden; }
.af-toolbar { position: absolute; z-index: 5; top: 10px; left: 10px; right: 10px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; pointer-events: none; }
.af-toolbar > * { pointer-events: auto; }
.af-spacer { flex: 1; pointer-events: none; }
.af-stepper, .af-tool { display: inline-flex; align-items: center; height: 34px; background: rgba(255, 255, 255, .92); border: 1px solid var(--af-border); border-radius: 999px; box-shadow: 0 2px 8px rgba(40, 30, 20, .06); backdrop-filter: blur(6px); }
.af-stepper span { padding: 0 4px 0 14px; font-size: 13px; color: var(--af-muted); }
.af-stepper b { min-width: 18px; text-align: center; font-size: 14px; }
.af-stepper button, .af-tool { width: 34px; height: 34px; padding: 0; margin: 0; justify-content: center; border: 0; background: transparent; color: var(--af-ink); font-size: 18px; line-height: 1; border-radius: 50%; box-shadow: none; }
.af-tool { border: 1px solid var(--af-border); background: rgba(255, 255, 255, .92); font-size: 17px; }
.af-stepper button:hover, .af-tool:hover { color: var(--af-accent); }

.af-viewport { position: relative; height: min(var(--af-chart-h), 75vh); min-height: 320px; overflow: hidden; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none;
	background-image: radial-gradient(circle, rgba(120, 100, 80, .13) 1px, transparent 1.2px); background-size: 22px 22px; }
.af-viewport.af-grabbing { cursor: grabbing; }
.af-stage { position: absolute; left: 0; top: 0; transform-origin: 0 0; transition: transform .55s cubic-bezier(.2, .75, .25, 1); will-change: transform; }
.af-stage.af-noanim, .af-stage.af-noanim .af-card { transition: none !important; }
.af-hint { position: absolute; left: 0; right: 0; bottom: 8px; text-align: center; font-size: 12px; color: var(--af-muted); pointer-events: none; opacity: .8; }

.af-links { position: absolute; left: 0; top: 0; overflow: visible; }
.af-links .af-line { fill: none; stroke: var(--af-line); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.af-links .af-far { fill: none; stroke: var(--af-line); stroke-width: 2; stroke-dasharray: 5 5; }
.af-links.af-hide { opacity: 0; }
.af-links.af-fade { animation: af-fade .5s ease .25s both; }
@keyframes af-fade { from { opacity: 0; } to { opacity: 1; } }
.af-ring circle { fill: none; stroke: var(--af-accent); stroke-width: 1.6; }
.af-ring .af-ring-bg { fill: var(--af-paper); stroke: none; }
.af-ring text { font-size: 11px; fill: var(--af-muted); text-anchor: middle; font-family: inherit; }

.af-cards { position: absolute; left: 0; top: 0; }
.af-card {
	position: absolute; left: 0; top: 0; width: 176px; height: 66px; display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 12px;
	background: var(--af-card); border: 1px solid var(--af-border); border-left: 4px solid var(--af-u); border-radius: 10px;
	box-shadow: 0 1px 2px rgba(40, 30, 20, .06), 0 4px 14px rgba(40, 30, 20, .06);
	color: var(--af-ink) !important; overflow: visible;
	transition: transform .55s cubic-bezier(.2, .75, .25, 1), opacity .35s ease, box-shadow .2s, border-color .2s;
	-webkit-user-drag: none;
}
.af-card.af-m { border-left-color: var(--af-m); }
.af-card.af-f { border-left-color: var(--af-f); }
.af-card:hover { box-shadow: 0 2px 4px rgba(40, 30, 20, .08), 0 10px 24px rgba(40, 30, 20, .12); border-color: #d4cabe; }
.af-card.af-m:hover { border-left-color: var(--af-m); }
.af-card.af-f:hover { border-left-color: var(--af-f); }
.af-card.af-enter, .af-card.af-leave { opacity: 0; }
.af-card.af-leave { pointer-events: none; }
.af-card.af-role-focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--af-accent) 35%, transparent), 0 10px 26px rgba(40, 30, 20, .16); }
.af-card.af-role-spouse { background: #fffdfa; }

.af-avatar { flex-shrink: 0; width: 40px; height: 40px; border-radius: 50%; overflow: hidden; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 600; letter-spacing: .02em; background: var(--af-u-soft); color: var(--af-u); }
.af-m .af-avatar { background: var(--af-m-soft); color: var(--af-m); }
.af-f .af-avatar { background: var(--af-f-soft); color: var(--af-f); }
.af-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.af-card-text { min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.af-card-given, .af-card-surname { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.af-card-surname { font-weight: 700; font-size: 13.5px; }
.af-card-years { font-size: 12px; color: var(--af-muted); margin-top: 2px; }
.af-more { position: absolute; left: 50%; width: 20px; height: 14px; margin-left: -10px; font-size: 8px; line-height: 14px; text-align: center; color: var(--af-muted); background: var(--af-paper); border: 1px solid var(--af-border); border-radius: 7px; }
.af-more-up { top: -8px; }
.af-more-down { bottom: -8px; }

/* Plein écran */
.af-chart.af-full { position: fixed; inset: 0; z-index: 100000; border-radius: 0; border: 0; }
.af-chart.af-full .af-viewport { height: 100vh; max-height: none; }
html.af-noscroll, html.af-noscroll body { overflow: hidden !important; }
.admin-bar .af-chart.af-full { top: 32px; }

/* ------------------------------------------------------------ Fiche */
.af-fiche { margin-top: 22px; padding: 26px; background: #fff; border: 1px solid var(--af-border); border-radius: var(--af-radius); }
.af-fiche-head { display: flex; align-items: center; gap: 20px; padding-bottom: 20px; margin-bottom: 20px; border-bottom: 1px solid var(--af-border); }
.af-portrait { flex-shrink: 0; width: 88px; height: 88px; border-radius: 50%; overflow: hidden; display: flex; align-items: center; justify-content: center; background: var(--af-u-soft); }
.af-portrait img { width: 100%; height: 100%; object-fit: cover; }
.af-portrait-ini { font-size: 30px; font-weight: 300; color: var(--af-u); }
.af-portrait-ini.af-m { background: var(--af-m-soft); color: var(--af-m); }
.af-portrait-ini.af-f { background: var(--af-f-soft); color: var(--af-f); }
.af-fiche-id { flex: 1; min-width: 0; }
.af-fiche-name { font-size: 26px; line-height: 1.2; font-weight: 300; color: var(--af-ink); }
.af-fiche-name strong { font-weight: 700; }
.af-life { margin-top: 6px; color: var(--af-muted); font-size: 14px; }
.af-age { white-space: nowrap; }
.af-edit, .af-button { flex-shrink: 0; display: inline-block; padding: 8px 16px; font-size: 13px; font-weight: 600; color: var(--af-accent) !important; border: 1px solid currentColor; border-radius: 999px; transition: background .2s, color .2s; }
.af-edit:hover, .af-button:hover { background: var(--af-accent); color: #fff !important; }

.af-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 30px; }
.af-block + .af-block { margin-top: 24px; }
.af-h { margin: 0 0 10px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--af-muted); }
.af-h2 { margin-top: 14px; }
.af-n { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 4px; font-size: 11px; line-height: 18px; text-align: center; letter-spacing: 0; color: var(--af-muted); background: var(--af-paper); border-radius: 9px; }

.af-timeline { position: relative; padding-left: 18px !important; }
.af-timeline::before { content: ""; position: absolute; left: 4px; top: 8px; bottom: 8px; width: 2px; background: var(--af-border); }
.af-timeline li { position: relative; display: flex; gap: 14px; padding: 7px 0; }
.af-timeline li::before { content: ""; position: absolute; left: -18px; top: 14px; width: 10px; height: 10px; border-radius: 50%; background: #fff; border: 2px solid var(--af-line); }
.af-timeline li.af-ev-birth::before { border-color: var(--af-m); background: var(--af-m); }
.af-timeline li.af-ev-marr::before { border-color: var(--af-accent); background: var(--af-accent); }
.af-timeline li.af-ev-death::before { border-color: var(--af-ink); background: var(--af-ink); }
.af-ev-date { flex-shrink: 0; width: 92px; font-size: 13px; color: var(--af-muted); padding-top: 1px; font-variant-numeric: tabular-nums; }
.af-ev-body { display: flex; flex-direction: column; min-width: 0; }
.af-ev-type { font-weight: 600; }
.af-ev-type a { color: inherit; border-bottom: 1px dotted var(--af-line); }
.af-ev-place, .af-ev-desc { font-size: 14px; color: var(--af-muted); }
.af-ev-desc { white-space: pre-line; }

.af-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.af-chip { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 7px 12px; background: #fff; border: 1px solid var(--af-border); border-radius: 999px; color: var(--af-ink) !important; font-size: 14px; transition: border-color .2s, box-shadow .2s; }
.af-chip:hover { border-color: #cbbfb2; box-shadow: 0 3px 10px rgba(40, 30, 20, .08); }
.af-chip small { color: var(--af-muted); font-size: 12px; white-space: nowrap; }
.af-chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.af-unknown { color: var(--af-muted) !important; border-style: dashed; }
.af-union-block { padding: 14px 16px; background: var(--af-paper); border-radius: 10px; }
.af-marr { margin-top: 10px; font-size: 14px; color: var(--af-muted); display: flex; align-items: center; gap: 8px; }
.af-link-small { display: inline-block; margin-top: 10px; font-size: 13px; color: var(--af-accent) !important; }
.af-notes-body { color: var(--af-ink); font-size: 14.5px; }
.af-notes-body p { margin: 0 0 10px; }

/* Petites alliances (⚭) dessinées en CSS */
.af-ring-ico { position: relative; display: inline-block; flex-shrink: 0; width: 20px; height: 12px; }
.af-ring-ico::before, .af-ring-ico::after { content: ""; position: absolute; top: 1px; width: 10px; height: 10px; border: 1.6px solid var(--af-accent); border-radius: 50%; }
.af-ring-ico::before { left: 2px; }
.af-ring-ico::after { left: 8px; }

/* ------------------------------------------------------------ Listes */
.af-list-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 14px; }
.af-list-head .af-filter { flex: 1; min-width: 220px; max-width: 420px; }
.af-scope { display: inline-flex; padding: 3px; background: var(--af-paper); border: 1px solid var(--af-border); border-radius: 999px; }
.af-scope button { margin: 0; padding: 6px 14px; border: 0; border-radius: 999px; background: transparent; color: var(--af-muted); font-size: 13px; font-weight: 600; box-shadow: none; }
.af-scope button.af-on { background: #fff; color: var(--af-ink); box-shadow: 0 1px 4px rgba(40, 30, 20, .1); }

.af-letters { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 16px; }
.af-letters button { width: 32px; height: 32px; margin: 0; padding: 0; border: 1px solid var(--af-border); border-radius: 8px; background: #fff; color: var(--af-ink); font-size: 13px; font-weight: 600; box-shadow: none; }
.af-letters button:hover { border-color: var(--af-accent); color: var(--af-accent); }

.af-groups { columns: 2 360px; column-gap: 28px; }
.af-group { break-inside: avoid; margin-bottom: 18px; }
.af-group-h { padding: 6px 0; margin-bottom: 4px; font-size: 16px; font-weight: 700; border-bottom: 2px solid var(--af-border); }
.af-group ul a { display: grid; grid-template-columns: 8px minmax(0, 1fr) auto; grid-template-rows: auto auto; column-gap: 10px; align-items: center; padding: 6px 8px; margin: 0 -8px; border-radius: 6px; color: var(--af-ink) !important; }
.af-group ul a:hover { background: var(--af-paper); }
.af-li-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.af-li-years { font-size: 13px; color: var(--af-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.af-li-place { grid-column: 2 / 4; font-size: 12.5px; color: var(--af-muted); }
.af-li-place:empty { display: none; }

.af-fam-list { border: 1px solid var(--af-border); border-radius: var(--af-radius); overflow: hidden; background: #fff; }
.af-fam-row { display: grid; grid-template-columns: minmax(0, 1fr) 260px 90px; gap: 14px; align-items: center; padding: 11px 16px; border-top: 1px solid var(--af-border); color: var(--af-ink) !important; }
.af-fam-row:first-child { border-top: 0; }
.af-fam-row:hover { background: var(--af-paper); }
.af-fam-names { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.af-fam-names > span { display: inline-flex; align-items: center; gap: 7px; }
.af-fam-meta, .af-fam-kids { font-size: 13px; color: var(--af-muted); }
.af-fam-kids { text-align: right; }

.af-couple { display: flex; align-items: center; justify-content: center; gap: 26px; flex-wrap: wrap; margin-bottom: 24px; }
.af-partner { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; min-width: 200px; color: var(--af-ink) !important; }
.af-partner .af-fiche-name { font-size: 20px; }
.af-couple-ring { position: relative; width: 44px; height: 26px; }
.af-couple-ring::before, .af-couple-ring::after { content: ""; position: absolute; top: 0; width: 26px; height: 26px; border: 2.5px solid var(--af-accent); border-radius: 50%; }
.af-couple-ring::before { left: 0; }
.af-couple-ring::after { left: 16px; }

/* ------------------------------------------------------------ Statistiques */
.af-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.af-tile { padding: 16px; background: #fff; border: 1px solid var(--af-border); border-radius: var(--af-radius); }
.af-tile b { display: block; font-size: 26px; line-height: 1.15; font-weight: 300; color: var(--af-ink); }
.af-tile span { font-size: 13px; color: var(--af-muted); }
.af-oldest { margin: 0 0 22px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; color: var(--af-muted); }
.af-stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; }
.af-stats-grid .af-block { margin: 0; padding: 18px; background: #fff; border: 1px solid var(--af-border); border-radius: var(--af-radius); }
.af-bars li { display: grid; grid-template-columns: minmax(0, 150px) 1fr 36px; gap: 10px; align-items: center; padding: 4px 0; font-size: 14px; }
.af-bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.af-bar { height: 8px; background: var(--af-paper); border-radius: 4px; overflow: hidden; }
.af-bar span { display: block; height: 100%; background: var(--af-accent); border-radius: 4px; opacity: .85; }
.af-bar-n { text-align: right; color: var(--af-muted); font-size: 13px; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------ Mobile */
@media (max-width: 760px) {
	.af-title { font-size: 23px; }
	.af-search { width: 100%; }
	.af-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
	.af-tabs a { padding: 9px 11px; font-size: 13px; white-space: nowrap; }
	.af-viewport { height: min(var(--af-chart-h), 68vh); }
	.af-toolbar { position: static; flex-wrap: nowrap; gap: 4px; padding: 6px; border-bottom: 1px solid var(--af-border); background: #fff; }
	.af-spacer { display: none; }
	.af-stepper, .af-tool { height: 30px; box-shadow: none; }
	.af-stepper button, .af-tool { width: 28px; height: 28px; font-size: 16px; }
	.af-stepper span { padding: 0 0 0 9px; font-size: 12px; }
	.af-stepper b { min-width: 14px; font-size: 13px; }
	.af-stepper span { font-size: 0; }
	.af-stepper span::before { content: attr(data-short); font-size: 12px; }
	.af-tool[data-z=in], .af-tool[data-z=out] { display: none; }
	.af-hint { display: none; }
	.af-fiche { padding: 18px; }
	.af-fiche-head { flex-wrap: wrap; gap: 14px; }
	.af-portrait { width: 68px; height: 68px; }
	.af-fiche-name { font-size: 22px; }
	.af-grid { grid-template-columns: 1fr; gap: 24px; }
	.af-ev-date { width: 80px; }
	.af-fam-row { grid-template-columns: 1fr; gap: 2px; }
	.af-fam-kids { text-align: left; }
}
