/**
 * Brasiliana LOD: constelação de relacionados (gaveta da busca).
 *
 * Portado do Tainacan Semântico 0.4.0 (`relations.css`), com o prefixo trocado
 * para `blod-rel` (os dois plugins podem conviver no mesmo site) e sem as regras
 * de modo escuro: a gaveta deste plugin é sempre clara e fixa `color-scheme`.
 * Cada museu ganha um matiz por `--h`.
 */
.blod-rel {
	--blodrel-ink: currentColor;
	--blodrel-line: color-mix(in srgb, currentColor 18%, transparent);
	--blodrel-soft: color-mix(in srgb, currentColor 6%, transparent);
	--blodrel-muted: color-mix(in srgb, currentColor 62%, transparent);
	--blodrel-card: color-mix(in srgb, Canvas 94%, currentColor 6%);
	--blodrel-radius: 14px;

	margin: 3rem 0 2rem;
	padding: clamp(1rem, 2.5vw, 1.75rem);
	border: 1px solid var(--blodrel-line);
	border-radius: calc(var(--blodrel-radius) + 4px);
	background:
		radial-gradient(120% 90% at 50% 0%, color-mix(in srgb, currentColor 7%, transparent), transparent 70%),
		var(--blodrel-soft);
	color: inherit;
	line-height: 1.5;
	container-type: inline-size;
}

.blod-rel *,
.blod-rel *::before,
.blod-rel *::after {
	box-sizing: border-box;
}

.blod-rel-header {
	margin-bottom: 1rem;
}

.blod-rel-title {
	margin: 0 0 0.25rem;
	font-size: clamp(1.25rem, 2.2vw, 1.6rem);
	letter-spacing: -0.01em;
}

.blod-rel-summary {
	margin: 0;
	max-width: 62ch;
	color: var(--blodrel-muted);
}

.blod-rel-help {
	margin: 1rem 0 0;
	font-size: 0.85rem;
	color: var(--blodrel-muted);
}

/* ---- toolbar ------------------------------------------------------------ */

.blod-rel-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	margin-bottom: 0.75rem;
}

.blod-rel-legend {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
}

.blod-rel-chip,
.blod-rel-switch button {
	display: inline-flex;
	align-items: center;
	gap: 0.45rem;
	padding: 0.3rem 0.75rem;
	border: 1px solid var(--blodrel-line);
	border-radius: 999px;
	background: transparent;
	color: inherit;
	font: inherit;
	font-size: 0.82rem;
	cursor: pointer;
	transition: background 0.15s ease, border-color 0.15s ease;
}

.blod-rel-chip:hover,
.blod-rel-switch button:hover {
	background: var(--blodrel-soft);
}

.blod-rel-chip[aria-pressed='true'] {
	border-color: hsl(var(--h) 62% 46%);
	background: hsl(var(--h) 62% 46% / 0.14);
}

.blod-rel-chip-dot {
	width: 0.7rem;
	height: 0.7rem;
	border-radius: 50%;
	background: hsl(var(--h) 62% 46%);
	box-shadow: 0 0 0 3px hsl(var(--h) 62% 46% / 0.22);
}

.blod-rel-switch {
	display: inline-flex;
	padding: 3px;
	border: 1px solid var(--blodrel-line);
	border-radius: 999px;
	background: var(--blodrel-soft);
}

.blod-rel-switch button {
	border-color: transparent;
}

.blod-rel-switch button[aria-pressed='true'] {
	background: var(--blodrel-card);
	border-color: var(--blodrel-line);
	font-weight: 600;
	box-shadow: 0 1px 2px color-mix(in srgb, currentColor 14%, transparent);
}

.blod-rel button:focus-visible,
.blod-rel a:focus-visible {
	outline: 2px solid hsl(214 80% 55%);
	outline-offset: 2px;
}

/* ---- canvas ------------------------------------------------------------- */

.blod-rel-canvas {
	position: relative;
	width: 100%;
	max-width: 880px;
	margin: 0 auto;
	aspect-ratio: 760 / 600;
	border-radius: var(--blodrel-radius);
	background:
		radial-gradient(closest-side, color-mix(in srgb, currentColor 9%, transparent), transparent 78%),
		var(--blodrel-card);
	border: 1px solid var(--blodrel-line);
	overflow: hidden;
}

.blod-rel-canvas[hidden],
.blod-rel-legend[hidden],
.blod-rel-fallback[hidden],
.blod-rel-stage[hidden] {
	display: none;
}

.blod-rel-svg {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	display: block;
}

.blod-rel-bands circle {
	fill: none;
	stroke: var(--blodrel-line);
	stroke-dasharray: 2 7;
	stroke-linecap: round;
	stroke-width: 1.5;
}

/* ---- edges -------------------------------------------------------------- */

.blod-rel-edge {
	stroke: hsl(var(--h) 55% 48%);
	stroke-linecap: round;
	opacity: 0.5;
	transition: opacity 0.2s ease, stroke-width 0.2s ease;
}

.blod-rel-edge.is-shared {
	stroke-dasharray: 3 5;
	opacity: 0.38;
}

