/**
 * ErosCharm — product cards and section headers (homepage).
 *
 * Same design language as the product page, cart and checkout: warm paper,
 * near-black ink, warm neutral surfaces, red reserved for sale, Playfair
 * Display for section titles, a clean sans for UI.
 *
 * Tokens are declared on the component roots (.ec-cards, .ec-section-head),
 * so nothing leaks into the rest of the Elementor page. Logical properties
 * throughout: RTL mirrors by itself. Hover effects are gated behind
 * (hover: hover); nothing important depends on hover.
 */

.ec-cards,
.ec-section-head {
	--ec-ink: #1f1612;
	--ec-ink-70: #4a403a;
	--ec-muted: #736a63;
	--ec-soft: #a39a92;
	--ec-paper: #ffffff;
	--ec-card: #f4efea;
	--ec-line: #e8e1d9;
	--ec-red: #c63a40;
	--ec-brown: #2b1d17;

	--ec-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
		"Helvetica Neue", "Noto Sans Arabic", Arial, sans-serif;
	--ec-serif: "Playfair Display", Georgia, "Noto Naskh Arabic",
		"Times New Roman", serif;

	--ec-radius: 2px;
	--ec-ease: cubic-bezier(0.2, 0, 0.2, 1);
}

/* ==========================================================================
 * Section header
 * ========================================================================== */

.ec-section-head {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 12px 32px;
	width: 100%;
	padding-block: 8px 6px;
	font-family: var(--ec-sans);
	color: var(--ec-ink);
}

.ec-section-head__text {
	min-width: 0;
}

.ec-section-head .ec-section-head__title {
	margin: 0 !important;
	padding: 0 !important;
	font-family: var(--ec-serif) !important;
	font-size: clamp(30px, 3.4vw, 50px) !important;
	font-weight: 500 !important;
	line-height: 1.04 !important;
	letter-spacing: -0.01em !important;
	text-transform: none !important;
	color: var(--ec-ink) !important;
}

.ec-section-head__sub {
	margin: 10px 0 0 !important;
	font-size: 15px;
	line-height: 1.5;
	color: var(--ec-muted);
}

.ec-section-head__more {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-height: 44px;
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--ec-ink) !important;
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 6px;
	white-space: nowrap;
}

.ec-section-head__more:hover {
	text-decoration-thickness: 2px;
}

[dir="rtl"] .ec-section-head__more span {
	display: inline-block;
	transform: scaleX(-1);
}

.ec-section-head__more:focus-visible {
	outline: 2px solid var(--ec-ink);
	outline-offset: 4px;
}

/* The decorative arrow image beside the old heading is superseded. */
.e-con:has(> .elementor-widget-heading .ec-section-head) > .elementor-widget-image {
	display: none !important;
}

.e-con:has(> .elementor-widget-heading .ec-section-head) > .elementor-widget-heading {
	flex: 1 1 100% !important;
	width: 100% !important;
	max-width: 100% !important;
}

/* ==========================================================================
 * Grid
 * ========================================================================== */

.ec-cards {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 44px 20px;
	width: 100%;
	margin: 0 !important;
	padding: 0 !important;
	list-style: none !important;
	font-family: var(--ec-sans);
	color: var(--ec-ink);
}

/* Sections hold 8 or 4 products: 4 and 2 columns keep every row full. */
@media (max-width: 899px) {
	.ec-cards {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 36px 16px;
	}
}

@media (max-width: 767px) {
	.ec-cards {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 28px 10px;
	}
}

/* ==========================================================================
 * Card
 * ========================================================================== */

.ec-card {
	position: relative;
	display: flex;
	flex-direction: column;
	min-width: 0;
	margin: 0 !important;
	padding: 0 !important;
	list-style: none;
	background: none;
	text-align: start;
}

/* Image */
.ec-card__media {
	position: relative;
	aspect-ratio: 4 / 5;
	overflow: hidden;
	border-radius: var(--ec-radius);
	background: var(--ec-card);
}

.ec-card__image-link {
	position: absolute;
	inset: 0;
	display: block;
}

.ec-cards .ec-card__img {
	position: absolute;
	inset: 0;
	display: block;
	width: 100% !important;
	height: 100% !important;
	max-width: none !important;
	margin: 0 !important;
	object-fit: cover;
	object-position: center top;
	border-radius: 0;
	transition: transform 0.9s var(--ec-ease), opacity 0.5s var(--ec-ease);
}

