/**
 * Product card structure, states, motion and a11y (T6.8).
 *
 * Parent page grids belong to T7/T8. This file only makes the card a
 * stable grid/list item. Motion: transform + opacity. No cursor-follow,
 * pointer tilt or pointer parallax. --mx / --my stay 0.
 */

/* Woo loop item only — columns stay with Woo / T8. Not a page grid. */
body.po-woocommerce-active ul.products li.product {
	min-width: 0;
}

body.po-woocommerce-active ul.products li.product .po-card {
	height: 100%;
}

.po-card {
	--po-card-accent: var(--po-color-purple);
	--po-card-cut: 2.35rem;
	position: relative;
	display: flex;
	flex-direction: column;
	width: 100%;
	height: 100%;
	min-width: 0;
	max-width: 100%;
	background-color: var(--po-color-surface);
	border: 1px solid var(--po-color-border);
	border-radius: var(--po-radius-medium);
	overflow: hidden;
	transition:
		transform var(--po-dur) var(--po-ease),
		border-color var(--po-dur) var(--po-ease),
		box-shadow var(--po-dur) var(--po-ease);
}

.po-card__corner {
	position: absolute;
	top: 0;
	right: 0;
	z-index: 5;
	width: var(--po-card-cut);
	height: var(--po-card-cut);
	pointer-events: none;
	background: var(--po-card-accent);
	clip-path: polygon(0 0, 100% 0, 100% 100%);
}

.po-card__cover {
	position: relative;
	flex: 0 0 auto;
	min-width: 0;
	border-radius: var(--po-radius-medium) var(--po-radius-medium) 0 0;
	overflow: hidden;
}

.po-card__cover::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 2;
	pointer-events: none;
	background: color-mix(in srgb, var(--po-color-background) 42%, transparent);
	opacity: 0;
	transition: opacity 280ms var(--po-ease);
}

.po-card__media,
#primary .po-card__media {
	position: relative;
	display: block;
	aspect-ratio: 1 / 1;
	overflow: hidden;
	background-color: var(--po-color-surface-alt);
	text-decoration: none;
	color: inherit;
}

.po-card__image,
.po-card__media-fallback {
	display: block;
	width: 100%;
	height: 100%;
	max-width: 100%;
	object-fit: cover;
	object-position: center;
}

.po-card__image {
	transition:
		transform 420ms var(--po-ease),
		filter 420ms var(--po-ease);
}

.po-card__media-fallback {
	background:
		linear-gradient(
			145deg,
			var(--po-color-surface-alt),
			var(--po-color-surface-raised)
		);
}

.po-card__body {
	display: flex;
	flex-direction: column;
	flex: 1 1 auto;
	gap: 0.4rem;
	min-width: 0;
	padding: 0.85rem 0.95rem 1rem;
}

.po-card__kicker {
	margin: 0;
	color: var(--po-color-muted);
	font-family: var(--po-font-body);
	font-size: 0.7rem;
	font-weight: var(--po-font-weight-ui-extrabold);
	letter-spacing: 0.08em;
	line-height: 1.35;
	text-transform: uppercase;
	overflow-wrap: break-word;
	word-break: normal;
}

.po-card__title {
	margin: 0;
	max-width: 100%;
	font-family: var(--po-font-display);
	font-size: 1rem;
	font-weight: var(--po-font-weight-display);
	letter-spacing: var(--po-font-display-tracking);
	line-height: 1.3;
	overflow-wrap: break-word;
	word-break: normal;
	hyphens: none;
}

.po-card__badges {
	position: absolute;
	inset: 0.55rem;
	z-index: 3;
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	gap: 0.4rem;
	pointer-events: none;
}

.po-card__badges-start,
.po-card__badges-end {
	display: flex;
	flex-direction: column;
	flex-wrap: wrap;
	align-items: flex-start;
	gap: 0.35rem;
	min-width: 0;
	max-width: calc(50% - 0.2rem);
}

.po-card__badges-end {
	align-items: flex-end;
	align-self: flex-end;
	margin-inline-start: auto;
}

.po-card .po-badge {
	max-width: 100%;
	white-space: normal;
	overflow-wrap: break-word;
	word-break: normal;
}

.po-card .po-price,
.po-card .po-price__pix,
.po-card .po-price__installments,
.po-card .po-rating {
	margin: 0;
	max-width: 100%;
	min-width: 0;
}

