/**
 * Blok: Karuzela tekstowa (ks-marquee).
 *
 * Wygląd spójny z motywem kamilskierski2024:
 * - tło: sygnaturowy gradient Kamila (135deg, #58b2f4 -> #691ab4),
 * - font: Inter (globalny motywu), tekst biały,
 * - szerokość: pełna szerokość wewnętrznego kontenera strony (max 1450px).
 *
 * Zasada animacji (odporna na zmiany szerokości ekranu):
 * - Ścieżka (.ks-marquee__track) przesuwa się o szerokość DOKŁADNIE jednej
 *   grupy (--ks-marquee-shift, ustawiane przez JS w px, raz, przed startem).
 * - Treść jest okresowa (każda grupa identyczna), więc reset pętli z
 *   translateX(-shift) do 0 jest niewidoczny — brak przeskoków.
 * - JS przy zmianie szerokości TYLKO dokleja klony na koniec (append-only).
 *   Nie zmienia --ks-marquee-shift ani duration, więc animacja NIGDY się
 *   nie restartuje (ukrycie scrolla itp. jej nie psuje).
 */

.wp-block-acf-ks-marquee {
	margin-block-start: -24px !important;
}

.ks-marquee {
	--ks-marquee-gap: 2.75rem;

	position: relative;
	box-sizing: border-box;
	width: 100%;
	max-width: 1450px;
	margin-inline: auto;
	overflow: hidden;

	/* Wygląd spójny ze stroną. */
	background: linear-gradient(135deg, #58b2f4 0%, #691ab4 100%);
	color: #fff;
	font-family: "Inter", sans-serif;
	border-radius: 9999px;
	padding-block: 1.05rem;
	box-shadow: 0 18px 40px -22px rgba(105, 26, 180, 0.75);
}

.ks-marquee__track {
	display: flex;
	flex-wrap: nowrap;
	width: max-content;
	will-change: transform;
	backface-visibility: hidden;
	transform: translate3d(0, 0, 0);
}

/* Animacja startuje dopiero, gdy JS ustawi --ks-marquee-shift i doda .is-running. */
.ks-marquee.is-running .ks-marquee__track {
	animation: ks-marquee-scroll var(--ks-marquee-duration, 20s) linear infinite;
}

/*
 * Pauza tylko dla urządzeń z prawdziwym kursorem. Dzięki temu dotknięcie
 * ekranu nie zostawia paska w stanie :hover i nie wywołuje pozornego skoku.
 */
@media (hover: hover) and (pointer: fine) {
	.ks-marquee.is-pausable.is-running:hover .ks-marquee__track {
		animation-play-state: paused;
	}
}

.ks-marquee__group {
	display: flex;
	flex-wrap: nowrap;
	align-items: center;
	flex: 0 0 auto;
}

.ks-marquee__item {
	display: inline-flex;
	align-items: center;
	white-space: nowrap;
	padding-inline: calc(var(--ks-marquee-gap) / 2);

	font-weight: 700;
	font-size: 1rem;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	line-height: 1;
	color: #fff;
}

.ks-marquee__icon {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 1.25em;
	height: 1.25em;
	margin-right: 0.6em;
}

.ks-marquee__icon svg {
	display: block;
	width: 100%;
	height: 100%;
}

.ks-marquee__icon img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.ks-marquee__label {
	display: inline-block;
}

.ks-marquee__sep {
	flex: 0 0 auto;
	width: calc(1.05em + 2px);
	height: calc(1.05em + 2px);
	user-select: none;
	pointer-events: none;

	/* bullet.svg jako maska — kolor bierze z tekstu (currentColor). */
	background-color: currentColor;
	-webkit-mask: url(../theme-assets/images/bullet.svg) center / contain no-repeat;
	mask: url(../theme-assets/images/bullet.svg) center / contain no-repeat;
}

/*
 * Wariant statyczny: jeden zestaw haseł, bez klonów i bez przesuwania.
 * Na szerokich ekranach elementy mają szerokość wynikającą z treści i równe
 * odstępy, a niżej zawijają się i przechodzą do jednej kolumny na mobile.
 */
.ks-marquee.is-static {
	border-radius: 32px;
	padding: 1.25rem clamp(1rem, 2.5vw, 2.5rem);
}

.ks-marquee.is-static .ks-marquee__track {
	display: block;
	width: 100%;
	will-change: auto;
	transform: none;
	animation: none;
}

.ks-marquee.is-static .ks-marquee__group {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1.5rem;
	width: 100%;
}

.ks-marquee.is-static .ks-marquee__item {
	flex: 0 1 auto;
	justify-content: flex-start;
	min-width: 0;
	width: fit-content;
	padding: 0.65rem 0.5rem;
	white-space: normal;
	line-height: 1.25;
	text-align: left;
}

.ks-marquee.is-static.has-icons .ks-marquee__icon {
	flex: 0 0 38px;
	width: 38px;
	height: 38px;
	margin-right: 1rem;
}

.ks-marquee__marker-bullet {
	display: block;
	flex: 0 0 10px;
	width: 10px;
	height: 10px;
	margin-right: 0.8rem;
	border-radius: 50%;
	background: currentColor;
}

.ks-marquee.is-static .ks-marquee__sep {
	display: none;
}

@media screen and (max-width: 1024px) {
	.ks-marquee.is-static .ks-marquee__group {
		flex-wrap: wrap;
		justify-content: center;
		column-gap: clamp(1.5rem, 5vw, 4rem);
		row-gap: 0.5rem;
	}
}

@media screen and (max-width: 760px) {
	.ks-marquee.is-static {
		border-radius: 28px;
		padding: 1rem;
	}

	.ks-marquee.is-static .ks-marquee__group {
		flex-direction: column;
		flex-wrap: nowrap;
		gap: 0.35rem;
	}

	.ks-marquee.is-static .ks-marquee__item {
		align-items: center;
		justify-content: center;
		gap: 0.55rem;
		padding: 0.85rem 0.5rem;
		text-align: center;
	}

	.ks-marquee.is-static.has-icons .ks-marquee__item {
		flex-direction: column;
	}

	.ks-marquee.is-static.has-icons .ks-marquee__icon {
		margin-right: 0;
	}
}

@keyframes ks-marquee-scroll {
	from {
		transform: translate3d(0, 0, 0);
	}
	to {
		/* Fallback -50% zadziała nawet bez JS, jeśli w ścieżce są 2 grupy. */
		transform: translate3d(var(--ks-marquee-shift, -50%), 0, 0);
	}
}

/* Szacunek dla użytkowników z ograniczoną animacją — pasek statyczny. */
@media (prefers-reduced-motion: reduce) {
	.ks-marquee__track {
		animation: none !important;
		transform: none !important;
	}
}
