/* ==========================================================================
   BiographyPoints Family & History Theme - Interactive Family Tree Engine
   Directly matching official Screenshot 2: Orthogonal Elbow Tree Layout
   ========================================================================== */

.bpt-tree-wrapper {
	position: relative;
	width: 100%;
	background: #ffffff;
	border: 1px solid var(--bpt-border-subtle);
	border-radius: var(--bpt-radius-lg);
	box-shadow: 0 4px 20px rgba(11, 21, 53, 0.05);
	overflow: hidden;
	margin-top: 24px;
	margin-bottom: 40px;
}

/* Tree Top Header & Toolbar (Floating Screenshot 2 style) */
.bpt-tree-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 16px 24px;
	border-bottom: 1px solid var(--bpt-border-subtle);
	background: #ffffff;
	flex-wrap: wrap;
	gap: 16px;
	z-index: 10;
	position: relative;
}

.bpt-tree-title {
	font-family: var(--bpt-font-heading);
	font-size: 1.25rem;
	font-weight: 700;
	margin: 0;
	color: var(--bpt-primary-navy);
	display: flex;
	align-items: center;
	gap: 8px;
}

/* Floating Controls (Screenshot 2: Top Right Toolbar) */
.bpt-tree-toolbar {
	display: flex;
	align-items: center;
	gap: 10px;
}

.bpt-tree-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	height: 38px;
	padding: 0 14px;
	border-radius: var(--bpt-radius-sm);
	background: #ffffff;
	border: 1.5px solid #cbd5e1;
	color: var(--bpt-primary-navy);
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.2s ease;
	user-select: none;
}

.bpt-tree-btn:hover {
	background: #f8fafc;
	border-color: var(--bpt-primary-navy);
}

.bpt-tree-btn:active {
	transform: scale(0.97);
}

/* Reset Button is a sleek black pill (from Screenshot 2) */
.bpt-btn-reset-pill {
	background: #0b1535 !important;
	color: #ffffff !important;
	border: 1.5px solid #0b1535 !important;
	border-radius: 999px !important;
	padding: 0 18px !important;
}

.bpt-btn-reset-pill:hover {
	background: #1e293b !important;
	border-color: #1e293b !important;
}

.bpt-gen-select {
	height: 38px;
	padding: 0 12px;
	border-radius: var(--bpt-radius-sm);
	border: 1.5px solid #cbd5e1;
	background: #ffffff;
	font-size: 0.88rem;
	font-weight: 600;
	color: var(--bpt-primary-navy);
	cursor: pointer;
}

