/* Genealogy Family Tree viewer */

.genealogy-tree {
	--gt-bg: #e9ede8;
	--gt-dot: rgba(40, 70, 55, 0.14);
	--gt-card: #fbfcfa;
	--gt-ink: #1d2823;
	--gt-muted: #5d6b64;
	--gt-line: #a3b2a9;
	--gt-line-hi: #b4651e;
	--gt-chrome: rgba(251, 252, 250, 0.92);
	--gt-border: rgba(30, 55, 45, 0.15);
	--gt-shadow: 0 1px 2px rgba(20, 40, 30, 0.08), 0 4px 14px rgba(20, 40, 30, 0.08);
	--gt-male: #3d6b9e;
	--gt-female: #a8486a;
	--gt-other: #74589e;
	--gt-unknown: #8a857b;
	--gt-select: #b4651e;
	--gt-serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
	--gt-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

	position: relative;
	width: 100%;
	min-height: 320px;
	overflow: hidden;
	background: var(--gt-bg);
	color: var(--gt-ink);
	font-family: var(--gt-sans);
	font-size: 14px;
	line-height: 1.35;
	border-radius: 10px;
	outline: none;
	-webkit-tap-highlight-color: transparent;
	box-sizing: border-box;
}
.genealogy-tree *, .genealogy-tree *::before, .genealogy-tree *::after { box-sizing: border-box; }

/* Colour scheme: light by default; .gt-theme-dark always dark;
   .gt-theme-auto follows the visitor's device setting. */
@media (prefers-color-scheme: dark) {
	.genealogy-tree.gt-theme-auto {
		--gt-bg: #141a17;
		--gt-dot: rgba(210, 255, 230, 0.07);
		--gt-card: #1f2723;
		--gt-ink: #e8efe9;
		--gt-muted: #9fb0a6;
		--gt-line: #4a5a51;
		--gt-line-hi: #e0a463;
		--gt-chrome: rgba(31, 39, 35, 0.92);
		--gt-border: rgba(210, 255, 230, 0.12);
		--gt-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 14px rgba(0, 0, 0, 0.3);
		--gt-male: #7aa7dc;
		--gt-female: #e08aa8;
		--gt-other: #b49ae0;
		--gt-unknown: #a9a397;
		--gt-select: #e0a463;
	}
}
.genealogy-tree.gt-theme-dark {
	--gt-bg: #141a17;
	--gt-dot: rgba(210, 255, 230, 0.07);
	--gt-card: #1f2723;
	--gt-ink: #e8efe9;
	--gt-muted: #9fb0a6;
	--gt-line: #4a5a51;
	--gt-line-hi: #e0a463;
	--gt-chrome: rgba(31, 39, 35, 0.92);
	--gt-border: rgba(210, 255, 230, 0.12);
	--gt-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 14px rgba(0, 0, 0, 0.3);
	--gt-male: #7aa7dc;
	--gt-female: #e08aa8;
	--gt-other: #b49ae0;
	--gt-unknown: #a9a397;
	--gt-select: #e0a463;
}

.genealogy-tree--cover, .genealogy-tree.is-maximized, .genealogy-tree--page {
	position: fixed;
	inset: 0;
	width: 100vw;
	height: 100vh !important;
	height: 100dvh !important;
	z-index: 99990;
	border-radius: 0;
}
.genealogy-tree.is-fullscreen { border-radius: 0; }
html.gt-noscroll, html.gt-noscroll body { overflow: hidden; }
body.admin-bar .genealogy-tree--cover, body.admin-bar .genealogy-tree.is-maximized { top: 0; }

/* Stage and world */

.gt-stage {
	position: absolute;
	inset: 0;
	cursor: grab;
	touch-action: none;
	user-select: none;
	-webkit-user-select: none;
	background-image: radial-gradient(circle, var(--gt-dot) 1.2px, transparent 1.6px);
}
.gt-stage.is-dragging { cursor: grabbing; }
.gt-world {
	position: absolute;
	left: 0;
	top: 0;
	transform-origin: 0 0;
}
.gt-lines {
	position: absolute;
	left: 0;
	top: 0;
	overflow: visible;
	pointer-events: none;
}
.gt-edge {
	fill: none;
	stroke: var(--gt-line);
	stroke-width: 2;
	stroke-linejoin: round;
	transition: stroke 0.2s, opacity 0.2s;
}
.gt-edge--spouse { stroke-width: 2.5; stroke-dasharray: none; }
.lod-0 .gt-edge { stroke-width: 5; }
.lod-1 .gt-edge { stroke-width: 3; }
.has-selection .gt-edge { opacity: 0.35; }
.has-selection .gt-edge.is-related { opacity: 1; stroke: var(--gt-line-hi); stroke-width: 3; }
.lod-0.has-selection .gt-edge.is-related { stroke-width: 7; }

