/*
 * KFD 11.10.2026 - kafelki produktow na stronie glownej (modul ets_homecategories "Home Products PRO").
 * Zamiast karuzeli Slick (przewijanie po 1 kafelku w kolko, kopie kafelkow, strzalki 24 px pod kafelkami):
 * przewijanie natywne (palec jak w aplikacji, przyciaganie do kafelka), na telefonie widac 2 kafelki i kawalek 3.,
 * pod rzedem pasek postepu, od 768 px okragle strzalki 44 px, "Zobacz wszystkie" przy tytule i na koncu rzedu.
 * 12.10: strzalka "dalej" takze na telefonie, grubszy pasek, jednorazowa podpowiedz ruchem (kfd-kafelki.js).
 * Uklad dziala od pierwszego wyswietlenia (bez JS, bez przeskokow). Gdy kfd-kafelki.js sie nie wczyta, modul wlacza
 * Slick jak dotad (.slick-slider) i te reguly przestaja dzialac. Komputer od 1200 px: 6 kafelkow w rzedzie jak dotad.
 */
html body#index .hc-layout.hc-carousel {
	--kfd-kaf-n: 2.25;
	--kfd-kaf-granat: #011638;
	--kfd-kaf-tlo-paska: #e6e8ee;
}

@media (min-width: 480px) {
	html body#index .hc-layout.hc-carousel { --kfd-kaf-n: 3.25; }
}

@media (min-width: 768px) {
	html body#index .hc-layout.hc-carousel { --kfd-kaf-n: 4.3; }
}

@media (min-width: 1200px) {
	html body#index .hc-layout.hc-carousel { --kfd-kaf-n: 6; }
}

/* rzad kafelkow: przewijanie w bok (natywne), bez paska przewijania przegladarki */
html body#index .hc-layout.hc-carousel .hc-products-list.has-products:not(.slick-slider) {
	display: flex;
	flex-wrap: nowrap;
	align-items: stretch;
	overflow-x: auto;
	overflow-y: hidden;
	scroll-snap-type: x mandatory;
	overscroll-behavior-x: contain;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
}

html body#index .hc-layout.hc-carousel .hc-products-list.has-products:not(.slick-slider)::-webkit-scrollbar {
	display: none;
}

html body#index .hc-layout.hc-carousel .hc-products-list.has-products:not(.slick-slider) > .product,
html body#index .hc-layout.hc-carousel .hc-products-list.has-products:not(.slick-slider) > .kfd-rail__end {
	flex: 0 0 calc(100% / var(--kfd-kaf-n));
	width: calc(100% / var(--kfd-kaf-n));
	min-width: 0;
	scroll-snap-align: start;
}

/* karta na cala szerokosc kafelka: homecategories.css (stan bez Slick) daje article.product-miniature 25% przy 768-991 */
html body#index .hc-layout.hc-carousel .hc-products-list.has-products:not(.slick-slider) > .product > .product-miniature {
	width: 100% !important;
	max-width: none !important;
}

/* telefon: rzad do prawej krawedzi ekranu (kawalek 3. kafelka "wystaje"), na koncu odstep jak margines strony */
@media (max-width: 767px) {
	html body#index .hc-layout.hc-carousel .hc-products-list.has-products:not(.slick-slider) {
		margin-right: calc(-1 * var(--kfd-page-gutter, 16px));
	}

	html body#index .hc-layout.hc-carousel .hc-products-list.has-products:not(.slick-slider)::after {
		content: "";
		flex: 0 0 calc(var(--kfd-page-gutter, 16px) - 6px);
	}
}

/* miejsce na pasek postepu zarezerwowane od poczatku (bez przeskoku, gdy pojawi sie pasek) */
html body#index .hc-layout.hc-carousel .is_17.products {
	position: relative;
}

@media (max-width: 1199px) {
	html body#index .hc-layout.hc-carousel .is_17.products {
		padding-bottom: 14px;
	}
}

/* pasek postepu pod rzedem (pokazuje, ze jest wiecej i gdzie jestesmy) */
html body#index .kfd-rail__bar {
	display: none;
	position: absolute;
	left: 6px;
	right: 6px;
	bottom: 2px;
	height: 4px;
	border-radius: 4px;
	background: var(--kfd-kaf-tlo-paska);
	overflow: hidden;
	pointer-events: none;
}

html body#index .kfd-rail--scroll > .kfd-rail__bar {
	display: block;
}

html body#index .kfd-rail__thumb {
	height: 100%;
	width: 30%;
	border-radius: 4px;
	background: var(--kfd-kaf-granat);
	will-change: transform;
}

/* strzalki: tablet i komputer, gdy jest co przewijac; na telefonie wystarcza palec, kawalek kafelka i pasek */
html body#index .kfd-rail__btn {
	display: none;
	position: absolute;
	top: var(--kfd-rail-btn-top, 35%);
	z-index: 3;
	width: 44px;
	height: 44px;
	margin-top: -22px;
	padding: 0;
	align-items: center;
	justify-content: center;
	border: 1px solid #e1e4ea;
	border-radius: 50%;
	background: #fff;
	color: var(--kfd-kaf-granat);
	box-shadow: 0 4px 14px rgba(1, 22, 56, 0.14);
	cursor: pointer;
	transition: opacity 0.15s ease, box-shadow 0.15s ease;
}

