/* ===== Блок «Графики и показатели» ===== */

.chart-block .chart-card__title {
	font-size: 16px;
	font-weight: 700;
	line-height: 1.3;
	color: var(--c-ink);
	letter-spacing: -0.01em;
}

/* Легенда линий */
.chart-block .chart-legend {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 22px;
	font-size: 12.5px;
	color: var(--c-muted);
}
.chart-block .chart-legend li {
	display: inline-flex;
	align-items: center;
	gap: 7px;
}
.chart-block .chart-legend i {
	width: 9px;
	height: 9px;
	border-radius: 50%;
	background: var(--c);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 18%, transparent);
}
.chart-block--ads .chart-legend i {
	width: 14px;
	height: 7px;
	border-radius: 4px;
	box-shadow: none;
}

/* Фигура графика: до отрисовки видна таблица, после — canvas (таблица остаётся для дикторов) */
.chart-block .chart-fig {
	position: relative;
	min-width: 0;
}
.chart-block .chart-fig__plot {
	position: relative;
	height: 290px;
	display: none;
}
.chart-block .chart-fig.is-ready .chart-fig__plot {
	display: block;
}
.chart-block .chart-fig.is-ready .chart-table-wrap {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}
.chart-block .chart-table-wrap {
	overflow-x: auto;
}
.chart-block .chart-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 13px;
	font-variant-numeric: tabular-nums;
}
.chart-block .chart-table caption {
	text-align: left;
	font-size: 12px;
	color: var(--c-muted);
	padding-bottom: 8px;
}
.chart-block .chart-table th,
.chart-block .chart-table td {
	padding: 6px 10px;
	border-bottom: 1px solid var(--c-line);
	text-align: right;
}
.chart-block .chart-table th:first-child {
	text-align: left;
}
.chart-block .chart-table thead th {
	font-weight: 600;
	color: var(--c-ink);
	font-size: 12px;
}
.chart-block .chart-table tbody th {
	font-weight: 500;
	color: var(--c-muted);
}

/* Выноска у конца линии */
.chart-block .chart-fig__callout {
	display: inline-flex;
	flex-direction: column;
	align-items: center;
	gap: 1px;
	margin-bottom: 12px;
	padding: 9px 16px 10px;
	border-radius: 10px;
	background: linear-gradient(180deg, #1fd59b 0%, #10c088 100%);
	color: #fff;
	text-align: center;
	line-height: 1.2;
	box-shadow: 0 10px 24px rgba(16, 192, 136, 0.3);
	white-space: nowrap;
}
.chart-block .chart-fig__callout span {
	font-size: 12px;
	opacity: 0.95;
}
.chart-block .chart-fig__callout b {
	font-size: 17px;
	font-weight: 700;
}
.chart-block .chart-fig.is-ready .chart-fig__callout {
	position: absolute;
	z-index: 2;
	margin: 0;
	transform: translate(-50%, calc(-100% - 14px));
	pointer-events: none;
}
.chart-block .chart-fig.is-ready .chart-fig__callout::after {
	content: "";
	position: absolute;
	top: 100%;
	left: var(--tip, 50%);
	width: 0;
	height: 0;
	margin-left: -7px;
	border: 7px solid transparent;
	border-top-color: #10c088;
}

/* ----- Вид «Результаты SEO» ----- */
.chart-block .chart-seo {
	display: grid;
	grid-template-columns: minmax(0, 0.78fr) minmax(0, 1.22fr);
	gap: 40px;
	align-items: center;
	padding: 32px 36px 28px;
}
.chart-block .chart-seo__big {
	font-size: clamp(44px, 4.6vw, 60px);
	font-weight: 800;
	line-height: 1;
	letter-spacing: -0.03em;
	color: var(--c-accent-ink);
}
.chart-block .chart-seo__label {
	margin-top: 12px;
	max-width: 300px;
	font-size: 18px;
	line-height: 1.4;
	color: var(--c-text);
}
.chart-block .chart-seo__stats {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, auto));
	justify-content: start;
	gap: 16px 36px;
	margin-top: 36px;
}
.chart-block .chart-seo__stats li {
	display: flex;
	flex-direction: column;
	gap: 6px;
	min-width: 0;
}
.chart-block .chart-seo__stats b {
	font-size: 22px;
	line-height: 1.1;
	font-weight: 700;
	color: #0a8f63;
	letter-spacing: -0.01em;
	white-space: nowrap;
}
.chart-block .chart-seo__stats span {
	font-size: 12px;
	line-height: 1.35;
	color: var(--c-muted);
}
.chart-block .chart-seo__chart {
	display: grid;
	gap: 14px;
	min-width: 0;
}
.chart-block .chart-seo__chart .chart-legend {
	justify-content: center;
}