/* Tree Viewport (Infinite pan canvas with subtle dot grid) */
.bpt-tree-viewport {
	width: 100%;
	height: 720px;
	position: relative;
	overflow: hidden;
	background-color: #f8fafc;
	background-image: radial-gradient(#cbd5e1 1.2px, transparent 1.2px);
	background-size: 24px 24px;
	cursor: grab;
	user-select: none;
	touch-action: none;
}

.bpt-tree-viewport.is-dragging {
	cursor: grabbing;
}

.bpt-tree-stage {
	position: absolute;
	top: 0;
	left: 0;
	transform-origin: 0 0;
	will-change: transform;
	padding: 60px 80px 120px;
	min-width: 1600px;
}

/* Generation Levels Container */
.bpt-tree-hierarchy-wrap {
	display: flex;
	flex-direction: column;
	align-items: center;
	position: relative;
	width: 100%;
}

.bpt-generation-level {
	display: flex;
	justify-content: center;
	align-items: flex-start;
	position: relative;
	margin-bottom: 90px;
	width: 100%;
}

.bpt-generation-level:last-child {
	margin-bottom: 20px;
}

/* Node Card (Vertical white card matching Screenshot 2) */
.bpt-tree-node-card {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	width: 200px;
	background: #ffffff;
	border: 1.5px solid #e2e8f0;
	border-radius: 12px;
	padding: 18px 14px 16px;
	box-shadow: 0 4px 12px rgba(11, 21, 53, 0.06);
	transition: all 0.25s ease;
	cursor: pointer;
	position: relative;
	z-index: 3;
}

.bpt-tree-node-card:hover {
	transform: translateY(-4px);
	box-shadow: 0 8px 24px rgba(11, 21, 53, 0.12);
	border-color: var(--bpt-secondary-green);
}

.bpt-tree-node-card.is-focus-subject {
	border-color: var(--bpt-secondary-green);
	border-width: 2px;
	box-shadow: 0 0 0 4px rgba(13, 102, 85, 0.15), 0 8px 24px rgba(11, 21, 53, 0.08);
}

/* Junction Branch Point Indicator (Blue circle '<' on top of card from Screenshot 2) */
.bpt-branch-indicator {
	position: absolute;
	top: -12px;
	left: 50%;
	transform: translateX(-50%);
	width: 22px;
	height: 22px;
	border-radius: 50%;
	background: #2563eb;
	color: #ffffff;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 11px;
	font-weight: 700;
	box-shadow: 0 2px 5px rgba(37, 99, 235, 0.35);
	z-index: 4;
}

/* Top Portrait */
.bpt-node-portrait-wrap {
	margin-bottom: 10px;
	position: relative;
}

.bpt-node-avatar-circle {
	width: 62px;
	height: 62px;
	border-radius: 50%;
	object-fit: cover;
	border: 3px solid #ffffff;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
	display: block;
}

.bpt-node-avatar-fallback-circle {
	width: 62px;
	height: 62px;
	border-radius: 50%;
	background: var(--bpt-primary-navy);
	color: #ffffff;
	display: flex;
	align-items: center;
	justify-content: center;
	font-family: var(--bpt-font-heading);
	font-size: 18px;
	font-weight: 700;
	border: 3px solid #ffffff;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

/* Node Text Info */
.bpt-node-name-label {
	font-family: var(--bpt-font-heading);
	font-size: 0.98rem;
	font-weight: 700;
	color: var(--bpt-primary-navy);
	margin-bottom: 4px;
	line-height: 1.25;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.bpt-node-lifespan-label {
	font-size: 0.82rem;
	color: #64748b;
	font-weight: 500;
}

.bpt-node-rel-role {
	display: inline-block;
	margin-top: 6px;
	font-size: 0.72rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	padding: 2px 8px;
	border-radius: 4px;
	background: #f1f5f9;
	color: #475569;
}

/* Spouses Cluster (Brooklyn in center with Jenny on left and Laura on right) */
.bpt-spouses-row {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 40px;
	position: relative;
}

.bpt-spouse-connector-heart {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	border-radius: 50%;
	background: #fee2e2;
	color: var(--bpt-accent-pink);
	border: 1.5px solid #fecaca;
	font-size: 14px;
	font-weight: 700;
	box-shadow: 0 2px 6px rgba(230, 41, 104, 0.25);
	position: relative;
	z-index: 3;
}

/* Children Row */
.bpt-children-row {
	display: flex;
	justify-content: center;
	align-items: flex-start;
	gap: 36px;
	position: relative;
	flex-wrap: nowrap;
}

/* SVG Orthogonal Lines Layer */
.bpt-tree-svg-layer {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
	z-index: 2;
}

.bpt-tree-orthogonal-line {
	fill: none;
	stroke: #cbd5e1;
	stroke-width: 2px;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.bpt-tree-orthogonal-line.spouse-line {
	stroke: #cbd5e1;
	stroke-width: 2px;
}

/* Node Quickview Modal Card */
.bpt-node-quickview {
	position: absolute;
	bottom: 24px;
	left: 24px;
	background: #ffffff;
	border: 1px solid var(--bpt-border-subtle);
	border-radius: var(--bpt-radius-md);
	box-shadow: 0 10px 30px rgba(11, 21, 53, 0.15);
	padding: 20px 24px;
	max-width: 360px;
	z-index: 100;
	display: none;
	animation: bptFadeUp 0.2s ease;
}

.bpt-node-quickview.active {
	display: block;
}

@keyframes bptFadeUp {
	from { opacity: 0; transform: translateY(10px); }
	to { opacity: 1; transform: translateY(0); }
}

.bpt-qv-close {
	position: absolute;
	top: 12px;
	right: 12px;
	background: none;
	border: none;
	font-size: 20px;
	line-height: 1;
	color: #94a3b8;
	cursor: pointer;
}

.bpt-qv-close:hover {
	color: #0b1535;
}

.bpt-qv-name {
	font-family: var(--bpt-font-heading);
	font-size: 1.15rem;
	font-weight: 700;
	color: var(--bpt-primary-navy);
	margin: 0 0 4px;
}

.bpt-qv-dates {
	font-size: 0.84rem;
	color: #64748b;
	margin-bottom: 10px;
}

.bpt-qv-bio {
	font-size: 0.88rem;
	line-height: 1.5;
	color: #334155;
	margin-bottom: 14px;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

/* Accessible View */
.bpt-accessible-tree-wrapper {
	display: none;
	padding: 30px;
	background: #ffffff;
	border-top: 1px solid #e2e8f0;
}

.bpt-accessible-tree-wrapper.active {
	display: block;
}

.bpt-accessible-tree ul {
	list-style: none;
	padding-left: 24px;
	margin: 10px 0;
}

.bpt-accessible-tree li {
	position: relative;
	padding: 6px 0;
	font-size: 0.95rem;
}

.bpt-accessible-tree li::before {
	content: '├── ';
	color: #94a3b8;
	font-family: monospace;
}

.bpt-accessible-tree a {
	font-weight: 600;
	color: var(--bpt-primary-navy);
	text-decoration: none;
}

.bpt-accessible-tree a:hover {
	color: var(--bpt-secondary-green);
	text-decoration: underline;
}
