
.ctg-shell {
	--ctg-ink: #171512;
	--ctg-paper: #f4efe5;
	--ctg-paper-2: #ebe3d5;
	--ctg-accent: #a54932;
	--ctg-line: rgba(23, 21, 18, 0.22);
	--ctg-height: 640px;
	background: var(--ctg-paper);
	border: 1px solid rgba(23, 21, 18, 0.12);
	border-radius: 22px;
	color: var(--ctg-ink);
	overflow: hidden;
	box-shadow: 0 18px 50px rgba(23, 21, 18, 0.08);
}

.ctg-shell * { box-sizing: border-box; }

.ctg-header {
	display: flex;
	gap: 28px;
	align-items: end;
	justify-content: space-between;
	padding: 28px 30px 20px;
	background: var(--ctg-ink);
	color: var(--ctg-paper);
}

.ctg-kicker {
	margin: 0 0 4px;
	font-size: 12px;
	letter-spacing: .16em;
	text-transform: uppercase;
	opacity: .72;
}

.ctg-heading {
	margin: 0;
	font-size: clamp(28px, 4vw, 46px);
	line-height: 1;
	font-weight: 650;
}

.ctg-intro {
	max-width: 720px;
	margin: 10px 0 0;
	font-size: 14px;
	line-height: 1.7;
	opacity: .78;
}

.ctg-filters {
	display: flex;
	flex-wrap: wrap;
	justify-content: flex-end;
	gap: 7px;
}

.ctg-filters button {
	border: 1px solid rgba(244,239,229,.28);
	border-radius: 999px;
	background: transparent;
	color: var(--ctg-paper);
	padding: 8px 13px;
	font: inherit;
	font-size: 12px;
	cursor: pointer;
}

.ctg-filters button:hover,
.ctg-filters button:focus-visible,
.ctg-filters button.is-active {
	background: var(--ctg-paper);
	color: var(--ctg-ink);
	outline: none;
}

.ctg-stage-wrap {
	position: relative;
	display: grid;
	grid-template-columns: minmax(0, 1fr) 320px;
	min-height: var(--ctg-height);
}

.ctg-stage {
	position: relative;
	min-height: var(--ctg-height);
	overflow: hidden;
	background:
		linear-gradient(rgba(23,21,18,.035) 1px, transparent 1px),
		linear-gradient(90deg, rgba(23,21,18,.035) 1px, transparent 1px),
		var(--ctg-paper);
	background-size: 38px 38px;
}

.ctg-stage:focus-visible {
	outline: 2px solid var(--ctg-accent);
	outline-offset: -2px;
}

.ctg-edges,
.ctg-nodes {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
}

.ctg-edges {
	z-index: 1;
	pointer-events: none;
}

.ctg-nodes {
	z-index: 2;
	pointer-events: none;
}

.ctg-edge-line {
	stroke: rgba(23,21,18,.28);
	stroke-width: 1.4;
}

.ctg-edge-label {
	fill: rgba(23,21,18,.62);
	font-size: 10px;
	text-anchor: middle;
	paint-order: stroke;
	stroke: var(--ctg-paper);
	stroke-width: 4px;
	stroke-linejoin: round;
}

.ctg-node {
	position: absolute;
	z-index: 1;
	pointer-events: auto;
	transform: translate(-50%, -50%);
	min-width: 78px;
	max-width: 150px;
	border: 1px solid rgba(23,21,18,.22);
	border-radius: 15px;
	background: rgba(244,239,229,.96);
	color: var(--ctg-ink);
	padding: 10px 12px 9px;
	box-shadow: 0 8px 22px rgba(23,21,18,.08);
	cursor: pointer;
	text-align: left;
	font: inherit;
	transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease, opacity .16s ease;
}

.ctg-node:hover,
.ctg-node:focus-visible,
.ctg-node.is-selected {
	transform: translate(-50%, -50%) scale(1.045);
	border-color: var(--ctg-accent);
	box-shadow: 0 10px 28px rgba(23,21,18,.13);
	outline: none;
}

.ctg-node.is-dimmed { opacity: .13; pointer-events: none; }

.ctg-node-type {
	display: block;
	margin-bottom: 3px;
	font-size: 9px;
	letter-spacing: .12em;
	text-transform: uppercase;
	opacity: .58;
}

.ctg-node-label {
	display: block;
	font-size: 13px;
	font-weight: 650;
	line-height: 1.2;
}

.ctg-node[data-type="person"]::before,
.ctg-node[data-type="place"]::before,
.ctg-node[data-type="item"]::before,
.ctg-node[data-type="trace"]::before {
	content: "";
	display: inline-block;
	width: 7px;
	height: 7px;
	border-radius: 50%;
	margin-right: 6px;
	background: var(--ctg-accent);
	vertical-align: 1px;
}