.po-card .po-price,
.po-card .woocommerce-Price-amount,
.po-card .po-price__pix,
.po-card .po-price__installments {
	overflow-wrap: break-word;
	word-break: normal;
}

.po-card__title-link,
#primary .po-card .po-card__title-link,
#primary .po-card .po-card__title-link:hover {
	color: var(--po-color-text);
	text-decoration: none;
}

.po-card__title-link::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
}

.po-card__hover-cta {
	position: absolute;
	left: 5%;
	right: 5%;
	bottom: 14%;
	z-index: 4;
	display: flex;
	justify-content: center;
	opacity: 0;
	transform: translateY(0.55rem);
	pointer-events: none;
	transition:
		opacity 220ms var(--po-ease),
		transform 220ms var(--po-ease);
}

.po-card__hover-cta .po-button,
.po-card__hover-cta .add_to_cart_button,
.po-card__hover-cta .po-card__buy,
#primary .po-card__hover-cta a.button,
body.po-woocommerce-active .woocommerce ul.products li.product .po-card__hover-cta a.button {
	display: inline-flex;
	flex: 1 1 auto;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 0.2em 0.35em;
	width: 100%;
	min-width: 0;
	min-height: 2.6rem;
	height: auto;
	padding: 0.5rem 0.55rem;
	border: 0;
	border-radius: 0.35rem;
	background: var(--po-color-yellow);
	background-color: var(--po-color-yellow);
	color: var(--po-color-background);
	font-size: 0.75rem;
	font-weight: var(--po-font-weight-ui-extrabold);
	letter-spacing: 0.03em;
	line-height: 1.2;
	text-transform: uppercase;
	text-decoration: none;
	text-align: center;
	white-space: normal;
	overflow: visible;
	overflow-wrap: anywhere;
	hyphens: manual;
	box-shadow: 0 10px 22px color-mix(in srgb, var(--po-color-background) 45%, transparent);
}

.po-card__hover-cta .po-button::after,
.po-card__hover-cta .add_to_cart_button::after,
.po-card__hover-cta .po-card__buy::after {
	content: "→";
	flex: 0 0 auto;
}

.po-card__title-link:focus-visible,
.po-card__hover-cta .po-button:focus-visible,
.po-card__hover-cta .add_to_cart_button:focus-visible {
	outline: 3px solid var(--po-color-cyan);
	outline-offset: 3px;
}

.po-card:focus-within {
	z-index: 1;
	border-color: color-mix(in srgb, var(--po-color-cyan) 28%, var(--po-color-border));
}

/* —— List (T8 consumer; thumb ~110px, one row) —— */

.po-card--list {
	flex-direction: row;
	align-items: stretch;
}

.po-card--list .po-card__cover {
	flex: 0 0 clamp(72px, 28vw, 110px);
	width: clamp(72px, 28vw, 110px);
	max-width: 110px;
	border-radius: var(--po-radius-medium) 0 0 var(--po-radius-medium);
}

.po-card--list .po-card__media {
	width: 100%;
}

.po-card--list .po-badge {
	font-size: 0.625rem;
	padding: 0.2em 0.4em;
}

.po-card--list .po-card__body {
	flex: 1 1 auto;
	justify-content: center;
	padding: 0.7rem 0.85rem;
}

.po-card--list .po-card__title {
	font-size: 0.9375rem;
}

.po-card--compact .po-card__body {
	padding: 0.7rem 0.8rem 0.85rem;
}

.po-card--compact .po-card__title {
	font-size: 0.9375rem;
}

.po-card--list {
	--po-card-cut: 1.1rem;
}

.po-card--list .po-card__hover-cta {
	left: 6%;
	right: 6%;
	bottom: 10%;
}

.po-card--list .po-card__hover-cta .po-button,
.po-card--list .po-card__hover-cta .add_to_cart_button {
	min-height: 1.7rem;
	padding: 0.25rem 0.4rem;
	font-size: 0.625rem;
}

/* —— States (meaning is always in text, not only color) —— */

.po-card--out-of-stock .po-card__cover,
.po-card--unavailable .po-card__cover,
.po-card--not-purchasable .po-card__cover {
	opacity: 0.78;
}

.po-card--no-image .po-card__media-fallback {
	outline: 1px dashed var(--po-color-border);
	outline-offset: -1px;
}