html body#index .kfd-rail__btn .material-icons {
	font-size: 26px;
	line-height: 1;
}

html body#index .kfd-rail__btn--prev { left: -4px; }
html body#index .kfd-rail__btn--next { right: -4px; }

html body#index .kfd-rail__btn:hover {
	box-shadow: 0 6px 18px rgba(1, 22, 56, 0.22);
}

html body#index .kfd-rail__btn:focus-visible {
	outline: 2px solid #3d52d5;
	outline-offset: 2px;
}

html body#index .kfd-rail__btn:disabled {
	opacity: 0;
	pointer-events: none;
}

@media (min-width: 768px) {
	html body#index .kfd-rail--scroll > .kfd-rail__btn {
		display: flex;
	}
}

/* telefon: strzalka "dalej" na wystajacym kafelku (40 px, pole dotyku 48 px) - dla tych, ktorzy nie przesuwaja palcem;
 * znika na koncu rzedu. Strzalki "wstecz" na telefonie nie ma (zaslanialaby pierwszy kafelek) - wraca sie palcem. */
@media (max-width: 767px) {
	html body#index .kfd-rail--scroll > .kfd-rail__btn--next {
		display: flex;
		right: calc(6px - var(--kfd-page-gutter, 16px));
		width: 40px;
		height: 40px;
		margin-top: -20px;
		background: rgba(255, 255, 255, 0.94);
	}

	html body#index .kfd-rail__btn--next::before {
		content: "";
		position: absolute;
		inset: -4px;
	}

	html body#index .kfd-rail__btn--next .material-icons {
		font-size: 24px;
	}
}

/* jednorazowa podpowiedz (raz na wizyte, pierwszy rzad na ekranie): kafelki lekko "drgaja" w lewo i wracaja */
@keyframes kfd-rail-podpowiedz {
	0% { transform: translateX(0); }
	32% { transform: translateX(-56px); }
	58% { transform: translateX(0); }
	76% { transform: translateX(-16px); }
	100% { transform: translateX(0); }
}

html body#index .hc-products-list.kfd-rail--podpowiedz > .product,
html body#index .hc-products-list.kfd-rail--podpowiedz > .kfd-rail__end {
	animation: kfd-rail-podpowiedz 1.4s cubic-bezier(0.3, 0.7, 0.3, 1) 1;
}

/* "Zobacz wszystkie" przy tytule sekcji (tytul i tak jest odnosnikiem, ale wyglada jak naglowek) */
html body#index .hc-layout.hc-carousel .hc-tab-info {
	position: relative;
}

html body#index .kfd-rail__all {
	position: absolute;
	top: var(--kfd-rail-all-top, 0);
	right: 0;
	z-index: 2;
	display: inline-flex;
	align-items: center;
	gap: 2px;
	min-height: 32px;
	padding: 0 2px 0 8px;
	color: #3d52d5 !important;
	font-family: Montserrat, Manrope, sans-serif;
	font-size: 14px;
	font-weight: 600;
	line-height: 1;
	text-decoration: none !important;
	white-space: nowrap;
}

html body#index .kfd-rail__all .material-icons {
	font-size: 20px;
}

html body#index .kfd-rail__all:hover,
html body#index .kfd-rail__all:focus-visible {
	text-decoration: underline !important;
}

/* ostatni "kafelek": Zobacz wszystkie (tylko gdy rzad sie przewija - na komputerze 6 kafelkow bez zmian) */
html body#index .hc-layout.hc-carousel .hc-products-list.has-products:not(.slick-slider) > .kfd-rail__end {
	display: flex;
	padding: 12px;
}

@media (max-width: 991px) {
	html body#index .hc-layout.hc-carousel .hc-products-list.has-products:not(.slick-slider) > .kfd-rail__end { padding: 10px; }
}

@media (max-width: 768px) {
	html body#index .hc-layout.hc-carousel .hc-products-list.has-products:not(.slick-slider) > .kfd-rail__end { padding: 6px; }
}

@media (min-width: 1200px) {
	html body#index .hc-layout.hc-carousel .hc-products-list.has-products:not(.slick-slider) > .kfd-rail__end { display: none; }
}

html body#index .kfd-rail__end a {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 10px;
	min-height: 160px;
	padding: 16px 12px;
	border: 1px dashed #c9cfdb;
	border-radius: 12px;
	background: #f7f8fb;
	color: var(--kfd-kaf-granat) !important;
	font-family: Montserrat, Manrope, sans-serif;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.3;
	text-align: center;
	text-decoration: none !important;
}

html body#index .kfd-rail__end a:hover,
html body#index .kfd-rail__end a:focus-visible {
	border-color: #3d52d5;
	color: #3d52d5 !important;
}

html body#index .kfd-rail__end .kfd-rail__end-ikona {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	background: var(--kfd-kaf-granat);
	color: #fff;
}

html body#index .kfd-rail__end .kfd-rail__end-ikona .material-icons {
	font-size: 26px;
}

@media (prefers-reduced-motion: reduce) {
	html body#index .hc-layout.hc-carousel .hc-products-list.has-products:not(.slick-slider) { scroll-behavior: auto; }
	html body#index .hc-products-list.kfd-rail--podpowiedz > .product,
	html body#index .hc-products-list.kfd-rail--podpowiedz > .kfd-rail__end { animation: none; }
}