.is-enhanced:not(.is-ready) .blod-rel-edge {
	opacity: 0;
}

.blod-rel-stage.is-focus .blod-rel-edge {
	opacity: 0.08;
}

.blod-rel-stage.is-focus .blod-rel-edge.is-on {
	opacity: 0.95;
}

/* ---- nodes -------------------------------------------------------------- */

.blod-rel a.blod-rel-node {
	color: inherit;
	text-decoration: none;
	cursor: pointer;
	outline: none;
	transition: opacity 0.2s ease;
}

.blod-rel-orb {
	transform-box: fill-box;
	transform-origin: center;
	transition: transform 0.2s ease;
}

.blod-rel-hit {
	fill: transparent;
}

.blod-rel-halo {
	fill: hsl(var(--h) 62% 50% / 0.16);
	transition: fill 0.2s ease;
}

.blod-rel-ring {
	fill: color-mix(in srgb, Canvas 86%, hsl(var(--h) 62% 50%) 14%);
	stroke: hsl(var(--h) 62% 46%);
	stroke-width: 2.4;
}

.blod-rel-dot {
	fill: hsl(var(--h) 62% 46%);
}

.ring-2 .blod-rel-ring {
	stroke-width: 1.8;
}

/* Characteristics (author, technique, decade...) are not items: dashed ring, hollow centre. */
.blod-rel-node.is-attr .blod-rel-ring {
	stroke-dasharray: 4 3;
}

.blod-rel-node.is-attr .blod-rel-dot {
	fill: none;
	stroke: hsl(var(--h) 62% 46%);
	stroke-width: 2;
}

.blod-rel-node.is-attr .blod-rel-label {
	font-style: italic;
}

.blod-rel-node.is-attr:not([href]) {
	cursor: default;
}

.blod-rel-item[data-kind="attribute"] .blod-rel-link {
	font-style: italic;
}

.blod-rel-label.is-outer {
	font-size: 11.5px;
	font-weight: 500;
}

.blod-rel-label {
	fill: currentColor;
	font-size: 12.5px;
	font-weight: 600;
	paint-order: stroke;
	stroke: var(--blodrel-card);
	stroke-width: 4px;
	stroke-linejoin: round;
	pointer-events: none;
}

.blod-rel-node:hover .blod-rel-orb,
.blod-rel-node:focus-visible .blod-rel-orb,
.blod-rel-node.is-on .blod-rel-orb {
	transform: scale(1.22);
}

.blod-rel-node:hover .blod-rel-halo,
.blod-rel-node:focus-visible .blod-rel-halo,
.blod-rel-node.is-on .blod-rel-halo {
	fill: hsl(var(--h) 62% 50% / 0.3);
}

.blod-rel-node:focus-visible .blod-rel-ring {
	stroke-width: 4;
}

.blod-rel-stage.is-focus .blod-rel-node:not(.is-on) {
	opacity: 0.28;
}

.blod-rel-node.is-muted {
	opacity: 0.16;
}

.is-enhanced:not(.is-ready) .blod-rel-node {
	opacity: 0;
}

.is-ready .blod-rel-node {
	animation: blod-rel-in 0.55s cubic-bezier(0.2, 0.8, 0.2, 1) both;
	animation-delay: calc(var(--i, 0) * 28ms + 120ms);
}

@keyframes blod-rel-in {
	from {
		opacity: 0;
		transform: scale(0.4);
	}
}

/* ---- centre ------------------------------------------------------------- */

.blod-rel-center {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 22%;
	min-width: 84px;
	max-width: 150px;
	aspect-ratio: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0.15rem;
	padding: 0.6rem;
	transform: translate(-50%, -50%);
	border-radius: 50%;
	text-align: center;
	background: radial-gradient(circle at 30% 25%, hsl(var(--h) 62% 58%), hsl(var(--h) 62% 36%));
	color: #fff;
	box-shadow: 0 0 0 8px hsl(var(--h) 62% 46% / 0.16), 0 0 0 18px hsl(var(--h) 62% 46% / 0.08), 0 8px 24px hsl(var(--h) 62% 30% / 0.35);
	pointer-events: none;
}

.blod-rel-center-kind {
	font-size: clamp(0.55rem, 1.3cqi, 0.68rem);
	letter-spacing: 0.06em;
	text-transform: uppercase;
	opacity: 0.85;
}

.blod-rel-center-title {
	display: -webkit-box;
	overflow: hidden;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 3;
	font-size: clamp(0.72rem, 1.9cqi, 0.95rem);
	line-height: 1.2;
	color: #fff;
}

/* ---- tooltip ------------------------------------------------------------ */

.blod-rel-tip {
	position: absolute;
	z-index: 3;
	width: 240px;
	padding: 0.75rem 0.9rem;
	transform: translate(-50%, -100%);
	border: 1px solid hsl(var(--h) 55% 46% / 0.55);
	border-radius: 12px;
	background: var(--blodrel-card);
	color: inherit;
	font-size: 0.82rem;
	box-shadow: 0 10px 30px color-mix(in srgb, currentColor 22%, transparent);
	/* Brasiliana LOD: o balão tem botões, então recebe o ponteiro. */
	pointer-events: auto;
}