.po-card--no-price .po-price--empty .po-price__now {
	font-style: italic;
}

/* —— Approved hover (MV-CARD-01/02, T1.4). Fine pointer only. —— */

@media (hover: hover) and (pointer: fine) {
	.po-card:hover {
		z-index: 1;
		transform: translateY(-6px);
		border-color: color-mix(in srgb, var(--po-color-purple) 40%, var(--po-color-border));
		box-shadow: var(--po-shadow-raised);
	}

	.po-card:hover .po-card__image {
		transform: scale(1.075);
		filter: saturate(1.05) contrast(1.025);
	}

	.po-card--promo:hover {
		border-color: color-mix(in srgb, var(--po-color-lime) 45%, var(--po-color-border));
	}

	.po-card--presale:hover {
		border-color: color-mix(in srgb, var(--po-color-cyan) 40%, var(--po-color-border));
	}

	.po-card--promo.po-card--presale:hover {
		border-color: color-mix(in srgb, var(--po-color-cyan) 28%, color-mix(in srgb, var(--po-color-lime) 28%, var(--po-color-border)));
	}

	.po-card:hover .po-card__cover::after,
	.po-card:focus-within .po-card__cover::after {
		opacity: 1;
	}

	.po-card:hover .po-card__hover-cta,
	.po-card:focus-within .po-card__hover-cta {
		opacity: 1;
		transform: none;
		pointer-events: auto;
	}

	.po-card__hover-cta .po-button:active,
	.po-card__hover-cta .add_to_cart_button:active {
		transform: translateY(0);
	}
}

@media (hover: none) {
	.po-card:hover,
	.po-card:hover .po-card__image {
		transform: none;
		filter: none;
		box-shadow: none;
	}

	.po-card__hover-cta {
		opacity: 1;
		transform: none;
		pointer-events: auto;
	}

	.po-card__cover::after {
		opacity: 0.35;
	}

	.po-card__hover-cta .po-button:active,
	.po-card__hover-cta .add_to_cart_button:active {
		opacity: 0.92;
	}
}

/* —— Official tokens: 400 / 720 / 820 / 1120. Test viewports 320–1440 map here. —— */

@media (max-width: 400px) { /* --po-bp-tight */
	.po-card__body {
		padding: 0.7rem 0.75rem 0.85rem;
	}

	.po-card__title {
		font-size: 0.9375rem;
	}

	.po-card .po-price ins .woocommerce-Price-amount,
	.po-card .po-price:not(:has(del)) .woocommerce-Price-amount,
	.po-card .po-price__now {
		font-size: 1.125rem;
	}

	.po-card--list .po-card__cover {
		flex-basis: 72px;
		width: 72px;
		max-width: 72px;
	}

	.po-card--list .po-card__badges {
		inset: 0.3rem;
	}
}

@media (max-width: 720px) { /* --po-bp-nav */
	.po-card__hover-cta .po-button,
	.po-card__hover-cta .add_to_cart_button {
		min-height: 2.4rem;
		font-size: 0.75rem;
	}
}

@media (max-width: 820px), (hover: none) { /* --po-bp-env */
	.po-card:hover {
		transform: none;
		box-shadow: none;
	}

	.po-card:hover .po-card__image {
		transform: none;
	}

	.po-card__hover-cta {
		opacity: 1;
		transform: none;
		pointer-events: auto;
	}

	.po-card__cover::after {
		opacity: 0.28;
	}
}

@media (min-width: 1120px) { /* --po-bp-wide + container amplo */
	.po-card {
		min-width: 0;
	}

	.po-card__title {
		font-size: 1.0625rem;
	}
}

@media (prefers-reduced-motion: reduce) {
	.po-card,
	.po-card__image,
	.po-card .po-button,
	.po-card .add_to_cart_button,
	.po-card__hover-cta,
	.po-card__cover::after {
		transition: none;
		transform: none;
	}

	.po-card:hover,
	.po-card:hover .po-card__image,
	.po-card .po-button:hover,
	.po-card .add_to_cart_button:hover {
		transform: none;
		filter: none;
		box-shadow: none;
	}

	.po-card__hover-cta {
		opacity: 1;
		pointer-events: auto;
	}

	.po-card__cover::after {
		opacity: 0.2;
	}
}
