.raoa-pie-chart {
	--raoa-pie-hole: 28%;
	--raoa-pie-reveal: 100%;
	--raoa-pie-duration: 1200ms;
	--raoa-pie-gap-color: #ffffff;
	display: flex;
	flex-direction: column;
	width: 100%;
	color: #071537;
}

.raoa-pie-chart-title {
	margin: 0 0 20px;
	color: #071537;
	font-size: 22px;
	font-weight: 700;
	line-height: 1.3;
	text-align: center;
}

.raoa-pie-chart-body {
	display: flex;
	align-items: center;
	justify-content: inherit;
	gap: inherit;
	width: 100%;
}

.raoa-pie-chart-layout-bottom .raoa-pie-chart-body,
.raoa-pie-chart-layout-top .raoa-pie-chart-body,
.raoa-pie-chart-layout-none .raoa-pie-chart-body {
	flex-direction: column;
}

.raoa-pie-chart-layout-left .raoa-pie-chart-body,
.raoa-pie-chart-layout-right .raoa-pie-chart-body {
	flex-direction: row;
	flex-wrap: wrap;
}

.raoa-pie-chart-layout-left .raoa-pie-chart-legend,
.raoa-pie-chart-layout-right .raoa-pie-chart-legend {
	flex: 1 1 180px;
	min-width: 160px;
}

.raoa-pie-chart-visual {
	display: flex;
	flex-direction: column;
	align-items: center;
}

.raoa-pie-chart-canvas {
	position: relative;
	display: grid;
	place-items: center;
	width: 280px;
	height: 280px;
	max-width: 100%;
	aspect-ratio: 1 / 1;
}

.raoa-pie-chart-disk {
	position: absolute;
	inset: 0;
	border-radius: 50%;
	background-color: var(--raoa-pie-gap-color, #ffffff);
	background-repeat: no-repeat;
	transform-origin: center;
	/* Crisper outer rim so slice ends do not feather unevenly. */
	-webkit-mask-image:
		conic-gradient(from -90deg, #000 0 var(--raoa-pie-reveal), transparent 0),
		radial-gradient(closest-side, #000 99.85%, transparent 100%);
	mask-image:
		conic-gradient(from -90deg, #000 0 var(--raoa-pie-reveal), transparent 0),
		radial-gradient(closest-side, #000 99.85%, transparent 100%);
	-webkit-mask-composite: source-in;
	mask-composite: intersect;
	-webkit-mask-repeat: no-repeat;
	mask-repeat: no-repeat;
	-webkit-mask-size: 100% 100%;
	mask-size: 100% 100%;
}

/* Cap the pie apex so separator wedges meet as one clean joint. */
.raoa-pie-chart-type-pie.raoa-pie-chart-has-gaps .raoa-pie-chart-canvas::after {
	content: "";
	position: absolute;
	z-index: 1;
	width: 3.2%;
	height: 3.2%;
	min-width: 7px;
	min-height: 7px;
	border-radius: 50%;
	background: var(--raoa-pie-gap-color, #ffffff);
	pointer-events: none;
}

.raoa-pie-chart-type-donut .raoa-pie-chart-disk {
	/* Harder hole edge so gap corners finish square to the inner ring. */
	-webkit-mask-image:
		conic-gradient(from -90deg, #000 0 var(--raoa-pie-reveal), transparent 0),
		radial-gradient(
			closest-side,
			transparent calc(100% - var(--raoa-pie-hole) - 0.35px),
			#000 calc(100% - var(--raoa-pie-hole))
		);
	mask-image:
		conic-gradient(from -90deg, #000 0 var(--raoa-pie-reveal), transparent 0),
		radial-gradient(
			closest-side,
			transparent calc(100% - var(--raoa-pie-hole) - 0.35px),
			#000 calc(100% - var(--raoa-pie-hole))
		);
}

.raoa-pie-chart-center {
	position: relative;
	z-index: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 2px;
	max-width: 55%;
	text-align: center;
	pointer-events: none;
}

.raoa-pie-chart-center-value {
	display: block;
	color: #071537;
	font-size: 28px;
	font-weight: 700;
	line-height: 1.1;
}

.raoa-pie-chart-center-label {
	display: block;
	color: #5b6478;
	font-size: 13px;
	font-weight: 500;
	line-height: 1.3;
}

.raoa-pie-chart-legend {
	display: flex;
	flex-direction: column;
	gap: 12px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.raoa-pie-chart-layout-bottom .raoa-pie-chart-legend,
.raoa-pie-chart-layout-top .raoa-pie-chart-legend {
	width: 100%;
	max-width: 360px;
}

.raoa-pie-chart-legend-item {
	display: grid;
	grid-template-columns: auto 1fr auto;
	align-items: center;
	gap: 10px;
	min-width: 0;
}

.raoa-pie-chart-marker {
	display: block;
	width: 12px;
	height: 12px;
	border-radius: 3px;
	background-color: #1769f5;
	flex-shrink: 0;
}

.raoa-pie-chart-legend-label {
	min-width: 0;
	color: #071537;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.35;
	overflow-wrap: anywhere;
}

.raoa-pie-chart-legend-value {
	color: #5b6478;
	font-size: 14px;
	font-weight: 500;
	line-height: 1.35;
	white-space: nowrap;
}

@media (max-width: 767px) {
	.raoa-pie-chart-layout-left .raoa-pie-chart-body,
	.raoa-pie-chart-layout-right .raoa-pie-chart-body {
		flex-direction: column;
	}

	.raoa-pie-chart-layout-left .raoa-pie-chart-legend,
	.raoa-pie-chart-layout-right .raoa-pie-chart-legend {
		width: 100%;
		max-width: 360px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.raoa-pie-chart {
		--raoa-pie-reveal: 100%;
	}
}