.blod-rel-tip[hidden] {
	display: none;
}

.blod-rel-tip.is-below {
	transform: translate(-50%, 0);
}

.blod-rel-tip-title {
	display: block;
	font-size: 0.95rem;
	line-height: 1.25;
}

.blod-rel-tip-kind {
	display: inline-block;
	margin: 0.2rem 0 0.4rem;
	padding: 0 0.5rem;
	border-radius: 999px;
	background: hsl(var(--h) 62% 46% / 0.16);
	color: hsl(var(--h) 62% 36%);
	font-size: 0.72rem;
	font-weight: 600;
}

.blod-rel-tip-meter {
	display: flex;
	align-items: center;
	gap: 3px;
	margin-bottom: 0.4rem;
}

.blod-rel-tip-meter i,
.blod-rel-meter i {
	display: inline-block;
	width: 14px;
	height: 5px;
	border-radius: 3px;
	background: var(--blodrel-line);
}

.blod-rel-tip-meter i.is-on,
.blod-rel-meter i.is-on {
	background: hsl(var(--h, 214) 62% 46%);
}

.blod-rel-tip-tier {
	margin-left: 0.4rem;
	color: var(--blodrel-muted);
	font-size: 0.75rem;
}

.blod-rel-tip-why {
	margin: 0 0 0.4rem;
	padding: 0;
	list-style: none;
}

.blod-rel-tip-why li {
	padding: 1px 0;
}

.blod-rel-tip-through {
	display: block;
	color: var(--blodrel-muted);
	font-size: 0.75rem;
}

.blod-rel-tip-open {
	color: hsl(var(--h) 62% 40%);
	font-size: 0.75rem;
	font-weight: 600;
}

/* Brasiliana LOD: as ações do balão são botão e link de verdade. */
.blod-rel-tip-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px 12px;
	margin-top: 0.5rem;
}

button.blod-rel-tip-open {
	margin: 0;
	padding: 5px 12px;
	border: 0;
	border-radius: 999px;
	background: hsl(var(--h) 62% 36%);
	color: #ffffff;
	font: inherit;
	font-size: 0.78rem;
	font-weight: 600;
	line-height: 1.3;
	cursor: pointer;
}

button.blod-rel-tip-open:hover,
button.blod-rel-tip-open:focus-visible {
	background: hsl(var(--h) 62% 28%);
	outline: 2px solid hsl(var(--h) 62% 36%);
	outline-offset: 2px;
}

a.blod-rel-tip-open,
.blod-rel-tip-page {
	color: hsl(var(--h) 62% 32%);
	font-size: 0.78rem;
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: 2px;
}

/* Ponto com balão fixado pelo toque. */
.blod-rel-node.is-pinned .blod-rel-halo {
	opacity: 1;
}

.blod-rel-more {
	margin: 0.75rem 0 0;
	text-align: center;
	color: var(--blodrel-muted);
	font-size: 0.82rem;
}

/* ---- list view (also the no-JavaScript view) ---------------------------- */

.blod-rel-subtitle {
	margin: 0 0 0.5rem;
	font-size: 1rem;
}

.blod-rel-list {
	display: grid;
	gap: 0.5rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.blod-rel-item {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	grid-template-areas:
		'link meter'
		'class why';
	gap: 0.1rem 1rem;
	padding: 0.7rem 0.9rem;
	border: 1px solid var(--blodrel-line);
	border-radius: 12px;
	background: var(--blodrel-card);
}

.blod-rel-item[data-ring='2'] {
	opacity: 0.88;
}

.blod-rel-link {
	grid-area: link;
	font-weight: 600;
}

.blod-rel-meter {
	grid-area: meter;
	display: flex;
	align-items: center;
	gap: 3px;
}

.blod-rel-class {
	grid-area: class;
	color: var(--blodrel-muted);
	font-size: 0.8rem;
}

.blod-rel-why {
	grid-area: why;
	justify-self: end;
	color: var(--blodrel-muted);
	font-size: 0.8rem;
	text-align: right;
}

@container (max-width: 520px) {
	.blod-rel-item {
		grid-template-columns: 1fr;
		grid-template-areas:
			'link'
			'class'
			'why'
			'meter';
	}

	.blod-rel-why {
		justify-self: start;
		text-align: left;
	}

	.blod-rel-tip {
		width: 200px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.blod-rel *,
	.blod-rel *::before,
	.blod-rel *::after {
		animation: none !important;
		transition: none !important;
	}

	.is-enhanced:not(.is-ready) .blod-rel-node,
	.is-enhanced:not(.is-ready) .blod-rel-edge {
		opacity: 1;
	}
}

@media print {
	.blod-rel-toolbar,
	.blod-rel-canvas {
		display: none;
	}

	.blod-rel-fallback[hidden] {
		display: block;
	}
}

/* Brasiliana LOD: os motivos (anel interno) são neutros — a cor é do museu. */
.blod-rel-node.is-attr .blod-rel-orb,
.blod-rel-edge.is-direct {
	filter: saturate(0);
}
