/* JJR Family Tree - Layout: parents top, V connector, children below */
.jjr-family-tree {
	background-color: #fff;
	padding: 1.5rem 1.25rem;
	max-width: 100%;
	overflow-x: auto;
	border: 1px solid rgba(0, 46, 92, 0.08);
	border-radius: 8px;
}

.jjr-family-tree .jjr-ft-tree-actions {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 1rem;
	flex-wrap: wrap;
	margin-bottom: 1.5rem;
}

.jjr-family-tree .jjr-ft-back-link {
	color: var(--color-secondary, #002e5c);
	font-weight: 600;
	text-decoration: none;
}

.jjr-family-tree .jjr-ft-back-link:hover {
	text-decoration: underline;
}

.jjr-family-tree .jjr-ft-branch-title {
	font-size: 1.15rem;
	font-weight: 700;
	color: #333;
}

.jjr-family-tree .jjr-ft-generation-label {
	text-align: center;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: #5b6573;
	margin: 0.7rem 0 0.85rem;
	font-size: 1.5rem;
}

.jjr-family-tree .jjr-ft-parents {
	display: flex;
	justify-content: center;
	align-items: flex-start;
	gap: clamp(1.25rem, 4vw, 3rem);
	margin-bottom: 0.9rem;
	flex-wrap: wrap;
}

.jjr-family-tree .jjr-ft-person {
	text-align: center;
	width: 148px;
	max-width: 100%;
}

.jjr-family-tree .jjr-ft-photo {
	width: 128px;
	height: 128px;
	margin: 0 auto 0.45rem;
	border-radius: 6px;
	overflow: hidden;
	background: #f0f0f0;
	border: 2px solid #d7dde5;
}

.jjr-family-tree .jjr-ft-photo img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.jjr-family-tree .jjr-ft-placeholder {
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 0.8rem;
	color: #888;
	text-align: center;
	padding: 0.5rem;
	line-height: 1.2;
}

.jjr-family-tree .jjr-ft-name {
	color: #333;
	font-weight: 700;
	font-size: 1.5rem;
	line-height: 1.25;
	overflow-wrap: anywhere;
}

.jjr-family-tree .jjr-ft-main-member .jjr-ft-photo {
	border-color: var(--color-secondary, #002e5c);
}

.jjr-family-tree .jjr-ft-second-parent .jjr-ft-photo {
	border-color: rgba(0, 46, 92, 0.35);
}

.jjr-family-tree.jjr-family-tree--empty {
	text-align: center;
	padding: 4rem 2rem;
	border-radius: 20px;
	background: #faf7f2;
}

.jjr-family-tree .jjr-ft-empty-message {
	margin: 0;
	font-size: 1.35rem;
	font-weight: 700;
	color: var(--color-secondary, #002e5c);
}

.jjr-family-tree .jjr-ft-person-link {
	text-decoration: none;
	color: inherit;
	display: block;
}
.jjr-family-tree .jjr-ft-person-link:hover .jjr-ft-photo {
	border-color: var(--color-primary, #f5d000);
}
.jjr-family-tree .jjr-ft-person-link:hover .jjr-ft-name {
	color: var(--color-secondary, #002e5c);
}

.jjr-ft-import-status {
	margin-top: 1rem;
	padding: 1rem 1.25rem;
	border-radius: 10px;
	border: 1px solid #d7d7d7;
	background: #fafafa;
}

.jjr-ft-import-status p {
	margin: 0 0 0.75rem;
}

.jjr-ft-import-status ul {
	margin: 0.25rem 0 0;
	padding-left: 1.25rem;
}

.jjr-ft-status-success {
	background: #edf8f1;
	border-color: #acd6b6;
}

.jjr-ft-status-error {
	background: #fff1f1;
	border-color: #e3b7b7;
}

/* Red V connector - more space above and below */
.jjr-family-tree .jjr-ft-connector {
	width: 0;
	height: 0;
	margin: 0.85rem auto 0.9rem;
	border-left: 30px solid transparent;
	border-right: 30px solid transparent;
	border-top: 22px solid #c41e3a;
}

.jjr-family-tree .jjr-ft-connector-small {
	border-left-width: 28px;
	border-right-width: 28px;
	border-top-width: 22px;
}

/* Children row */
.jjr-family-tree .jjr-ft-children {
	display: flex;
	justify-content: center;
	align-items: flex-start;
	flex-wrap: wrap;
	gap: 1.15rem;
	margin-top: 1rem;
}

.jjr-family-tree .jjr-ft-children .jjr-ft-person {
	width: 126px;
}

.jjr-family-tree .jjr-ft-children .jjr-ft-name {
	font-size: 0.98rem;
}

.jjr-family-tree .jjr-ft-children .jjr-ft-photo {
	width: 104px;
	height: 104px;
}

.jjr-family-tree .jjr-ft-grandparents,
.jjr-family-tree .jjr-ft-grandchildren {
	margin-top: 0.5rem;
}

.jjr-family-tree.jjr-ft-branch-tree .jjr-ft-branch-node {
	margin-bottom: 2.5rem;
}

.jjr-family-tree.jjr-ft-branch-tree .jjr-ft-branch-children {
	margin-top: 2rem;
	padding-top: 1rem;
	border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.jjr-family-tree.jjr-ft-branch-tree .jjr-ft-branch-level-1,
.jjr-family-tree.jjr-ft-branch-tree .jjr-ft-branch-level-2,
.jjr-family-tree.jjr-ft-branch-tree .jjr-ft-branch-level-3 {
	background: #fcfcfc;
	border-radius: 20px;
	padding: 1.5rem 1rem;
}

.jjr-family-tree + p,
.jjr-family-tree + .wp-block-paragraph {
	max-width: 760px;
	margin: 1rem auto 0;
	padding: 0.85rem 1rem;
	border-left: 4px solid var(--color-secondary, #002e5c);
	background: #f4f8fb;
	color: #1f2937;
	font-size: 1.05rem;
	font-weight: 600;
	line-height: 1.45;
}


@media (max-width: 768px) {
	.jjr-family-tree { padding: 1rem 0.75rem; }
	.jjr-family-tree .jjr-ft-parents { gap: 1rem; }
	.jjr-family-tree .jjr-ft-person { width: 132px; }
	.jjr-family-tree .jjr-ft-photo { width: 104px; height: 104px; }
	.jjr-family-tree .jjr-ft-children .jjr-ft-person { width: 112px; }
	.jjr-family-tree .jjr-ft-children .jjr-ft-photo { width: 88px; height: 88px; }
	.jjr-family-tree .jjr-ft-children { gap: 1rem; }
}
