/**
 * Dark Editorial Commerce – reskin archiwum sklepu (strona sklepu,
 * kategorie, tagi produktów).
 *
 * Ładowany TYLKO na kde_is_shop_view() (patrz inc/enqueue.php). Struktura:
 *   .kde-shop-header    – custom nagłówek, renderowany przez
 *                         kde_render_shop_header() w inc/woocommerce.php
 *                         (hook woocommerce_before_main_content, nie pełny
 *                         override szablonu archiwum)
 *   .woocommerce-result-count / .woocommerce-ordering
 *                       – DOMYŚLNE elementy WooCommerce (licznik wyników,
 *                         sortowanie), tylko przemalowane – zachowują
 *                         prawdziwe działanie sortowania
 *   ul.products         – domyślna lista WooCommerce, przełączona na
 *                         CSS grid; karty renderuje
 *                         woocommerce/content-product.php (.kde-product-card)
 *   .woocommerce-pagination – domyślna paginacja WooCommerce, przemalowana
 */

/* ── TŁO STRONY ──
 * Ten plik ładuje się tylko na widokach sklepu (kde_is_shop_view()), więc
 * bezpiecznie ustawiamy tło na kilku prawdopodobnych wrapperach Kadence
 * naraz (różnią się między wersjami/motywami potomnymi) – i tak nie
 * wycieknie to na inne strony. Bez tego widać domyślne tło Kadence za
 * siatką produktów zamiast naszej "złamanej bieli".
 */
body,
.site,
#content,
.content-area,
.site-main {
	background-color: #f3f0eb;
}

/* ── NAGŁÓWEK SKLEPU (full-bleed, ta sama technika co hero produktu) ── */
.kde-shop-header {
	width: 100vw;
	position: relative;
	left: 50%;
	right: 50%;
	margin-left: -50vw;
	margin-right: -50vw;
	background: #121212;
	padding: 24px 24px 56px;
}
.kde-shop-header__intro {
	max-width: 1200px;
	margin: 0 auto;
	text-align: center;
	padding: 8px 24px 0;
}
.kde-shop-header__eyebrow {
	display: block;
	font-family: 'Inter', sans-serif;
	font-size: 14px;
	font-weight: 600;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: #c9a15a;
	margin-bottom: 20px;
}
.kde-shop-header__title {
	font-family: 'Fraunces', serif;
	font-optical-sizing: auto;
	font-weight: 560;
	font-size: clamp(2.25rem, 4vw, 3rem);
	line-height: 1.15;
	letter-spacing: -0.015em;
	max-width: 700px;
	margin: 0 auto;
	color: #f3f0eb;
}
.kde-shop-header__tagline {
	max-width: 540px;
	margin: 20px auto 0;
	font-family: 'Inter', sans-serif;
	font-size: 17px;
	color: #a8a196;
}

