/**
 * Inoforest Audience Stats
 *
 * Contents
 * 1. Grid (variables)
 * 2. Number tiles: icon, number, label
 * 3. Breakdown cards: title, rows, bars
 * 4. Plain style, editor hint
 *
 * Colours read the Design System (--inoforest-color-*) with fallbacks. Style-tab controls target the parts with three
 * classes, one more than the rules here, so a choice in the panel always wins.
 */

/* 1. Grid ------------------------------------------------------------------ */
.inoforest-audience-stats {
	--ino-as-columns: 4;
	--ino-as-gap: 20px;
	--ino-as-breakdown-min: 260px;
	--ino-as-primary: var(--inoforest-color-primary, #0b7a75);
	--ino-as-heading: var(--inoforest-color-heading, #0d1b2a);
}

.inoforest-audience-stats .inoforest-audience-stats__metrics {
	display: grid;
	grid-template-columns: repeat(var(--ino-as-columns), minmax(0, 1fr));
	gap: var(--ino-as-row-gap, var(--ino-as-gap)) var(--ino-as-gap);
	margin: 0;
	padding: 0;
	list-style: none;
}

.inoforest-audience-stats .inoforest-audience-stats__breakdowns {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(var(--ino-as-breakdown-min), 100%), 1fr));
	gap: var(--ino-as-row-gap, var(--ino-as-gap)) var(--ino-as-gap);
}

.inoforest-audience-stats__metrics + .inoforest-audience-stats__breakdowns {
	margin-top: var(--ino-as-row-gap, var(--ino-as-gap));
}

/* 2. Number tiles ------------------------------------------------------------ */
.inoforest-audience-stats .inoforest-audience-stats__metric {
	min-width: 0;
	height: 100%;
	margin: 0;
	padding: 28px 20px;
	text-align: center;
	background-color: var(--inoforest-color-background, #fff);
	border: 1px solid var(--inoforest-color-border, #e3e9ee);
	border-radius: 20px;
	box-sizing: border-box;
}

/* The icon sits in the tile's first line, as an inline icon would. */
.inoforest-audience-stats .inoforest-audience-stats__metric-icon {
	font-size: 1.6rem;
	color: var(--ino-as-primary);
}

.inoforest-audience-stats__metric-icon svg {
	width: 1em;
	height: 1em;
	fill: currentColor;
	vertical-align: -0.125em;
}

.inoforest-audience-stats .inoforest-audience-stats__metric-number {
	display: block;
	margin: 6px 0 2px;
	font-family: var(--inoforest-font-heading-family, inherit);
	font-size: 2.4rem;
	font-weight: 600;
	line-height: 1.1;
	color: var(--ino-as-heading);
}

.inoforest-audience-stats .inoforest-audience-stats__metric-label {
	font-size: 0.9rem;
	color: var(--inoforest-color-muted, var(--inoforest-color-text, #5a6a79));
}

/* 3. Breakdown cards ------------------------------------------------------------ */
.inoforest-audience-stats .inoforest-audience-stats__breakdown {
	min-width: 0;
	padding: 28px;
	background-color: var(--inoforest-color-background, #fff);
	border: 1px solid var(--inoforest-color-border, #e3e9ee);
	border-radius: 20px;
}

.inoforest-audience-stats .inoforest-audience-stats__title {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 0 0 20px;
	font-family: var(--inoforest-font-heading-family, inherit);
	font-size: 1.2rem;
	font-weight: var(--inoforest-font-heading-weight, 600);
	line-height: 1.15;
	color: var(--ino-as-heading);
}

.inoforest-audience-stats .inoforest-audience-stats__title-icon {
	display: inline-flex;
	color: var(--ino-as-primary);
}

.inoforest-audience-stats__title-icon svg {
	width: 1em;
	height: 1em;
	fill: currentColor;
}

.inoforest-audience-stats .inoforest-audience-stats__rows {
	display: grid;
	gap: 16px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.inoforest-audience-stats .inoforest-audience-stats__row {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	gap: 6px 12px;
	margin: 0;
	font-size: 0.925rem;
}

.inoforest-audience-stats .inoforest-audience-stats__row-label {
	color: var(--ino-as-heading);
	overflow-wrap: anywhere;
}

.inoforest-audience-stats .inoforest-audience-stats__row-value {
	font-weight: 700;
	color: var(--ino-as-heading);
}

.inoforest-audience-stats .inoforest-audience-stats__bar {
	display: block;
	grid-column: 1 / -1;
	height: 10px;
	overflow: hidden;
	background-color: color-mix(in srgb, var(--ino-as-primary) 10%, var(--inoforest-color-surface, #f4f6f8));
	border-radius: 999px;
}

.inoforest-audience-stats .inoforest-audience-stats__fill {
	display: block;
	width: var(--ino-as-value, 0%);
	height: 100%;
	background-color: var(--ino-as-primary);
	border-radius: 999px;
}

/* 4. Plain style, editor hint ------------------------------------------------- */
.inoforest-audience-stats:where([data-style="plain"]) :is(.inoforest-audience-stats__metric, .inoforest-audience-stats__breakdown) {
	padding-right: 0;
	padding-left: 0;
	background-color: transparent;
	border-width: 0;
}

.inoforest-audience-stats__hint {
	margin: 0;
	font-size: 0.85rem;
}
