/*
 * TA Sale Frames: frames on product tiles. Rules apply only to tiles that carry
 * .ta-sf-on, so a page with nothing live is untouched. Each rule has two selectors:
 * the WooCommerce li.product (its old weight, which beats theme card rules) and a
 * generic .ta-sf-tile root for theme cards (div, article). Colours come from
 * three custom properties (--ta-sf-main / --ta-sf-ink / --ta-sf-accent).
 */

.ta-sf-data {
	display: none;
}

/* The theme clips tiles (overflow hidden); the pill and coupon notches sit on the edge.
   The class is doubled so the side padding beats theme rules like
   "body.home .x ul.products li.product { padding: 0 !important }": the strips and bars
   reach the frame edge with negative margins of exactly this padding. */
.woocommerce ul.products li.product.ta-sf-on.ta-sf-on,
.ta-sf-tile.ta-sf-on.ta-sf-on {
	position: relative;
	overflow: visible;
	box-sizing: border-box;
	border-style: solid;
	border-color: var(--ta-sf-main);
	border-width: 3px;
	border-radius: 12px;
	--ta-sf-pad: 15px;
	padding-left: var(--ta-sf-pad) !important;
	padding-right: var(--ta-sf-pad) !important;
}

/* Defaults per style. */
.woocommerce ul.products li.product.ta-sf-on.ta-sf-style-red-pill,
.ta-sf-tile.ta-sf-on.ta-sf-style-red-pill { --ta-sf-main: #cc0000; --ta-sf-ink: #fff; }
.woocommerce ul.products li.product.ta-sf-on.ta-sf-style-charcoal,
.ta-sf-tile.ta-sf-on.ta-sf-style-charcoal { --ta-sf-main: #161616; --ta-sf-ink: #fff; --ta-sf-accent: #ff3b3b; }
.woocommerce ul.products li.product.ta-sf-on.ta-sf-style-dark-bar,
.ta-sf-tile.ta-sf-on.ta-sf-style-dark-bar { --ta-sf-main: #161616; --ta-sf-ink: #fff; }
.woocommerce ul.products li.product.ta-sf-on.ta-sf-style-coupon,
.ta-sf-tile.ta-sf-on.ta-sf-style-coupon { --ta-sf-main: #cc0000; --ta-sf-ink: #fff; }
.woocommerce ul.products li.product.ta-sf-on.ta-sf-style-green-gold,
.ta-sf-tile.ta-sf-on.ta-sf-style-green-gold { --ta-sf-main: #0f5132; --ta-sf-ink: #f3e3b0; --ta-sf-accent: #b8912a; }
.woocommerce ul.products li.product.ta-sf-on.ta-sf-style-flag,
.ta-sf-tile.ta-sf-on.ta-sf-style-flag { --ta-sf-main: #01411c; --ta-sf-ink: #fff; }
.woocommerce ul.products li.product.ta-sf-on.ta-sf-style-countdown,
.ta-sf-tile.ta-sf-on.ta-sf-style-countdown { --ta-sf-main: #161616; --ta-sf-ink: #fff; --ta-sf-accent: #ff5a5a; }
.woocommerce ul.products li.product.ta-sf-on.ta-sf-style-ribbon,
.ta-sf-tile.ta-sf-on.ta-sf-style-ribbon { --ta-sf-main: #cc0000; --ta-sf-ink: #fff; }
.woocommerce ul.products li.product.ta-sf-on.ta-sf-style-price-tag,
.ta-sf-tile.ta-sf-on.ta-sf-style-price-tag { --ta-sf-main: #cc0000; --ta-sf-ink: #fff; }
.woocommerce ul.products li.product.ta-sf-on.ta-sf-style-white-friday,
.ta-sf-tile.ta-sf-on.ta-sf-style-white-friday { --ta-sf-main: #161616; --ta-sf-ink: #161616; --ta-sf-accent: #cc0000; }

/* Label elements share a base. */
.ta-sf-pill,
.ta-sf-bar,
.ta-sf-strip {
	display: block;
	box-sizing: border-box;
	font-family: inherit;
	font-style: normal;
	line-height: 1.2;
	text-align: center;
	text-decoration: none;
	position: relative;
	z-index: 2;
}

/* 1. red-pill (and charcoal, its dark twin): pill on the top edge, end date strip at the bottom */
.woocommerce ul.products li.product.ta-sf-on.ta-sf-style-red-pill,
.ta-sf-tile.ta-sf-on.ta-sf-style-red-pill,
.woocommerce ul.products li.product.ta-sf-on.ta-sf-style-charcoal,
.ta-sf-tile.ta-sf-on.ta-sf-style-charcoal {
	margin-top: 16px;
	padding-top: 14px !important;
}
/* The strip's bottom margin assumes this padding; without it the strip hangs below the tile. */
.woocommerce ul.products li.product.ta-sf-on.ta-sf-on.ta-sf-style-red-pill,
.ta-sf-tile.ta-sf-on.ta-sf-on.ta-sf-style-red-pill,
.woocommerce ul.products li.product.ta-sf-on.ta-sf-on.ta-sf-style-charcoal,
.ta-sf-tile.ta-sf-on.ta-sf-on.ta-sf-style-charcoal,
.woocommerce ul.products li.product.ta-sf-on.ta-sf-on.ta-sf-style-coupon,
.ta-sf-tile.ta-sf-on.ta-sf-on.ta-sf-style-coupon,
.woocommerce ul.products li.product.ta-sf-on.ta-sf-on.ta-sf-style-price-tag,
.ta-sf-tile.ta-sf-on.ta-sf-on.ta-sf-style-price-tag,
.woocommerce ul.products li.product.ta-sf-on.ta-sf-on.ta-sf-style-countdown,
.ta-sf-tile.ta-sf-on.ta-sf-on.ta-sf-style-countdown {
	padding-bottom: 15px !important;
}
.ta-sf-pill {
	position: absolute;
	top: -15px;
	left: 50%;
	transform: translateX(-50%);
	width: auto;
	background: var(--ta-sf-main);
	color: var(--ta-sf-ink);
	font-size: 13px;
	font-weight: 800;
	letter-spacing: 1px;
	padding: 6px 16px;
	border-radius: 999px;
	white-space: nowrap;
	z-index: 3;
}
.ta-sf-style-red-pill .ta-sf-strip,
.ta-sf-style-charcoal .ta-sf-strip {
	background: var(--ta-sf-main);
	color: var(--ta-sf-ink);
	font-size: 12px;
	font-weight: 600;
	padding: 7px 0;
	margin: 8px calc(-3px - var(--ta-sf-pad)) calc(-3px - 15px);
	border-radius: 0 0 9px 9px;
}
/* charcoal: thinner dark frame so the red % badge and price lead; a red dot in the pill. */
.woocommerce ul.products li.product.ta-sf-on.ta-sf-on.ta-sf-style-charcoal,
.ta-sf-tile.ta-sf-on.ta-sf-on.ta-sf-style-charcoal {
	border-width: 2px;
}
.ta-sf-style-charcoal .ta-sf-strip {
	margin: 8px calc(-2px - var(--ta-sf-pad)) calc(-2px - 15px);
	border-radius: 0 0 10px 10px;
}
.ta-sf-style-charcoal .ta-sf-pill {
	display: inline-flex;
	align-items: center;
	gap: 7px;
}
.ta-sf-style-charcoal .ta-sf-pill::before {
	content: "";
	flex: none;
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--ta-sf-accent);
}

/* ribbon: quiet light card; the label is a tab on the frame's top-left edge, clear of the photo and the shop's own badges. */
.woocommerce ul.products li.product.ta-sf-on.ta-sf-style-ribbon,
.ta-sf-tile.ta-sf-on.ta-sf-style-ribbon {
	margin-top: 16px;
	padding-top: 14px !important;
}
.woocommerce ul.products li.product.ta-sf-on.ta-sf-on.ta-sf-style-ribbon,
.ta-sf-tile.ta-sf-on.ta-sf-on.ta-sf-style-ribbon {
	border-width: 1px;
	border-color: #e3e3e3;
}
.ta-sf-style-ribbon .ta-sf-pill {
	top: -14px;
	left: 12px;
	transform: none;
	max-width: calc(100% - 24px);
	font-size: 12px;
	letter-spacing: 0.5px;
	padding: 6px 12px;
	border-radius: 6px 6px 6px 0;
}

/* price-tag: light frame, no pill; the label and end date sit in a tinted strip under the price. */
.woocommerce ul.products li.product.ta-sf-on.ta-sf-on.ta-sf-style-price-tag,
.ta-sf-tile.ta-sf-on.ta-sf-on.ta-sf-style-price-tag {
	border-width: 1px;
	border-color: #efc2c2;
	border-color: color-mix(in srgb, var(--ta-sf-main) 25%, #fff);
}
.ta-sf-style-price-tag .ta-sf-strip:not(.ta-sf-strip-count) {
	background: #fff2f2;
	background: color-mix(in srgb, var(--ta-sf-main) 6%, #fff);
	color: var(--ta-sf-main);
	border-top: 1px dashed #e3a3a3;
	border-top-color: color-mix(in srgb, var(--ta-sf-main) 40%, #fff);
	font-size: 13px;
	font-weight: 700;
	padding: 9px 6px;
	margin: 10px calc(-1px - var(--ta-sf-pad)) calc(-1px - 15px);
	border-radius: 0 0 11px 11px;
}

/* Styles with no bottom strip: room under the card's last line (some themes give cards no bottom padding). */
.woocommerce ul.products li.product.ta-sf-on.ta-sf-on.ta-sf-style-dark-bar,
.woocommerce ul.products li.product.ta-sf-on.ta-sf-on.ta-sf-style-white-friday,
.woocommerce ul.products li.product.ta-sf-on.ta-sf-on.ta-sf-style-green-gold,
.woocommerce ul.products li.product.ta-sf-on.ta-sf-on.ta-sf-style-flag,
.woocommerce ul.products li.product.ta-sf-on.ta-sf-on.ta-sf-style-ribbon,
.ta-sf-tile.ta-sf-on.ta-sf-on.ta-sf-style-dark-bar,
.ta-sf-tile.ta-sf-on.ta-sf-on.ta-sf-style-white-friday,
.ta-sf-tile.ta-sf-on.ta-sf-on.ta-sf-style-green-gold,
.ta-sf-tile.ta-sf-on.ta-sf-on.ta-sf-style-flag,
.ta-sf-tile.ta-sf-on.ta-sf-on.ta-sf-style-ribbon {
	padding-bottom: 12px !important;
}

/* 2 / 4 / 5. title bar above the photo, merged into the frame */
.ta-sf-bar {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	margin: -3px calc(-3px - var(--ta-sf-pad)) 10px;
	padding: 10px 6px;
	background: var(--ta-sf-main);
	color: var(--ta-sf-ink);
	font-size: 13px;
	font-weight: 800;
	letter-spacing: 3px;
	border-radius: 9px 9px 0 0;
}
.woocommerce ul.products li.product.ta-sf-on.ta-sf-style-dark-bar,
.ta-sf-tile.ta-sf-on.ta-sf-style-dark-bar {
	border-width: 6px;
}
.ta-sf-style-dark-bar .ta-sf-bar {
	margin: -6px calc(-6px - var(--ta-sf-pad)) 10px;
}
/* white-friday: thin dark frame, white top bar with dark text and two red dashes. */
.woocommerce ul.products li.product.ta-sf-on.ta-sf-on.ta-sf-style-white-friday,
.ta-sf-tile.ta-sf-on.ta-sf-on.ta-sf-style-white-friday {
	border-width: 2px;
}
.ta-sf-style-white-friday .ta-sf-bar {
	margin: -2px calc(-2px - var(--ta-sf-pad)) 10px;
	background: #fff;
	color: var(--ta-sf-ink);
	border: 2px solid var(--ta-sf-main);
	border-radius: 10px 10px 0 0;
	gap: 10px;
	letter-spacing: 2px;
}
.ta-sf-style-white-friday .ta-sf-bar::before,
.ta-sf-style-white-friday .ta-sf-bar::after {
	content: "";
	flex: none;
	width: 10px;
	height: 2px;
	background: var(--ta-sf-accent);
}
.woocommerce ul.products li.product.ta-sf-on.ta-sf-style-green-gold,
.ta-sf-tile.ta-sf-on.ta-sf-style-green-gold {
	overflow: hidden;
	box-shadow: inset 0 0 0 2px #fff, inset 0 0 0 3px var(--ta-sf-accent);
}
.ta-sf-style-green-gold .ta-sf-bar,
.ta-sf-style-flag .ta-sf-bar {
	letter-spacing: 1.5px;
}
.ta-sf-style-green-gold .ta-sf-bar {
	font-weight: 700;
	padding: 9px 6px;
	border-radius: 0;
}
.ta-sf-crescent {
	flex: 0 0 auto;
	width: 18px;
	height: 18px;
}
.ta-sf-bar-text {
	min-width: 0;
}

/* 3. coupon: a tear-off stub at the bottom (dashed line, side notches) with the label and end date. */
.woocommerce ul.products li.product.ta-sf-on.ta-sf-on.ta-sf-style-coupon,
.ta-sf-tile.ta-sf-on.ta-sf-on.ta-sf-style-coupon {
	border-width: 2px;
}
.ta-sf-style-coupon .ta-sf-strip:not(.ta-sf-strip-count) {
	background: #fff;
	color: var(--ta-sf-main);
	border-top: 2px dashed var(--ta-sf-main);
	font-size: 13px;
	font-weight: 800;
	letter-spacing: 0.3px;
	padding: 10px 6px;
	margin: 12px calc(-2px - var(--ta-sf-pad)) calc(-2px - 15px);
	border-radius: 0 0 10px 10px;
}
.ta-sf-style-coupon .ta-sf-strip:not(.ta-sf-strip-count)::before,
.ta-sf-style-coupon .ta-sf-strip:not(.ta-sf-strip-count)::after {
	content: "";
	position: absolute;
	top: -10px;
	box-sizing: border-box;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: var(--ta-sf-page, #f5f5f5);
	border: 2px solid var(--ta-sf-main);
}
.ta-sf-style-coupon .ta-sf-strip:not(.ta-sf-strip-count)::before {
	left: -10px;
	clip-path: inset(0 0 0 50%);
}
.ta-sf-style-coupon .ta-sf-strip:not(.ta-sf-strip-count)::after {
	right: -10px;
	clip-path: inset(0 50% 0 0);
}

/* 5. flag: green frame; the bar carries the flag's white band on its left. */
.woocommerce ul.products li.product.ta-sf-on.ta-sf-style-flag,
.ta-sf-tile.ta-sf-on.ta-sf-style-flag {
	overflow: hidden;
}
.ta-sf-style-flag .ta-sf-bar {
	background: linear-gradient(90deg, var(--ta-sf-main) 0, var(--ta-sf-main) 4px, #fff 4px, #fff 20%, var(--ta-sf-main) 20%);
	padding-left: 20%;
}

/* 6. countdown strip */
.woocommerce ul.products li.product.ta-sf-on.ta-sf-style-countdown,
.ta-sf-tile.ta-sf-on.ta-sf-style-countdown {
	border-width: 2px;
	overflow: hidden;
}
.ta-sf-strip-count {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	column-gap: 10px;
	row-gap: 2px;
	margin: 8px calc(-2px - var(--ta-sf-pad)) calc(-2px - 15px);
	padding: 9px 0;
	background: var(--ta-sf-main);
	color: var(--ta-sf-ink);
}
.ta-sf-strip-text {
	font-size: 12px;
	font-weight: 600;
	opacity: 0.87;
}
/* The event name above the timer, on styles whose label lives in the bottom strip (countdown, coupon, price-tag). */
.ta-sf-strip-label {
	flex: none;
	width: 100%;
	font-size: 11px;
	font-weight: 800;
	letter-spacing: 2px;
}
.ta-sf-style-countdown .ta-sf-strip-label {
	color: var(--ta-sf-accent);
}
.ta-sf-count {
	font-size: 15px;
	font-weight: 800;
	font-variant-numeric: tabular-nums;
	letter-spacing: 1px;
}

/* Countdown strip on the styles that have no bottom strip of their own (last 48 hours only). */
.ta-sf-style-dark-bar .ta-sf-strip-count {
	margin: 8px calc(-6px - var(--ta-sf-pad)) calc(-6px - 15px);
	border-radius: 0 0 6px 6px;
}
.ta-sf-style-red-pill .ta-sf-strip-count,
.ta-sf-style-green-gold .ta-sf-strip-count,
.ta-sf-style-flag .ta-sf-strip-count {
	margin: 8px calc(-3px - var(--ta-sf-pad)) calc(-3px - 15px);
}
.ta-sf-style-ribbon .ta-sf-strip-count,
.ta-sf-style-price-tag .ta-sf-strip-count {
	margin: 8px calc(-1px - var(--ta-sf-pad)) calc(-1px - 15px);
}

/* Phones: two-column grid. */
@media (max-width: 480px) {
	.woocommerce ul.products li.product.ta-sf-on,
	.ta-sf-tile.ta-sf-on {
		border-radius: 10px;
	}
	.ta-sf-pill {
		top: -13px;
		font-size: 12px;
		letter-spacing: 0.5px;
		padding: 5px 12px;
		max-width: 96%;
		overflow: hidden;
		text-overflow: ellipsis;
	}
	.woocommerce ul.products li.product.ta-sf-on.ta-sf-style-red-pill,
	.ta-sf-tile.ta-sf-on.ta-sf-style-red-pill,
	.woocommerce ul.products li.product.ta-sf-on.ta-sf-style-charcoal,
	.ta-sf-tile.ta-sf-on.ta-sf-style-charcoal {
		margin-top: 12px;
		padding-top: 10px !important;
	}
	.ta-sf-style-red-pill .ta-sf-strip {
		font-size: 11px;
		padding: 5px 0;
	}
	/* charcoal keeps its labels at 12px on phones (10-11px is below a readable floor). */
	.ta-sf-style-charcoal .ta-sf-pill {
		top: -13px;
		font-size: 12px;
		padding: 5px 12px;
		gap: 6px;
	}
	.ta-sf-style-charcoal .ta-sf-strip {
		font-size: 12px;
		padding: 6px 0;
	}
	.ta-sf-bar {
		font-size: 12px;
		letter-spacing: 1.5px;
		padding: 8px 4px;
		margin-bottom: 6px;
	}
	.ta-sf-style-green-gold .ta-sf-bar,
	.ta-sf-style-flag .ta-sf-bar {
		letter-spacing: 1px;
	}
	.ta-sf-crescent {
		width: 14px;
		height: 14px;
	}
	.woocommerce ul.products li.product.ta-sf-on.ta-sf-style-ribbon,
	.ta-sf-tile.ta-sf-on.ta-sf-style-ribbon {
		margin-top: 14px;
		padding-top: 12px !important;
	}
	.ta-sf-style-ribbon .ta-sf-pill {
		top: -13px;
		left: 10px;
		max-width: calc(100% - 20px);
		padding: 5px 10px;
	}
	.ta-sf-style-white-friday .ta-sf-bar {
		gap: 6px;
		letter-spacing: 1.5px;
	}
	.ta-sf-style-white-friday .ta-sf-bar::before,
	.ta-sf-style-white-friday .ta-sf-bar::after {
		width: 8px;
	}
	.ta-sf-style-price-tag .ta-sf-strip:not(.ta-sf-strip-count),
	.ta-sf-style-coupon .ta-sf-strip:not(.ta-sf-strip-count) {
		font-size: 12px;
		padding: 8px 4px;
		border-radius: 0 0 8px 8px;
	}
	.ta-sf-strip-label {
		font-size: 11px;
		letter-spacing: 1px;
	}
	.ta-sf-strip-count {
		flex-direction: column;
		gap: 2px;
		padding: 6px 4px;
	}
	.ta-sf-strip-text {
		font-size: 11px;
	}
	.ta-sf-count {
		font-size: 12px;
		letter-spacing: 0.5px;
	}
}