.ctg-node[data-type="place"]::before { border-radius: 2px; background: #6e6a58; }
.ctg-node[data-type="item"]::before  { border-radius: 0; transform: rotate(45deg); background: #8c674d; }
.ctg-node[data-type="trace"]::before { background: #5c625f; }

.ctg-card {
	position: relative;
	padding: 22px;
	background: #fffaf1;
	border-left: 1px solid rgba(23,21,18,.12);
}

.ctg-card-close {
	position: absolute;
	right: 14px;
	top: 12px;
	width: 32px;
	height: 32px;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--ctg-ink);
	font-size: 22px;
	cursor: pointer;
}

.ctg-card-visual {
	aspect-ratio: 4 / 3;
	border-radius: 14px;
	background:
		linear-gradient(145deg, rgba(23,21,18,.08), rgba(165,73,50,.08));
	display: grid;
	place-items: center;
	margin-bottom: 18px;
	color: rgba(23,21,18,.38);
	font-size: 11px;
	letter-spacing: .12em;
}

.ctg-card-type {
	margin: 0 0 4px;
	color: var(--ctg-accent);
	font-size: 10px;
	letter-spacing: .13em;
	text-transform: uppercase;
}

.ctg-card-title {
	margin: 0;
	font-size: 26px;
	line-height: 1.2;
}

.ctg-card-excerpt {
	margin: 12px 0 16px;
	font-size: 13px;
	line-height: 1.8;
	color: rgba(23,21,18,.74);
}

.ctg-card-meta {
	margin: 0;
	border-top: 1px solid rgba(23,21,18,.10);
}

.ctg-card-meta div {
	display: grid;
	grid-template-columns: 82px 1fr;
	gap: 10px;
	padding: 10px 0;
	border-bottom: 1px solid rgba(23,21,18,.10);
	font-size: 12px;
}

.ctg-card-meta dt { opacity: .55; }
.ctg-card-meta dd { margin: 0; }

.ctg-card-link {
	display: inline-block;
	margin-top: 18px;
	color: var(--ctg-accent);
	font-size: 13px;
	text-decoration: none;
}

.ctg-empty {
	position: absolute;
	z-index: 3;
	inset: 0;
	display: grid;
	pointer-events: none;
	place-items: center;
	font-size: 13px;
	opacity: .55;
}

.ctg-empty[hidden] {
	display: none !important;
}

.ctg-footnote {
	margin: 0;
	padding: 8px 12px;
	border-top: 1px solid rgba(23,21,18,.10);
	background: var(--ctg-paper-2);
	font-size: 10px;
	text-align: right;
	letter-spacing: .06em;
	opacity: .58;
}

@media (max-width: 820px) {
	.ctg-header { align-items: flex-start; flex-direction: column; }
	.ctg-filters { justify-content: flex-start; }

	/*
	 * Mobile keeps the graph as the main canvas. Details are a bottom drawer
	 * over the graph instead of a second vertical row.
	 */
	.ctg-stage-wrap {
		display: block;
		min-height: 560px;
		overflow: hidden;
	}

	.ctg-stage {
		min-height: 560px;
	}

	.ctg-card {
		position: absolute;
		z-index: 8;
		left: 10px;
		right: 10px;
		bottom: 10px;
		max-height: min(46vh, 410px);
		overflow-y: auto;
		padding: 20px 18px 18px;
		border: 1px solid rgba(23,21,18,.14);
		border-radius: 18px;
		background: rgba(255,250,241,.96);
		box-shadow: 0 18px 46px rgba(23,21,18,.22);
		backdrop-filter: blur(10px);
		-webkit-backdrop-filter: blur(10px);
		transform: translateY(calc(100% + 24px));
		opacity: 0;
		pointer-events: none;
		transition: transform .22s ease, opacity .18s ease;
	}

	.ctg-card::before {
		content: "";
		display: block;
		width: 42px;
		height: 4px;
		margin: -8px auto 12px;
		border-radius: 999px;
		background: rgba(23,21,18,.18);
	}

	.ctg-card.is-open {
		transform: translateY(0);
		opacity: 1;
		pointer-events: auto;
	}

	.ctg-card-visual {
		float: left;
		width: 88px;
		margin: 0 14px 10px 0;
	}

	.ctg-card-title {
		font-size: 22px;
	}

	.ctg-card-excerpt {
		margin-top: 8px;
		line-height: 1.65;
	}

	.ctg-card-meta {
		clear: both;
	}
}

@media (max-width: 520px) {
	.ctg-header { padding: 22px 18px 18px; }
	.ctg-stage-wrap,
	.ctg-stage { min-height: 530px; }
	.ctg-node { min-width: 68px; max-width: 112px; padding: 8px 9px; }
	.ctg-node-label { font-size: 11px; }
	.ctg-edge-label { display: none; }
	.ctg-card { max-height: min(43vh, 360px); }
}
