/* Primolia – oznaczenia produktów, filtr prezentowy, ozdoba w koszyku */

:root {
	--pl-burgundy: #471625;
	--pl-olive: #b8bf73;
	--pl-cream: #f4ebd0;
	--pl-gold: #c9a54a;
	--pl-paper: #f6f4e8;
	--pl-font-heading: "Playfair Display", serif;
	--pl-font-body: "Open Sans", sans-serif;
}

/* ===== Badge'y na karcie (rodzic musi mieć position: relative) ===== */

.pl-badges {
	position: absolute;
	inset: 0;
	z-index: 2;
	overflow: hidden;
	border-radius: inherit;
	pointer-events: none;
	font-family: var(--pl-font-body);
}

/* Wstążka „Na prezent” – wywinięta poza lewą krawędź karty.
   Siedzi bezpośrednio w kontenerze zdjęcia (poza .pl-badges), więc kontener
   nie może jej przycinać; obrazek i tak przycina własny <span> z overflow:hidden. */
.product-card__image-box:has(> .pl-ribbon) {
	overflow: visible;
	container-type: inline-size;
}

.pl-ribbon {
	position: absolute;
	top: 12px; /* równo z kółkiem polifenoli */
	left: -10px;
	z-index: 3;
	pointer-events: none;
	font-family: var(--pl-font-body);
	filter: drop-shadow(0 3px 4px rgba(71, 22, 37, 0.3));
}

/* Zagięcie – kawałek wstążki „za” kartą */
.pl-ribbon::before {
	content: "";
	position: absolute;
	top: 100%;
	left: 0;
	border-top: 8px solid #2a0c15;
	border-left: 10px solid transparent;
}

.pl-ribbon__text {
	display: block;
	padding: 9px 24px 9px 16px;
	background: var(--pl-burgundy);
	color: var(--pl-cream);
	border-block: 2px solid var(--pl-gold);
	clip-path: polygon(0 0, 100% 0, calc(100% - 10px) 50%, 100% 100%, 0 100%);
	font-size: 12.5px;
	font-weight: 800;
	line-height: 1;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	white-space: nowrap;
}

/* Karuzele (Swiper) mają overflow:hidden – miejsce na wywiniętą część po lewej.
   Swiper odejmuje padding od szerokości, więc slajdy zostają tej samej szerokości. */
.swiper:has(.pl-ribbon) {
	margin-left: -10px;
	padding-left: 10px;
}

/* Gdy na karcie jest też „Promocja!” / „Brak w magazynie” (lewy górny róg) */
.product-card__image-box:has(> .onsale) > .pl-ribbon {
	top: 58px;
}

/* Wąska karta: wstążka nie mieści się obok kółka polifenoli – schodzi pod nie.
   Progi = szerokość wnętrza karty, przy której wstążka dotknęłaby kółka. */
@media (min-width: 641px) {
	@container (max-width: 170px) {
		.product-card__image-box:has(.pl-badge--poly) > .pl-ribbon.pl-ribbon {
			top: 90px;
		}
	}
}

@media (max-width: 640px) {
	@container (max-width: 130px) {
		.product-card__image-box:has(.pl-badge--poly) > .pl-ribbon.pl-ribbon {
			top: 70px;
		}
	}
}

.pl-badge--harvest {
	position: absolute;
	left: 0;
	bottom: 64px;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 14px 8px 12px;
	border-radius: 0 999px 999px 0;
	background: var(--pl-olive);
	color: var(--pl-burgundy);
	box-shadow: 0 2px 6px rgba(71, 22, 37, 0.18);
	font-size: 11px;
	font-weight: 800;
	line-height: 1;
	letter-spacing: 0.12em;
	text-transform: uppercase;
}

.pl-badge--harvest svg {
	flex: none;
}

