/**
 * Elementor widget — Brands animated marquee
 */

.elementor-widget-nextshop_brands_marquee {
	width: 100%;
}

.elementor-widget-nextshop_brands_marquee .elementor-widget-container {
	width: 100%;
}

.ns-el-brands-marquee {
	--ns-brands-duration: 30s;
	--ns-brands-visible: 6;
	--ns-brands-gap: 20px;
	--ns-brands-fade-color: var(--ns-body-bg, #ffffff);
	--ns-brands-fade-size: 64px;
	width: 100%;
	position: relative;
}

.ns-el-brands-marquee.is-fade-auto {
	--ns-brands-fade-color: var(--ns-body-bg, #ffffff);
}

.ns-el-brands-marquee__header {
	margin-bottom: 1.5rem;
}

.ns-el-brands-marquee__title {
	margin: 0 0 0.4rem;
	font-size: 1.35rem;
	font-weight: 800;
	line-height: 1.35;
	color: var(--ns-text, #1a1a2e);
}

.ns-el-brands-marquee__subtitle {
	margin: 0;
	font-size: 0.92rem;
	line-height: 1.6;
	color: var(--ns-muted, #64748b);
}

.ns-el-brands-marquee__header[style*="text-align: center"] .ns-el-brands-marquee__subtitle {
	margin-inline: auto;
}

.ns-el-brands-marquee__viewport {
	overflow: hidden;
	width: 100%;
	position: relative;
	container-type: inline-size;
	display: flex;
	align-items: center;
}

.ns-el-brands-marquee.is-animated .ns-el-brands-marquee__viewport {
	touch-action: pan-y;
	cursor: grab;
	user-select: none;
	-webkit-user-select: none;
}

.ns-el-brands-marquee.is-animated .ns-el-brands-marquee__viewport.is-dragging {
	cursor: grabbing;
}

.ns-el-brands-marquee.is-animated .ns-el-brands-marquee__viewport.is-dragging .ns-el-brands-marquee__track {
	animation-play-state: paused;
}

.ns-el-brands-marquee.has-fade::before,
.ns-el-brands-marquee.has-fade::after {
	content: '';
	position: absolute;
	top: 0;
	bottom: 0;
	width: var(--ns-brands-fade-size);
	pointer-events: none;
	z-index: 3;
}

.ns-el-brands-marquee.has-fade::before {
	inset-inline-start: 0;
	background: linear-gradient(to var(--ns-brands-fade-dir-start, left), var(--ns-brands-fade-color), transparent);
}

.ns-el-brands-marquee.has-fade::after {
	inset-inline-end: 0;
	background: linear-gradient(to var(--ns-brands-fade-dir-end, right), var(--ns-brands-fade-color), transparent);
}

[dir="rtl"] .ns-el-brands-marquee.has-fade {
	--ns-brands-fade-dir-start: right;
	--ns-brands-fade-dir-end: left;
}

.ns-el-brands-marquee__track {
	display: flex;
	flex-wrap: nowrap;
	width: max-content;
	align-items: stretch;
	will-change: transform;
}

.ns-el-brands-marquee__group {
	display: flex;
	flex-wrap: nowrap;
	align-items: stretch;
	gap: var(--ns-brands-gap);
	flex: 0 0 auto;
}

.ns-el-brands-marquee__item {
	flex: 0 0 calc((100cqw - (var(--ns-brands-visible) - 1) * var(--ns-brands-gap)) / var(--ns-brands-visible));
	max-width: calc((100cqw - (var(--ns-brands-visible) - 1) * var(--ns-brands-gap)) / var(--ns-brands-visible));
	text-decoration: none;
	color: inherit;
	display: flex;
	min-width: 0;
}

.ns-el-brands-marquee__item-inner {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0.45rem;
	width: 100%;
	min-height: 100%;
	border: 1px solid var(--ns-border, #e8ecf1);
	background: var(--ns-surface, #ffffff);
	transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
	box-sizing: border-box;
}

.ns-el-brands-marquee--display-icon .ns-el-brands-marquee__item-inner {
	flex-direction: row;
}

.ns-el-brands-marquee__logo {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 56px;
	height: 56px;
	flex-shrink: 0;
	overflow: hidden;
}

.ns-el-brands-marquee__logo img {
	display: block;
	max-width: 48px;
	max-height: 48px;
	width: auto;
	height: auto;
	object-fit: contain;
	transition: filter 0.35s ease, transform 0.35s ease;
}

.ns-el-brands-marquee.has-grayscale .ns-el-brands-marquee__logo img {
	filter: grayscale(100%);
	opacity: 0.72;
}

.ns-el-brands-marquee.has-grayscale .ns-el-brands-marquee__item:hover .ns-el-brands-marquee__logo img {
	filter: grayscale(0%);
	opacity: 1;
}

.ns-el-brands-marquee__fallback {
	font-size: 0.75rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	line-height: 1;
	color: var(--ns-muted, #64748b);
}

.ns-el-brands-marquee__name {
	font-size: 0.82rem;
	font-weight: 600;
	line-height: 1.35;
	text-align: center;
	color: var(--ns-text, #334155);
	transition: color 0.25s ease;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	max-width: 100%;
}

/* Animation — infinite horizontal loop */
.ns-el-brands-marquee.is-animated .ns-el-brands-marquee__track {
	animation: ns-brands-scroll-left var(--ns-brands-duration, 30s) linear infinite;
}

.ns-el-brands-marquee.is-animated.ns-el-brands-marquee--dir-end .ns-el-brands-marquee__track,
.ns-el-brands-marquee.is-animated.ns-el-brands-marquee--dir-right .ns-el-brands-marquee__track {
	animation-name: ns-brands-scroll-right;
}

[dir="rtl"] .ns-el-brands-marquee.is-animated.ns-el-brands-marquee--dir-start .ns-el-brands-marquee__track {
	animation-name: ns-brands-scroll-right;
}

[dir="rtl"] .ns-el-brands-marquee.is-animated.ns-el-brands-marquee--dir-end .ns-el-brands-marquee__track {
	animation-name: ns-brands-scroll-left;
}

.ns-el-brands-marquee.is-pause-hover:hover .ns-el-brands-marquee__track {
	animation-play-state: paused;
}

@keyframes ns-brands-scroll-left {
	from {
		transform: translate3d(0, 0, 0);
	}
	to {
		transform: translate3d(-50%, 0, 0);
	}
}

@keyframes ns-brands-scroll-right {
	from {
		transform: translate3d(-50%, 0, 0);
	}
	to {
		transform: translate3d(0, 0, 0);
	}
}

/* Static mode (animation off) — horizontal scroll on small screens */
.ns-el-brands-marquee:not(.is-animated) .ns-el-brands-marquee__viewport {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
	-ms-overflow-style: none;
	touch-action: pan-x pan-y;
}

.ns-el-brands-marquee:not(.is-animated) .ns-el-brands-marquee__viewport::-webkit-scrollbar {
	display: none;
}

.ns-el-brands-marquee:not(.is-animated) .ns-el-brands-marquee__track {
	width: 100%;
}

.ns-el-brands-marquee:not(.is-animated) .ns-el-brands-marquee__group {
	flex: 1 1 auto;
	min-width: 0;
}

/* Dark mode — theme tokens */
body.nextshop-color-dark .ns-el-brands-marquee.is-fade-auto,
body.nextshop-color-dark .ns-el-brands-marquee {
	--ns-brands-fade-color: var(--ns-body-bg, #0a0a0a);
}

body.nextshop-color-dark .ns-el-brands-marquee__item-inner {
	border-color: var(--ns-border, #2a2a2a);
	background: var(--ns-surface, #141414);
}

body.nextshop-color-dark .ns-el-brands-marquee.has-grayscale .ns-el-brands-marquee__logo img {
	opacity: 0.85;
}

body.nextshop-color-dark .ns-el-brands-marquee.has-grayscale .ns-el-brands-marquee__item:hover .ns-el-brands-marquee__logo img {
	opacity: 1;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
	.ns-el-brands-marquee.is-animated .ns-el-brands-marquee__track {
		animation: none;
	}

	.ns-el-brands-marquee.is-animated .ns-el-brands-marquee__viewport {
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
		touch-action: pan-x pan-y;
		cursor: auto;
		user-select: auto;
		-webkit-user-select: auto;
	}
}
