/*
 * Elementor Product Grid — structural + default styles.
 * Colors/typography below are the design defaults; the Elementor controls
 * override them via generated CSS.
 */

.epg-grid {
	display: grid;
}

.epg-product {
	box-sizing: border-box;
	display: flex;
	flex-direction: column;
}

/* ---- Image area (3:4) ---- */
.epg-image-wrapper {
	position: relative;
	overflow: hidden;
	background: #f5f0e8;
	aspect-ratio: 1 / 1;
	margin-bottom: 0;
}

.epg-link {
	display: block;
	position: relative;
	width: 100%;
	height: 100%;
}

.epg-img {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: opacity 0.35s ease;
}

.epg-img--primary {
	opacity: 1;
}

.epg-img--hover {
	opacity: 0;
}

/* Only swap when a hover image actually exists (.has-hover). */
.epg-image-wrapper.has-hover:hover .epg-img--primary {
	opacity: 0;
}

.epg-image-wrapper.has-hover:hover .epg-img--hover {
	opacity: 1;
}

/* ---- Badges ---- */
.epg-badge {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 3px 8px;
	font-family: 'Arimo', sans-serif;
	font-size: 9px;
	font-weight: 500;
	letter-spacing: 1.26px;
	line-height: 13.5px;
	text-transform: uppercase;
	white-space: nowrap;
}

.epg-badge--auth {
	position: absolute;
	top: 12px;
	left: 12px;
	background: rgba(255, 255, 255, 0.92);
	color: #1a5c3a;
}

.epg-badge--new {
	background: #000000;
	color: #ffffff;
	padding: 3px 10px;
	letter-spacing: 1.08px;
}

.epg-badge--limited {
	background: #1a5c3a;
	color: #ffffff;
	padding: 3px 10px;
	letter-spacing: 1.08px;
}

.epg-badges-right {
	position: absolute;
	top: 12px;
	right: 12px;
	display: flex;
	align-items: center;
	gap: 8px;
	z-index: 3;
}

/* ---- Slide-up action bar ---- */
.epg-actions {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 12px;
	padding: 12px 0;
	background: rgba(255, 255, 255, 0.95);
	transform: translateY(100%);
	opacity: 0;
	transition: transform 0.35s ease, opacity 0.35s ease;
}

.epg-image-wrapper:hover .epg-actions {
	transform: translateY(0);
	opacity: 1;
}

.epg-action {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	text-decoration: none;
	font-family: 'Arimo', sans-serif;
	font-size: 10px;
	letter-spacing: 1.4px;
	line-height: 15px;
	text-transform: uppercase;
	white-space: nowrap;
	color: #000000;
}

.epg-action--bag {
	font-weight: 500;
}

.epg-action--view {
	font-weight: 400;
}

.epg-action:hover {
	opacity: 0.7;
}

.epg-action svg {
	display: block;
	flex-shrink: 0;
}

.epg-sep {
	font-family: 'Arimo', sans-serif;
	font-size: 16px;
	line-height: 24px;
	color: rgba(0, 0, 0, 0.2);
}

.epg-add-to-bag.is-added {
	opacity: 0.6;
}

/* ---- Content area ---- */
.epg-content {
	padding: 16px 0 8px;
}

.epg-brand {
	margin: 0;
	font-family: 'Arimo', sans-serif;
	font-size: 10px;
	font-weight: 500;
	letter-spacing: 2px;
	line-height: 15px;
	text-transform: uppercase;
	color: #1a5c3a;
}

.epg-name {
	margin: 0;
	padding-top: 3px;
	font-family: 'Cormorant Garamond', serif;
	font-size: 17px;
	font-weight: 500;
	letter-spacing: 0.34px;
	line-height: 25.5px;
	color: #000000;
}

.epg-condition {
	margin: 0;
	padding-top: 3px;
	font-family: 'Arimo', sans-serif;
	font-size: 11px;
	font-weight: 300;
	letter-spacing: 0.44px;
	line-height: 16.5px;
	color: #999999;
}

/* ---- Condition dots ---- */
.epg-dots {
	display: flex;
	align-items: center;
	gap: 2px;
	padding-top: 8px;
}

.epg-dot {
	display: block;
	width: 5px;
	height: 5px;
	border-radius: 2.5px;
	flex-shrink: 0;
}

.epg-dot--on {
	background: #1a5c3a;
}

.epg-dot--off {
	background: rgba(0, 0, 0, 0.12);
}

/* ---- Price ---- */
.epg-price {
	display: flex;
	align-items: center;
	gap: 12px;
	padding-top: 12px;
}

.epg-sale {
	font-family: 'Cormorant Garamond', serif;
	font-size: 18px;
	font-weight: 500;
	letter-spacing: 0.72px;
	line-height: 27px;
	color: #000000;
}

.epg-regular {
	font-family: 'Cormorant Garamond', serif;
	font-size: 14px;
	font-weight: 400;
	letter-spacing: 0.56px;
	line-height: 21px;
	text-decoration: line-through;
	color: #bbbbbb;
}