.pl-badge--poly {
	position: absolute;
	top: 12px;
	right: 12px;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	width: 70px;
	height: 70px;
	border: 3px solid var(--pl-olive);
	border-radius: 50%;
	background: #fff;
	color: var(--pl-burgundy);
	box-shadow: 0 2px 8px rgba(71, 22, 37, 0.18);
	text-align: center;
}

.pl-badge__num {
	font-family: var(--pl-font-heading);
	font-size: 19px;
	font-weight: 700;
	line-height: 1;
}

.pl-badge__unit {
	font-size: 9px;
	font-weight: 700;
	line-height: 1.3;
}

.pl-badge__label {
	font-size: 8.5px;
	line-height: 1.1;
}

.pl-badge--poly-low {
	border-color: #d9dcb2;
}

.pl-badge--poly-high {
	background: var(--pl-burgundy);
	color: var(--pl-cream);
	border-color: var(--pl-gold);
}

@media (max-width: 640px) {
	.pl-ribbon {
		top: 8px;
		left: -7px;
	}

	.pl-ribbon::before {
		border-top-width: 6px;
		border-left-width: 7px;
	}

	.pl-ribbon__text {
		padding: 7px 18px 7px 11px;
		font-size: 10.5px;
		letter-spacing: 0.08em;
		clip-path: polygon(0 0, 100% 0, calc(100% - 8px) 50%, 100% 100%, 0 100%);
	}

	.product-card__image-box:has(> .onsale) > .pl-ribbon {
		top: 50px;
	}

	.pl-badge--harvest {
		bottom: 48px;
		padding: 6px 10px 6px 8px;
		font-size: 9.5px;
		letter-spacing: 0.08em;
	}

	.pl-badge--poly {
		top: 8px;
		right: 8px;
		width: 54px;
		height: 54px;
		border-width: 2px;
	}

	.pl-badge__num {
		font-size: 15px;
	}

	.pl-badge__label {
		display: none;
	}
}

/* ===== Filtr „Polecamy na prezent” ===== */

