/* Product badges and the note under the gallery. Colours come from the theme palette. */
.wc-block-components-product-image,
.woocommerce-product-gallery__image {
	position: relative;
}

.pk-margised {
	position: absolute;
	inset: 0;
	z-index: 2;
	pointer-events: none;
	--pk-seal: 5.25rem;
	--pk-inset: 0.5rem;
}

/* Main image on the product page (not the related product cards below it). */
.woocommerce-product-gallery .pk-margised {
	--pk-seal: 7rem;
	--pk-inset: 0.85rem;
}

.pk-margised__tl {
	position: absolute;
	top: var(--pk-inset);
	left: var(--pk-inset);
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 0.35rem;
	max-width: calc(100% - 2 * var(--pk-inset));
}

.pk-margised--seal .pk-margised__tl {
	max-width: calc(100% - var(--pk-seal) - 3 * var(--pk-inset));
}

.pk-margised__tr {
	position: absolute;
	top: var(--pk-inset);
	right: var(--pk-inset);
}

.pk-margised__bc {
	position: absolute;
	bottom: var(--pk-inset);
	left: var(--pk-inset);
	right: var(--pk-inset);
	display: flex;
	justify-content: center;
}

.pk-margis {
	display: inline-block;
	max-width: 100%;
	box-sizing: border-box;
	padding: 0.2rem 0.65rem;
	border: 1.5px solid var(--wp--preset--color--base, #fff);
	border-radius: 999px;
	box-shadow: 0 1px 4px rgba(42, 28, 18, 0.3);
	font-size: 0.8rem;
	font-weight: 700;
	line-height: 1.3;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.pk-margis--discount {
	background: var(--wp--preset--color--danger, #9a2314);
	color: var(--wp--preset--color--base, #fff);
}

.pk-margis--text {
	background: var(--wp--preset--color--brand, #6a4127);
	color: var(--wp--preset--color--base, #fff);
}

.pk-margis--limited {
	background: var(--wp--preset--color--deep, #3f2716);
	color: var(--wp--preset--color--deep-ink, #f8eddd);
}

.pk-margis--seal {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0.1em;
	width: var(--pk-seal);
	height: var(--pk-seal);
	padding: calc(var(--pk-seal) * 0.12);
	border-radius: 50%;
	background: var(--wp--preset--color--accent, #c98a2b);
	color: var(--wp--preset--color--ink, #2a1c12);
	outline: 1.5px dashed rgba(42, 28, 18, 0.35);
	outline-offset: calc(var(--pk-seal) * -0.07);
	text-align: center;
	white-space: normal;
	overflow: hidden;
	overflow-wrap: normal;
	word-break: normal;
	hyphens: manual;
	line-height: 1.1;
	transform: rotate(8deg);
}

/* Text scales with the seal so two short words always fit. */
.pk-margis__pealkiri {
	font-size: calc(var(--pk-seal) * 0.145);
	font-weight: 800;
}

.pk-margis__alus {
	font-size: calc(var(--pk-seal) * 0.11);
	font-weight: 600;
}

/* WooCommerce zoom button sits top right; move it below when a seal is there. */
.woocommerce div.product div.images.woocommerce-product-gallery:has(.pk-margised--seal) .woocommerce-product-gallery__trigger {
	top: auto;
	bottom: 0.85rem;
}

.pk-galerii-tekst {
	margin-top: 1rem;
	font-size: 0.95rem;
	line-height: 1.5;
}

.pk-galerii-tekst > :first-child {
	margin-top: 0;
}

.pk-galerii-tekst > :last-child {
	margin-bottom: 0;
}

@media (max-width: 600px) {
	.pk-margised {
		--pk-seal: 4.5rem;
		--pk-inset: 0.4rem;
	}

	.woocommerce-product-gallery .pk-margised {
		--pk-seal: 5.5rem;
		--pk-inset: 0.6rem;
	}

	.pk-margis {
		padding: 0.15rem 0.5rem;
		font-size: 0.7rem;
	}
}
