/* --- Grid (Flex) de tarjetas --- */
.tarjeta-grid {
	display: flex;
	flex-wrap: wrap;
	gap: 20px;
	margin: 20px 0;
	justify-content: flex-start;
}

/* 3 columnas por defecto (entre ~992px y 1399px) */
.tarjeta-card {
	flex: 0 0 calc(33.333% - 20px);
	max-width: calc(33.333% - 20px);
	background: #eee;
	text-align: center;
	cursor: pointer;
	position: relative;
	transition: background 0.3s, color 0.3s;
	border-radius: 0;
	aspect-ratio: 370/275;
	display: flex;
	align-items: center;
	justify-content: center;
}

.tarjeta-card:hover {
	background: #ddd;
}

.tarjeta-card h3 {
	margin: 0;
	font-size: 28px !important;
}

/* 2 columnas en pantallas ≤768px */
@media (max-width: 768px) {
	.tarjeta-card {
		flex: 0 0 calc(50% - 20px);
		max-width: calc(50% - 20px);
	}
}

/* 1 columna en pantallas ≤480px */
@media (max-width: 480px) {
	.tarjeta-card {
		flex: 0 0 100%;
		max-width: 100%;
	}
}

/* Tarjeta activa: negra, texto blanco */
.tarjeta-card.active {
	background: #000;
	color: #fff;
}
.tarjeta-card.active h3 {
	color: #fff;
}

/* --- Overlay (fondo oscuro) --- */
.tarjeta-overlay {
	display: none;
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.7);
	z-index: 9998; /* General por defecto */
}

/* --- Pop-up --- */
.tarjeta-popup {
	display: none;
	position: fixed;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);

	width: 90%;
	max-width: 700px;
	min-height: 300px;
	max-height: 80vh;

	overflow: hidden;
	background: #fff;
	padding: 50px 60px; /* Padding grande por defecto */
	box-sizing: border-box;
	box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);

	/* z-index elevado */
	z-index: 9999;
}

/* Ajustes específicos para pantallas ≤480px */
@media (max-width: 480px) {
	.tarjeta-popup {
		/* Reducir el padding en móvil */
		padding: 16px 16px;
		/* Aumentar más el z-index si tu menú sticky es muy alto */
		z-index: 99999;
	}
}

/* Contenedor interno (botón X, título, categoría, etc.) */
.tarjeta-popup-content {
	position: relative;
}

/* Botón de cierre (X) */
.tarjeta-popup-close {
	position: absolute;
	margin-top: -7%;
	top: 1rem;
	right: 0.5rem;
	margin-right: -5%;
	background: transparent;
	border: none;
	cursor: pointer;
	font-size: 4rem;
	line-height: 1;
}

/* En móviles, agrandar más la X y ajustarla si lo deseas */
@media (max-width: 480px) {
	.tarjeta-popup-close {
		font-size: 4rem !important; /* Un poco más grande en móvil */
	}
}

/* Título del pop-up */
.tarjeta-popup h2 {
	margin-top: 0;
	margin-bottom: 0.5rem;
	font-size: 1.5rem;
}

/* Categoría */
.tarjeta-popup-categoria {
	margin-bottom: 1rem;
	font-style: normal;
	font-weight: normal;
}
.tarjeta-popup-categoria strong {
	font-weight: bold !important;
}

/* Scroll solo en el texto extenso */
.tarjeta-popup-text {
	margin: 1em 0;
	max-height: calc(70vh - 250px);
	overflow-y: auto;
	font-size: 1.4rem;

	/* Un relleno a la derecha para que el texto no quede pegado al scroll */
	padding-right: 10px;
	box-sizing: border-box; /* aseguramos que el padding se calcule bien */
}

/* Scrollbar delgada */
.tarjeta-popup-text::-webkit-scrollbar {
	width: 6px;
}
.tarjeta-popup-text::-webkit-scrollbar-track {
	background: #f1f1f1;
}
.tarjeta-popup-text::-webkit-scrollbar-thumb {
	background: #bbb;
	border-radius: 4px;
}
.tarjeta-popup-text::-webkit-scrollbar-thumb:hover {
	background: #999;
}

/* Línea */
.tarjeta-separador {
	border: 0;
	border-top: 1px solid #000;
	margin-top: 3rem;
	margin-bottom: 0;
}