.ec-card__img--alt {
	opacity: 0;
}

@media (hover: hover) {
	.ec-card:hover .ec-card__img {
		transform: scale(1.035);
	}

	.ec-card.has-alt:hover .ec-card__img--alt {
		opacity: 1;
	}
}

@media (prefers-reduced-motion: reduce) {
	.ec-cards .ec-card__img {
		transition: none;
	}

	.ec-card:hover .ec-card__img {
		transform: none;
	}
}

.ec-card.is-out .ec-card__img--main {
	filter: saturate(0.6);
}

/* Badges */
.ec-card__badges {
	position: absolute;
	top: 12px;
	inset-inline-start: 12px;
	z-index: 2;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 6px;
	pointer-events: none;
}

.ec-card__badge {
	display: inline-flex;
	align-items: center;
	padding: 6px 9px;
	border-radius: var(--ec-radius);
	background: var(--ec-paper);
	color: var(--ec-ink);
	font-size: 11px;
	font-weight: 600;
	line-height: 1;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.ec-card__badge--sale {
	background: var(--ec-red);
	color: #fff;
	letter-spacing: 0.02em;
	direction: ltr;
	unicode-bidi: isolate;
}

.ec-card__badge--new {
	background: var(--ec-card);
}

.ec-card__badge--best {
	background: var(--ec-brown);
	color: #fff;
}

.ec-card__badge--stock {
	background: rgba(255, 255, 255, 0.92);
	color: var(--ec-muted);
}

/* Add to cart — WooCommerce's own loop button, restyled as an icon button */
.ec-card__cart {
	position: absolute;
	bottom: 10px;
	inset-inline-end: 10px;
	z-index: 3;
	display: flex;
	align-items: center;
	gap: 6px;
}

.ec-card__cart .screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px);
	white-space: nowrap;
}

.ec-cards .ec-card__cart .button {
	position: relative;
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	width: 44px !important;
	min-width: 44px !important;
	height: 44px !important;
	min-height: 44px !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	border-radius: var(--ec-radius) !important;
	background: var(--ec-paper) !important;
	color: var(--ec-ink) !important;
	box-shadow: 0 4px 14px rgba(31, 22, 18, 0.12) !important;
	font-size: 0 !important;
	line-height: 0 !important;
	letter-spacing: 0 !important;
	text-indent: 0 !important;
	overflow: hidden;
	cursor: pointer;
	transition: background-color 0.2s var(--ec-ease), color 0.2s var(--ec-ease), transform 0.2s var(--ec-ease);
}

.ec-cards .ec-card__cart .button::before {
	content: "";
	width: 20px;
	height: 20px;
	background-color: currentColor;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linejoin='round'%3E%3Cpath d='M5 8h14l-1 13H6z'/%3E%3Cpath d='M9 8V6a3 3 0 0 1 6 0v2'/%3E%3Cpath d='M12 12v5M9.5 14.5h5' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linejoin='round'%3E%3Cpath d='M5 8h14l-1 13H6z'/%3E%3Cpath d='M9 8V6a3 3 0 0 1 6 0v2'/%3E%3Cpath d='M12 12v5M9.5 14.5h5' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* Not a direct add (e.g. variable product → "select options"): arrow icon. */
.ec-cards .ec-card__cart .button:not(.add_to_cart_button)::before {
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14M13 6l6 6-6 6'/%3E%3C/svg%3E");
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14M13 6l6 6-6 6'/%3E%3C/svg%3E");
}

[dir="rtl"] .ec-cards .ec-card__cart .button:not(.add_to_cart_button)::before {
	transform: scaleX(-1);
}

.ec-cards .ec-card__cart .button.loading::before {
	animation: ec-card-pulse 0.9s ease-in-out infinite;
}

.ec-cards .ec-card__cart .button.added::before {
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E");
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E");
}

.ec-cards .ec-card__cart .button::after {
	display: none !important;
}

@keyframes ec-card-pulse {
	50% { opacity: 0.35; }
}

@media (hover: hover) {
	.ec-card:hover .ec-card__cart .button,
	.ec-cards .ec-card__cart .button:focus-visible {
		background: var(--ec-brown) !important;
		color: #fff !important;
	}

	.ec-cards .ec-card__cart .button:hover {
		transform: translateY(-1px);
	}
}

.ec-cards .ec-card__cart .button:focus-visible {
	outline: 2px solid var(--ec-paper) !important;
	outline-offset: 2px;
	box-shadow: 0 0 0 4px var(--ec-ink) !important;
}

/* WooCommerce's "View cart" link after an AJAX add — Side Cart opens instead. */
.ec-cards .ec-card__cart .added_to_cart {
	display: none !important;
}

/* Body */
.ec-card__body {
	display: flex;
	flex-direction: column;
	gap: 4px;
	padding-block-start: 14px;
}

.ec-cards .ec-card__cat {
	margin: 0 !important;
	font-size: 11px;
	font-weight: 500;
	line-height: 1.3;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--ec-muted);
}