/* Pigułki kategorii – ten sam komponent co na stronie głównej */
.kde-pill-nav-wrap { text-align: center; margin-top: 40px; }
.kde-pill-nav {
	display: inline-flex;
	align-items: center;
	flex-wrap: wrap;
	justify-content: center;
	gap: 14px;
	padding: 14px 28px;
	border-radius: 999px;
	border: 1px solid rgba(243, 240, 235, 0.12);
	background: rgba(243, 240, 235, 0.04);
}
.kde-pill-nav a {
	font-family: 'Inter', sans-serif;
	color: #a8a196;
	text-decoration: none;
	font-size: 15px;
	font-weight: 500;
}
.kde-pill-nav a:hover,
.kde-pill-nav a.is-active {
	color: #c9a15a;
}
.kde-pill-nav a.is-active { font-weight: 600; }
.kde-pill-nav span { color: #a8a196; opacity: 0.4; }
@media (max-width: 560px) {
	.kde-pill-nav { gap: 10px; padding: 12px 20px; }
	.kde-pill-nav a { font-size: 14px; }
}

/* Opis kategorii (woocommerce_archive_description) – jeśli administrator
   go wypełnił, wyświetla się pod naszym nagłówkiem jako zwykły akapit. */
.term-description {
	max-width: 680px;
	margin: 40px auto 0;
	padding: 0 24px;
	font-family: 'Inter', sans-serif;
	font-size: 16px;
	color: #6b6558;
	text-align: center;
}

/* ── PASEK WYNIKÓW / SORTOWANIA (domyślne elementy WooCommerce) ──
 * Wynik/sortowanie są floated (obok siebie), więc nie da się ich
 * wyśrodkować przez margin:auto tak jak ul.products niżej – zamiast tego
 * dajemy im padding liczony tym samym wzorem co margines centrowanego
 * kontenera 1200px, żeby wyrównały się dokładnie z krawędziami siatki
 * na każdej szerokości ekranu.
 */
.woocommerce-result-count {
	float: left;
	padding-left: max(24px, calc((100% - 1200px) / 2));
	font-family: 'Inter', sans-serif;
	font-size: 14px;
	color: #6b6558;
	margin: 40px 0 8px;
}
.woocommerce-ordering {
	float: right;
	padding-right: max(24px, calc((100% - 1200px) / 2));
	margin: 40px 0 8px;
}
.woocommerce-ordering select.orderby {
	font-family: 'Inter', sans-serif;
	font-size: 14px;
	font-weight: 600;
	color: #1c1a17;
	background: transparent;
	border: none;
	border-bottom: 1px solid rgba(28, 26, 23, 0.22);
	padding: 4px 20px 4px 0;
	cursor: pointer;
}

/* ── SIATKA PRODUKTÓW ── */
ul.products {
	clear: both;
	max-width: 1200px;
	margin: 0 auto 64px;
	padding: 0 24px;
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 28px;
	list-style: none;
}
@media (max-width: 900px) {
	ul.products { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
	ul.products { grid-template-columns: 1fr; }
}

.kde-product-card {
	display: flex;
	flex-direction: column;
	background: #ffffff;
	border: 1px solid rgba(28, 26, 23, 0.14);
	border-radius: 4px;
	overflow: hidden;
	transition: border-color 0.25s ease, box-shadow 0.25s ease;
}
.kde-product-card:hover {
	border-color: #c9a15a;
	box-shadow: 0 20px 40px rgba(201, 161, 90, 0.18), 0 2px 8px rgba(28, 26, 23, 0.06);
}

.kde-product-card__link {
	display: block;
	text-decoration: none;
	color: inherit;
}

.kde-product-card__cover {
	aspect-ratio: 4 / 3;
	overflow: hidden;
	background: #1c1a17;
}
.kde-product-card__cover img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.4s ease;
}
.kde-product-card:hover .kde-product-card__cover img {
	transform: scale(1.03);
}
.kde-product-card__cover--placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	padding: 24px;
	text-align: center;
	background: linear-gradient(155deg, #1c1a17 0%, #121212 100%);
}
.kde-product-card__cover--placeholder span {
	font-family: 'Fraunces', serif;
	font-optical-sizing: auto;
	font-weight: 540;
	font-size: 20px;
	letter-spacing: -0.01em;
	color: #c9a15a;
	opacity: 0.85;
}

.kde-product-card__body { padding: 24px 24px 20px; }
.kde-product-card__eyebrow {
	display: block;
	font-family: 'Inter', sans-serif;
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: #a9813f;
	margin-bottom: 10px;
}
.kde-product-card__body .woocommerce-loop-product__title,
.kde-product-card__body h2 {
	font-family: 'Fraunces', serif !important;
	font-optical-sizing: auto;
	font-weight: 540 !important;
	font-size: 21px !important;
	letter-spacing: -0.01em;
	line-height: 1.3;
	color: #1c1a17 !important;
	margin: 0;
}

.kde-product-card__footer {
	margin-top: auto;
	padding: 0 24px 24px;
	display: flex;
	flex-direction: column;
	align-items: stretch;
	gap: 16px;
}
.kde-product-card__price {
	font-family: 'Inter', sans-serif;
	font-size: 18px;
	font-weight: 700;
	color: #1c1a17;
}
.kde-product-card__price .woocommerce-Price-amount {
	font-family: 'Inter', sans-serif;
}
.kde-product-card__price del {
	text-decoration: line-through;
}
.kde-product-card__price del .woocommerce-Price-amount {
	font-size: 13px;
	font-weight: 400;
	color: #6b6558;
	margin-right: 6px;
}
.kde-product-card__price ins {
	text-decoration: none;
}
/*
 * "Cena w ostatnich 30 dniach..." – domyślny komunikat zgodności z
 * dyrektywą Omnibus, dorzucany przez WooCommerce (core) wewnątrz
 * get_price_html(), więc bez tej reguły dziedziczy pogrubienie/rozmiar
 * ceny nad nim. Mniejsze litery, bez pogrubienia, węższa interlinia.
 */
.kde-product-card__price .wc-price-history {
	display: block;
	margin-top: 6px;
	font-family: 'Inter', sans-serif;
	font-size: 11px;
	font-weight: 400;
	line-height: 1.3;
	color: #6b6558;
}

/*
 * "Zobacz więcej" jako przycisk konturowy pod ceną – ten sam wzorzec co
 * .cta--outline na stronie produktu/koszyku: przezroczyste tło, cienka
 * ramka akcentu, wypełnia się na hover.
 */
.kde-product-card__view {
	display: block;
	text-align: center;
	padding: 12px 20px;
	font-family: 'Inter', sans-serif;
	font-size: 14px;
	font-weight: 600;
	letter-spacing: 0.02em;
	color: #a9813f;
	background: transparent;
	border: 1.5px solid #c9a15a;
	border-radius: 4px;
	text-decoration: none;
	transition: background 0.2s ease, color 0.2s ease;
}
.kde-product-card__view:hover {
	background: #c9a15a;
	color: #121212;
}

/* ── PAGINACJA (domyślna WooCommerce) ── */
.woocommerce-pagination {
	clear: both;
	text-align: center;
	margin: 0 0 96px;
}
.woocommerce-pagination ul.page-numbers {
	display: inline-flex;
	gap: 8px;
	list-style: none;
	margin: 0;
	padding: 0;
}
.woocommerce-pagination .page-numbers li { display: inline-flex; }
.woocommerce-pagination .page-numbers a,
.woocommerce-pagination .page-numbers span {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 36px;
	height: 36px;
	padding: 0 10px;
	font-family: 'Inter', sans-serif;
	font-size: 14px;
	font-weight: 600;
	color: #6b6558;
	border: 1px solid rgba(28, 26, 23, 0.14);
	border-radius: 4px;
	text-decoration: none;
}
.woocommerce-pagination .page-numbers a:hover,
.woocommerce-pagination .page-numbers span.current {
	border-color: #c9a15a;
	color: #a9813f;
}

/* ── ANIMACJE (subtelne, respektują prefers-reduced-motion) ──
 * Nagłówek: zawsze widoczny od razu przy wejściu na stronę, więc animuje
 * się po prostu przy załadowaniu (bez obserwatora scrolla).
 * Karty produktów: mogą być poniżej pierwszego ekranu (kolejne rzędy),
 * więc pojawiają się dopiero przy wjechaniu w widok – obserwator w
 * assets/js/shop.js dodaje klasę .is-visible, kiedy karta wjedzie w kadr.
 * Opóźnienie każdej karty ustawia PHP w woocommerce/content-product.php
 * (zmienna --kde-reveal-delay, wg pozycji w siatce) – stąd wrażenie, że
 * produkty "wjeżdżają" po kolei, jeden po drugim, a nie wszystkie naraz.
 */
@media (prefers-reduced-motion: no-preference) {
	@keyframes kdeShopFadeUp {
		from { opacity: 0; transform: translateY(14px); }
		to   { opacity: 1; transform: translateY(0); }
	}
	.kde-shop-header__eyebrow,
	.kde-shop-header__title,
	.kde-shop-header__tagline,
	.kde-pill-nav-wrap {
		opacity: 0;
		animation: kdeShopFadeUp 0.7s ease forwards;
	}
	.kde-shop-header__eyebrow { animation-delay: 0.05s; }
	.kde-shop-header__title { animation-delay: 0.12s; }
	.kde-shop-header__tagline { animation-delay: 0.2s; }
	.kde-pill-nav-wrap { animation-delay: 0.3s; }

	/*
	 * Karty startują niewidoczne TYLKO gdy html.kde-js-reveal jest obecne –
	 * tę klasę dodaje assets/js/shop.js zanim zacznie obserwować karty.
	 * Jeśli JS się nie wykona (błąd, zablokowany, brak IntersectionObserver),
	 * klasa nigdy się nie pojawi i karty zostają widoczne od razu – nie mogą
	 * "zniknąć na zawsze" przez samą tę regułę CSS.
	 */
	html.kde-js-reveal .kde-product-card[data-reveal] {
		opacity: 0;
		transform: translateY(16px);
		transition: opacity 0.6s ease, transform 0.6s ease,
			border-color 0.25s ease, box-shadow 0.25s ease;
		transition-delay: var(--kde-reveal-delay, 0s);
	}
	html.kde-js-reveal .kde-product-card[data-reveal].is-visible {
		opacity: 1;
		transform: translateY(0);
	}
}
