/* ============================================================
   Valabi Smart Offers — catalog-discount countdowns
   Aesthetic: warm ticket stock. The clock reads like a torn coupon —
   pressed paper faces, hairline ridges, a perforation between the words
   and the numbers, one accent spine holding it together. Deliberately
   theme-blending: we never swap the font family (that would break Persian
   text), only weight, tracking, colour and tabular figures.
   Everything is scoped to .vso-ct and resets its own box model so it
   survives inside an arbitrary third-party theme.
   ============================================================ */

.vso-ct {
	--vso-accent: #d6336c;
	--vso-accent-deep: #a61e4d;
	--vso-accent-soft: #fdeef4;
	--vso-accent-line: #f6d3e1;
	--vso-accent-track: #f6dbe6;
	--vso-accent-mid: #f06595;
	--vso-ink: #181219;
	--vso-mute: #6b6270;
	--vso-paper: #fff;
	--vso-face: color-mix(in srgb, var(--vso-accent-soft) 30%, #fff);
	--vso-ridge: color-mix(in srgb, var(--vso-accent) 18%, #fff);

	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
	margin: 10px 0;
	font-family: inherit;
	line-height: 1.45;
	color: var(--vso-ink);
}

/* Visibility is deliberately NOT gated on a class the ticker adds: the server
   already prints the correct remaining time, and an opacity transition can be
   left parked at 0 in a throttled subtree (seen live inside a Flatsome
   related-products row), which hides the timer for good. */
.vso-ct * { box-sizing: border-box; }

/* Words ------------------------------------------------------ */
.vso-ct__label {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	min-width: 0;
	color: var(--vso-mute);
	font-size: 12px;
	font-weight: 700;
	letter-spacing: .01em;
}

.vso-ct__icon {
	flex: none;
	width: 15px;
	height: 15px;
	fill: none;
	stroke: var(--vso-accent);
	stroke-width: 1.8;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.vso-ct__label-text {
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* Numbers ---------------------------------------------------- */
.vso-ct__clock {
	display: inline-flex;
	align-items: stretch;
	gap: 5px;
	direction: ltr; /* time always reads left-to-right, even on an RTL page */
}

.vso-ct__unit {
	display: inline-flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	min-width: 0;
}

.vso-ct__digits {
	font-variant-numeric: tabular-nums;
	font-feature-settings: "tnum" 1, "lnum" 1;
	font-weight: 800;
	letter-spacing: .02em;
	color: var(--vso-accent-deep);
}

.vso-ct__caption {
	color: var(--vso-mute);
	font-size: 9px;
	font-weight: 650;
	line-height: 1.1;
	letter-spacing: .02em;
	white-space: nowrap;
}

/* Time only runs one way: once a leading unit empties it is gone. */
.vso-ct.is-no-days .vso-ct__unit--days,
.vso-ct.is-no-hours .vso-ct__unit--hours { display: none; }

/* ============================================================
   1. Blocks — pressed paper tiles. The product-page showpiece.
   ============================================================ */
.vso-ct--blocks {
	align-items: stretch;
	gap: 12px;
	padding: 11px 13px;
	border: 1px solid var(--vso-accent-line);
	border-radius: 14px;
	background:
		linear-gradient(180deg, color-mix(in srgb, var(--vso-accent-soft) 70%, #fff), var(--vso-paper));
	box-shadow: 0 1px 2px rgba(29, 22, 32, .04), 0 14px 30px -22px rgba(20, 12, 18, .5);
}

/* The accent spine that holds the card together. */
.vso-ct--blocks .vso-ct__label {
	position: relative;
	align-self: center;
	padding-inline-start: 9px;
	color: var(--vso-accent-deep);
	font-size: 12.5px;
}

.vso-ct--blocks .vso-ct__label::before {
	content: "";
	position: absolute;
	inset-inline-start: 0;
	top: 50%;
	width: 2px;
	height: 20px;
	border-radius: 2px;
	background: var(--vso-accent);
	transform: translateY(-50%);
}

.vso-ct--blocks .vso-ct__clock {
	margin-inline-start: auto;
	gap: 6px;
}

.vso-ct--blocks .vso-ct__unit {
	gap: 3px;
	padding: 6px 8px 5px;
	border: 1px solid color-mix(in srgb, var(--vso-accent) 12%, #fff);
	border-radius: 10px;
	background: var(--vso-paper);
	/* A hairline of light across the top edge — the "pressed" face. */
	box-shadow:
		inset 0 1px 0 rgba(255, 255, 255, .9),
		0 1px 3px rgba(20, 12, 18, .07);
}

.vso-ct--blocks .vso-ct__digits {
	font-size: 17px;
	line-height: 1.05;
}

/* The seconds tile breathes, so the card is visibly alive at a glance. */
.vso-ct--blocks .vso-ct__unit--seconds {
	position: relative;
	border-color: color-mix(in srgb, var(--vso-accent) 30%, #fff);
}

.vso-ct--blocks .vso-ct__unit--seconds::after {
	content: "";
	position: absolute;
	inset-inline: 7px;
	bottom: 3px;
	height: 2px;
	border-radius: 2px;
	background: var(--vso-accent);
	animation: vso-ct-breathe 1s ease-out infinite;
}

@keyframes vso-ct-breathe {
	0% { opacity: .85; transform: scaleX(1); }
	100% { opacity: .15; transform: scaleX(.4); }
}

/* ============================================================
   2. Ribbon — one coupon strip, perforated between words and numbers.
   ============================================================ */
.vso-ct--ribbon {
	gap: 0;
	padding: 0;
	border: 1px solid color-mix(in srgb, var(--vso-accent) 22%, #fff);
	border-radius: 12px;
	background:
		repeating-linear-gradient(
			135deg,
			transparent 0 7px,
			color-mix(in srgb, var(--vso-accent) 5%, transparent) 7px 8px
		),
		linear-gradient(90deg, var(--vso-accent-soft), color-mix(in srgb, var(--vso-accent-soft) 45%, #fff));
	overflow: hidden;
}

.vso-ct--ribbon .vso-ct__label {
	flex: 1 1 auto;
	padding: 10px 13px;
	color: var(--vso-accent-deep);
	font-size: 12.5px;
}

.vso-ct--ribbon .vso-ct__clock {
	position: relative;
	flex: none;
	align-items: center;
	gap: 0;
	padding: 9px 13px;
	background: var(--vso-paper);
}

/* The perforation. */
.vso-ct--ribbon .vso-ct__clock::before {
	content: "";
	position: absolute;
	inset-inline-start: 0;
	top: 6px;
	bottom: 6px;
	border-inline-start: 1px dashed color-mix(in srgb, var(--vso-accent) 35%, #fff);
}

.vso-ct--ribbon .vso-ct__unit {
	flex-direction: row;
	align-items: baseline;
	gap: 3px;
	padding-inline: 7px;
}

/* Ridges between the units, instead of tiles around them. */
.vso-ct--ribbon .vso-ct__unit + .vso-ct__unit {
	border-inline-start: 1px solid var(--vso-ridge);
}

.vso-ct--ribbon .vso-ct__digits {
	font-size: 16px;
	line-height: 1.1;
}

.vso-ct--ribbon .vso-ct__caption {
	font-size: 8.5px;
	opacity: .85;
}

/* ============================================================
   3. Minimal — one unboxed line: «۲ روز ۰۴:۱۲:۳۳». Sits under a theme
   price without arguing with it.
   ============================================================ */
.vso-ct--minimal {
	gap: 7px;
	margin: 7px 0;
}

.vso-ct--minimal .vso-ct__label { font-size: 11.5px; }
.vso-ct--minimal .vso-ct__icon { width: 13px; height: 13px; }

.vso-ct--minimal .vso-ct__clock {
	align-items: baseline;
	gap: 0;
	padding: 2px 7px;
	border-radius: 7px;
	background: var(--vso-face);
}

.vso-ct--minimal .vso-ct__unit {
	flex-direction: row;
	align-items: baseline;
	gap: 2px;
}

.vso-ct--minimal .vso-ct__digits {
	font-size: 13.5px;
	line-height: 1.2;
}

/* Only the days keep a word; the rest join up as a clock. */
.vso-ct--minimal .vso-ct__caption { display: none; }

.vso-ct--minimal .vso-ct__unit--days .vso-ct__caption {
	display: inline;
	margin-inline-end: 5px;
	font-size: 10px;
	color: var(--vso-accent-deep);
}

.vso-ct--minimal .vso-ct__unit--minutes::before,
.vso-ct--minimal .vso-ct__unit--seconds::before {
	content: ":";
	margin: 0 1px;
	color: color-mix(in srgb, var(--vso-accent-deep) 55%, transparent);
	font-weight: 700;
}

/* ============================================================
   Contexts
   ============================================================ */

/* Product page: give the showpiece room to breathe under the price. */
.vso-ct--product { margin: 14px 0 16px; }
/* Hug the clock rather than stretch: with two units left (or four) the card
   stays the same shape, just narrower. */
.vso-ct--product.vso-ct--blocks {
	width: fit-content;
	max-width: min(420px, 100%);
}

/* Archive banner: one wide strip above the grid, words at one end and the
   clock at the other rather than a lonely pair floating in all that width. */
.vso-ct--banner {
	width: 100%;
	margin: 4px 0 18px;
	justify-content: space-between;
}
.vso-ct--banner .vso-ct__label { flex: 1 1 auto; }
.vso-ct--banner.vso-ct--ribbon .vso-ct__label { font-size: 13.5px; }
.vso-ct--banner.vso-ct--blocks .vso-ct__label { font-size: 13.5px; }

/* Product card in a grid: the tightest possible read. A card is far too
   narrow for tiles, so PHP always sends the minimal design here — this
   only shrinks it further and drops the words. */
.vso-ct--card {
	gap: 5px;
	margin: 4px 0 2px;
	justify-content: center;
}

.vso-ct--card .vso-ct__label-text { display: none; }
.vso-ct--card .vso-ct__icon { width: 12px; height: 12px; }
.vso-ct--card .vso-ct__clock { padding: 1px 6px; }
.vso-ct--card .vso-ct__digits { font-size: 12.5px; }
.vso-ct--card .vso-ct__unit--days .vso-ct__caption { font-size: 9px; }

/* The moment after a countdown runs out on a product page. */
.vso-ct--ended {
	display: block;
	color: var(--vso-mute);
	font-size: 12.5px;
	font-weight: 700;
}

/* ============================================================
   Small screens — the clock must never wrap mid-number.
   ============================================================ */
@media (max-width: 480px) {
	.vso-ct--blocks {
		gap: 9px;
		padding: 10px;
	}
	.vso-ct--blocks .vso-ct__clock {
		margin-inline-start: 0;
		width: 100%;
		justify-content: space-between;
	}
	.vso-ct--blocks .vso-ct__unit {
		flex: 1 1 0;
		padding-inline: 4px;
	}
	.vso-ct--blocks .vso-ct__digits { font-size: 16px; }

	.vso-ct--ribbon { flex-wrap: nowrap; }
	.vso-ct--ribbon .vso-ct__label { padding: 9px 11px; }
	.vso-ct--ribbon .vso-ct__clock { padding: 8px 9px; }
	.vso-ct--ribbon .vso-ct__unit { padding-inline: 5px; }
	.vso-ct--ribbon .vso-ct__digits { font-size: 15px; }
	.vso-ct--ribbon .vso-ct__caption { display: none; }
}

@media (max-width: 360px) {
	.vso-ct--blocks .vso-ct__caption,
	.vso-ct--minimal .vso-ct__label-text { font-size: 8.5px; }
	.vso-ct--ribbon .vso-ct__label-text { font-size: 11.5px; }
}

@media (prefers-reduced-motion: reduce) {
	.vso-ct--blocks .vso-ct__unit--seconds::after { animation: none; opacity: .5; }
}