.ec-cards .ec-card__title {
	margin: 0 !important;
	padding: 0 !important;
	font-family: var(--ec-sans) !important;
	font-size: 15px !important;
	font-weight: 500 !important;
	line-height: 1.35 !important;
	letter-spacing: 0 !important;
	text-transform: none !important;
	color: var(--ec-ink) !important;
}

.ec-cards .ec-card__title a {
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	overflow: hidden;
	color: inherit !important;
	text-decoration: none !important;
}

/* The title link covers the whole card, so the card is one big target. */
.ec-cards .ec-card__title a::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
}

.ec-cards .ec-card__title a:focus-visible {
	outline: none;
}

.ec-cards .ec-card__title a:focus-visible::after {
	outline: 2px solid var(--ec-ink);
	outline-offset: 4px;
}

@media (hover: hover) {
	.ec-card:hover .ec-card__title a {
		text-decoration: underline !important;
		text-underline-offset: 3px;
	}
}

/* Price */
.ec-cards .ec-card__price {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 2px 10px;
	margin: 2px 0 0;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.3;
	color: var(--ec-ink);
}

.ec-cards .ec-card__price ins {
	order: 1;
	text-decoration: none;
	background: none;
	font-weight: 600;
}

.ec-cards .ec-card.is-sale .ec-card__price ins {
	color: var(--ec-red);
}

.ec-cards .ec-card__price del {
	order: 2;
	font-size: 13px;
	font-weight: 400;
	color: var(--ec-soft);
	opacity: 1;
}

.ec-cards .ec-card__price .screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px);
	white-space: nowrap;
}

/* Colour swatches — real attribute colours only */
.ec-cards .ec-card__colors {
	display: flex;
	align-items: center;
	gap: 6px;
	margin: 6px 0 0 !important;
	padding: 0 !important;
	list-style: none !important;
}

.ec-card__color {
	width: 12px;
	height: 12px;
	margin: 0 !important;
	border-radius: 50%;
	background: var(--ec-swatch);
	box-shadow: inset 0 0 0 1px rgba(31, 22, 18, 0.18);
}

.ec-card__color .screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px);
}

.ec-card__color-more {
	margin: 0 !important;
	font-size: 11px;
	color: var(--ec-muted);
}

/* Rating — only rendered when real reviews exist */
.ec-card__rating {
	display: flex;
	align-items: center;
	gap: 6px;
	margin-top: 4px;
	font-size: 12px;
	color: var(--ec-muted);
}

.ec-card__rating .star-rating {
	margin: 0 !important;
	float: none !important;
	font-size: 11px;
	color: var(--ec-ink);
}

/* ==========================================================================
 * Mobile
 * ========================================================================== */

@media (max-width: 767px) {
	.ec-section-head {
		align-items: flex-start;
		flex-direction: column;
		gap: 4px;
	}

	.ec-section-head .ec-section-head__title {
		font-size: 30px !important;
	}

	.ec-section-head__sub {
		font-size: 14px;
	}

	.ec-card__badges {
		top: 8px;
		inset-inline-start: 8px;
	}

	.ec-card__badge {
		padding: 5px 7px;
		font-size: 10px;
	}

	.ec-card__cart {
		bottom: 6px;
		inset-inline-end: 6px;
	}

	.ec-card__body {
		padding-block-start: 10px;
	}

	.ec-cards .ec-card__cat {
		font-size: 10px;
	}

	.ec-cards .ec-card__title {
		font-size: 14px !important;
	}

	.ec-cards .ec-card__price {
		font-size: 14px;
		gap: 0 8px;
	}

	.ec-cards .ec-card__price del {
		font-size: 12px;
	}
}