/*
 * wc_price() wraps the price in its own spans
 * (.woocommerce-Price-amount / .woocommerce-Price-currencySymbol / bdi).
 * Theme CSS can recolor those inner spans, which made the Elementor color
 * control only affect the strike-through line (currentColor) and not the text.
 * Force the inner spans to inherit the card price color so the color control
 * applies to both the text and the strike-through.
 */
.epg-price .amount,
.epg-price .woocommerce-Price-amount,
.epg-price .woocommerce-Price-currencySymbol,
.epg-price bdi {
	color: inherit !important;
}

/* ---- Wishlist (heart) button: hidden until image hover ---- */
.epg-wishlist-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	padding: 0;
	border: none;
	background: none;
	color: #000000;
	cursor: pointer;
	opacity: 0;
	transition: opacity 0.35s ease;
}

.epg-image-wrapper:hover .epg-wishlist-btn {
	opacity: 1;
}

/* Override the theme's generic button:hover black background / shadow. */
.epg-wishlist-btn:hover,
.epg-wishlist-btn:focus {
	background-color: transparent !important;
	box-shadow: none !important;
	outline: none !important;
}

/*
 * ---- Force the wishlist button to be ICON ONLY (no "Add to wishlist" text) ----
 *
 * WPC Smart Wishlist's frontend.js runs woosw_refresh_buttons() on every page
 * load and executes `$('.woosw-btn:not(.woosw-btn-has-icon)').text( ... )`.
 * jQuery .text() wipes every child node, which deleted our heart spans and left
 * the bare string "Add to wishlist" / "Browse wishlist".
 *
 * The real fix is the `woosw-btn-has-icon` class on the button markup (see
 * class-widget-product-grid.php), which makes woosw skip us entirely. Everything
 * below is the belt-and-braces layer, so no theme or plugin update can put text
 * back on this button.
 */

/* 1. Any stray text node dumped straight into the button renders at zero size. */
.epg-wishlist-btn {
	font-size: 0 !important;
	line-height: 0 !important;
}

/* 2. Hide any element injected into the button (woosw's text span, tick, spinner,
      or a theme's label), keeping only our own .epg-wishlist-icon spans. */
.epg-wishlist-btn > *:not(.epg-wishlist-icon) {
	display: none !important;
}

/* 3. Kill pseudo-element labels/ticks on the button itself. Safe: the Font
      Awesome heart glyph is a ::before on the child <i>, not on the button. */
.epg-wishlist-btn::before,
.epg-wishlist-btn::after {
	content: none !important;
}

.epg-wishlist-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	line-height: 1;
}

.epg-wishlist-icon i,
.epg-wishlist-icon svg {
	display: block;
}

/*
 * The icon declares its own size, so it is immune to the inherited font-size: 0
 * above. Deliberately low specificity (no .epg-wishlist-btn prefix) so Elementor's
 * generated "Icon Size" rule — `{{WRAPPER}} .epg-wishlist-btn i` — always wins.
 * These values mirror the control's 18px default and only apply as a fallback.
 */
.epg-wishlist-icon i {
	font-size: 18px;
}

.epg-wishlist-icon svg {
	width: 18px;
	height: 18px;
}

.epg-wishlist-icon--on {
	display: none;
}

.epg-wishlist-btn.woosw-added .epg-wishlist-icon--off {
	display: none;
}

.epg-wishlist-btn.woosw-added .epg-wishlist-icon--on {
	display: flex;
}

/* Added-to-cart feedback state. */
.epg-add-to-bag.is-added {
	color: #1a5c3a;
}

/* Hide the "View cart" link WooCommerce inserts after AJAX add-to-cart. */
.wc-forward {
	display: none !important;
}

/* Empty state (also shown via AJAX when the catalog empties mid-browse). */
.epg-grid .epg-empty {
	grid-column: 1 / -1;
	padding: 24px 0;
	margin: 0;
	font-family: 'Arimo', sans-serif;
	font-size: 13px;
	color: #999999;
	text-align: center;
}

/* ---- Pagination ---- */
.epg-pagination {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 8px;
}

.epg-pagination:not(:empty) {
	margin-top: 40px;
}

.epg-page-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 36px;
	height: 36px;
	padding: 0 10px;
	border: 1px solid rgba(0, 0, 0, 0.15);
	border-radius: 0 !important;
	color: #000000;
	font-family: 'Arimo', sans-serif;
	font-size: 12px;
	font-weight: 400;
	letter-spacing: 0.48px;
	line-height: 1;
	cursor: pointer;
	box-shadow: none !important;
	transition: color 0.25s ease, background-color 0.25s ease, border-color 0.25s ease;
}

/* Neutralise the theme's generic button background on the unselected buttons.
   Scoped to :not(.is-active) so the active button's own background (and the
   Elementor "Active Background" control) can still win the cascade. */
