/* ==========================================================================
   Módulo de gráficos por shortcode — Abogados Menz 2026
   Base compartida (patrón docs/MANUAL-GRAFICOS-SHORTCODE.md).

   Reglas del patrón:
   - Todo el CSS del módulo vive aquí (nada de <style> en el contenido).
   - Solo .am-graf-base define clases compartidas; cada gráfico con diseño
     propio debe scoping 100% bajo su propio contenedor.
   - Carga únicamente en posts que usan un shortcode del registro (init.php).

   Paleta del sitio: azul petróleo #04354f + ámbar #efb810.
   ========================================================================== */

.am-graf-base {
	--am-graf-azul: #04354f;
	--am-graf-azul-medio: #3d6e8c;
	--am-graf-azul-suave: #9db8c9;
	--am-graf-ambar: #efb810;
	--am-graf-gris-fondo: #f5f7f9;
	--am-graf-gris-borde: #dde4ea;
	--am-graf-gris-barra: #c4cfd8;
	--am-graf-texto: #2b3440;
	--am-graf-texto-claro: #6b7684;

	font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	color: var(--am-graf-texto);
	line-height: 1.5;
	margin: 1.5rem 0;
}

/* --------------------------------------------------------------------------
   Barras animadas (.am-graf-anim-bar + data-width="NN%")
   -------------------------------------------------------------------------- */

.am-graf-base .am-graf-bar-item {
	margin-bottom: 1.25rem;
}

.am-graf-base .am-graf-bar-item:last-child {
	margin-bottom: 0;
}

.am-graf-base .am-graf-bar-labels {
	display: flex;
	justify-content: space-between;
	gap: 0.75rem;
	margin-bottom: 0.4rem;
	font-weight: 600;
	font-size: 0.95rem;
}

.am-graf-base .am-graf-bar-labels .am-graf-bar-valor {
	font-weight: 800;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
	color: var(--am-graf-azul);
}

.am-graf-base .am-graf-bar-track {
	width: 100%;
	height: 18px;
	background-color: var(--am-graf-gris-fondo);
	border: 1px solid var(--am-graf-gris-borde);
	border-radius: 9px;
	overflow: hidden;
}

.am-graf-base .am-graf-bar-fill {
	height: 100%;
	width: 0%;
	border-radius: 9px;
	transition: width 1.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Variantes de color de barra */
.am-graf-base .am-graf-fill-azul { background-color: var(--am-graf-azul); }
.am-graf-base .am-graf-fill-azul-medio { background-color: var(--am-graf-azul-medio); }
.am-graf-base .am-graf-fill-azul-suave { background-color: var(--am-graf-azul-suave); }
.am-graf-base .am-graf-fill-ambar { background-color: var(--am-graf-ambar); }
.am-graf-base .am-graf-fill-gris { background-color: var(--am-graf-gris-barra); }

/* --------------------------------------------------------------------------
   Donut (.am-graf-donut-chart + data-target="48.2" — conic-gradient animado)
   El texto central vive en .am-graf-donut-counter (data-final="48,2%").
   -------------------------------------------------------------------------- */

.am-graf-base .am-graf-donut {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 2rem;
	background: var(--am-graf-gris-fondo);
	padding: 1.5rem;
	border-radius: 12px;
	flex-wrap: wrap;
}

.am-graf-base .am-graf-donut-chart {
	width: 150px;
	height: 150px;
	border-radius: 50%;
	background: conic-gradient(var(--am-graf-gris-borde) 100%, var(--am-graf-gris-borde) 0);
	display: flex;
	align-items: center;
	justify-content: center;
	position: relative;
	flex-shrink: 0;
}

.am-graf-base .am-graf-donut-inner {
	width: 108px;
	height: 108px;
	background-color: var(--am-graf-gris-fondo);
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 1.75rem;
	font-weight: 900;
	color: var(--am-graf-azul);
	box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.am-graf-base .am-graf-donut-side {
	flex: 1;
	min-width: 220px;
}

.am-graf-base .am-graf-donut-leyenda {
	display: flex;
	gap: 1.25rem;
	flex-wrap: wrap;
	margin-top: 0.75rem;
	font-size: 0.875rem;
	color: var(--am-graf-texto-claro);
}

.am-graf-base .am-graf-chip {
	display: inline-block;
	width: 12px;
	height: 12px;
	border-radius: 3px;
	margin-right: 0.4rem;
	vertical-align: middle;
}

.am-graf-base .am-graf-chip--azul { background-color: var(--am-graf-azul); }
.am-graf-base .am-graf-chip--gris { background-color: var(--am-graf-gris-borde); }

/* --------------------------------------------------------------------------
   Cifras clave (.am-graf-stat-row + .am-graf-counter + data-target)
   El contenido inicial del span es el valor FINAL formateado: quien no
   ejecuta JS (y los rastreadores) ven la cifra real, no un 0.
   -------------------------------------------------------------------------- */

.am-graf-base .am-graf-stat-row {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
	gap: 1.25rem;
	background: var(--am-graf-gris-fondo);
	padding: 1.5rem;
	border-radius: 12px;
	text-align: center;
}

.am-graf-base .am-graf-stat-num {
	font-size: 1.875rem;
	font-weight: 900;
	color: var(--am-graf-azul);
	line-height: 1.15;
	font-variant-numeric: tabular-nums;
}

/* Cifra destacada: se enfatiza por tamaño (el ámbar #efb810 no tiene
   contraste suficiente como color de texto sobre fondo claro). */
.am-graf-base .am-graf-stat-num--destacado {
	font-size: 2.375rem;
}

.am-graf-base .am-graf-stat-desc {
	font-size: 0.875rem;
	color: var(--am-graf-texto-claro);
	margin-top: 0.25rem;
}
