/**
 * Hoolistic Toolkit — Rejillas de categorías
 *
 * Hoja compartida por [hoolistic_categorias_blog] y
 * [hoolistic_categorias_producto].
 *
 * Principio de diseño: no imponemos tipografía. Los títulos usan la etiqueta
 * real (h2/h3/…) sin declarar font-family, así heredan la fuente de
 * encabezados del tema o del kit global de Elementor. Los colores salen de
 * las variables globales de Elementor cuando existen, con reserva neutra.
 */

.htk-cats {
	/* Colores: kit de Elementor -> reserva neutra. */
	--htk-acento: var( --e-global-color-accent, #111827 );
	--htk-texto: var( --e-global-color-text, currentColor );
	--htk-fondo: rgba( 0, 0, 0, 0.04 );

	/* Rejilla. */
	--htk-cols: 3;
	--htk-cols-tablet: 2;
	--htk-cols-movil: 1;
	--htk-gap: 24px;
	--htk-radio: 14px;
	--htk-altura: 240px;

	display: grid;
	grid-template-columns: repeat( var( --htk-cols ), minmax( 0, 1fr ) );
	gap: var( --htk-gap );
	margin: 0;
	padding: 0;
	list-style: none;
	font-family: inherit;
}

/* Enlace base: sin estilos de enlace del tema. */
.htk-cats .htk-cat {
	position: relative;
	display: flex;
	flex-direction: column;
	text-decoration: none;
	color: inherit;
	box-shadow: none;
	transition: transform 0.35s ease, box-shadow 0.35s ease, background-color 0.35s ease, border-color 0.35s ease;
}

.htk-cats .htk-cat:hover,
.htk-cats .htk-cat:focus {
	text-decoration: none;
	color: inherit;
}

.htk-cats .htk-cat:focus-visible {
	outline: 2px solid var( --htk-acento );
	outline-offset: 3px;
}

/* Título: sin font-family propia -> hereda la del tema. */
.htk-cats .htk-cat__title {
	margin: 0;
	padding: 0;
	font-size: var( --htk-titulo-size, clamp( 1.05rem, 1.35vw, 1.25rem ) );
	line-height: 1.25;
	color: inherit;
	word-break: break-word;
}

/* Con heredar_tipografia="no": el título usa la fuente del texto normal. */
.htk-cats--tipografia-base .htk-cat__title {
	font-family: inherit;
	font-weight: inherit;
}

.htk-cats .htk-cat__count {
	display: block;
	font-size: 0.8125em;
	line-height: 1.4;
	opacity: 0.75;
	font-family: inherit;
}

.htk-cats .htk-cat__desc {
	display: block;
	font-size: 0.875em;
	line-height: 1.55;
	opacity: 0.8;
	font-family: inherit;
}

.htk-cats .htk-cat__body {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

/* Alineaciones. */
.htk-cats--centro .htk-cat__body {
	text-align: center;
	align-items: center;
}

.htk-cats--derecha .htk-cat__body {
	text-align: right;
	align-items: flex-end;
}

/* --------------------------------------------------------------------------
   Estilo: TARJETAS
   -------------------------------------------------------------------------- */

.htk-cats--tarjetas .htk-cat {
	overflow: hidden;
	border-radius: var( --htk-radio );
	background-color: var( --htk-fondo );
	isolation: isolate;
}

.htk-cats--tarjetas .htk-cat__media {
	position: relative;
	display: block;
	height: var( --htk-altura );
	overflow: hidden;
	background: linear-gradient( 140deg, hsl( var( --htk-hue, 220 ) 32% 88% ), hsl( var( --htk-hue, 220 ) 28% 72% ) );
}

.htk-cats--tarjetas .htk-cat__img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.6s cubic-bezier( 0.2, 0.7, 0.3, 1 );
}

.htk-cats--tarjetas .htk-cat__placeholder {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 4rem;
	font-weight: 700;
	color: rgba( 255, 255, 255, 0.85 );
	letter-spacing: 0.02em;
}

.htk-cats--tarjetas .htk-cat__velo {
	position: absolute;
	inset: 0;
	background: linear-gradient( to top, rgba( 0, 0, 0, 0.72 ) 0%, rgba( 0, 0, 0, 0.28 ) 45%, rgba( 0, 0, 0, 0 ) 75% );
	transition: opacity 0.35s ease;
}

.htk-cats--tarjetas .htk-cat__body {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 2;
	padding: 20px 22px;
	color: #fff;
}

.htk-cats--tarjetas .htk-cat__title {
	color: #fff;
	text-shadow: 0 1px 12px rgba( 0, 0, 0, 0.35 );
}

.htk-cats--tarjetas .htk-cat__count,
.htk-cats--tarjetas .htk-cat__desc {
	color: rgba( 255, 255, 255, 0.88 );
	opacity: 1;
}

.htk-cats--tarjetas .htk-cat:hover {
	transform: translateY( -4px );
	box-shadow: 0 18px 40px -18px rgba( 0, 0, 0, 0.45 );
}

.htk-cats--tarjetas .htk-cat:hover .htk-cat__img {
	transform: scale( 1.06 );
}

.htk-cats--tarjetas .htk-cat:hover .htk-cat__velo {
	opacity: 0.85;
}

/* --------------------------------------------------------------------------
   Estilo: MINIMAL
   -------------------------------------------------------------------------- */

.htk-cats--minimal .htk-cat {
	padding: 22px 4px 20px;
	border-top: 2px solid var( --htk-acento );
	color: var( --htk-texto );
}

.htk-cats--minimal .htk-cat__body {
	gap: 4px;
}

.htk-cats--minimal .htk-cat__title {
	position: relative;
	display: inline-block;
	padding-bottom: 2px;
	background-image: linear-gradient( var( --htk-acento ), var( --htk-acento ) );
	background-repeat: no-repeat;
	background-position: 0 100%;
	background-size: 0% 1px;
	transition: background-size 0.4s cubic-bezier( 0.2, 0.7, 0.3, 1 );
}

.htk-cats--minimal .htk-cat:hover .htk-cat__title {
	background-size: 100% 1px;
}

.htk-cats--minimal .htk-cat:hover {
	transform: translateY( -2px );
}

/* --------------------------------------------------------------------------
   Estilo: PASTILLAS
   -------------------------------------------------------------------------- */

.htk-cats--pastillas {
	display: flex;
	flex-wrap: wrap;
	gap: calc( var( --htk-gap ) / 2 );
}

.htk-cats--pastillas.htk-cats--centro {
	justify-content: center;
}

.htk-cats--pastillas.htk-cats--derecha {
	justify-content: flex-end;
}

.htk-cats--pastillas .htk-cat {
	flex-direction: row;
	align-items: center;
	padding: 10px 20px;
	border: 1px solid var( --htk-acento );
	border-radius: 999px;
	background-color: transparent;
	color: var( --htk-texto );
}

.htk-cats--pastillas .htk-cat__body {
	flex-direction: row;
	align-items: baseline;
	gap: 8px;
}

.htk-cats--pastillas .htk-cat__title {
	font-size: var( --htk-titulo-size, 0.95rem );
}

.htk-cats--pastillas .htk-cat__count {
	display: inline-block;
	font-size: 0.75em;
	opacity: 0.6;
}

.htk-cats--pastillas .htk-cat__desc {
	display: none;
}

.htk-cats--pastillas .htk-cat:hover {
	background-color: var( --htk-acento );
	color: #fff;
	transform: translateY( -2px );
}

.htk-cats--pastillas .htk-cat:hover .htk-cat__count {
	opacity: 0.85;
}

/* --------------------------------------------------------------------------
   Estilo: LISTA
   -------------------------------------------------------------------------- */

.htk-cats--lista {
	display: block;
}

.htk-cats--lista .htk-cat {
	flex-direction: row;
	align-items: center;
	gap: 16px;
	padding: 18px 6px;
	border-bottom: 1px solid rgba( 0, 0, 0, 0.1 );
	color: var( --htk-texto );
}

.htk-cats--lista .htk-cat:first-child {
	border-top: 1px solid rgba( 0, 0, 0, 0.1 );
}

.htk-cats--lista .htk-cat__body {
	flex: 1 1 auto;
	gap: 4px;
	padding-right: 40px;
}

.htk-cats--lista .htk-cat__flecha {
	position: absolute;
	right: 6px;
	top: 50%;
	width: 22px;
	height: 8px;
	transform: translateY( -50% );
	opacity: 0.35;
	transition: transform 0.35s ease, opacity 0.35s ease;
}

.htk-cats--lista .htk-cat__flecha::before,
.htk-cats--lista .htk-cat__flecha::after {
	content: "";
	position: absolute;
	background-color: currentColor;
}

.htk-cats--lista .htk-cat__flecha::before {
	left: 0;
	top: 50%;
	width: 100%;
	height: 1.5px;
	transform: translateY( -50% );
}

.htk-cats--lista .htk-cat__flecha::after {
	right: 0;
	top: 50%;
	width: 8px;
	height: 8px;
	border-top: 1.5px solid currentColor;
	border-right: 1.5px solid currentColor;
	transform: translateY( -50% ) rotate( 45deg );
}

.htk-cats--lista .htk-cat:hover {
	color: var( --htk-acento );
}

.htk-cats--lista .htk-cat:hover .htk-cat__flecha {
	transform: translateY( -50% ) translateX( 5px );
	opacity: 1;
}

/* --------------------------------------------------------------------------
   Responsive (breakpoints de Elementor)
   -------------------------------------------------------------------------- */

@media ( max-width: 1024px ) {
	.htk-cats {
		grid-template-columns: repeat( var( --htk-cols-tablet ), minmax( 0, 1fr ) );
	}
}

@media ( max-width: 767px ) {
	.htk-cats {
		grid-template-columns: repeat( var( --htk-cols-movil ), minmax( 0, 1fr ) );
	}

	.htk-cats--tarjetas .htk-cat__body {
		padding: 16px 18px;
	}
}

/* --------------------------------------------------------------------------
   Accesibilidad
   -------------------------------------------------------------------------- */

@media ( prefers-reduced-motion: reduce ) {
	.htk-cats .htk-cat,
	.htk-cats .htk-cat__img,
	.htk-cats .htk-cat__title,
	.htk-cats .htk-cat__flecha,
	.htk-cats .htk-cat__velo {
		transition: none !important;
	}

	.htk-cats .htk-cat:hover {
		transform: none;
	}
}

/* Aviso para editores cuando no hay resultados. */
.htk-cats-aviso {
	padding: 12px 16px;
	border: 1px dashed rgba( 0, 0, 0, 0.25 );
	border-radius: 8px;
	font-size: 0.875em;
	opacity: 0.75;
}
