.erss-categories-wrap {
	width: 100%;
}

.erss-categories-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
}

.erss-categories-heading {
	margin: 0;
	font-size: 20px;
	font-weight: 700;
	line-height: 1.4;
}

.erss-categories-heading-wrap {
	display: inline-flex;
	align-items: center;
	min-width: 0;
}

.erss-categories-heading-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	line-height: 1;
}

.erss-categories-heading-icon i,
.erss-categories-heading-icon svg {
	display: block;
}

.erss-categories-all {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	color: #179d55;
	font-size: 14px;
	text-decoration: none;
	white-space: nowrap;
	transition: color 180ms ease, background-color 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.erss-categories-all-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	line-height: 0;
}

.erss-categories-all-icon img {
	display: block;
	width: 16px;
	height: 16px;
	object-fit: contain;
}

.erss-categories {
	--erss-cat-columns: 8;
	--erss-cat-gap: 20px;
	display: grid;
	grid-template-columns: repeat(var(--erss-cat-columns), minmax(0, 1fr));
	gap: var(--erss-cat-gap);
	width: 100%;
}

/* اسکرول افقی وقتی گزینه فعال باشد — یک ردیف + اسکرول به‌جای ردیف بعدی */
.erss-categories-wrap.erss-categories-scroll .erss-categories {
	display: flex !important;
	flex-wrap: nowrap !important;
	grid-template-columns: none !important;
	overflow-x: auto !important;
	overflow-y: hidden !important;
	padding-bottom: 6px;
	scroll-behavior: smooth;
	scroll-snap-type: x proximity;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: thin;
}

.erss-categories-wrap.erss-categories-scroll .erss-category-card {
	flex: 0 0 calc((100% - (var(--erss-cat-columns) - 1) * var(--erss-cat-gap)) / var(--erss-cat-columns)) !important;
	width: calc((100% - (var(--erss-cat-columns) - 1) * var(--erss-cat-gap)) / var(--erss-cat-columns)) !important;
	max-width: none !important;
	min-width: 0;
	scroll-snap-align: start;
	justify-self: auto;
}

.erss-category-card {
	display: flex;
	min-width: 0;
	flex-direction: column;
	color: inherit;
	text-decoration: none;
	justify-self: center;
}

.erss-category-card:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 3px;
}

.erss-category-image {
	display: block;
	width: 100%;
	height: 196px;
	overflow: hidden;
	background: transparent;
}

.erss-category-image img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/*
 * Some themes apply opacity, brightness, filters or transforms to linked
 * images on hover. Keep category cards visually identical in every state.
 */
.erss-category-card:hover,
.erss-category-card:active,
.erss-category-card:hover .erss-category-image,
.erss-category-card:active .erss-category-image,
.erss-category-card:hover .erss-category-image img,
.erss-category-card:active .erss-category-image img {
	opacity: 1 !important;
	filter: none !important;
	transform: none !important;
	mix-blend-mode: normal !important;
}

.erss-category-card:hover .erss-category-image::before,
.erss-category-card:hover .erss-category-image::after,
.erss-category-card:active .erss-category-image::before,
.erss-category-card:active .erss-category-image::after {
	opacity: 0 !important;
	background: transparent !important;
}

.erss-category-placeholder {
	display: block;
	width: 100%;
	height: 100%;
	background: linear-gradient(135deg, #f4f0e7, #e5dfd3);
}

.erss-category-title {
	display: block;
	margin-top: 10px;
	color: inherit;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.5;
	text-align: inherit;
}

.erss-category-count {
	display: block;
	margin-top: 2px;
	color: #777;
	font-size: 12px;
	line-height: 1.5;
}

.erss-categories-notice {
	padding: 14px;
	border: 1px dashed #b5b5b5;
	border-radius: 6px;
	background: #fafafa;
	color: #555;
	text-align: center;
}

@media (max-width: 767px) {
	.erss-categories {
		display: flex;
		gap: var(--erss-cat-gap);
		overflow-x: auto;
		overflow-y: hidden;
		padding-bottom: 6px;
		scroll-behavior: smooth;
		scroll-snap-type: x proximity;
		-webkit-overflow-scrolling: touch;
		scrollbar-width: none;
	}

	.erss-categories::-webkit-scrollbar {
		display: none;
	}

	.erss-category-card {
		/*
		 * 3.5 cards: three full cards, three full gaps, plus half of the next
		 * card. This remains exact when the gap is changed in Elementor.
		 */
		flex: 0 0 var(--erss-cat-mobile-width, calc((100% - (3 * var(--erss-cat-gap))) / 3.5));
		width: var(--erss-cat-mobile-width, auto);
		scroll-snap-align: start;
	}

	.erss-categories-heading {
		font-size: 16px;
	}

	.erss-categories-all {
		font-size: 12px;
	}

	.erss-category-title {
		font-size: 11px;
		line-height: 1.45;
	}
}

@media (prefers-reduced-motion: reduce) {
	.erss-categories,
	.erss-category-card,
	.erss-category-image img {
		scroll-behavior: auto;
		transition: none;
	}
}