/* Макет SEO: карточка ≈285, цифра 50, подпись 19 в три строки, график ≈700×225, легенда слева над графиком */
@media (min-width: 1101px) {
	.chart-block .chart-seo {
		grid-template-columns: minmax(0, 520fr) minmax(0, 700fr);
		gap: 20px;
		padding: 26px 30px 22px 30px;
	}
	.chart-block .chart-seo__big {
		font-size: 50px;
	}
	.chart-block .chart-seo__label {
		margin-top: 8px;
		max-width: 270px;
		font-size: 19px;
	}
	.chart-block .chart-seo__stats {
		gap: 16px 60px;
		margin-top: 32px;
	}
	.chart-block .chart-seo__stats b {
		font-size: 26px;
	}
	.chart-block .chart-seo__stats span {
		font-size: 13px;
	}
	.chart-block--seo .chart-fig__plot {
		height: 225px;
	}
	.chart-block .chart-seo__chart {
		gap: 10px;
	}
	.chart-block .chart-seo__chart .chart-legend {
		justify-content: flex-start;
		padding-left: 75px;
	}
}

/* ----- Вид «Показатели рекламы» ----- */
.chart-block .chart-kpis {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 20px;
	margin-bottom: 20px;
}
.chart-block .chart-kpi {
	display: flex;
	align-items: center;
	gap: 18px;
	padding: 22px 24px;
	min-width: 0;
}
.chart-block .chart-kpi__icon {
	color: var(--c-accent-ink);
	flex: none;
}
.chart-block .chart-kpi__icon .icon {
	width: 44px;
	height: 44px;
	stroke-width: 1.5;
}
.chart-block .chart-kpi__body {
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-width: 0;
}
.chart-block .chart-kpi__value {
	font-size: 24px;
	line-height: 1.1;
	font-weight: 700;
	letter-spacing: -0.02em;
	color: var(--c-accent-ink);
}
.chart-block .chart-kpi__label {
	font-size: 13px;
	line-height: 1.35;
	color: var(--c-muted);
}
.chart-block .chart-pair {
	display: grid;
	grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
	gap: 20px;
	align-items: stretch;
}
.chart-block .chart-pair--single {
	grid-template-columns: minmax(0, 1fr);
}
.chart-block .chart-card {
	display: flex;
	flex-direction: column;
	gap: 16px;
	padding: 24px 26px 20px;
	min-width: 0;
}
.chart-block .chart-card__head {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 8px 24px;
}
.chart-block--ads .chart-fig__plot {
	height: 270px;
}