/* Person cards */

.gt-card {
	position: absolute;
	background: var(--gt-card);
	border: 1px solid var(--gt-border);
	border-top: 5px solid var(--gt-accent, var(--gt-unknown));
	border-radius: 10px;
	box-shadow: var(--gt-shadow);
	overflow: hidden;
	cursor: pointer;
	transition: opacity 0.2s, box-shadow 0.2s, transform 0.2s;
	outline: none;
}
.gt-card.g-male { --gt-accent: var(--gt-male); }
.gt-card.g-female { --gt-accent: var(--gt-female); }
.gt-card.g-other { --gt-accent: var(--gt-other); }
.gt-card:hover { box-shadow: 0 0 0 2px var(--gt-accent), var(--gt-shadow); }
.gt-card:focus-visible { box-shadow: 0 0 0 3px var(--gt-select); }
.gt-card.is-selected { box-shadow: 0 0 0 4px var(--gt-select), 0 10px 30px rgba(0, 0, 0, 0.2); }
.has-selection .gt-card:not(.is-related) { opacity: 0.38; }

/* Level 0: far away. A coloured tile with a big short name. */
.gt-l0 {
	display: none;
	position: absolute;
	inset: 0;
	align-items: center;
	justify-content: center;
	padding: 0 10px;
	font-family: var(--gt-serif);
	font-size: 38px;
	font-weight: 600;
	letter-spacing: -0.01em;
	color: var(--gt-ink);
	background: color-mix(in srgb, var(--gt-accent, var(--gt-unknown)) 16%, var(--gt-card));
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.lod-0 .gt-l0 { display: flex; }
.lod-0 .gt-body { display: none; }
.lod-0 .gt-card { border-top-width: 10px; border-radius: 14px; }

.gt-body {
	display: flex;
	align-items: center;
	gap: 12px;
	height: 100%;
	padding: 8px 14px;
}
.gt-photo {
	flex: none;
	display: none;
	align-items: center;
	justify-content: center;
	width: 60px;
	height: 60px;
	border-radius: 50%;
	overflow: hidden;
	background: color-mix(in srgb, var(--gt-accent, var(--gt-unknown)) 18%, var(--gt-card));
	color: var(--gt-accent, var(--gt-unknown));
	font-family: var(--gt-serif);
	font-weight: 600;
	font-size: 22px;
}
.gt-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gt-text { min-width: 0; flex: 1; }
.gt-name {
	font-family: var(--gt-serif);
	font-weight: 600;
	color: var(--gt-ink);
	overflow: hidden;
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	line-clamp: 2;
}
.gt-surname { font-weight: 700; }
.gt-nee { display: none; font-weight: 400; color: var(--gt-muted); font-style: italic; }
.gt-years { color: var(--gt-muted); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gt-facts { display: none; }
.gt-fact { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--gt-muted); }
.gt-occ { font-style: italic; }
.gt-private { font-style: italic; }

/* Level 1: names only, large enough to read from a distance. */
.lod-1 .gt-body { justify-content: center; text-align: center; }
.lod-1 .gt-name { font-size: 23px; line-height: 1.12; }
.lod-1 .gt-given, .lod-1 .gt-surname { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lod-1 .gt-years { display: none; }

/* Level 2: name, life span and photo. */
.lod-2 .gt-photo { display: flex; }
.lod-2 .gt-name { font-size: 17px; line-height: 1.2; }
.lod-2 .gt-years { font-size: 14px; margin-top: 3px; }

/* Level 3: everything that fits on the card. */
.lod-3 .gt-body { align-items: flex-start; padding-top: 9px; gap: 10px; }
.lod-3 .gt-photo { display: flex; width: 50px; height: 50px; font-size: 18px; margin-top: 2px; }
.lod-3 .gt-name { font-size: 13px; line-height: 1.2; -webkit-line-clamp: 1; line-clamp: 1; display: block; white-space: nowrap; text-overflow: ellipsis; }
.lod-3 .gt-nee { display: inline; }
.lod-3 .gt-years { font-size: 11px; margin: 1px 0 3px; }
.lod-3 .gt-facts { display: block; font-size: 10.5px; line-height: 1.38; }

/* Chrome: top bar, controls */

.gt-bar {
	position: absolute;
	top: 12px;
	left: 12px;
	right: 12px;
	display: flex;
	align-items: center;
	gap: 10px;
	pointer-events: none;
	z-index: 3;
}
.gt-bar > * { pointer-events: auto; }
.gt-home, .gt-title, .gt-tree-select, .gt-search input, .gt-btn, .gt-meter, .gt-hint, .gt-results {
	background: var(--gt-chrome);
	border: 1px solid var(--gt-border);
	box-shadow: var(--gt-shadow);
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
}
.gt-home {
	display: grid;
	place-items: center;
	width: 40px;
	height: 40px;
	border-radius: 10px;
	color: var(--gt-ink);
	text-decoration: none;
	font-size: 18px;
}
.gt-title {
	padding: 9px 14px;
	border-radius: 10px;
	font-family: var(--gt-serif);
	font-weight: 600;
	font-size: 16px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	min-width: 0;
	flex: 0 1 auto;
}
.gt-title:empty { display: none; }
.gt-tree-select {
	height: 40px;
	padding: 0 32px 0 12px;
	border-radius: 10px;
	color: var(--gt-ink);
	font: inherit;
	font-size: 14px;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
	background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
	background-position: calc(100% - 17px) 18px, calc(100% - 12px) 18px;
	background-size: 5px 5px;
	background-repeat: no-repeat;
	min-width: 0;
	max-width: 200px;
}
.gt-tree-select:focus-visible { outline: 3px solid color-mix(in srgb, var(--gt-select) 50%, transparent); }
@media (max-width: 640px) { .gt-title { display: none; } }
.gt-search { position: relative; margin-left: auto; flex: 0 1 300px; min-width: 150px; }
.gt-search input {
	width: 100%;
	height: 40px;
	padding: 0 14px;
	border-radius: 10px;
	color: var(--gt-ink);
	font: inherit;
	font-size: 15px;
	outline: none;
	-webkit-appearance: none;
	appearance: none;
}
.gt-search input:focus { border-color: var(--gt-select); box-shadow: 0 0 0 3px color-mix(in srgb, var(--gt-select) 25%, transparent); }
.gt-results {
	display: none;
	position: absolute;
	top: 46px;
	left: 0;
	right: 0;
	margin: 0;
	padding: 4px;
	list-style: none;
	border-radius: 10px;
	max-height: 60vh;
	overflow: auto;
}
.gt-results.is-open { display: block; }
.gt-results li {
	display: flex;
	justify-content: space-between;
	gap: 10px;
	padding: 8px 10px;
	margin: 0;
	border-radius: 6px;
	cursor: pointer;
}
.gt-results li span { color: var(--gt-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.gt-results li:hover, .gt-results li.is-active { background: color-mix(in srgb, var(--gt-select) 16%, transparent); }

.gt-controls {
	position: absolute;
	right: 12px;
	bottom: 12px;
	display: flex;
	flex-direction: column;
	gap: 6px;
	z-index: 3;
	transition: right 0.25s;
}
.gt-btn {
	display: grid;
	place-items: center;
	width: 40px;
	height: 40px;
	padding: 0;
	border-radius: 10px;
	color: var(--gt-ink);
	cursor: pointer;
}
.gt-btn:hover { border-color: var(--gt-select); color: var(--gt-select); }
.gt-btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--gt-select) 50%, transparent); outline-offset: 1px; }

.gt-meter {
	position: absolute;
	left: 12px;
	bottom: 12px;
	display: flex;
	gap: 3px;
	align-items: flex-end;
	padding: 8px 10px;
	border-radius: 10px;
	z-index: 3;
}
.gt-meter span { width: 5px; border-radius: 2px; background: var(--gt-border); transition: background 0.2s; }
.gt-meter span:nth-child(1) { height: 6px; }
.gt-meter span:nth-child(2) { height: 10px; }
.gt-meter span:nth-child(3) { height: 14px; }
.gt-meter span:nth-child(4) { height: 18px; }
.gt-meter span.on { background: var(--gt-select); }

.gt-hint {
	position: absolute;
	left: 50%;
	bottom: 12px;
	transform: translateX(-50%);
	padding: 8px 14px;
	border-radius: 999px;
	font-size: 13px;
	color: var(--gt-muted);
	white-space: nowrap;
	z-index: 2;
	pointer-events: none;
	transition: opacity 0.8s;
}
.gt-hint.is-faded { opacity: 0; }
@media (max-width: 640px) { .gt-hint { display: none; } }

.gt-status {
	position: absolute;
	inset: 0;
	display: grid;
	place-items: center;
	color: var(--gt-muted);
	font-size: 16px;
}

/* Details panel */

.gt-panel {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	width: min(380px, 92vw);
	background: var(--gt-card);
	border-left: 1px solid var(--gt-border);
	box-shadow: -8px 0 30px rgba(0, 0, 0, 0.12);
	transform: translateX(105%);
	transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
	overflow-y: auto;
	overscroll-behavior: contain;
	z-index: 4;
	padding: 0 0 24px;
}
.has-panel .gt-panel { transform: none; }
@media (min-width: 721px) { .has-panel .gt-controls { right: calc(min(380px, 92vw) + 12px); } }
@media (max-width: 720px) {
	.gt-panel {
		top: auto;
		left: 0;
		width: 100%;
		max-height: 62%;
		border-left: 0;
		border-top: 1px solid var(--gt-border);
		border-radius: 16px 16px 0 0;
		transform: translateY(105%);
	}
}
@media (prefers-reduced-motion: reduce) { .gt-panel, .gt-card, .gt-edge { transition: none; } }

.gt-panel-close {
	position: sticky;
	top: 10px;
	float: right;
	margin: 10px 10px 0 0;
	width: 34px;
	height: 34px;
	border-radius: 50%;
	border: 1px solid var(--gt-border);
	background: var(--gt-chrome);
	color: var(--gt-ink);
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	z-index: 1;
}
.gt-panel-close:hover { color: var(--gt-select); border-color: var(--gt-select); }
.gt-panel-head {
	padding: 22px 22px 16px;
	border-top: 6px solid var(--gt-accent, var(--gt-unknown));
}
.gt-panel-head.g-male { --gt-accent: var(--gt-male); }
.gt-panel-head.g-female { --gt-accent: var(--gt-female); }
.gt-panel-head.g-other { --gt-accent: var(--gt-other); }
.gt-panel-photo {
	display: block;
	width: 112px;
	height: 112px;
	border-radius: 50%;
	object-fit: cover;
	margin: 0 0 14px;
	box-shadow: 0 0 0 4px var(--gt-card), 0 0 0 6px var(--gt-accent, var(--gt-unknown));
}
.gt-panel h2 {
	margin: 0 40px 4px 0;
	font-family: var(--gt-serif);
	font-size: 26px;
	line-height: 1.15;
	color: var(--gt-ink);
}
.gt-panel-sub { margin: 0; color: var(--gt-muted); font-size: 15px; }
.gt-facts-list {
	display: grid;
	grid-template-columns: auto 1fr;
	gap: 8px 16px;
	margin: 0;
	padding: 4px 22px 16px;
}
.gt-facts-list dt { color: var(--gt-muted); font-size: 13px; padding-top: 1px; }
.gt-facts-list dd { margin: 0; }
.gt-private-note { margin: 0 22px 12px; color: var(--gt-muted); font-style: italic; }
.gt-bio { padding: 0 22px 8px; font-size: 14.5px; line-height: 1.55; }
.gt-bio p { margin: 0 0 0.8em; }
.gt-bio img { max-width: 100%; height: auto; }
.gt-rel { padding: 8px 22px 4px; }
.gt-rel h3 {
	margin: 0 0 6px;
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--gt-muted);
	font-weight: 600;
}
.gt-rel ul { list-style: none; margin: 0; padding: 0; }
.gt-rel li { margin: 0 0 4px; }
.gt-rel-link {
	display: flex;
	justify-content: space-between;
	gap: 10px;
	width: 100%;
	padding: 8px 10px 8px 12px;
	border: 1px solid var(--gt-border);
	border-left: 4px solid var(--gt-accent, var(--gt-unknown));
	border-radius: 8px;
	background: transparent;
	color: var(--gt-ink);
	font: inherit;
	text-align: left;
	cursor: pointer;
}
.gt-rel-link.g-male { --gt-accent: var(--gt-male); }
.gt-rel-link.g-female { --gt-accent: var(--gt-female); }
.gt-rel-link.g-other { --gt-accent: var(--gt-other); }
.gt-rel-link:hover, .gt-rel-link:focus-visible { background: color-mix(in srgb, var(--gt-select) 10%, transparent); outline: none; }
.gt-rel-name { font-weight: 600; }
.gt-rel-years { color: var(--gt-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.gt-edit {
	display: inline-block;
	margin: 14px 22px 0;
	color: var(--gt-select);
	font-weight: 600;
	text-decoration: none;
}
.gt-edit:hover { text-decoration: underline; }

/* Display styles */

.gt-plane { position: absolute; inset: 0; transform-style: preserve-3d; }
.gt-views {
	position: absolute;
	left: 50%;
	bottom: 12px;
	transform: translateX(-50%);
	display: flex;
	gap: 2px;
	padding: 3px;
	border-radius: 12px;
	background: var(--gt-chrome);
	border: 1px solid var(--gt-border);
	box-shadow: var(--gt-shadow);
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	z-index: 3;
}
.gt-view-btn {
	border: 0;
	background: transparent;
	color: var(--gt-ink);
	font: inherit;
	font-size: 14px;
	padding: 7px 13px;
	border-radius: 9px;
	cursor: pointer;
	white-space: nowrap;
}
.gt-view-btn:hover { color: var(--gt-select); }
.gt-view-btn[aria-pressed="true"] { background: var(--gt-select); color: #fff; }
.gt-view-btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--gt-select) 50%, transparent); }
.gt-views ~ .gt-hint, .gt .gt-views + .gt-hint { bottom: 62px; }
.gt-hint { bottom: 62px; }
@media (max-width: 640px) { .gt-view-btn { padding: 7px 9px; font-size: 13px; } .gt-meter { display: none; } }

