/*
 * PDP-059: PDP Alternatives section (modules/pdp-alternatives.php).
 *
 * Reference: foksbat/zigzag-design@94d510de7c5e39df97f7a73db402453aeac12050,
 * context/PDP_ALTERNATIVES_VISUAL_CONTRACT.md and the canonical Finals
 * (Desktop v1.72.5 AltCard51, Tablet v1.19.5 / Mobile v2.2.48.5 AltCard v2.2.5).
 * Values are the computed values of those Finals; every selector is scoped
 * to .zz-pdp-alt / .zz-pdp-alt-row.
 *
 * Composition switch = the neighbouring Decision Core thresholds
 * (pdp-decision-core.css): Mobile <=549.98, Tablet portrait 550-1023.98,
 * Tablet landscape 1024-1279.98, Desktop >=1280. Columns 2 / 3 / 4 / 5;
 * visible prefix Mobile 4, Tablet 6, Desktop 5 of the one ranked list
 * (display:none removes the remainder from layout, AT and tab order).
 * Natural left-aligned grid: sparse rows keep the ordinary cell width.
 */

.zz-pdp-alt-row > .col {
	padding-bottom: 0;
}

.zz-pdp-alt {
	padding-top: 48px;
	color: #2f2f2f;
	font-family: Lato, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

.zz-pdp-alt__heading {
	margin: 0 0 18px;
	padding: 0;
	color: #2f2f2f;
	font-family: inherit;
	font-size: 26px;
	font-weight: 700;
	line-height: 33px;
	letter-spacing: normal;
	text-transform: none;
}

.zz-pdp-alt__grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	column-gap: 10px;
	row-gap: 14px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.zz-pdp-alt__grid > .zz-pdp-alt__item {
	display: flex;
	min-width: 0;
	margin: 0;
	padding: 0;
	list-style: none;
}

/* Visible prefix: Mobile 4 (default), Tablet 6, Desktop 5. */
.zz-pdp-alt__grid > .zz-pdp-alt__item:nth-child(n + 5) {
	display: none;
}

/* ---------------------------------------------------------------- card (AltCard v2.2.5) */

.zz-pdp-alt__card {
	display: flex;
	flex-direction: column;
	flex: 1 1 auto;
	min-width: 0;
	border: 1px solid #e5e7eb;
	border-radius: 14px;
	background: #fff;
}

.zz-pdp-alt__media {
	position: relative;
	display: block;
	aspect-ratio: 1 / 1;
	border-radius: 13px 13px 0 0;
	background: #fff;
}

/*
 * Same declarations as the Final's image zone (overflow visible), so a square
 * Woo thumbnail renders exactly like the Final: on Desktop its automatic
 * minimum height keeps the zone square despite aspect-ratio 1.1 / 1
 * (measured 233.19 x 233.19 at 1440). Corners are rounded on the image itself.
 */
.zz-pdp-alt__media .zz-pdp-alt__img {
	display: block;
	width: 100%;
	max-width: none;
	height: 100%;
	margin: 0;
	border-radius: 13px 13px 0 0;
	object-fit: contain;
}

.zz-pdp-alt__badge {
	position: absolute;
	top: 8px;
	display: inline-flex;
	align-items: center;
	height: 20px;
	padding: 0 8px;
	border-radius: 999px;
	font: 700 10.5px/1 Lato, sans-serif;
	white-space: nowrap;
}

.zz-pdp-alt__badge--top {
	left: 8px;
	background: #ffd700;
	color: #030305;
}

/* PROVISIONAL_BADGE_SET: factual G23 role as a neutral text pill in the Final's seal corner. */
.zz-pdp-alt__badge--factual {
	right: 8px;
	max-width: calc(100% - 16px);
	overflow: hidden;
	border: 1px solid rgba(17, 17, 17, 0.12);
	background: rgba(255, 255, 255, 0.92);
	color: #2f2f2f;
	text-overflow: ellipsis;
}

.zz-pdp-alt__body {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	gap: 4px;
	min-width: 0;
	padding: 10px 11px 11px;
}

/* PROVISIONAL_SPEC: one line; an empty spec keeps the row height. */
.zz-pdp-alt__spec {
	min-height: 11px;
	margin: 0;
	padding: 0;
	overflow: hidden;
	color: #6b7280;
	font: 600 10px/1.1 Lato, sans-serif;
	letter-spacing: 0.04em;
	text-overflow: ellipsis;
	text-transform: uppercase;
	white-space: nowrap;
}

/* Fixed 3-line title zone; the link itself clamps so its focus ring is not clipped. */
.zz-pdp-alt__title {
	height: 56.55px;
	margin-top: 1px;
}

.zz-pdp-alt__title a {
	display: -webkit-box;
	overflow: hidden;
	color: #2f2f2f;
	font: 550 14.5px/1.3 Lato, sans-serif;
	text-decoration: none;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 3;
	line-clamp: 3;
}

.zz-pdp-alt__title a:hover {
	color: #2f2f2f;
	text-decoration: underline;
}

/* PROVISIONAL_ZERO_REVIEW: no stars/count, row height reserved. */
.zz-pdp-alt__rating {
	display: flex;
	align-items: center;
	gap: 5px;
	min-height: 11.5px;
}

.zz-pdp-alt__stars {
	display: inline-flex;
	align-items: center;
	gap: 2.5px;
}

.zz-pdp-alt__star {
	position: relative;
	display: block;
	width: 11px;
	height: 11px;
}

.zz-pdp-alt__star svg {
	display: block;
	width: 100%;
	height: 100%;
}

.zz-pdp-alt__star-empty {
	fill: #d1d5db;
	stroke: #d1d5db;
	stroke-width: 0.8;
	stroke-linejoin: round;
}

.zz-pdp-alt__star-fill {
	position: absolute;
	inset: 0;
	fill: #ffd700;
	stroke: #ffd700;
	stroke-width: 0.8;
	stroke-linejoin: round;
}

.zz-pdp-alt__count {
	color: #6b7280;
	font: 400 11.5px/1 Lato, sans-serif;
}

/*
 * Price + Buy row. Native WooCommerce price HTML (PRICE_DISPLAY =
 * NATIVE_WOOCOMMERCE) may be a sale del/ins pair or a variable range wider
 * than the Final's single price. OVD-3 A: the row wraps instead of
 * overflowing - when price and Buy do not fit side by side (always at a
 * 139px Mobile 320 card), Buy moves under the price inside the card and the
 * price may wrap inside its own box. No clipping, no truncation.
 * With space-between, column-gap only sets the wrap threshold (6px keeps the
 * Final's side-by-side row at 360 for the site's native "140 грн." width);
 * row-gap 12px keeps the stacked Buy's 8px hit area and focus ring off the price.
 */
.zz-pdp-alt__commerce {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	column-gap: 6px;
	row-gap: 12px;
	min-width: 0;
	margin-top: auto;
	padding-top: 6px;
}

.zz-pdp-alt__price.price {
	flex: 0 1 auto;
	min-width: 0;
	margin: 0;
	color: #2f2f2f;
	font: 700 16px/1 Lato, sans-serif;
	white-space: normal;
}

.zz-pdp-alt__price .amount {
	color: inherit;
	font-weight: inherit;
	white-space: nowrap;
}

.zz-pdp-alt__price del {
	margin-right: 4px;
	color: #6b7280;
	font-size: 12.5px;
	font-weight: 400;
	opacity: 1;
}

.zz-pdp-alt__price del .amount {
	color: #6b7280;
}

.zz-pdp-alt__price ins {
	color: inherit;
	font-weight: 700;
	text-decoration: none;
}

.zz-pdp-alt__buy {
	display: flex;
	flex: 0 0 auto;
	align-items: center;
	gap: 6px;
	margin: -8px -6px;
	padding: 8px 6px;
	border: 0;
	border-radius: 6px;
	background: transparent;
	color: #ed0678;
	font: 700 12.5px/1 Lato, sans-serif;
	text-decoration: none;
	cursor: pointer;
}

.zz-pdp-alt__buy:hover {
	color: #ed0678;
	opacity: 0.85;
}

.zz-pdp-alt__buy-icon {
	flex: 0 0 auto;
	width: 15px;
	height: 15px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.zz-pdp-alt__buy.loading {
	opacity: 0.6;
}

.zz-pdp-alt__buy.added::after {
	content: none;
}

.zz-pdp-alt__title a:focus-visible,
.zz-pdp-alt__cta:focus-visible {
	outline: 2px solid #ed0678;
	outline-offset: 2px;
}

/* Inset: the 8px / 6px hit-area padding frames the label and the ring never reaches the price. */
.zz-pdp-alt__buy:focus-visible {
	outline: 2px solid #ed0678;
	outline-offset: -2px;
}

/* ---------------------------------------------------------------- CTA row */

.zz-pdp-alt__cta-row {
	display: flex;
	padding-top: 12px;
}

.zz-pdp-alt__cta {
	display: flex;
	flex: 1 1 auto;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	box-sizing: border-box;
	min-height: 50px;
	padding: 0 14px;
	border: 1px solid #e5e7eb;
	border-radius: 12px;
	background: #fafafa;
	color: #2f2f2f;
	font: 600 15.5px/1 Lato, sans-serif;
	text-align: left;
	text-decoration: none;
}

.zz-pdp-alt__cta:hover {
	color: #2f2f2f;
	border-color: #d1d5db;
}

/* ---------------------------------------------------------------- Tablet portrait */
@media (min-width: 550px) and (max-width: 1023.98px) {
	.zz-pdp-alt {
		padding-top: 36px;
	}

	.zz-pdp-alt__grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}

	.zz-pdp-alt__grid > .zz-pdp-alt__item:nth-child(n + 5) {
		display: flex;
	}

	.zz-pdp-alt__cta-row {
		padding-top: 20px;
	}

	.zz-pdp-alt__cta {
		gap: 14px;
		padding: 0 18px;
	}
}

/* Mobile: the Final's 16px side padding (equal to the Decision Core column above). */
@media (max-width: 549.98px) {
	.zz-pdp-alt-row > .col {
		padding-right: 16px;
		padding-left: 16px;
	}

	.zz-pdp-alt {
		padding-top: 32px;
	}

	/*
	 * PDP-063: the trailing row of the lower slot (an empty CMS row after Reviews) carries Flatsome's default
	 * .col padding-bottom:30px, which stacked on top of the 32px above. Only when Alternatives render.
	 */
	.custom-product-page:has(.zz-pdp-alt-row) .zz-lower-slot > .row:last-child > .col {
		padding-bottom: 0;
	}

	/* PDP-063 R1: #e5e7eb on white reads as a faded curve on a phone; same 1px stroke / 14px radius, stronger neutral. */
	.zz-pdp-alt__card {
		border-color: #d1d5db;
	}
}

/* ---------------------------------------------------------------- Tablet landscape */
@media (min-width: 1024px) and (max-width: 1279.98px) {
	.zz-pdp-alt__grid {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}

	.zz-pdp-alt__grid > .zz-pdp-alt__item:nth-child(n + 5) {
		display: flex;
	}

	.zz-pdp-alt__cta-row {
		justify-content: flex-end;
		padding-top: 20px;
	}

	.zz-pdp-alt__cta {
		flex: 0 0 auto;
		gap: 14px;
		padding: 0 18px;
	}
}

/* ---------------------------------------------------------------- Desktop (AltCard51) */
@media (min-width: 1280px) {
	.zz-pdp-alt__heading {
		font-size: 24px;
		line-height: 30px;
	}

	.zz-pdp-alt__grid {
		grid-template-columns: repeat(5, minmax(0, 1fr));
	}

	.zz-pdp-alt__grid > .zz-pdp-alt__item:nth-child(n + 5) {
		display: flex;
	}

	.zz-pdp-alt__grid > .zz-pdp-alt__item:nth-child(n + 6) {
		display: none;
	}

	.zz-pdp-alt__card {
		border-radius: 12px;
	}

	.zz-pdp-alt__media {
		aspect-ratio: 1.1 / 1;
		border-radius: 11px 11px 0 0;
	}

	.zz-pdp-alt__media .zz-pdp-alt__img {
		border-radius: 11px 11px 0 0;
	}

	.zz-pdp-alt__badge {
		top: 6px;
		height: 17px;
		padding: 0 6px;
		font-size: 9px;
	}

	.zz-pdp-alt__badge--top {
		left: 6px;
	}

	.zz-pdp-alt__badge--factual {
		right: 6px;
		max-width: calc(100% - 12px);
	}

	.zz-pdp-alt__body {
		gap: 5px;
		padding: 9px 10px 11px;
	}

	.zz-pdp-alt__spec {
		min-height: 12.1px;
		font-size: 11px;
		letter-spacing: 0.03em;
	}

	.zz-pdp-alt__title {
		height: 54.6px;
	}

	.zz-pdp-alt__title a {
		font-size: 14px;
	}

	.zz-pdp-alt__rating {
		gap: 4px;
		min-height: 12px;
	}

	.zz-pdp-alt__star {
		width: 12px;
		height: 12px;
	}

	.zz-pdp-alt__count {
		font-size: 12px;
	}

	.zz-pdp-alt__price.price {
		font-size: 16.5px;
	}

	.zz-pdp-alt__buy {
		gap: 4px;
		margin: -6px -4px;
		padding: 6px 4px;
		font-size: 13.5px;
	}

	.zz-pdp-alt__buy-icon {
		width: 13px;
		height: 13px;
	}

	.zz-pdp-alt__cta-row {
		justify-content: flex-end;
		padding-top: 20px;
	}

	.zz-pdp-alt__cta {
		flex: 0 0 auto;
		gap: 14px;
		padding: 0 18px;
	}
}
