/**
 * Pedigree Atlas — interactive pan/zoom family-tree canvas.
 * Recreation of design_handoff_pedigree_atlas/ layout, recoloured to follow the ACTIVE site
 * theme (variables.css / inc/theme-manager.php) so it matches whichever palette is selected:
 * deep brand canvas (burgundy/footer tones), gold accent, white cards, brand text.
 * Display face: Playfair Display (names); UI face: Jost (labels/switches/badges).
 */

.pedigree-atlas {
	/* Highlights / active state / subject ring / connector-to-subject */
	--atlas-accent: var(--color-gold, #c8a951);
	--atlas-primary: var(--color-burgundy, #550223);
	/* Deep brand canvas backdrop */
	--atlas-canvas-1: var(--color-burgundy, #550223);
	--atlas-canvas-2: var(--color-burgundy-dark, #47011c);
	--atlas-canvas-3: var(--color-footer, #2e0114);
	/* Cards (white, like the rest of the site) */
	--atlas-card: var(--color-card, #fff);
	--atlas-card-border: var(--color-border, #e8e0d8);
	--atlas-ink: var(--color-text, #2a2a2a);
	--atlas-card-muted: var(--color-text-muted, #888);
	--atlas-title: var(--color-burgundy, #550223);
	/* Light text / chrome on the dark canvas + floating panels */
	--atlas-on-dark: color-mix(in srgb, var(--color-footer-text, #c8a8a8) 45%, #fff);
	--atlas-on-dark-muted: var(--color-footer-text, #c8a8a8);
	--atlas-panel: color-mix(in srgb, var(--color-footer, #2e0114) 90%, transparent);
	--atlas-panel-border: color-mix(in srgb, #fff 16%, transparent);
	--atlas-rule: color-mix(in srgb, #fff 14%, transparent);
	/* Connector lines need real luminance contrast on the dark canvas — a translucent light
	   stroke reads far better than the dusty footer-text tone (which vanished, esp. in God View). */
	--atlas-line: color-mix(in srgb, #fff 58%, transparent);
	--atlas-seg-bg: color-mix(in srgb, #000 24%, var(--color-burgundy-dark, #47011c));
	--atlas-surface: color-mix(in srgb, var(--color-burgundy-dark, #47011c) 80%, #000);
	/* Chrome surfaces that were hard-coded to the dark canvas — varname'd so light mode can flip them */
	--atlas-bar-bg: color-mix(in srgb, var(--color-footer, #2e0114) 92%, transparent);
	--atlas-overlay: color-mix(in srgb, var(--color-footer, #2e0114) 55%, rgba(0, 0, 0, 0.55));
	--atlas-track-off: color-mix(in srgb, #fff 18%, transparent);
	--atlas-chrome-hover: color-mix(in srgb, #fff 8%, transparent);

	position: relative;
	color: var(--atlas-on-dark);
	font-family: 'Jost', var(--font-sans, sans-serif);
	background: radial-gradient(1200px 820px at 50% 42%, var(--atlas-canvas-1) 0%, var(--atlas-canvas-2) 58%, var(--atlas-canvas-3) 100%);
	overflow: hidden;
	-webkit-font-smoothing: antialiased;
}
.pedigree-atlas * { box-sizing: border-box; }

/* ── light theme (parchment palette, still site-themed); dark above is the default/original ── */
.pedigree-atlas.atlas-theme-light {
	--atlas-canvas-1: color-mix(in srgb, var(--color-bg, #f5efe9) 92%, #fff);
	--atlas-canvas-2: var(--color-bg, #f5efe9);
	--atlas-canvas-3: color-mix(in srgb, var(--color-bg, #f5efe9) 84%, var(--color-burgundy, #550223));
	--atlas-on-dark: var(--color-burgundy, #550223);
	--atlas-on-dark-muted: color-mix(in srgb, var(--color-burgundy, #550223) 52%, var(--color-bg, #f5efe9));
	--atlas-panel: color-mix(in srgb, var(--color-card, #fff) 90%, transparent);
	--atlas-panel-border: color-mix(in srgb, var(--color-burgundy, #550223) 18%, transparent);
	--atlas-rule: color-mix(in srgb, var(--color-burgundy, #550223) 12%, transparent);
	--atlas-line: color-mix(in srgb, var(--color-burgundy, #550223) 30%, transparent);
	--atlas-seg-bg: color-mix(in srgb, var(--color-burgundy, #550223) 8%, var(--color-card, #fff));
	--atlas-surface: var(--color-card, #fff);
	--atlas-bar-bg: color-mix(in srgb, var(--color-bg, #f5efe9) 88%, transparent);
	--atlas-overlay: color-mix(in srgb, var(--color-bg, #f5efe9) 58%, rgba(0, 0, 0, 0.2));
	--atlas-track-off: color-mix(in srgb, var(--color-burgundy, #550223) 18%, transparent);
	--atlas-chrome-hover: color-mix(in srgb, var(--color-burgundy, #550223) 8%, transparent);
}

.pedigree-atlas--inline {
	height: min(164vh, 1520px);
	min-height: 920px;
	border-radius: 16px;
	border: 1px solid var(--atlas-panel-border);
	box-shadow: 0 14px 40px rgba(0, 0, 0, 0.28);
	margin: 0;
}
/* Inline (dog-edit) Atlas: scale the frame to the displayed pedigree depth (G1–G5) so each tree fits.
   Set by JS (atlas-h-gen1…5 from the effective G selection); ignored by the fullscreen variant.
   Heights are mode-aware: the Horizontal pedigree stacks its deepest generation vertically (2^G cards),
   so the frame grows tall with depth; the Vertical tree grows sideways, so its height stays flatter. */
.pedigree-atlas--inline.atlas-mode-pedigree.atlas-h-gen1 { height: min(72vh, 460px);  min-height: 360px; }
.pedigree-atlas--inline.atlas-mode-pedigree.atlas-h-gen2 { height: min(82vh, 580px);  min-height: 440px; }
.pedigree-atlas--inline.atlas-mode-pedigree.atlas-h-gen3 { height: min(92vh, 720px);  min-height: 520px; }
.pedigree-atlas--inline.atlas-mode-pedigree.atlas-h-gen4 { height: min(128vh, 1080px); min-height: 720px; }
.pedigree-atlas--inline.atlas-mode-pedigree.atlas-h-gen5 { height: min(164vh, 1520px); min-height: 920px; }

.pedigree-atlas--inline.atlas-mode-tree.atlas-h-gen1 { height: min(78vh, 540px); min-height: 400px; }
.pedigree-atlas--inline.atlas-mode-tree.atlas-h-gen2 { height: min(84vh, 620px); min-height: 460px; }
.pedigree-atlas--inline.atlas-mode-tree.atlas-h-gen3 { height: min(90vh, 700px); min-height: 520px; }
.pedigree-atlas--inline.atlas-mode-tree.atlas-h-gen4 { height: min(90vh, 700px); min-height: 520px; }
.pedigree-atlas--inline.atlas-mode-tree.atlas-h-gen5 { height: min(90vh, 700px); min-height: 520px; }
.pedigree-atlas--fullscreen {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	/* iOS: inset:0 / height:100% / 100vh resolve to the LARGER layout viewport (toolbar expanded),
	   so the canvas runs behind the Safari toolbars and fit() centres into hidden space. Dynamic
	   viewport height matches the actually-visible area. 100vh is the fallback for old browsers. */
	height: 100vh;
	height: 100dvh;
	z-index: 9999;
	border-radius: 0;
}
/* Keep the bar + zoom controls clear of the notch / home indicator on iPhone (esp. landscape). */
.pedigree-atlas--fullscreen .atlas-topbar {
	padding-top: max(10px, env(safe-area-inset-top));
	padding-left: max(20px, env(safe-area-inset-left));
	padding-right: max(20px, env(safe-area-inset-right));
}
.pedigree-atlas--fullscreen .atlas-zoom {
	right: max(18px, env(safe-area-inset-right));
	bottom: max(18px, env(safe-area-inset-bottom));
}
.pedigree-atlas--fullscreen .atlas-panel { left: env(safe-area-inset-left); }

.pedigree-atlas .atlas-loading {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--atlas-on-dark-muted);
	font-size: 13px;
	letter-spacing: 1px;
}

/* ── viewport / pannable wrapper ── */
.pedigree-atlas .atlas-viewport {
	position: absolute;
	inset: 0;
	overflow: hidden;
	cursor: grab;
	touch-action: none;          /* we own all touch gestures (pan + pinch-zoom) */
	-webkit-user-select: none;
	user-select: none;
	-webkit-touch-callout: none; /* no iOS long-press menu while dragging */
}
.pedigree-atlas .atlas-viewport.is-grabbing { cursor: grabbing; }
.pedigree-atlas .atlas-wrap {
	position: absolute;
	left: 0;
	top: 0;
	transform-origin: 0 0;
	will-change: transform;
}
.pedigree-atlas .atlas-edges {
	position: absolute;
	left: 0;
	top: 0;
	overflow: visible;
	pointer-events: none;
}

/* ── generation headers (pedigree mode) ── */
.pedigree-atlas .atlas-genhead {
	position: absolute;
	text-align: center;
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 5px;
	color: color-mix(in srgb, var(--atlas-on-dark-muted) 80%, transparent);
}

/* ── node cards (white, theme ink) ── */
.pedigree-atlas .atlas-node { position: absolute; }
.pedigree-atlas .atlas-card {
	width: 100%;
	height: 100%;
	background: var(--atlas-card);
	border: 1px solid var(--atlas-card-border);
	border-radius: 11px;
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.30);
	overflow: hidden;
	display: flex;
	flex-direction: column;
	cursor: pointer;
	color: var(--atlas-ink);
	transition: box-shadow .15s, border-color .15s;
}
.pedigree-atlas .atlas-node--subject .atlas-card {
	border: 2px solid var(--atlas-accent);
	box-shadow: 0 0 0 5px color-mix(in srgb, var(--atlas-accent) 28%, transparent), 0 12px 32px rgba(0, 0, 0, 0.42);
}

/* Empty pedigree slot (dog-edit Atlas) — a dashed "add ancestor" card. */
.pedigree-atlas .atlas-node--empty .atlas-card {
	background: color-mix(in srgb, var(--atlas-card) 55%, transparent);
	border: 1.5px dashed color-mix(in srgb, var(--atlas-card-border) 75%, var(--atlas-ink) 20%);
	box-shadow: none;
	align-items: center;
	justify-content: center;
	gap: 4px;
	color: var(--atlas-card-muted);
	transition: border-color .15s, color .15s, background .15s;
}
.pedigree-atlas .atlas-node--empty .atlas-card:hover {
	border-color: var(--atlas-accent);
	color: var(--atlas-accent);
	background: color-mix(in srgb, var(--atlas-accent) 8%, var(--atlas-card));
}
.pedigree-atlas .atlas-empty-plus { font-size: 26px; line-height: 1; font-weight: 300; }
.pedigree-atlas .atlas-empty-label { font-size: 11px; letter-spacing: .04em; text-transform: uppercase; }
.pedigree-atlas .atlas-node--empty .atlas-sex { opacity: .5; }
.pedigree-atlas .atlas-edit-hint {
	margin: 10px 0 0;
	font-size: 11.5px;
	line-height: 1.4;
	color: var(--atlas-card-muted);
}

/* photo block */
.pedigree-atlas .atlas-photo {
	position: relative;
	height: 104px;
	flex: 0 0 auto;
	overflow: hidden; /* clip the framing zoom (transform:scale on the img) to the 4:3 box, like .profile-photo */
	background: repeating-linear-gradient(45deg,
		var(--color-bg, #f5efe9), var(--color-bg, #f5efe9) 6px,
		color-mix(in srgb, var(--atlas-card-border) 70%, var(--color-bg, #f5efe9)) 6px,
		color-mix(in srgb, var(--atlas-card-border) 70%, var(--color-bg, #f5efe9)) 12px);
}
.pedigree-atlas .atlas-photo-img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	/* Per-dog focal-point framing from the profile (vars set inline on the <img>). */
	object-position: var(--focus, 50% 50%);
	transform: scale(var(--zoom, 1));
	transform-origin: var(--focus, 50% 50%);
}
.pedigree-atlas .atlas-photo-ph { display: none; }
.pedigree-atlas .atlas-avatar {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 48px;
	height: 48px;
	border-radius: 50%;
	background: color-mix(in srgb, var(--atlas-primary) 8%, var(--atlas-card));
	border: 1px solid color-mix(in srgb, var(--atlas-primary) 32%, transparent);
	display: flex;
	align-items: center;
	justify-content: center;
	font-family: 'Playfair Display', var(--font-serif, serif);
	font-size: 16px;
	color: var(--atlas-primary);
}
.pedigree-atlas .atlas-photo-tag {
	position: absolute;
	bottom: 5px;
	left: 0;
	right: 0;
	text-align: center;
	font-family: monospace;
	font-size: 8px;
	letter-spacing: 1.5px;
	color: color-mix(in srgb, var(--atlas-ink) 38%, transparent);
}
.pedigree-atlas .atlas-photo:has(.atlas-photo-img) .atlas-photo-tag { display: none; }
/* Portrait cards: photo area locked to a 4:3 ratio across the full card width. */
.pedigree-atlas .atlas-node--portrait .atlas-photo { height: auto; aspect-ratio: 4 / 3; }

.pedigree-atlas .atlas-sex {
	position: absolute;
	top: 7px;
	right: 7px;
	width: 21px;
	height: 21px;
	border-radius: 50%;
	background: var(--atlas-card);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 12px;
	line-height: 1;
	/* Force plain-text (non-emoji) rendering of ♂/♀ so iOS Safari centres them like desktop. */
	font-variant-emoji: text;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
}
.pedigree-atlas .atlas-sex[data-sex="M"] { color: var(--color-sire-border, #2f6f9b); border: 1px solid var(--color-sire-border, #2f6f9b); }
.pedigree-atlas .atlas-sex[data-sex="F"] { color: var(--color-dam-border, #9b6fb0); border: 1px solid var(--color-dam-border, #9b6fb0); }

/* card body */
.pedigree-atlas .atlas-card-body {
	flex: 1;
	padding: 9px 10px 10px;
	display: flex;
	flex-direction: column;
	gap: 5px;
	align-items: center;
	justify-content: center;
	text-align: center;
	min-height: 0;
}
.pedigree-atlas .atlas-name {
	font-family: 'Playfair Display', var(--font-serif, serif);
	font-size: 13px;
	line-height: 1.18;
	color: var(--atlas-ink);
	text-wrap: pretty;
}
.pedigree-atlas .atlas-titles {
	font-family: 'Jost', var(--font-sans, sans-serif);
	font-size: 9px;
	letter-spacing: 1.6px;
	text-transform: uppercase;
	color: var(--atlas-title);
}
/* Country in "(…)" after the title — same face/size as the title but normal case + spacing and a
   muted tone, so it reads "AU Ch. (Australia)" (not "(AUSTRALIA)") and sits as a secondary detail. */
.pedigree-atlas .atlas-country {
	text-transform: none;
	letter-spacing: 0.2px;
	color: var(--atlas-card-muted);
}

/* ── compact style ── */
.pedigree-atlas .atlas-node--compact .atlas-card {
	flex-direction: row;
	align-items: center;
	gap: 10px;
	padding: 8px 11px;
}
.pedigree-atlas .atlas-avatar--inline {
	position: static;
	transform: none;
	width: 42px;
	height: 42px;
	flex: 0 0 auto;
	overflow: hidden;
	font-family: 'Playfair Display', var(--font-serif, serif);
	font-size: 13px;
}
.pedigree-atlas .atlas-avatar--inline .atlas-photo-img { position: static; border-radius: 50%; }
.pedigree-atlas .atlas-node--compact .atlas-card-body {
	flex: 1;
	min-width: 0;
	align-items: flex-start;
	text-align: left;
	padding: 0;
	gap: 3px;
}
.pedigree-atlas .atlas-node--compact .atlas-name {
	font-size: 12px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: 100%;
}
.pedigree-atlas .atlas-node--compact .atlas-titles {
	font-size: 8px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: 100%;
}
.pedigree-atlas .atlas-node--compact .atlas-sex {
	position: static;
	flex: 0 0 auto;
	width: 19px;
	height: 19px;
	font-size: 11px;
}

/* ── expanded detail card (dark brand surface) ── */
.pedigree-atlas .atlas-detail {
	position: absolute;
	left: 50%;
	transform: translateX(-50%);
	width: 254px;
	background: var(--atlas-surface);
	border: 1px solid var(--atlas-accent);
	border-radius: 13px;
	box-shadow: 0 20px 48px rgba(0, 0, 0, 0.55);
	padding: 15px 15px 13px;
	z-index: 80;
	text-align: left;
	cursor: default;
	color: var(--atlas-on-dark);
}
.pedigree-atlas .atlas-detail-head {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	gap: 10px;
}
.pedigree-atlas .atlas-detail-name {
	display: block;
	font-family: 'Playfair Display', var(--font-serif, serif);
	font-size: 15px;
	line-height: 1.2;
}
.pedigree-atlas .atlas-detail-titles {
	display: block;
	font-size: 9px;
	letter-spacing: 1.8px;
	text-transform: uppercase;
	color: var(--atlas-accent);
	margin-top: 5px;
}
.pedigree-atlas .atlas-detail-close {
	flex: 0 0 auto;
	width: 23px;
	height: 23px;
	border-radius: 50%;
	border: 1px solid var(--atlas-panel-border);
	background: none;
	color: var(--atlas-on-dark-muted);
	cursor: pointer;
	font-size: 14px;
	line-height: 1;
}
.pedigree-atlas .atlas-detail-grid {
	display: grid;
	grid-template-columns: auto 1fr;
	gap: 7px 14px;
	margin-top: 13px;
	font-size: 11px;
}
.pedigree-atlas .atlas-detail-k { color: var(--atlas-on-dark-muted); }
.pedigree-atlas .atlas-detail-v { color: var(--atlas-on-dark); }
.pedigree-atlas .atlas-detail-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 15px; }
/* In God View the row can hold 3 buttons (Show all / Edit / Profile) — let the primary take a full
   row and the rest wrap beneath, so nothing spills past the popup edge. */
.pedigree-atlas--global .atlas-detail-actions .atlas-btn--primary { flex: 1 0 100%; }
.pedigree-atlas .atlas-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-family: 'Jost', var(--font-sans, sans-serif);
	font-size: 10px;
	line-height: 1;
	letter-spacing: 1px;
	text-transform: uppercase;
	padding: 9px 11px;
	border-radius: 8px;
	cursor: pointer;
	text-decoration: none;
	text-align: center;
	border: 1px solid transparent;
}
.pedigree-atlas .atlas-btn--primary {
	flex: 1;
	border: none;
	background: var(--atlas-accent);
	color: color-mix(in srgb, var(--atlas-primary) 70%, #000);
	font-weight: 600;
}
.pedigree-atlas .atlas-btn--ghost {
	flex: 0 0 auto;
	border: 1px solid var(--atlas-panel-border);
	background: none;
	color: var(--atlas-on-dark);
}

/* ── inline edit form (dog-edit screen only) ── */
.pedigree-atlas .atlas-btn--edit {
	flex: 0 0 auto;
	border: 1px solid var(--atlas-panel-border);
	background: none;
	color: var(--atlas-on-dark);
}
.pedigree-atlas .atlas-btn--edit:hover { border-color: var(--atlas-accent); }
.pedigree-atlas .atlas-detail--edit { width: 270px; }
.pedigree-atlas .atlas-edit-field { display: block; margin-top: 12px; }
.pedigree-atlas .atlas-edit-label {
	display: block;
	font-size: 9px;
	letter-spacing: 1.6px;
	text-transform: uppercase;
	color: var(--atlas-on-dark-muted);
	margin-bottom: 5px;
}
.pedigree-atlas .atlas-edit-field input[type="text"] {
	width: 100%;
	padding: 7px 9px;
	border-radius: 7px;
	border: 1px solid var(--atlas-panel-border);
	background: color-mix(in srgb, #000 16%, var(--atlas-surface));
	color: var(--atlas-on-dark);
	font-family: 'Jost', var(--font-sans, sans-serif);
	font-size: 13px;
}
.pedigree-atlas .atlas-edit-field input[type="text"]:focus {
	outline: none;
	border-color: var(--atlas-accent);
}
.pedigree-atlas .atlas-edit-field select {
	width: 100%;
	padding: 7px 9px;
	border-radius: 7px;
	border: 1px solid var(--atlas-panel-border);
	background: color-mix(in srgb, #000 16%, var(--atlas-surface));
	color: var(--atlas-on-dark);
	font-family: 'Jost', var(--font-sans, sans-serif);
	font-size: 13px;
}
.pedigree-atlas .atlas-edit-field select:focus { outline: none; border-color: var(--atlas-accent); }
.pedigree-atlas .atlas-edit-ac-wrap { position: relative; }
.pedigree-atlas .atlas-edit-ac {
	position: absolute;
	left: 0;
	right: 0;
	top: calc(100% + 4px);
	margin: 0;
	padding: 4px;
	list-style: none;
	max-height: 168px;
	overflow-y: auto;
	background: var(--atlas-surface);
	border: 1px solid var(--atlas-accent);
	border-radius: 9px;
	box-shadow: 0 14px 32px rgba(0, 0, 0, 0.45);
	z-index: 90;
}
.pedigree-atlas .atlas-edit-ac-item {
	padding: 6px 9px;
	border-radius: 6px;
	font-size: 12px;
	color: var(--atlas-on-dark);
	cursor: pointer;
}
.pedigree-atlas .atlas-edit-ac-item.is-active,
.pedigree-atlas .atlas-edit-ac-item:hover {
	background: color-mix(in srgb, var(--atlas-accent) 28%, transparent);
}
/* Rich ancestor-name results: bare name + champion-title pill + country pill (mirrors the dog-edit pedigree fields). */
.pedigree-atlas .atlas-edit-ac-item .atlas-ac-name { margin-right: 6px; }
.pedigree-atlas .atlas-ac-tag {
	display: inline-block;
	margin-right: 5px;
	padding: 1px 6px;
	border-radius: 5px;
	font-size: 10px;
	line-height: 1.5;
	white-space: nowrap;
	vertical-align: middle;
}
.pedigree-atlas .atlas-ac-tag--title {
	color: var(--atlas-accent);
	background: color-mix(in srgb, var(--atlas-accent) 18%, transparent);
}
.pedigree-atlas .atlas-ac-tag--country {
	color: var(--atlas-on-dark-muted);
	background: color-mix(in srgb, var(--atlas-on-dark) 12%, transparent);
}
.pedigree-atlas .atlas-edit-ac-empty { padding: 6px 9px; font-size: 12px; color: var(--atlas-on-dark-muted); }

/* Locked Title/Country — linked to the chosen dog, not hand-editable here. */
.pedigree-atlas .atlas-edit-field input.atlas-edit-locked,
.pedigree-atlas .atlas-edit-field select.atlas-edit-locked {
	opacity: 0.55;
	cursor: not-allowed;
	background: color-mix(in srgb, #000 26%, var(--atlas-surface));
}

/* "Set current view as default" — dog-edit Atlas settings panel. */
.pedigree-atlas .atlas-save-default {
	display: block;
	width: 100%;
	margin-top: 4px;
	padding: 8px 10px;
	border: 1px solid var(--atlas-accent);
	border-radius: 8px;
	background: color-mix(in srgb, var(--atlas-accent) 16%, transparent);
	color: var(--atlas-on-dark);
	font-family: 'Jost', var(--font-sans, sans-serif);
	font-size: 12px;
	letter-spacing: .02em;
	cursor: pointer;
	transition: background .15s, opacity .15s;
}
.pedigree-atlas .atlas-save-default:hover { background: color-mix(in srgb, var(--atlas-accent) 28%, transparent); }
.pedigree-atlas .atlas-save-default:disabled { opacity: .6; cursor: default; }

.pedigree-atlas .atlas-edit-champs { display: flex; flex-wrap: wrap; gap: 6px; }
.pedigree-atlas .atlas-edit-chip { position: relative; cursor: pointer; }
.pedigree-atlas .atlas-edit-chip input { position: absolute; opacity: 0; width: 0; height: 0; }
.pedigree-atlas .atlas-edit-chip span {
	display: inline-block;
	padding: 5px 10px;
	border-radius: 999px;
	border: 1px solid var(--atlas-panel-border);
	color: var(--atlas-on-dark-muted);
	font-size: 10px;
	letter-spacing: .4px;
	transition: background .12s, color .12s, border-color .12s;
}
.pedigree-atlas .atlas-edit-chip:has(input:checked) span {
	background: var(--atlas-accent);
	border-color: var(--atlas-accent);
	color: color-mix(in srgb, var(--atlas-primary) 70%, #000);
	font-weight: 600;
}
.pedigree-atlas .atlas-edit-none { color: var(--atlas-on-dark-muted); font-size: 11px; }

/* ── +/− toggles ── */
.pedigree-atlas .atlas-toggle {
	position: absolute;
	width: 24px;
	height: 24px;
	border-radius: 50%;
	background: var(--atlas-surface);
	border: 1px solid var(--atlas-panel-border);
	color: var(--atlas-on-dark);
	font-size: 15px;
	font-family: 'Jost', var(--font-sans, sans-serif);
	line-height: 1;
	cursor: pointer;
	z-index: 70;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	box-shadow: 0 2px 7px rgba(0, 0, 0, 0.45);
	transition: background .12s, border-color .12s, color .12s;
}
.pedigree-atlas .atlas-toggle:hover {
	background: color-mix(in srgb, var(--atlas-accent) 26%, var(--atlas-surface));
	border-color: var(--atlas-accent);
}

/* ── top bar ── */
.pedigree-atlas .atlas-topbar {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	min-height: 62px;
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 10px 20px;
	background: var(--atlas-bar-bg);
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	border-bottom: 1px solid var(--atlas-panel-border);
	z-index: 40;
	flex-wrap: wrap;
}
.pedigree-atlas .atlas-brand { display: flex; align-items: center; gap: 12px; flex: 0 0 auto; }
.pedigree-atlas .atlas-brand-mark {
	width: 35px;
	height: 35px;
	border-radius: 50%;
	border: 1.5px solid var(--atlas-accent);
	display: flex;
	align-items: center;
	justify-content: center;
	font-family: 'Playfair Display', var(--font-serif, serif);
	font-size: 16px;
}
.pedigree-atlas .atlas-brand-text { line-height: 1; }
.pedigree-atlas .atlas-brand-name { display: block; font-family: 'Playfair Display', var(--font-serif, serif); font-size: 17px; }
.pedigree-atlas .atlas-brand-sub {
	display: block;
	font-size: 9px;
	letter-spacing: 3px;
	color: var(--atlas-on-dark-muted);
	text-transform: uppercase;
	margin-top: 3px;
}
.pedigree-atlas .atlas-controls {
	flex: 1;
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 14px;
	flex-wrap: wrap;
}
.pedigree-atlas .atlas-focus {
	flex: 0 0 auto;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	line-height: 1.1;
	border: none;
	background: none;
	font-family: inherit;
	color: inherit;
}
.pedigree-atlas .atlas-focus--pick { cursor: pointer; border-radius: 8px; padding: 4px 6px; transition: background .12s; }
.pedigree-atlas .atlas-focus--pick:hover { background: var(--atlas-chrome-hover); }
.pedigree-atlas .atlas-focus-label { font-size: 9px; letter-spacing: 2px; text-transform: uppercase; color: var(--atlas-on-dark-muted); }
.pedigree-atlas .atlas-focus-row { display: flex; align-items: center; gap: 6px; margin-top: 3px; }
.pedigree-atlas .atlas-focus-name { font-family: 'Playfair Display', var(--font-serif, serif); font-size: 13px; margin-top: 3px; }
.pedigree-atlas .atlas-focus-row .atlas-focus-name { margin-top: 0; }
.pedigree-atlas .atlas-focus-caret { font-size: 10px; color: var(--atlas-accent); }
.pedigree-atlas .atlas-close {
	flex: 0 0 auto;
	width: 34px;
	height: 34px;
	border-radius: 50%;
	border: 1px solid var(--atlas-panel-border);
	background: none;
	color: var(--atlas-on-dark);
	cursor: pointer;
	font-size: 15px;
	line-height: 1;
}

/* theme toggle (light / dark) — icon via CSS pseudo-content avoids WP emoji-staticize */
.pedigree-atlas .atlas-theme-toggle {
	flex: 0 0 auto;
	width: 34px;
	height: 34px;
	border-radius: 50%;
	border: 1px solid var(--atlas-panel-border);
	background: var(--atlas-seg-bg);
	color: var(--atlas-on-dark);
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 15px;
	line-height: 1;
	transition: background .12s, border-color .12s, color .12s;
}
.pedigree-atlas .atlas-theme-toggle:hover { border-color: var(--atlas-accent); }
.pedigree-atlas .atlas-theme-ico::before { content: '\2600'; }                   /* ☀ in dark mode → click for light */
.pedigree-atlas.atlas-theme-light .atlas-theme-ico::before { content: '\263E'; } /* ☾ in light mode → click for dark */
/* Drawer variant: a full-width labelled row (icon + "Light / dark") instead of the round icon button. */
.pedigree-atlas .atlas-theme-toggle--panel {
	width: 100%;
	height: auto;
	border-radius: 8px;
	justify-content: flex-start;
	gap: 8px;
	padding: 8px 10px;
}
.pedigree-atlas .atlas-theme-text { font-size: 12px; }

/* ── segmented controls ── */
.pedigree-atlas .atlas-seg {
	display: flex;
	background: var(--atlas-seg-bg);
	border: 1px solid var(--atlas-panel-border);
	border-radius: 9px;
	padding: 3px;
	gap: 2px;
}
.pedigree-atlas .atlas-seg--full { width: 100%; }
.pedigree-atlas .atlas-seg--full .atlas-seg-btn { flex: 1; }
.pedigree-atlas .atlas-seg-btn {
	border: none;
	cursor: pointer;
	font-family: 'Jost', var(--font-sans, sans-serif);
	font-size: 11px;
	font-weight: 500;
	letter-spacing: 0.6px;
	padding: 7px 14px;
	border-radius: 6px;
	background: transparent;
	color: var(--atlas-on-dark);
	transition: background .12s, color .12s;
}
.pedigree-atlas .atlas-seg-btn.is-active { background: var(--atlas-accent); color: color-mix(in srgb, var(--atlas-primary) 70%, #000); }

/* ── display panel (bottom-left) ── */
.pedigree-atlas .atlas-panel {
	position: absolute;
	left: 0;
	bottom: 18px;
	width: 214px;
	background: var(--atlas-panel);
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);
	border: 1px solid var(--atlas-panel-border);
	border-left: none;
	border-radius: 0 14px 14px 0;
	padding: 15px 16px;
	z-index: 40;
	box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
	/* Docked to the left edge and slid almost fully out of view by default — the tab pokes out. */
	transform: translateX(-100%);
	transition: transform .26s ease;
}
.pedigree-atlas .atlas-panel.is-open { transform: translateX(0); }

/* Click-tab handle that stays visible on the panel's right edge when it's tucked away. */
.pedigree-atlas .atlas-panel-tab {
	position: absolute;
	left: 100%;
	top: 50%;
	transform: translateY(-50%);
	width: 42px;
	height: 88px;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 10px;
	border: 1px solid var(--atlas-panel-border);
	border-left: none;
	border-radius: 0 14px 14px 0;
	background: var(--atlas-panel);
	-webkit-backdrop-filter: blur(10px);
	backdrop-filter: blur(10px);
	color: var(--atlas-on-dark);
	cursor: pointer;
	box-shadow: 6px 0 18px rgba(0, 0, 0, 0.22);
}
.pedigree-atlas .atlas-panel-tab:hover { color: var(--atlas-accent); }
.pedigree-atlas .atlas-panel-tab-ico::before { content: '\2699\FE0E'; font-size: 23px; line-height: 1; } /* ⚙ gear (text glyph) */
.pedigree-atlas .atlas-panel-tab-caret::before { content: '\203A'; font-size: 21px; line-height: 1; }    /* › → opens (slides right) */
.pedigree-atlas .atlas-panel.is-open .atlas-panel-tab-caret::before { content: '\2039'; }                 /* ‹ → closes */
.pedigree-atlas .atlas-panel-label {
	font-size: 9px;
	letter-spacing: 2.5px;
	text-transform: uppercase;
	color: var(--atlas-on-dark-muted);
	margin-bottom: 11px;
}
.pedigree-atlas .atlas-panel-rule { height: 1px; background: var(--atlas-rule); margin: 13px 0 12px; }
.pedigree-atlas .atlas-seg--full .atlas-seg-btn { padding: 7px 2px; font-size: 10px; letter-spacing: 0.4px; }
.pedigree-atlas .atlas-seg[data-group="gen"] .atlas-seg-btn { padding: 7px 0; font-size: 11px; }

/* switches */
.pedigree-atlas .atlas-switch {
	display: flex;
	align-items: center;
	gap: 11px;
	background: none;
	border: none;
	cursor: pointer;
	padding: 5px 0;
	width: 100%;
}
.pedigree-atlas .atlas-switch-track {
	width: 36px;
	height: 20px;
	border-radius: 10px;
	background: var(--atlas-track-off);
	position: relative;
	transition: background .15s;
	flex: 0 0 auto;
}
.pedigree-atlas .atlas-switch.is-on .atlas-switch-track { background: var(--atlas-accent); }
.pedigree-atlas .atlas-switch-knob {
	position: absolute;
	top: 2px;
	left: 2px;
	width: 16px;
	height: 16px;
	border-radius: 50%;
	background: #fff;
	transition: left .15s;
	box-shadow: 0 1px 3px rgba(0, 0, 0, .4);
}
.pedigree-atlas .atlas-switch.is-on .atlas-switch-knob { left: 18px; }
.pedigree-atlas .atlas-switch-label { font-size: 12.5px; letter-spacing: .4px; color: var(--atlas-on-dark); }

/* ── zoom (bottom-right) ── */
.pedigree-atlas .atlas-zoom {
	position: absolute;
	right: 18px;
	bottom: 18px;
	display: flex;
	align-items: center;
	gap: 4px;
	background: var(--atlas-panel);
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);
	border: 1px solid var(--atlas-panel-border);
	border-radius: 12px;
	padding: 5px;
	z-index: 40;
	box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}
.pedigree-atlas .atlas-zoom-btn {
	width: 34px;
	height: 34px;
	border: none;
	cursor: pointer;
	background: none;
	color: var(--atlas-on-dark);
	font-size: 20px;
	border-radius: 8px;
	line-height: 1;
}
.pedigree-atlas .atlas-zoom-pct { min-width: 46px; text-align: center; font-size: 12px; color: var(--atlas-on-dark-muted); }
.pedigree-atlas .atlas-zoom-rule { width: 1px; height: 20px; background: var(--atlas-rule); margin: 0 3px; }
.pedigree-atlas .atlas-zoom-fit {
	height: 34px;
	padding: 0 13px;
	border: none;
	cursor: pointer;
	background: none;
	color: var(--atlas-on-dark);
	font-size: 11px;
	letter-spacing: 1px;
	text-transform: uppercase;
	border-radius: 8px;
}

/* ── dog picker overlay (dedicated page) ── */
.pedigree-atlas .atlas-picker-overlay {
	position: absolute;
	inset: 0;
	z-index: 120;
	background: var(--atlas-overlay);
	backdrop-filter: blur(3px);
	-webkit-backdrop-filter: blur(3px);
	display: flex;
	align-items: flex-start;
	justify-content: center;
	padding-top: 84px;
}
.pedigree-atlas .atlas-picker-overlay[hidden] { display: none; }
.pedigree-atlas .atlas-picker {
	width: min(420px, 90%);
	max-height: 70%;
	display: flex;
	flex-direction: column;
	background: var(--atlas-surface);
	border: 1px solid var(--atlas-panel-border);
	border-radius: 14px;
	box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
	overflow: hidden;
}
.pedigree-atlas .atlas-picker-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 16px 8px;
}
.pedigree-atlas .atlas-picker-title {
	font-family: 'Playfair Display', var(--font-serif, serif);
	font-size: 16px;
	color: var(--atlas-on-dark);
}
.pedigree-atlas .atlas-picker-close {
	width: 26px; height: 26px;
	border-radius: 50%;
	border: 1px solid var(--atlas-panel-border);
	background: none;
	color: var(--atlas-on-dark-muted);
	cursor: pointer;
	font-size: 15px; line-height: 1;
}
.pedigree-atlas .atlas-picker-search {
	margin: 0 16px 10px;
	padding: 9px 12px;
	border-radius: 9px;
	border: 1px solid var(--atlas-panel-border);
	background: color-mix(in srgb, #000 22%, var(--atlas-surface));
	color: var(--atlas-on-dark);
	font-family: 'Jost', var(--font-sans, sans-serif);
	font-size: 13px;
}
.pedigree-atlas .atlas-picker-search::placeholder { color: var(--atlas-on-dark-muted); }
.pedigree-atlas .atlas-picker-list {
	list-style: none;
	margin: 0;
	padding: 0 8px 10px;
	overflow-y: auto;
}
.pedigree-atlas .atlas-pick-item {
	display: block;
	width: 100%;
	text-align: left;
	border: none;
	background: none;
	cursor: pointer;
	padding: 9px 10px;
	border-radius: 8px;
	color: var(--atlas-on-dark);
	font-family: 'Playfair Display', var(--font-serif, serif);
	font-size: 13.5px;
}
.pedigree-atlas .atlas-pick-item:hover { background: color-mix(in srgb, var(--atlas-accent) 24%, transparent); }
.pedigree-atlas .atlas-pick-empty { padding: 12px 10px; color: var(--atlas-on-dark-muted); font-size: 13px; }

/* ── empty state (no dog selected) ── */
.pedigree-atlas .atlas-empty {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 30;
}
.pedigree-atlas .atlas-empty[hidden] { display: none; }
.pedigree-atlas .atlas-empty-inner {
	text-align: center;
	max-width: 340px;
	padding: 28px;
}
.pedigree-atlas .atlas-empty-title {
	font-family: 'Playfair Display', var(--font-serif, serif);
	font-size: 26px;
	color: var(--atlas-on-dark);
}
.pedigree-atlas .atlas-empty-lead { color: var(--atlas-on-dark-muted); font-size: 14px; margin: 10px 0 20px; }
.pedigree-atlas .atlas-empty-btn {
	border: none;
	cursor: pointer;
	background: var(--atlas-accent);
	color: color-mix(in srgb, var(--atlas-primary) 70%, #000);
	font-family: 'Jost', var(--font-sans, sans-serif);
	font-weight: 600;
	font-size: 12px;
	letter-spacing: 1px;
	text-transform: uppercase;
	padding: 12px 22px;
	border-radius: 9px;
}
.pedigree-atlas .atlas-empty-actions {
	display: flex;
	gap: 12px;
	justify-content: center;
	flex-wrap: wrap;
}
.pedigree-atlas .atlas-empty-btn--ghost {
	background: transparent;
	color: var(--atlas-on-dark);
	border: 1px solid var(--atlas-accent);
}
.pedigree-atlas .atlas-empty-link {
	display: inline-block;
	margin-top: 16px;
	border: none;
	background: none;
	cursor: pointer;
	color: var(--atlas-on-dark-muted);
	font-family: 'Jost', var(--font-sans, sans-serif);
	font-size: 12px;
	letter-spacing: 0.4px;
	text-decoration: underline;
	text-underline-offset: 3px;
}
.pedigree-atlas .atlas-empty-link:hover { color: var(--atlas-on-dark); }
/* When no dog is selected, the chrome (controls/panel/focus) is hidden — only the empty state shows. */
.pedigree-atlas.atlas-no-subject .atlas-controls,
.pedigree-atlas.atlas-no-subject .atlas-focus,
.pedigree-atlas.atlas-no-subject .atlas-panel,
.pedigree-atlas.atlas-no-subject .atlas-zoom { display: none; }

/* ── inline section framing (profile + edit screen) ── */
.atlas-section { margin: 40px 0; min-width: 0; }
.atlas-section-head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 16px;
	flex-wrap: wrap;
}
/* No "Pedigree" heading (dog-edit screen): the link's only neighbours are the form section's
   gold-rule heading above and the canvas below. Pull the section up to cancel the 14px gap under
   that rule (.kdf-section-title margin-bottom) so the link, centred in its 52px band, sits an equal
   distance below the rule and above the canvas — i.e. truly in the middle. */
.atlas-section--bare { margin-top: -14px; }
.atlas-section-head--bare { min-height: 52px; align-items: center; }
.atlas-launch {
	margin-left: auto; /* keep the link top-right even when the "Pedigree" heading is hidden (dog-edit) */
	font-family: var(--font-sans, sans-serif);
	font-size: 13px;
	letter-spacing: 0.5px;
	color: var(--color-burgundy, #550223);
	text-decoration: none;
	white-space: nowrap;
}
.atlas-launch:hover { text-decoration: underline; }

/* ── dedicated fullscreen page host ── */
.atlas-page-host { position: relative; }
body.atlas-fullscreen-lock { overflow: hidden; }

/* ── God View (whole-kennel forest) ── */
/* Toggle button in the top-bar controls. */
.pedigree-atlas .atlas-god-toggle {
	flex: 0 0 auto;
	border: 1px solid var(--atlas-panel-border);
	background: var(--atlas-seg-bg);
	color: var(--atlas-on-dark);
	font-family: 'Jost', var(--font-sans, sans-serif);
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.6px;
	padding: 8px 14px;
	border-radius: 9px;
	cursor: pointer;
	transition: background .12s, color .12s, border-color .12s;
}
.pedigree-atlas .atlas-god-toggle:hover { border-color: var(--atlas-accent); }
.pedigree-atlas .atlas-god-toggle.is-active {
	background: var(--atlas-accent);
	color: color-mix(in srgb, var(--atlas-primary) 70%, #000);
	border-color: var(--atlas-accent);
}

/* The "Dogs" subset selector mirrors the Focus Dog button; only shown in God View. */
.pedigree-atlas .atlas-focus--gods {
	display: none;
	cursor: pointer;
	border-radius: 8px;
	padding: 4px 6px;
	transition: background .12s;
}
.pedigree-atlas .atlas-focus--gods:hover { background: var(--atlas-chrome-hover); }
.pedigree-atlas--global .atlas-focus--gods { display: block; }

/* In God View the top-bar single-dog picker + view switch are hidden (the whole-kennel chrome
   uses the God focus pill instead). The drawer's Layout + Generations controls DO apply in God
   View now (Layout flips the forest orientation; Generations caps the focused-dog cone), so they
   stay visible — matching the single-dog drawer. */
.pedigree-atlas--global .atlas-focus--pick,
.pedigree-atlas--global .atlas-view-seg { display: none; }
/* The Ancestors / Both / Descendants switch returns once a dog is focused (it filters that line). */
.pedigree-atlas--global.pedigree-atlas--focused .atlas-view-seg { display: flex; }

/* God-View focus pill — shows the dog the view switch is filtering on; click to clear. */
.pedigree-atlas .atlas-godfocus {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	flex: 0 0 auto;
	cursor: pointer;
	border: 1px solid var(--atlas-accent);
	border-radius: 8px;
	padding: 4px 8px;
	background: color-mix(in srgb, var(--atlas-accent) 16%, transparent);
	color: var(--atlas-on-dark);
}
.pedigree-atlas .atlas-godfocus[hidden] { display: none; }
.pedigree-atlas .atlas-godfocus-label { font-size: 9px; letter-spacing: 2px; text-transform: uppercase; color: var(--atlas-on-dark-muted); }
.pedigree-atlas .atlas-godfocus-name { font-family: 'Playfair Display', var(--font-serif, serif); font-size: 13px; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pedigree-atlas .atlas-godfocus-x { font-size: 11px; color: var(--atlas-accent); }

/* ── multi-select picker (choose which dogs to show in God View) ── */
.pedigree-atlas .atlas-picker-list { flex: 1 1 auto; min-height: 0; }
.pedigree-atlas .atlas-pick-check {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 10px;
	border-radius: 8px;
	cursor: pointer;
	color: var(--atlas-on-dark);
	font-family: 'Playfair Display', var(--font-serif, serif);
	font-size: 13.5px;
}
.pedigree-atlas .atlas-pick-check:hover { background: color-mix(in srgb, var(--atlas-accent) 18%, transparent); }
.pedigree-atlas .atlas-pick-check input {
	accent-color: var(--atlas-accent);
	width: 15px;
	height: 15px;
	flex: 0 0 auto;
}
.pedigree-atlas .atlas-picker-foot {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 10px 12px;
	border-top: 1px solid var(--atlas-panel-border);
}
.pedigree-atlas .atlas-picker-foot[hidden] { display: none; }
.pedigree-atlas .atlas-picker-mini {
	border: 1px solid var(--atlas-panel-border);
	background: transparent;
	color: var(--atlas-on-dark);
	font-family: 'Jost', var(--font-sans, sans-serif);
	font-size: 11px;
	letter-spacing: 0.4px;
	padding: 7px 10px;
	border-radius: 7px;
	cursor: pointer;
}
.pedigree-atlas .atlas-picker-mini:hover { border-color: var(--atlas-accent); }
.pedigree-atlas .atlas-picker-apply {
	margin-left: auto;
	border: none;
	cursor: pointer;
	background: var(--atlas-accent);
	color: color-mix(in srgb, var(--atlas-primary) 70%, #000);
	font-family: 'Jost', var(--font-sans, sans-serif);
	font-weight: 600;
	font-size: 11px;
	letter-spacing: 0.8px;
	text-transform: uppercase;
	padding: 8px 18px;
	border-radius: 8px;
}

/* ── responsive: stack chrome on narrow screens ── */
@media (max-width: 640px) {
	.pedigree-atlas .atlas-panel { width: 174px; left: 0; bottom: 12px; padding: 12px; }
	.pedigree-atlas .atlas-zoom { right: 12px; bottom: 12px; }
	.pedigree-atlas .atlas-focus { display: none; }
	.pedigree-atlas--inline { height: 140vh; }
}
