/*!
 * WooCommerce Smart Product Frame - front end
 * Luxe Vision Limited
 *
 * Content-driven layout: no fixed heights unless the admin sets min/max,
 * empty sections are never rendered, everything wraps.
 */

/* ---------- Single product frame ---------- */
.spf-frame {
	position: relative;
	box-sizing: border-box;
	max-width: 100%;
	background: var(--spf-bg, #fff);
	border: var(--spf-bw, 1px) var(--spf-bs, solid) var(--spf-bc, #e3e3e3);
	border-radius: var(--spf-r, 4px);
}
.spf-frame *,
.spf-frame *::before,
.spf-frame *::after {
	box-sizing: border-box;
}
.spf-shadow--soft { box-shadow: 0 2px 10px rgba(0, 0, 0, .06); }
.spf-shadow--lifted { box-shadow: 0 10px 28px rgba(0, 0, 0, .10); }

.spf-frame__inner {
	--_top-fs: var(--spf-top-fs, 13px);
	--_top-pt: var(--spf-top-pt, 6px);
	--_top-pb: var(--spf-top-pb, 6px);
	--_b-hs: var(--spf-b-hs, 15px);
	--_b-ts: var(--spf-b-ts, 13px);
	--_cols: var(--spf-cols-d, 2);
	position: relative;
	display: flex;
	flex-direction: column;
	gap: var(--spf-gap, 0);
	border-radius: max(0px, calc(var(--spf-r, 4px) - var(--spf-bw, 1px)));
	/* Frame padding lives here so the top strip can run edge to edge over it (clipping is at the padding edge). */
	padding: var(--spf-pt, 0) var(--spf-pr, 0) var(--spf-pb, 0) var(--spf-pl, 0);
	overflow: hidden;
	overflow: clip;
	min-width: 0;
}
.spf-frame.spf-is-m .spf-frame__inner {
	--_top-fs: var(--spf-top-fs-m, 12px);
	--_top-pt: var(--spf-top-pv-m, 4px);
	--_top-pb: var(--spf-top-pv-m, 4px);
	--_b-hs: var(--spf-b-hs-m, 14px);
	--_b-ts: var(--spf-b-ts-m, 12px);
	--_cols: var(--spf-cols-m, 1);
}

/* The gallery fills the frame; the frame itself takes the theme's gallery column. */
.spf-frame .spf-media {
	position: relative;
	min-width: 0;
}
.spf-frame .spf-media > .woocommerce-product-gallery,
.spf-frame .spf-media > .images,
.spf-frame .spf-media > .wp-block-woocommerce-product-image-gallery {
	float: none !important;
	width: 100% !important;
	max-width: 100% !important;
	margin: 0 !important;
}
.spf-frame.spf-moved-sticky .spf-media > .woocommerce-product-gallery {
	position: relative !important;
	top: auto !important;
}

/* ---------- Top area (compact by default) ---------- */
.spf-top {
	font-size: var(--_top-fs);
	font-weight: var(--spf-top-fw, 600);
	letter-spacing: var(--spf-top-ls, 0);
	line-height: 1.3;
	color: var(--spf-top-c, #fff);
	overflow-wrap: anywhere;
	hyphens: auto;
	pointer-events: none;
}
.spf-top-upper .spf-top { text-transform: uppercase; }
.spf-top.spf-align--left { text-align: left; }
.spf-top.spf-align--center { text-align: center; }
.spf-top.spf-align--right { text-align: right; }

/* In-flow styles */
.spf-top--strip,
.spf-top--headline {
	padding: var(--_top-pt) var(--spf-top-pr, 12px) var(--_top-pb) var(--spf-top-pl, 12px);
	background: var(--spf-top-bg, #1d1d1f);
	min-height: var(--spf-top-min, auto);
	max-height: var(--spf-top-max, none);
	/* Full width of the frame, whatever the frame padding: the colour reaches both borders.
	 * The optional outer margin then moves it in from the edges. */
	margin:
		calc(var(--spf-top-mv, 0px) - var(--spf-pt, 0px))
		calc(var(--spf-top-mh, 0px) - var(--spf-pr, 0px))
		calc(var(--spf-top-mv, 0px) + var(--spf-pt, 0px))
		calc(var(--spf-top-mh, 0px) - var(--spf-pl, 0px));
	/* Text is centred in the whole strip, also when it wraps. */
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
}
.spf-top--strip.spf-align--left,
.spf-top--headline.spf-align--left { justify-content: flex-start; }
.spf-top--strip.spf-align--right,
.spf-top--headline.spf-align--right { justify-content: flex-end; }
.spf-top-inset .spf-top--strip,
.spf-top-inset .spf-top--headline { border-radius: var(--spf-top-r, 4px); }
.spf-top-capped .spf-top--strip,
.spf-top-capped .spf-top--headline {
	overflow-y: auto;
	scrollbar-width: thin;
}

/* Floating styles take no height at all */
.spf-top--badge,
.spf-top--ribbon,
.spf-top--label {
	position: absolute;
	z-index: 6;
	max-width: calc(100% - 2 * var(--spf-top-ox, 8px));
	background: var(--spf-top-bg, #1d1d1f);
	padding: var(--_top-pt) var(--spf-top-pr, 12px) var(--_top-pb) var(--spf-top-pl, 12px);
}
.spf-top--badge {
	top: var(--spf-top-oy, 8px);
	border-radius: var(--spf-top-r, 4px);
	max-width: 65%;
}
.spf-corner--left .spf-top--badge { left: var(--spf-top-ox, 8px); }
.spf-corner--right .spf-top--badge { right: var(--spf-top-ox, 8px); }

.spf-top--ribbon {
	top: var(--spf-top-oy, 8px);
	max-width: 70%;
}
.spf-corner--left .spf-top--ribbon {
	left: 0;
	padding-right: calc(var(--spf-top-pr, 12px) + 8px);
	clip-path: polygon(0 0, 100% 0, calc(100% - 8px) 50%, 100% 100%, 0 100%);
}
.spf-corner--right .spf-top--ribbon {
	right: 0;
	padding-left: calc(var(--spf-top-pl, 12px) + 8px);
	clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 8px 50%);
}
.spf-top--label {
	top: var(--spf-top-oy, 8px);
	left: 50%;
	transform: translateX(-50%);
	width: max-content;
	border-radius: 999px;
	box-shadow: 0 2px 8px rgba(0, 0, 0, .15);
	text-align: center;
}

/* ---------- Overlays ---------- */
.spf-overlays {
	position: absolute;
	inset: var(--spf-safe, 8px);
	z-index: 5;
	pointer-events: none;
}
.spf-slot {
	position: absolute;
	display: flex;
	flex-direction: column;
	gap: 4px;
	max-width: 100%;
	pointer-events: none;
}
.spf-slot[data-pos^="top"] { top: 0; }
.spf-slot[data-pos^="bottom"] { bottom: 0; flex-direction: column-reverse; }
.spf-slot[data-pos$="left"] { left: 0; align-items: flex-start; max-width: 70%; }
.spf-slot[data-pos$="right"] { right: 0; align-items: flex-end; max-width: 70%; }
.spf-slot[data-pos$="center"] { left: 0; right: 0; align-items: center; }

.spf-ov {
	display: inline-block;
	max-width: 100%;
	background: var(--ov-bg, rgba(198, 40, 40, .92));
	color: var(--ov-c, #fff);
	border-radius: var(--ov-r, 3px);
	font-weight: var(--ov-fw, 600);
	font-size: var(--d-fs, 12px);
	line-height: 1.25;
	padding: var(--d-pv, 4px) var(--d-ph, 8px);
	translate: var(--d-x, 0) var(--d-y, 0);
	white-space: normal;
	overflow-wrap: anywhere;
	text-align: center;
	pointer-events: none;
	user-select: none;
}
.spf-is-m .spf-ov {
	font-size: var(--m-fs, 11px);
	padding: var(--m-pv, 3px) var(--m-ph, 6px);
	translate: var(--m-x, 0) var(--m-y, 0);
}
.spf-frame:not(.spf-is-m) .spf-ov[data-d-show="0"],
.spf-frame.spf-is-m .spf-ov[data-m-show="0"] {
	display: none;
}

/* ---------- Bottom information section ---------- */
.spf-bottom {
	display: flex;
	flex-direction: column;
	gap: var(--spf-b-gap, 8px);
	padding: var(--spf-b-pt, 8px) var(--spf-b-pr, 10px) var(--spf-b-pb, 10px) var(--spf-b-pl, 10px);
	margin: var(--spf-b-mt, 0) var(--spf-b-mh, 0) var(--spf-b-mb, 0);
	background: var(--spf-b-bg, #fafafa);
	color: var(--spf-b-c, #222);
	font-size: var(--_b-ts);
	line-height: 1.4;
	min-height: var(--spf-b-min, auto);
	max-height: var(--spf-b-max, none);
	container-type: inline-size;
	container-name: spfb;
	overflow-wrap: anywhere;
}
.spf-bottom-center .spf-bottom { text-align: center; }
.spf-bottom__headline {
	font-size: var(--_b-hs);
	font-weight: 700;
	line-height: 1.3;
	color: var(--spf-h-c, inherit);
	background: var(--spf-h-bg, transparent);
	padding: var(--spf-h-pv, 0) var(--spf-h-ph, 0);
	border-radius: var(--spf-h-r, 3px);
	margin-bottom: var(--spf-h-mb, 0);
}

.spf-boxes {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: var(--spf-b-gap, 8px);
}
.spf-box {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	min-width: 0;
	padding: var(--spf-box-p, 8px) var(--spf-box-ph, 8px);
	background: var(--spf-box-bg, #fff);
	border: var(--spf-box-bw, 1px) solid var(--spf-box-bc, #e6e6e6);
	border-radius: var(--spf-box-r, 4px);
	text-align: left;
}
.spf-bottom-center .spf-box { justify-content: center; text-align: center; }
.spf-box__icon {
	flex: 0 0 auto;
	display: inline-flex;
	color: var(--spf-b-acc, #c62828);
	line-height: 1;
	margin-top: 1px;
}
.spf-box__icon--text { font-size: 1.15em; }
.spf-box__body { display: flex; flex-direction: column; min-width: 0; }
.spf-box__title { font-weight: 600; }
.spf-box__title + .spf-box__text,
.spf-box__title + .spf-countdown,
.spf-box__text + .spf-countdown { margin-top: var(--spf-tm, 2px); }
.spf-countdown {
	font-weight: 700;
	color: var(--spf-b-acc, #c62828);
	font-variant-numeric: tabular-nums;
}

/* Automatic arrangement by number of boxes, based on the section's own width. */
.spf-boxes--auto.spf-boxes--n5,
.spf-boxes--manual {
	display: flex;
	flex-wrap: wrap;
}
.spf-boxes--auto.spf-boxes--n5 > .spf-box { flex: 1 1 170px; }
.spf-boxes--manual > .spf-box {
	flex: 1 1 calc((100% - (var(--_cols) - 1) * var(--spf-b-gap, 8px)) / var(--_cols));
}

@container spfb (min-width: 240px) {
	.spf-boxes--auto.spf-boxes--n2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@container spfb (min-width: 300px) {
	.spf-boxes--auto.spf-boxes--n3,
	.spf-boxes--auto.spf-boxes--n4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.spf-boxes--auto.spf-boxes--n3 > .spf-box:last-child { grid-column: 1 / -1; }
}
@container spfb (min-width: 480px) {
	.spf-boxes--auto.spf-boxes--n3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
	.spf-boxes--auto.spf-boxes--n3 > .spf-box:last-child { grid-column: auto; }
}
@container spfb (min-width: 640px) {
	.spf-boxes--auto.spf-boxes--n4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@supports not (container-type: inline-size) {
	.spf-boxes--auto { display: flex; flex-wrap: wrap; }
	.spf-boxes--auto > .spf-box { flex: 1 1 150px; }
}

.spf-images {
	display: flex;
	flex-wrap: wrap;
	gap: var(--spf-b-gap, 8px);
	align-items: center;
}
.spf-bottom-center .spf-images { justify-content: center; }
.spf-images img.spf-promo-img {
	height: var(--spf-img-h, 36px) !important;
	width: auto !important;
	max-width: 100%;
	object-fit: contain;
	margin: 0 !important;
}

/* ---------- Shop / category loop ----------
 * Everything here sits over the image (absolute), so product cards keep their height.
 * Only the optional note under the image adds height, and it is off by default. */
.spf-loop {
	position: relative;
	display: block;
	border-radius: var(--spf-l-r, 4px);
	transition: transform .2s ease, box-shadow .2s ease;
}
/* Round the image itself instead of clipping, so theme sale flashes that sit outside the corner stay visible. */
.spf-loop img {
	border-radius: var(--spf-l-r, 4px);
}
.spf-l-shadow--soft { box-shadow: 0 2px 10px rgba(0, 0, 0, .08); }
.spf-l-shadow--lifted { box-shadow: 0 10px 26px rgba(0, 0, 0, .14); }

.spf-loop__border {
	position: absolute;
	inset: var(--spf-l-in, 0);
	z-index: 3;
	border: var(--spf-l-bw, 1px) var(--spf-l-bs, solid) var(--spf-l-bc, #e3e3e3);
	border-radius: max(0px, calc(var(--spf-l-r, 4px) - var(--spf-l-in, 0px)));
	pointer-events: none;
	transition: border-color .2s ease;
}
.spf-l-border--double .spf-loop__border { border-width: max(3px, var(--spf-l-bw, 3px)); }
/* Corner brackets: four L-shaped marks instead of a full line. */
.spf-l-border--corners .spf-loop__border {
	border: 0;
	border-radius: 0;
	--c: var(--spf-l-bc, #e3e3e3);
	--w: var(--spf-l-bw, 1px);
	--len: var(--spf-l-cl, 16px);
	background:
		linear-gradient(var(--c), var(--c)) top left / var(--len) var(--w) no-repeat,
		linear-gradient(var(--c), var(--c)) top left / var(--w) var(--len) no-repeat,
		linear-gradient(var(--c), var(--c)) top right / var(--len) var(--w) no-repeat,
		linear-gradient(var(--c), var(--c)) top right / var(--w) var(--len) no-repeat,
		linear-gradient(var(--c), var(--c)) bottom left / var(--len) var(--w) no-repeat,
		linear-gradient(var(--c), var(--c)) bottom left / var(--w) var(--len) no-repeat,
		linear-gradient(var(--c), var(--c)) bottom right / var(--len) var(--w) no-repeat,
		linear-gradient(var(--c), var(--c)) bottom right / var(--w) var(--len) no-repeat;
}

/* Accent line along one edge of the image */
.spf-loop__accent {
	position: absolute;
	z-index: 2;
	background: var(--spf-l-ac, #c62828);
	pointer-events: none;
}
.spf-loop__accent[data-pos="top"] { top: 0; left: 0; right: 0; height: var(--spf-l-as, 3px); border-radius: var(--spf-l-r, 4px) var(--spf-l-r, 4px) 0 0; }
.spf-loop__accent[data-pos="bottom"] { bottom: 0; left: 0; right: 0; height: var(--spf-l-as, 3px); border-radius: 0 0 var(--spf-l-r, 4px) var(--spf-l-r, 4px); }
.spf-loop__accent[data-pos="left"] { top: 0; bottom: 0; left: 0; width: var(--spf-l-as, 3px); border-radius: var(--spf-l-r, 4px) 0 0 var(--spf-l-r, 4px); }

/* Text strip over the top or bottom edge of the image */
.spf-loop__strip {
	position: absolute;
	z-index: 2;
	left: var(--spf-l-sm, 0);
	right: var(--spf-l-sm, 0);
	padding: var(--spf-l-spv, 4px) var(--spf-l-sph, 8px);
	background: var(--spf-l-sbg, rgba(29, 29, 31, .85));
	color: var(--spf-l-sc, #fff);
	font-size: var(--spf-l-sfs, 11px);
	font-weight: 600;
	line-height: 1.3;
	text-align: center;
	overflow-wrap: anywhere;
	pointer-events: none;
}
.spf-loop__strip[data-pos="top"] { top: var(--spf-l-sm, 0); border-radius: var(--spf-l-r, 4px) var(--spf-l-r, 4px) var(--spf-l-sr, 0) var(--spf-l-sr, 0); }
.spf-loop__strip[data-pos="bottom"] { bottom: var(--spf-l-sm, 0); border-radius: var(--spf-l-sr, 0) var(--spf-l-sr, 0) var(--spf-l-r, 4px) var(--spf-l-r, 4px); }
.spf-loop__strip.spf-l-strip-inset { border-radius: var(--spf-l-sr, 0); }
.spf-l-upper { text-transform: uppercase; letter-spacing: .04em; }

.spf-loop__badge {
	position: absolute;
	z-index: 4;
	margin: var(--spf-l-boy, 8px) var(--spf-l-bo, 8px);
	max-width: calc(100% - 2 * var(--spf-l-bo, 8px));
	padding: var(--spf-l-bpv, 2px) var(--spf-l-bph, 7px);
	border-radius: 3px;
	background: var(--spf-l-bbg, #c62828);
	color: var(--spf-l-bco, #fff);
	font-size: var(--spf-l-bfs, 11px);
	font-weight: var(--spf-l-bfw, 600);
	line-height: 1.3;
	overflow-wrap: anywhere;
	pointer-events: none;
}
.spf-loop__badge[data-pos^="top"] { top: 0; }
.spf-loop__badge[data-pos^="bottom"] { bottom: 0; }
.spf-loop__badge[data-pos$="left"] { left: 0; }
.spf-loop__badge[data-pos$="right"] { right: 0; }
.spf-loop__badge[data-pos$="center"] {
	left: 0;
	right: 0;
	margin-left: auto;
	margin-right: auto;
	width: max-content;
}
.spf-l-shape--square { border-radius: 0; }
.spf-l-shape--pill { border-radius: 999px; }
.spf-l-shape--circle {
	display: flex;
	align-items: center;
	justify-content: center;
	width: auto;
	min-width: 3.4em;
	aspect-ratio: 1;
	padding: .35em;
	border-radius: 50%;
	text-align: center;
	line-height: 1.05;
}
.spf-loop__badge.spf-l-shape--circle[data-pos$="center"] { width: max-content; }
.spf-l-shape--tag {
	border-radius: 3px 0 0 3px;
	padding-right: calc(var(--spf-l-bph, 7px) + 8px);
	clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 50%, calc(100% - 8px) 100%, 0 100%);
}

/* Hover effects: on the whole product card where the theme marks it, else on the image. */
.spf-loop:hover,
:is(.product, .wc-block-product, .wc-block-grid__product, .spf-card):hover .spf-loop { z-index: 1; }
.spf-l-hover--lift:hover,
:is(.product, .wc-block-product, .wc-block-grid__product, .spf-card):hover .spf-l-hover--lift {
	transform: translateY(-4px);
	box-shadow: 0 12px 26px rgba(0, 0, 0, .16);
}
.spf-l-hover--glow:hover,
:is(.product, .wc-block-product, .wc-block-grid__product, .spf-card):hover .spf-l-hover--glow {
	box-shadow: 0 0 0 2px var(--spf-l-hc, #c62828), 0 6px 18px rgba(0, 0, 0, .12);
}
.spf-l-hover--border:hover .spf-loop__border,
:is(.product, .wc-block-product, .wc-block-grid__product, .spf-card):hover .spf-l-hover--border .spf-loop__border {
	border-color: var(--spf-l-hc, #c62828);
	--c: var(--spf-l-hc, #c62828);
}
.spf-loop__zoom {
	display: block;
	overflow: hidden;
	border-radius: var(--spf-l-r, 4px);
}
.spf-loop__zoom img {
	display: block;
	transition: transform .35s ease;
}
.spf-l-hover--zoom:hover .spf-loop__zoom img,
:is(.product, .wc-block-product, .wc-block-grid__product, .spf-card):hover .spf-l-hover--zoom .spf-loop__zoom img {
	transform: scale(1.06);
}
@media (prefers-reduced-motion: reduce) {
	.spf-loop, .spf-loop__zoom img { transition: none; }
	.spf-l-hover--lift:hover,
	:is(.product, .wc-block-product, .wc-block-grid__product, .spf-card):hover .spf-l-hover--lift { transform: none; }
	.spf-l-hover--zoom:hover .spf-loop__zoom img,
	:is(.product, .wc-block-product, .wc-block-grid__product, .spf-card):hover .spf-l-hover--zoom .spf-loop__zoom img { transform: none; }
}

.spf-loop__note {
	display: block;
	margin: var(--spf-l-tm, 6px) 0;
	padding: var(--spf-l-tpv, 3px) var(--spf-l-tph, 6px);
	border-radius: var(--spf-l-tr, 3px);
	background: var(--spf-l-tbg, #fafafa);
	color: var(--spf-l-tc, #222);
	font-size: var(--spf-l-tfs, 12px);
	line-height: 1.35;
	text-align: var(--spf-l-ta, center);
	overflow-wrap: anywhere;
}

/* ---------- True centring of short labels ----------
 * Letter spacing adds space after the last letter, which pushes the text left of centre.
 * Cancel it on the last letter, and trim font ascent/descent where the browser supports it
 * so the text also sits in the vertical middle of its badge. */
.spf-top__text {
	margin-right: calc(var(--spf-top-ls, 0px) * -1);
	min-width: 0;
	max-width: 100%;
}
@supports (text-box: trim-both cap alphabetic) {
	.spf-top--badge,
	.spf-top--ribbon,
	.spf-top--label,
	.spf-top--strip .spf-top__text,
	.spf-top--headline .spf-top__text,
	.spf-ov,
	.spf-loop__badge {
		text-box: trim-both cap alphabetic;
	}
}

.spf-bottom-capped .spf-bottom { overflow-y: auto; scrollbar-width: thin; }

/* ---------- Scheduled frames outside their dates ---------- */
.spf-frame.spf-inactive {
	border-width: 0;
	background: none;
	box-shadow: none;
	border-radius: 0;
}
.spf-frame.spf-inactive .spf-frame__inner { border-radius: 0; padding: 0; }
.spf-frame.spf-inactive .spf-top,
.spf-frame.spf-inactive .spf-bottom,
.spf-frame.spf-inactive .spf-overlays,
.spf-inactive .spf-overlays,
.spf-loop.spf-inactive .spf-loop__badge,
.spf-loop.spf-inactive .spf-loop__border,
.spf-loop.spf-inactive .spf-loop__strip,
.spf-loop.spf-inactive .spf-loop__accent,
.spf-loop__note.spf-inactive {
	display: none !important;
}

.spf-loop.spf-inactive { box-shadow: none !important; transform: none !important; }
.spf-loop.spf-inactive .spf-loop__zoom img { transform: none !important; }

@media print {
	.spf-overlays, .spf-top--badge, .spf-top--ribbon, .spf-top--label { display: none; }
}