.pl-gift-filter {
	position: relative;
	display: flex;
	align-items: center;
	gap: 12px;
	margin: 0 0 18px;
	padding: 16px;
	border-radius: 18px;
	background: var(--pl-burgundy);
	color: #fff;
	box-shadow: 0 8px 20px rgba(71, 22, 37, 0.28);
	text-decoration: none;
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.pl-gift-filter:hover,
.pl-gift-filter:focus {
	color: #fff;
	text-decoration: none;
	transform: translateY(-1px);
	box-shadow: 0 12px 26px rgba(71, 22, 37, 0.34);
}

.pl-gift-filter:focus-visible {
	outline: 3px solid var(--pl-olive);
	outline-offset: 3px;
}

.pl-gift-filter.is-active {
	box-shadow: 0 0 0 3px var(--pl-olive), 0 8px 20px rgba(71, 22, 37, 0.28);
}

.pl-gift-filter__icon {
	display: flex;
	flex: none;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 42px;
	border-radius: 50%;
	background: var(--pl-olive);
	color: var(--pl-burgundy);
}

.pl-gift-filter__text {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: 3px;
	min-width: 0;
}

.pl-gift-filter__title {
	color: var(--pl-cream);
	font-family: var(--pl-font-heading);
	font-size: 17px;
	font-weight: 700;
	line-height: 1.2;
}

.pl-gift-filter__sub {
	color: #e6ddc4;
	font-size: 12px;
	line-height: 1.3;
}

.pl-gift-filter__check {
	position: relative;
	flex: none;
	box-sizing: border-box;
	width: 22px;
	height: 22px;
	border: 2px solid var(--pl-olive);
	border-radius: 6px;
}

.pl-gift-filter.is-active .pl-gift-filter__check {
	background: var(--pl-olive);
}

.pl-gift-filter.is-active .pl-gift-filter__check::after {
	content: "";
	position: absolute;
	top: 2px;
	left: 6px;
	width: 5px;
	height: 10px;
	border: solid var(--pl-burgundy);
	border-width: 0 2.5px 2.5px 0;
	transform: rotate(45deg);
}

.pl-gift-filter__flag {
	position: absolute;
	top: -9px;
	right: 14px;
	padding: 3px 8px;
	border-radius: 999px;
	background: var(--pl-olive);
	color: var(--pl-burgundy);
	font-size: 10px;
	font-weight: 800;
	line-height: 1.2;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

/* ===== Ozdoba prezentowa w koszyku / checkout ===== */

.pl-giftwrap-wrap {
	clear: both;
	margin: 28px 0 8px;
	container-type: inline-size;
}

.pl-giftwrap-wrap--blocks {
	margin: 16px 0;
}

.pl-giftwrap {
	position: relative;
	display: grid;
	grid-template-columns: auto auto 1fr auto;
	align-items: center;
	gap: 14px 20px;
	padding: 22px 26px;
	border: 2px dashed var(--pl-burgundy);
	border-radius: 20px;
	background: var(--pl-paper);
	color: var(--pl-burgundy);
	cursor: pointer;
	transition: background 0.15s ease, box-shadow 0.15s ease;
}

.pl-giftwrap:hover {
	background: #f1eedc;
}

.pl-giftwrap.is-checked {
	border-style: solid;
	background: #fff;
	box-shadow: 0 0 0 3px rgba(184, 191, 115, 0.6);
}

.pl-giftwrap.is-loading {
	opacity: 0.6;
	cursor: progress;
}

.pl-giftwrap .pl-giftwrap__input {
	appearance: auto;
	width: 28px;
	height: 28px;
	margin: 0;
	accent-color: var(--pl-burgundy);
	cursor: pointer;
}

.pl-giftwrap .pl-giftwrap__input:focus-visible {
	outline: 3px solid var(--pl-olive);
	outline-offset: 2px;
}

.pl-giftwrap__icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 54px;
	height: 54px;
	border-radius: 50%;
	background: var(--pl-olive);
	color: var(--pl-burgundy);
}

.pl-giftwrap__text {
	display: flex;
	flex-direction: column;
	gap: 6px;
	min-width: 0;
}

.pl-giftwrap__title {
	font-family: var(--pl-font-heading);
	font-size: 20px;
	font-weight: 700;
	line-height: 1.25;
}

.pl-giftwrap__desc {
	color: #5c3a43;
	font-size: 14px;
	line-height: 1.4;
}

.pl-giftwrap__price {
	padding: 6px 14px;
	border: 1px solid var(--pl-burgundy);
	border-radius: 999px;
	background: #fff;
	font-size: 15px;
	font-weight: 700;
	white-space: nowrap;
}

.pl-giftwrap__flag {
	position: absolute;
	top: -12px;
	left: 24px;
	padding: 4px 12px;
	border: 2px solid var(--pl-gold);
	border-radius: 999px;
	background: var(--pl-burgundy);
	color: var(--pl-cream);
	font-size: 11px;
	font-weight: 800;
	line-height: 1.2;
	letter-spacing: 0.1em;
	text-transform: uppercase;
}

.pl-giftwrap__error {
	margin: 8px 0 0;
	color: #a1001c;
	font-size: 14px;
}

.pl-giftwrap-order-note {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 12px 16px;
	border-radius: 12px;
	background: var(--pl-paper);
	color: var(--pl-burgundy);
	font-weight: 600;
}

/* Wąskie konteksty: mobile, sidebar Cart Block, podsumowanie checkoutu */
@container (max-width: 480px) {
	.pl-giftwrap {
		grid-template-columns: auto 1fr;
		padding: 20px 18px 18px;
	}

	.pl-giftwrap__icon {
		display: none;
	}

	.pl-giftwrap__price {
		grid-column: 2;
		justify-self: start;
	}

	.pl-giftwrap__title {
		font-size: 17px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.pl-gift-filter,
	.pl-giftwrap {
		transition: none;
	}

	.pl-gift-filter:hover,
	.pl-gift-filter:focus {
		transform: none;
	}
}