.epg-page-btn:not(.is-active) {
	background-color: transparent !important;
}

.epg-page-btn.is-active {
	background-color: #000000;
	border-color: #000000;
	color: #ffffff;
}

/* Cancel Minimog's default black hover background on buttons. */
.epg-page-btn:not(.is-active):hover,
.epg-page-btn:not(.is-active):focus {
	background-color: transparent !important;
	border-color: rgba(0, 0, 0, 0.15);
	box-shadow: none !important;
	color: #1a5c3a;
}

.epg-page-dots {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 20px;
	height: 36px;
	color: #888888;
	font-family: 'Arimo', sans-serif;
	font-size: 12px;
}

/* Loading state while the next page is fetched. */
.epg-wrap.is-loading .epg-grid {
	opacity: 0.35;
	transition: opacity 0.2s ease;
}

.epg-wrap.is-loading .epg-pagination {
	pointer-events: none;
}

/* Hint shown when pagination recovery (a reload) has already been tried. */
.epg-pagination-error {
	margin-top: 24px;
	font-family: 'Arimo', sans-serif;
	font-size: 12px;
	color: #999999;
	text-align: center;
}

.epg-pagination-retry {
	margin-left: 8px;
	padding: 0;
	border: none;
	background: none;
	cursor: pointer;
	font-family: 'Arimo', sans-serif;
	font-size: 12px;
	letter-spacing: 0.5px;
	text-transform: uppercase;
	color: #1a5c3a;
}

.epg-pagination-retry:hover,
.epg-pagination-retry:focus {
	background-color: transparent !important;
	box-shadow: none !important;
	outline: none !important;
	color: #1a5c3a;
}

/* ---- Responsive text scaling ----
 *
 * Font sizes and the spacing around card text step down at Elementor's default
 * breakpoints (tablet <=1024px, mobile <=767px, small <=480px) so nothing
 * overflows a narrow card. font-size carries !important because Elementor may
 * emit px typography rules scoped to the widget that would otherwise beat these
 * media rules; letter-spacing / line-height / padding stay non-important.
 *
 * NOTE: this scales TEXT ONLY. Layout (column counts, gaps, hover behaviour,
 * image aspect) is intentionally left untouched.
 */

@media (max-width: 1024px) {
	.epg-name {
		font-size: 16px !important;
	}

	.epg-sale {
		font-size: 17px !important;
	}

	.epg-regular {
		font-size: 13px !important;
	}
}

@media (max-width: 767px) {
	.epg-badge {
		padding: 2px 7px;
		font-size: 8px !important;
		line-height: 12px;
		letter-spacing: 1px;
	}

	.epg-badge--new,
	.epg-badge--limited {
		padding: 2px 9px;
	}

	.epg-actions {
		padding: 9px 0;
		gap: 10px;
	}

	.epg-action {
		gap: 5px;
		font-size: 9px !important;
		line-height: 14px;
		letter-spacing: 1px;
	}

	.epg-action svg {
		width: 12px;
		height: 12px;
	}

	.epg-sep {
		font-size: 14px;
		line-height: 14px;
	}

	.epg-content {
		padding: 12px 0 6px;
	}

	.epg-brand {
		font-size: 9px !important;
		line-height: 13.5px;
		letter-spacing: 1.4px;
	}

	.epg-name {
		padding-top: 2px;
		font-size: 15px !important;
		line-height: 22px;
		letter-spacing: 0.3px;
	}

	.epg-condition {
		padding-top: 2px;
		font-size: 10px !important;
		line-height: 15px;
	}

	.epg-dots {
		padding-top: 6px;
	}

	.epg-price {
		gap: 8px;
		padding-top: 10px;
	}

	.epg-sale {
		font-size: 16px !important;
		line-height: 24px;
	}

	.epg-regular {
		font-size: 12px !important;
		line-height: 18px;
	}

	.epg-pagination:not(:empty) {
		margin-top: 24px;
	}

	.epg-page-btn {
		min-width: 34px;
		height: 34px;
		font-size: 11px;
	}

	.epg-page-dots {
		height: 34px;
		font-size: 11px;
	}
}

@media (max-width: 480px) {
	.epg-name {
		font-size: 14px !important;
	}

	.epg-sale {
		font-size: 15px !important;
	}
}

/*
 * Touch / phone: keep the wishlist (heart) button visible without a hover.
 * Matches no-hover / coarse pointers and every sub-767px layout (including the
 * Elementor phone preview). Scoped and !important so no theme / plugin rule can
 * hide it again. Only the heart is revealed — the Add to Bag / View Details
 * slide-up bar stays hover-only, matching desktop.
 */
@media (hover: none), (pointer: coarse), (max-width: 767px) {
	.epg-image-wrapper .epg-wishlist-btn,
	.epg-badges-right .epg-wishlist-btn,
	.epg-wishlist-btn {
		opacity: 1 !important;
		visibility: visible;
	}
}
