/*
 * Native Majestic Product Card
 * v0.2.1
 *
 * Responsive behaviour is part of the component. Desktop, tablet and mobile
 * are intentionally designed separately rather than relying on a stacked
 * desktop layout.
 */

.majestic-product-grid {
	--majestic-grid-columns-desktop: 4;
	--majestic-grid-columns-tablet: 3;
	--majestic-grid-columns-mobile: 2;

	display: grid;
	grid-template-columns: repeat(var(--majestic-grid-columns-desktop), minmax(0, 1fr));
	gap: 38px 24px;
	width: 100%;
}

.majestic-product-card {
	display: flex;
	flex-direction: column;
	min-width: 0;
	color: var(--majestic-color-text, #222);
	font-family: var(--majestic-font-body, inherit);
	text-align: center;
}

.majestic-product-card__media {
	position: relative;
	width: 100%;
	overflow: hidden;
	background: color-mix(in srgb, var(--majestic-color-secondary, #f7f3ed) 50%, #fff);
}

.majestic-product-card__image-link {
	position: relative;
	display: block;
	width: 100%;
	aspect-ratio: 1 / 1;
	overflow: hidden;
}

.majestic-product-card__image {
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: opacity .35s ease, transform .45s ease;
}

.majestic-product-card__image--primary {
	opacity: 1;
}

.majestic-product-card__image--hover {
	opacity: 0;
}

@media (hover: hover) and (pointer: fine) {
	.majestic-product-card__image-link:hover .majestic-product-card__image--primary {
		opacity: 0;
		transform: scale(1.015);
	}

	.majestic-product-card__image-link:hover .majestic-product-card__image--hover {
		opacity: 1;
		transform: scale(1.015);
	}
}

.majestic-product-card__badge {
	position: absolute;
	z-index: 2;
	top: 12px;
	right: 12px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 42px;
	min-height: 42px;
	padding: 7px;
	border-radius: 999px;
	background: var(--majestic-color-accent, #aa7f79);
	color: var(--majestic-color-on-dark, #fff);
	font-size: 11px;
	font-weight: 600;
	line-height: 1;
}

.majestic-product-card__body {
	display: flex;
	flex: 1;
	flex-direction: column;
	align-items: stretch;
	padding-top: 14px;
}

.majestic-product-card h3.majestic-product-card__title,
.elementor .majestic-product-card h3.majestic-product-card__title {
	min-height: 1.4em;
	margin: 0 0 2px;
	padding: 0;
	color: var(--majestic-color-text, #222);
	font-family: var(--majestic-font-body, inherit);
	font-size: var(--majestic-card-title-desktop, 15px) !important;
	font-weight: 600;
	line-height: 1.25 !important;
	letter-spacing: .015em;
	text-align: center;
	text-transform: uppercase;
}

.majestic-product-card h3.majestic-product-card__title a,
.elementor .majestic-product-card h3.majestic-product-card__title a {
	color: var(--majestic-color-text, #222) !important;
	font: inherit;
	line-height: inherit;
	text-decoration: none !important;
}

.majestic-product-card h3.majestic-product-card__title a:hover,
.majestic-product-card h3.majestic-product-card__title a:focus,
.majestic-product-card h3.majestic-product-card__title a:active,
.elementor .majestic-product-card h3.majestic-product-card__title a:hover,
.elementor .majestic-product-card h3.majestic-product-card__title a:focus,
.elementor .majestic-product-card h3.majestic-product-card__title a:active {
	color: var(--majestic-color-text, #222) !important;
	text-decoration: none !important;
}

.majestic-product-card__rating {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 5px;
	min-height: 18px;
	margin-bottom: 7px;
	font-size: 11px;
	line-height: 1;
}

.majestic-product-card__rating.is-empty {
	visibility: hidden;
}

.majestic-stars {
	position: relative;
	display: inline-block;
	overflow: hidden;
	width: 63px;
	height: 14px;
	font-family: Arial, sans-serif;
	font-size: 13px;
	line-height: 14px;
	letter-spacing: 0;
	text-align: left;
	white-space: nowrap;
}

.majestic-stars__empty {
	position: absolute;
	inset: 0;
	color: var(--majestic-empty-star-color, #8f8f8f);
}

.majestic-stars__filled {
	position: absolute;
	inset: 0 auto 0 0;
	width: var(--majestic-rating-width, 0%);
	overflow: hidden;
	color: var(--majestic-star-color, #d29f42);
	white-space: nowrap;
}

.majestic-product-card__review-count {
	font-size: 10px;
	opacity: .72;
}

.majestic-product-card__price {
	min-height: 24px;
	margin: 0 0 10px;
	font-size: var(--majestic-card-price-desktop, 13px);
	line-height: 1.5;
}

.majestic-product-card__price del {
	margin-right: 4px;
	opacity: .55;
}

.majestic-product-card__price ins {
	text-decoration: none;
}

.majestic-product-card a.majestic-product-card__cta,
.elementor .majestic-product-card a.majestic-product-card__cta {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	min-height: 36px;
	margin-top: auto;
	padding: 9px 12px;
	border: 1px solid var(--majestic-color-accent, #aa7f79);
	background: var(--majestic-color-accent, #aa7f79);
	color: #fff !important;
	font-family: var(--majestic-font-accent, var(--majestic-font-body, inherit));
	font-size: var(--majestic-card-button-desktop, 12px) !important;
	font-weight: 600;
	line-height: 1.2 !important;
	letter-spacing: .04em;
	text-align: center;
	text-decoration: none !important;
	text-transform: uppercase;
	transition: background-color .2s ease, border-color .2s ease, color .2s ease;
}

.majestic-product-card a.majestic-product-card__cta:hover,
.majestic-product-card a.majestic-product-card__cta:focus,
.majestic-product-card a.majestic-product-card__cta:active,
.elementor .majestic-product-card a.majestic-product-card__cta:hover,
.elementor .majestic-product-card a.majestic-product-card__cta:focus,
.elementor .majestic-product-card a.majestic-product-card__cta:active {
	border-color: var(--majestic-color-text, #222);
	background: var(--majestic-color-text, #222);
	color: #fff !important;
	text-decoration: none !important;
}

.majestic-product-card__cta:focus-visible,
.majestic-product-card__title a:focus-visible,
.majestic-product-card__image-link:focus-visible {
	outline: 2px solid var(--majestic-color-text, #222);
	outline-offset: 3px;
}

/* Tablet */
@media (max-width: 1024px) and (min-width: 768px) {
	.majestic-product-grid {
		grid-template-columns: repeat(var(--majestic-grid-columns-tablet), minmax(0, 1fr));
		gap: 32px 18px;
	}

	.majestic-product-card h3.majestic-product-card__title,
	.elementor .majestic-product-card h3.majestic-product-card__title {
		font-size: var(--majestic-card-title-tablet, 14px) !important;
	}

	.majestic-product-card a.majestic-product-card__cta,
	.elementor .majestic-product-card a.majestic-product-card__cta {
		min-height: 40px;
		font-size: var(--majestic-card-button-tablet, 12px) !important;
	}

	.majestic-product-card__price {
		font-size: var(--majestic-card-price-tablet, 13px);
	}
}

/* Mobile */
@media (max-width: 767px) {
	.majestic-product-grid {
		grid-template-columns: repeat(var(--majestic-grid-columns-mobile), minmax(0, 1fr));
		gap: 26px 12px;
	}

	.majestic-product-card__body {
		padding-top: 10px;
	}

	.majestic-product-card__badge {
		top: 8px;
		right: 8px;
		min-width: 36px;
		min-height: 36px;
		font-size: 9px;
	}

	.majestic-product-card h3.majestic-product-card__title,
	.elementor .majestic-product-card h3.majestic-product-card__title {
		min-height: 1.45em;
		margin-bottom: 2px;
		font-size: var(--majestic-card-title-mobile, 13px) !important;
		line-height: 1.3 !important;
	}

	.majestic-product-card__rating {
		gap: 3px;
		margin-bottom: 6px;
	}

	.majestic-stars {
		width: 58px;
		font-size: 12px;
	}

	.majestic-product-card__review-count {
		font-size: 9px;
	}

	.majestic-product-card__price {
		min-height: 22px;
		margin-bottom: 8px;
		font-size: var(--majestic-card-price-mobile, 14px);
	}

	.majestic-product-card a.majestic-product-card__cta,
	.elementor .majestic-product-card a.majestic-product-card__cta {
		min-height: 42px;
		padding-inline: 8px;
		font-size: var(--majestic-card-button-mobile, 12px) !important;
	}
}

/* Very narrow phones: remain 2-up, but reduce non-essential visual density. */
@media (max-width: 380px) {
	.majestic-product-grid {
		gap-inline: 9px;
	}

	.majestic-product-card__review-count {
		display: none;
	}
}