/* Tilted map: the flat tree laid on a board seen at an angle, cards lifted off it. */
.gt-mode-tilt .gt-stage {
	perspective: 1300px;
	perspective-origin: 50% 0%;
	background-image: linear-gradient(180deg, color-mix(in srgb, var(--gt-bg) 70%, #9fb7c4) 0%, var(--gt-bg) 45%);
}
.gt-mode-tilt .gt-plane {
	inset: -100%;
	transform: rotateX(34deg);
	transform-origin: 50% 50%;
	background-image: linear-gradient(var(--gt-dot) 1px, transparent 1px), linear-gradient(90deg, var(--gt-dot) 1px, transparent 1px);
	-webkit-mask-image: radial-gradient(ellipse 45% 40% at 50% 50%, #000 55%, transparent 100%);
	mask-image: radial-gradient(ellipse 45% 40% at 50% 50%, #000 55%, transparent 100%);
}
.gt-mode-tilt .gt-plane { background-color: color-mix(in srgb, var(--gt-card) 55%, var(--gt-bg)); }
.gt-mode-tilt .gt-world { left: 33.3333%; top: 33.3333%; transform-style: preserve-3d; }
.gt-mode-tilt .gt-card {
	transform: translateZ(26px);
	box-shadow: 0 30px 26px -14px rgba(20, 40, 30, 0.38), var(--gt-shadow);
}
.gt-mode-tilt .gt-card.is-selected { transform: translateZ(60px); box-shadow: 0 0 0 4px var(--gt-select), 0 60px 40px -20px rgba(20, 40, 30, 0.45); }

/* 3D scenes */
.gt-3d { position: absolute; inset: 0; display: none; }
.gt-3d canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.gt-mode-tiers .gt-3d, .gt-mode-organic .gt-3d { display: block; }
.gt-mode-tiers .gt-stage, .gt-mode-organic .gt-stage { display: none; }
.gt-mode-tiers .gt-3d { background: radial-gradient(ellipse 80% 70% at 50% 35%, #1f3a49 0%, #0c161d 55%, #04080b 100%); }
.gt-mode-organic .gt-3d { background: linear-gradient(180deg, #bcd8e6 0%, #e4ece0 52%, #d5dcc2 100%); }
.genealogy-tree.gt-mode-tiers {
	--gt-bg: #0c161d;
	--gt-card: #17232b;
	--gt-ink: #e8f0ec;
	--gt-muted: #9fb2aa;
	--gt-chrome: rgba(23, 35, 43, 0.82);
	--gt-border: rgba(170, 220, 240, 0.16);
	--gt-shadow: 0 4px 18px rgba(0, 0, 0, 0.4);
	--gt-select: #f0b45c;
	--gt-male: #78b0ee;
	--gt-female: #f191b3;
	--gt-other: #bba2f2;
	--gt-unknown: #aab4ae;
	--gt-line-hi: #f0b45c;
}

/* Profile photo beside the name at the names-only level */
.lod-1 .gt-card.has-photo .gt-body { justify-content: flex-start; text-align: left; gap: 12px; }
.lod-1 .gt-card.has-photo .gt-photo { display: flex; width: 74px; height: 74px; }
.lod-1 .gt-card.has-photo .gt-name { font-size: 20px; }
.lod-0 .gt-card.has-photo .gt-l0 { justify-content: flex-start; gap: 10px; padding-left: 10px; font-size: 32px; }
.gt-l0 img { width: 76px; height: 76px; border-radius: 50%; object-fit: cover; flex: none; }
.gt-l0 span { overflow: hidden; text-overflow: ellipsis; }

/* Gallery button on a card: only zoomed in, only when there are photos */
.gt-gal-btn {
	position: absolute;
	top: 8px;
	right: 8px;
	display: none;
	align-items: center;
	gap: 4px;
	height: 24px;
	padding: 0 8px;
	border: 1px solid var(--gt-border);
	border-radius: 999px;
	background: var(--gt-chrome);
	color: var(--gt-ink);
	font: 600 11px/1 var(--gt-sans);
	cursor: pointer;
}
.lod-2 .gt-gal-btn, .lod-3 .gt-gal-btn { display: inline-flex; }
.lod-3 .gt-gal-btn { top: 6px; right: 6px; height: 20px; padding: 0 6px; font-size: 10px; }
.lod-3 .gt-gal-btn svg { width: 12px; height: 12px; }
.gt-gal-btn:hover { color: #fff; background: var(--gt-select); border-color: var(--gt-select); }
.lod-3 .has-gallery .gt-name, .lod-2 .has-gallery .gt-name { padding-right: 34px; }

/* Thumbnails in the details panel */
.gt-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 6px; }
.gt-thumb { padding: 0; border: 0; border-radius: 6px; overflow: hidden; aspect-ratio: 1; cursor: pointer; background: var(--gt-border); max-width: 100%; }
.gt-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.2s; }
.gt-thumb:hover img { transform: scale(1.05); }
.gt-thumb:focus-visible { outline: 3px solid var(--gt-select); outline-offset: 1px; }

/* Lightbox */
.gt-lightbox {
	position: absolute;
	inset: 0;
	z-index: 10;
	display: flex;
	flex-direction: column;
	background: rgba(12, 16, 14, 0.97);
	color: #f2f5f3;
}
.gt-lightbox[hidden] { display: none; }
.gt-lb-top { display: flex; align-items: center; gap: 12px; padding: 12px 12px 0 18px; }
.gt-lb-title { font-family: var(--gt-serif); font-size: 18px; font-weight: 600; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gt-lb-count { font-variant-numeric: tabular-nums; color: rgba(242, 245, 243, 0.7); font-size: 14px; }
.gt-lb-close, .gt-lb-nav {
	border: 1px solid rgba(255, 255, 255, 0.2);
	background: rgba(255, 255, 255, 0.08);
	color: #fff;
	border-radius: 50%;
	cursor: pointer;
	display: grid;
	place-items: center;
}
.gt-lb-close { width: 40px; height: 40px; font-size: 24px; }
.gt-lb-nav { width: 48px; height: 48px; font-size: 30px; flex: none; }
.gt-lb-close:hover, .gt-lb-nav:hover { background: rgba(255, 255, 255, 0.2); }
.gt-lb-close:focus-visible, .gt-lb-nav:focus-visible { outline: 3px solid var(--gt-select); }
.gt-lightbox.is-single .gt-lb-nav { visibility: hidden; }
.gt-lb-stage { flex: 1; min-height: 0; display: flex; align-items: center; gap: 12px; padding: 12px; }
.gt-lb-fig { flex: 1; min-width: 0; height: 100%; margin: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; touch-action: pan-y; }
.gt-lb-fig img { max-width: 100%; max-height: calc(100% - 40px); object-fit: contain; border-radius: 4px; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5); user-select: none; -webkit-user-drag: none; }
.gt-lb-fig figcaption { text-align: center; font-size: 15px; color: rgba(242, 245, 243, 0.85); max-width: 70ch; }
.gt-lb-strip { display: flex; gap: 6px; justify-content: center; padding: 0 12px 14px; overflow-x: auto; }
.gt-lb-strip .gt-thumb { width: 56px; flex: none; opacity: 0.55; }
.gt-lb-strip .gt-thumb.is-current { opacity: 1; outline: 2px solid #fff; }
@media (max-width: 640px) { .gt-lb-nav { position: absolute; bottom: 90px; } .gt-lb-prev { left: 12px; } .gt-lb-next { right: 12px; } }

/* "All trees" view with a primary tree: thicker lines and higher-floating
   cards for the primary tree, thin lines and low cards for the others. */
.gt-multi .gt-edge.is-primary { stroke-width: 3.5; }
.gt-multi .gt-edge.is-secondary { stroke-width: 1.25; opacity: 0.8; }
.gt-multi.lod-1 .gt-edge.is-primary { stroke-width: 5.5; }
.gt-multi.lod-1 .gt-edge.is-secondary { stroke-width: 1.75; }
.gt-multi.lod-0 .gt-edge.is-primary { stroke-width: 9; }
.gt-multi.lod-0 .gt-edge.is-secondary { stroke-width: 2.5; }
.gt-multi.has-selection .gt-edge.is-secondary { opacity: 0.3; }
.gt-multi.has-selection .gt-edge.is-related { opacity: 1; }

.gt-multi .gt-card.is-primary { box-shadow: 0 10px 26px rgba(20, 40, 30, 0.28), var(--gt-shadow); }
.gt-multi .gt-card.is-secondary { box-shadow: 0 1px 3px rgba(20, 40, 30, 0.18); }

.gt-mode-tilt.gt-multi .gt-card.is-primary {
	transform: translateZ(48px);
	box-shadow: 0 64px 34px -22px rgba(20, 40, 30, 0.42), var(--gt-shadow);
}
.gt-mode-tilt.gt-multi .gt-card.is-secondary {
	transform: translateZ(7px);
	box-shadow: 0 9px 8px -5px rgba(20, 40, 30, 0.3);
}
/* A slow, gentle bob for the primary tree (skipped for very large trees). */
@keyframes gt-float {
	0%, 100% { translate: 0 0 0; }
	50% { translate: 0 0 9px; }
}
.gt-mode-tilt.gt-multi.gt-bob .gt-card.is-primary { animation: gt-float 4.5s ease-in-out infinite; }
.gt-mode-tilt.gt-multi .gt-card.is-selected { transform: translateZ(60px); animation: none; box-shadow: 0 0 0 4px var(--gt-select), 0 60px 40px -20px rgba(20, 40, 30, 0.45); }
@media (prefers-reduced-motion: reduce) { .gt-mode-tilt.gt-multi.gt-bob .gt-card.is-primary { animation: none; } }

.gt-legend {
	position: absolute;
	left: 12px;
	bottom: 58px;
	z-index: 3;
	display: grid;
	gap: 6px;
	padding: 9px 12px;
	border-radius: 10px;
	background: var(--gt-chrome);
	border: 1px solid var(--gt-border);
	box-shadow: var(--gt-shadow);
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	color: var(--gt-ink);
	font-size: 12.5px;
	pointer-events: none;
}
.gt-legend-row { display: flex; align-items: center; gap: 8px; }
.gt-legend-card {
	width: 18px;
	height: 13px;
	border-radius: 3px;
	background: var(--gt-card);
	border: 1px solid var(--gt-border);
	border-top: 3px solid var(--gt-select);
}
.gt-legend-row.is-primary .gt-legend-card { box-shadow: 0 5px 7px -2px rgba(20, 40, 30, 0.45); transform: translateY(-2px); }
.gt-legend-row.is-secondary .gt-legend-card { box-shadow: none; border-top-color: var(--gt-muted); }
.gt-legend-line { width: 28px; height: 0; border-top: 4px solid var(--gt-line); border-radius: 2px; }
.gt-legend-row.is-secondary .gt-legend-line { border-top-width: 1.5px; opacity: 0.85; }
@media (max-width: 640px) { .gt-legend { bottom: 12px; font-size: 12px; } }