/* Кольцевая диаграмма */
.chart-block .chart-donut {
	flex: 1;
	display: flex;
	align-items: center;
	gap: 26px;
}
.chart-block .chart-donut__ring {
	position: relative;
	flex: none;
	width: 196px;
	aspect-ratio: 1;
	border-radius: 50%;
	background: var(--ring);
}
/* Без JS: кольцо из conic-gradient с белой серединой */
.chart-block .chart-donut__ring::before {
	content: "";
	position: absolute;
	inset: 18%;
	border-radius: 50%;
	background: #fff;
}
.chart-block .chart-donut__ring canvas {
	display: none;
}
.chart-block .chart-donut.is-ready .chart-donut__ring {
	background: none;
}
.chart-block .chart-donut.is-ready .chart-donut__ring::before {
	display: none;
}
.chart-block .chart-donut.is-ready .chart-donut__ring canvas {
	display: block;
	position: relative;
	z-index: 1;
}
.chart-block .chart-donut__center {
	position: absolute;
	inset: 0;
	z-index: 2;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	text-align: center;
	pointer-events: none;
}
.chart-block .chart-donut__center b {
	font-size: 28px;
	line-height: 1.05;
	font-weight: 700;
	letter-spacing: -0.02em;
	color: var(--c-ink);
}
.chart-block .chart-donut__center span {
	font-size: 13px;
	color: var(--c-muted);
}
.chart-block .chart-donut__legend {
	flex: 1;
	display: grid;
	gap: 14px;
	min-width: 0;
	font-size: 13px;
}
.chart-block .chart-donut__legend li {
	display: flex;
	align-items: center;
	gap: 10px;
}
.chart-block .chart-donut__legend i {
	width: 9px;
	height: 9px;
	border-radius: 50%;
	background: var(--c);
	flex: none;
}
.chart-block .chart-donut__legend span {
	flex: 1;
	color: var(--c-text);
	min-width: 0;
}
.chart-block .chart-donut__legend b {
	font-weight: 600;
	color: var(--c-ink);
	font-variant-numeric: tabular-nums;
}

/* Тёмный фон секции */
.chart-block.section--dark .chart-card,
.chart-block.section--dark .chart-seo,
.chart-block.section--dark .chart-kpi {
	background: #fff;
}

/* Макет «Кейс — контекстная реклама»: плашки ≈300×124, иконка 52, цифра 30, подпись 15 */
@media (min-width: 1181px) {
	.chart-block .chart-kpi {
		min-height: 124px;
		padding: 22px 20px 22px 28px;
		gap: 22px;
	}
	.chart-block .chart-kpi__icon .icon {
		width: 52px;
		height: 52px;
	}
	.chart-block .chart-kpi__value {
		font-size: 30px;
	}
	.chart-block .chart-kpi__label {
		font-size: 15px;
		color: #3c4650;
	}
}

/* ----- Адаптив ----- */
@media (max-width: 1180px) {
	.chart-block .chart-kpis {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
	.chart-block .chart-pair {
		grid-template-columns: minmax(0, 1fr);
	}
}
@media (max-width: 1024px) {
	.chart-block .chart-seo {
		grid-template-columns: minmax(0, 1fr);
		gap: 28px;
	}
	.chart-block .chart-seo__label {
		max-width: 460px;
	}
	.chart-block .chart-seo__stats {
		margin-top: 24px;
	}
}
@media (max-width: 640px) {
	.chart-block .chart-seo {
		padding: 22px 18px 18px;
	}
	.chart-block .chart-seo__label {
		font-size: 16px;
	}
	.chart-block .chart-seo__stats {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 18px 20px;
	}
	.chart-block .chart-seo__stats b {
		font-size: 20px;
	}
	.chart-block .chart-fig__plot,
	.chart-block--ads .chart-fig__plot {
		height: 240px;
	}
	.chart-block .chart-kpis {
		gap: 12px;
	}
	.chart-block .chart-kpi {
		flex-direction: column;
		align-items: flex-start;
		gap: 10px;
		padding: 16px;
	}
	.chart-block .chart-kpi__icon .icon {
		width: 34px;
		height: 34px;
	}
	.chart-block .chart-kpi__value {
		font-size: 21px;
	}
	.chart-block .chart-card {
		padding: 20px 16px 16px;
	}
	.chart-block .chart-donut {
		flex-direction: column;
		align-items: stretch;
		gap: 22px;
	}
	.chart-block .chart-donut__ring {
		width: 190px;
		align-self: center;
	}
}
/* Телефон: три цифры по 2 в ряд — третья на всю строку */
@media (max-width: 640px) {
	.chart-block .chart-seo__stats > :last-child:nth-child(odd):not(:only-child) {
		grid-column: 1 / -1;
	}
}
