/* Data CEM · estilos de las tarjetas de gráficos. */

.cem-graf-grid {
	display: grid;
	gap: 1.5rem;
	margin: 2rem 0;
}
.cem-graf-grid--1,
.cem-graf-grid--single { grid-template-columns: 1fr; }
.cem-graf-grid--2 { grid-template-columns: repeat(2, 1fr); }
.cem-graf-grid--3 { grid-template-columns: repeat(3, 1fr); }

@media (max-width: 900px) {
	.cem-graf-grid--2,
	.cem-graf-grid--3 { grid-template-columns: 1fr; }
}

.cem-graf-card {
	margin: 0;
	background: #fff;
	border: 1px solid rgba(15, 23, 32, 0.08);
	border-radius: 6px;
	padding: 1.5rem;
	display: flex;
	flex-direction: column;
	transition: box-shadow 0.2s ease, border-color 0.2s ease;
}
.cem-graf-card:hover {
	border-color: rgba(0, 122, 114, 0.3);
	box-shadow: 0 2px 16px rgba(15, 23, 32, 0.06);
}

.cem-graf-titulo {
	font-family: var(--wp--preset--font-family--display, inherit);
	font-weight: 600;
	font-size: 1.05rem;
	line-height: 1.3;
	color: #0f1720;
	margin: 0 0 1rem;
	padding-bottom: 0.75rem;
	border-bottom: 2px solid #007a72;
}

.cem-graf-canvas-wrap {
	position: relative;
	width: 100%;
	height: 340px;
	min-height: 340px;
}
.cem-graf-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }

.cem-graf-takeaway {
	margin: 0 0 1rem;
	font-size: 0.9rem;
	line-height: 1.45;
	color: #2a2f35;
	font-weight: 600;
}
.cem-graf-takeaway::before {
	content: "";
	display: inline-block;
	width: 0.55rem;
	height: 0.55rem;
	background: #007a72;
	border-radius: 50%;
	margin-right: 0.5rem;
	vertical-align: middle;
}

.cem-graf-fuente {
	margin: 0.85rem 0 0;
	font-size: 0.72rem;
	letter-spacing: 0.02em;
	color: #5c6370;
	line-height: 1.4;
}

/* Tabla de datos expandible (accesibilidad AA) */
.cem-graf-tabla {
	margin-top: 0.85rem;
	border-top: 1px solid rgba(15, 23, 32, 0.08);
	padding-top: 0.5rem;
}
.cem-graf-tabla summary {
	cursor: pointer;
	font-size: 0.72rem;
	text-transform: uppercase;
	letter-spacing: 0.12em;
	color: #007a72;
	font-weight: 600;
	list-style: none;
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
}
.cem-graf-tabla summary::-webkit-details-marker { display: none; }
/* Texto alternativo vacío ("/ "") = el glifo es decorativo y no lo leen los lectores de pantalla. */
.cem-graf-tabla summary::before { content: "▸" / ""; transition: transform 0.15s; }
.cem-graf-tabla[open] summary::before { transform: rotate(90deg); }
.cem-graf-tabla-wrap { max-height: 280px; overflow: auto; margin-top: 0.6rem; }

/* Acciones del gráfico: descargar CSV + cómo citar (datos abiertos / rigor) */
.cem-graf-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; margin-top: 0.7rem; }
.cem-graf-csv {
	display: inline-flex; align-items: center; gap: 0.4rem; cursor: pointer;
	border: 0; background: transparent; padding: 0; font: inherit;
	font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.12em;
	color: #007a72; transition: color 0.15s;
}
.cem-graf-csv:hover { color: #00524d; }
.cem-graf-csv svg { flex-shrink: 0; }
.cem-graf-cite {
	font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.12em;
	color: #5c6370; text-decoration: none; border-bottom: 1px solid rgba(92,99,112,0.3); padding-bottom: 1px;
	transition: color 0.15s, border-color 0.15s;
}
.cem-graf-cite:hover { color: #007a72; border-color: #007a72; }
.cem-graf-tabla table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.cem-graf-tabla th {
	text-align: left;
	font-weight: 600;
	color: #5c6370;
	border-bottom: 1px solid rgba(15, 23, 32, 0.12);
	padding: 0.35rem 0.6rem;
	position: sticky;
	top: 0;
	background: #fff;
}
.cem-graf-tabla td {
	padding: 0.3rem 0.6rem;
	border-bottom: 1px solid rgba(15, 23, 32, 0.05);
	color: #2a2f35;
}
.cem-graf-tabla tbody tr:hover { background: rgba(0, 122, 114, 0.04); }

.cem-graf-error {
	border: 1px dashed #c8102e;
	color: #c8102e;
	background: #fff5f5;
	padding: 1rem;
	border-radius: 6px;
	font-size: 0.85rem;
}

/* Tabla buscable (catálogo MINREL, bibliografía) — ocupa el ancho completo de la grilla. */
.cem-graf-card--tabla { grid-column: 1 / -1; }

.cem-tabla-bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	margin-bottom: 0.75rem;
	flex-wrap: wrap;
}
.cem-tabla-search {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	flex: 1 1 220px;
	max-width: 360px;
	border: 1px solid rgba(15, 23, 32, 0.14);
	border-radius: 8px;
	padding: 0.4rem 0.7rem;
	color: #5c6370;
	transition: border-color 0.15s;
}
.cem-tabla-search:focus-within { border-color: #007a72; }
.cem-tabla-search input {
	border: 0;
	outline: 0;
	width: 100%;
	font-size: 0.85rem;
	color: #2a2f35;
	background: transparent;
}
.cem-tabla-count {
	font-size: 0.72rem;
	text-transform: uppercase;
	letter-spacing: 0.1em;
	color: #5c6370;
	white-space: nowrap;
}

.cem-tabla-scroll { max-height: 460px; overflow: auto; border: 1px solid rgba(15, 23, 32, 0.08); border-radius: 8px; }
.cem-tabla-scroll table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.cem-tabla-scroll th {
	text-align: left;
	font-weight: 600;
	color: #2a2f35;
	background: #f6f8f8;
	padding: 0.55rem 0.7rem;
	position: sticky;
	top: 0;
	cursor: pointer;
	user-select: none;
	white-space: nowrap;
	border-bottom: 1px solid rgba(15, 23, 32, 0.12);
}
.cem-tabla-scroll th:focus-visible { outline: 2px solid #007a72; outline-offset: -2px; }
.cem-tabla-arrow { display: inline-block; width: 0.7em; margin-left: 0.3em; color: #007a72; }
.cem-tabla-scroll th[data-dir="asc"] .cem-tabla-arrow::after { content: "▲"; font-size: 0.7em; }
.cem-tabla-scroll th[data-dir="desc"] .cem-tabla-arrow::after { content: "▼"; font-size: 0.7em; }
.cem-tabla-scroll td {
	padding: 0.45rem 0.7rem;
	border-bottom: 1px solid rgba(15, 23, 32, 0.05);
	color: #2a2f35;
	vertical-align: top;
}
.cem-tabla-scroll tbody tr:hover { background: rgba(0, 122, 114, 0.04); }
.cem-tabla-empty { margin: 0.85rem 0 0; font-size: 0.85rem; color: #5c6370; text-align: center; }
