/**
 * Topic Constellation – frontend styles
 */

.oc-topic-constellation {
	--oc-tc-text: #1a1a1a;
	--oc-tc-diamond: #6b7a67;
	--oc-tc-line: #1a1a1a;
	--oc-tc-hover-scale: 1.08;
	--oc-tc-gap-label: 10px;
	--oc-tc-line-width: 42px;
	--oc-tc-line-height: 1px;
	--oc-tc-diamond-size: 9px;
	position: relative;
	isolation: isolate;
	width: 100%;
	box-sizing: border-box;
	overflow: hidden;
}

.oc-topic-constellation *,
.oc-topic-constellation *::before,
.oc-topic-constellation *::after {
	box-sizing: border-box;
}

.oc-topic-constellation__bg {
	position: absolute;
	inset: 0;
	z-index: 0;
	background-repeat: no-repeat;
	background-size: cover;
	background-position: center center;
	pointer-events: none;
}

.oc-topic-constellation__canvas {
	position: relative;
	z-index: 1;
	width: 100%;
	min-height: 420px;
}

.oc-topic-constellation__item {
	position: absolute;
	z-index: 1;
	max-width: min(280px, 42vw);
	transform: translate(-50%, -50%) scale(1);
	transform-origin: center center;
	transition: transform 0.35s ease, z-index 0s linear 0.35s;
	will-change: transform;
}

.oc-topic-constellation__item:hover,
.oc-topic-constellation__item:focus-within {
	z-index: 5;
	transform: translate(-50%, -50%) scale(var(--oc-tc-hover-scale));
	transition: transform 0.35s ease, z-index 0s;
}

.oc-topic-constellation__link {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: var(--oc-tc-gap-label);
	text-decoration: none;
	color: inherit;
	border: 0;
	outline: none;
	background: transparent;
	cursor: pointer;
	padding: 0;
	margin: 0;
	text-align: center;
}

.oc-topic-constellation__link:hover,
.oc-topic-constellation__link:focus,
.oc-topic-constellation__link:focus-visible,
.oc-topic-constellation__link:active {
	border: 0;
	outline: none;
	box-shadow: none;
	text-decoration: none;
	color: inherit;
}

.oc-topic-constellation__label {
	margin: 0;
	color: var(--oc-tc-text);
	font-family: Georgia, 'Times New Roman', serif;
	font-size: clamp(1rem, 1.6vw, 1.35rem);
	font-weight: 400;
	line-height: 1.25;
	letter-spacing: -0.01em;
	transition: color 0.3s ease, font-family 0.3s ease, font-weight 0.3s ease;
}

.oc-topic-constellation__mark {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	width: max-content;
	max-width: 100%;
}

.oc-topic-constellation__line {
	display: block;
	flex: 0 0 auto;
	width: var(--oc-tc-line-width);
	height: var(--oc-tc-line-height);
	background-color: var(--oc-tc-line);
	opacity: 0;
	transform: scaleX(0);
	transform-origin: center;
	transition: opacity 0.3s ease, transform 0.35s ease;
}

.oc-topic-constellation__line.is-left {
	transform-origin: right center;
}

.oc-topic-constellation__line.is-right {
	transform-origin: left center;
}

.oc-topic-constellation__diamond {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	line-height: 1;
	color: var(--oc-tc-diamond);
	font-size: var(--oc-tc-diamond-size);
	transition: transform 0.3s ease, color 0.3s ease;
}

.oc-topic-constellation__diamond.is-css {
	width: var(--oc-tc-diamond-size);
	height: var(--oc-tc-diamond-size);
	background-color: var(--oc-tc-diamond);
	transform: rotate(45deg);
	color: transparent;
	font-size: 0;
}

.oc-topic-constellation__item:hover .oc-topic-constellation__line,
.oc-topic-constellation__item:focus-within .oc-topic-constellation__line,
.oc-topic-constellation__item.is-active .oc-topic-constellation__line {
	opacity: 1;
	transform: scaleX(1);
}

.oc-topic-constellation__item:hover .oc-topic-constellation__label,
.oc-topic-constellation__item:focus-within .oc-topic-constellation__label,
.oc-topic-constellation__item.is-active .oc-topic-constellation__label {
	font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
	font-weight: 600;
}

.oc-topic-constellation.is-lines-always .oc-topic-constellation__line {
	opacity: 1;
	transform: scaleX(1);
}

@media (max-width: 767px) {
	.oc-topic-constellation__canvas {
		display: flex;
		flex-direction: column;
		align-items: center;
		gap: 36px;
		min-height: 0 !important;
		padding: 8px 0;
	}

	.oc-topic-constellation__item {
		position: relative !important;
		left: auto !important;
		top: auto !important;
		max-width: 100%;
		transform: none;
	}

	.oc-topic-constellation__item:hover,
	.oc-topic-constellation__item:focus-within {
		transform: scale(var(--oc-tc-hover-scale));
	}

	.oc-topic-constellation__label {
		font-size: 1.15rem;
	}
}
