/*
 * Elementor Shop Grid — structural + default styles.
 * Colors/typography below are the design defaults (Jost + Cormorant Garamond +
 * deep-green accent); the Elementor controls override them via generated CSS.
 */

/* ---- Wrapper ---- */
.esg-shop-grid {
	width: 100%;
}

/* ---- Toolbar: category filter (left) + sort/count (right) ---- */
.esg-toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	flex-wrap: wrap;
	margin-bottom: 40px;
}

.esg-categories {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

/*
 * Category filter wrapper + tap-to-expand toggle. On desktop the toggle is
 * hidden and the wrapper is display:contents, so the existing toolbar layout
 * (categories left, sort/count right) is unchanged. On phones the wrapper is a
 * block and the toggle is the only thing shown until tapped, which reveals the
 * category list.
 */
.esg-cat-filter {
	display: contents;
}

.esg-cat-toggle {
	display: none;
}

.esg-cat-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 7px 18px;
	border: 1px solid rgba(0, 0, 0, 0.15);
	border-radius: 0 !important;
	background: transparent;
	background-color: transparent !important;
	color: #000000;
	font-family: 'Jost', sans-serif;
	font-size: 11px;
	font-weight: 300;
	letter-spacing: 1.54px;
	line-height: 16.5px;
	text-transform: uppercase;
	white-space: nowrap;
	cursor: pointer;
	box-shadow: none !important;
	transition: color 0.25s ease, background-color 0.25s ease, border-color 0.25s ease;
}

.esg-cat-btn.is-active {
	background-color: #000000 !important;
	border-color: #000000;
	color: #ffffff;
	font-weight: 500;
}

/*
 * Cancel Minimog's default black hover background on buttons. Keep the default
 * transparent background and only darken the border on hover.
 */
.esg-cat-btn:not(.is-active):hover,
.esg-cat-btn:not(.is-active):focus {
	background-color: transparent !important;
	border-color: rgba(0, 0, 0, 0.15);
	box-shadow: none !important;
}

.esg-toolbar-right {
	display: flex;
	align-items: center;
	gap: 16px;
}

.esg-count {
	font-family: 'Jost', sans-serif;
	font-size: 12px;
	font-weight: 400;
	letter-spacing: 0.48px;
	line-height: 18px;
	color: #888888;
	white-space: nowrap;
}

/* ---- Sort dropdown ---- */
.esg-sort {
	appearance: none;
	-webkit-appearance: none;
	-moz-appearance: none;
	width: 158px;
	height: 36px;
	padding: 0 32px 0 16px;
	border: 1px solid rgba(0, 0, 0, 0.15);
	border-radius: 0;
	background-color: #ffffff;
	background-image: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='10'%20height='6'%20viewBox='0%200%2010%206'%20fill='none'%3E%3Cpath%20d='M1%201L5%205L9%201'%20stroke='black'%20stroke-width='1.5'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 12px center;
	background-size: 10px 6px;
	font-family: 'Jost', sans-serif;
	font-size: 12px;
	font-weight: 400;
	letter-spacing: 0.96px;
	line-height: 1;
	color: #000000;
	cursor: pointer;
}

.esg-sort:focus {
	outline: none;
	border-color: #000000;
}

/* ---- Product grid ---- */
.esg-grid {
	display: grid;
	/* Per-device column counts ride on CSS variables set by the widget wrapper
	   (desktop / tablet / mobile). The numbers here are only fallbacks. */
	grid-template-columns: repeat(var(--esg-cols-desktop, 4), minmax(0, 1fr));
	column-gap: 24px;
	row-gap: 56px;
	transition: opacity 0.2s ease;
}

.esg-grid.is-loading {
	opacity: 0.4;
	pointer-events: none;
}

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

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

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

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

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

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

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

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

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

.esg-badge--auth {
	position: absolute;
	top: 12px;
	left: 12px;
	background: rgba(255, 255, 255, 0.92);
	color: #1a5c3a;
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
}

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

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

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

/*
 * ---- Wishlist (heart) button: icon only, revealed on image hover ----
 *
 * WPC Smart Wishlist's frontend.js refreshes every `.woosw-btn` on page load and
 * executes `$('.woosw-btn:not(.woosw-btn-has-icon)').text( ... )`. jQuery .text()
 * wipes every child node, which would delete our heart spans and leave 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-shop-grid.php). 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. */
.esg-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;
	font-size: 0 !important;
	line-height: 0 !important;
}

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

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

/* 2. Hide any element injected into the button (woosw's text span, tick, spinner,
      or a theme's label), keeping only our own .esg-wishlist-icon spans. */
.esg-wishlist-btn > *:not(.esg-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. */
.esg-wishlist-btn::before,
.esg-wishlist-btn::after {
	content: none !important;
}

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

.esg-wishlist-icon i,
.esg-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 .esg-wishlist-btn prefix) so Elementor's
 * generated "Icon Size" rule — `{{WRAPPER}} .esg-wishlist-btn i` — always wins.
 * These values mirror the control's 18px default and only apply as a fallback.
 */
.esg-wishlist-icon i {
	font-size: 18px;
}

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

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

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

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

/* ---- Slide-up action bar ---- */
.esg-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;
}

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

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

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

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

.esg-action:hover {
	color: #1a5c3a;
}

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

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

.esg-add-to-bag.is-added {
	color: #1a5c3a;
}

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

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

.esg-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;
}

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

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

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

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

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

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

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

.esg-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).
 * Force the inner spans to inherit the card price color so the color control
 * applies to both the text and the strike-through.
 */
.esg-price .amount,
.esg-price .woocommerce-Price-amount,
.esg-price .woocommerce-Price-currencySymbol,
.esg-price bdi {
	color: inherit !important;
}

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

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

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

.esg-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;
	background-color: transparent !important;
	color: #000000;
	font-family: 'Jost', 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;
}

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

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

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

/* ---- Responsive ----
 *
 * Stepped downscale at Elementor's default breakpoints (tablet <=1024px,
 * mobile <=767px, small <=480px): the card and toolbar text shrink in step so
 * nothing overflows a narrow card. Column counts per device are NOT hard-coded
 * here — each widget sets --esg-cols-{desktop,tablet,mobile} on its wrapper, and
 * the media queries below only supply the 4 / 2 / 1 defaults.
 *
 * font-size carries !important because Elementor may emit px typography rules
 * scoped to the widget (`{{WRAPPER}} .esg-name { font-size: 17px }`) that would
 * otherwise beat these media rules. letter-spacing / line-height / spacing stay
 * non-important and scoped so they only fine-tune, never lock out overrides.
 *
 * The hover-only slide-up action bar and wishlist heart are unusable on touch
 * (no hover), so on coarse-pointer / no-hover devices and on phone widths they
 * are kept permanently visible.
 */

/* Tablet: default 2 columns (overridable per widget via the wrapper variable)
   + a gentle first text step. */
@media (max-width: 1024px) {
	.esg-grid {
		grid-template-columns: repeat(var(--esg-cols-tablet, 2), minmax(0, 1fr));
		column-gap: 20px !important;
		row-gap: 44px !important;
	}

	.esg-name {
		font-size: 16px !important;
	}

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

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

/*
 * Touch / phone: reveal the action bar and wishlist heart without a hover.
 * Matches no-hover pointers (phones, tablets) and every sub-767px layout
 * (including Elementor's phone preview, which does not emulate hover:none).
 */
@media (hover: none), (max-width: 767px) {
	.esg-actions {
		transform: translateY(0);
		opacity: 1;
	}

	.esg-wishlist-btn {
		opacity: 1;
	}
}

/* Mobile: default 1 column (overridable per widget) + fonts/spacing step down.
   The category filter collapses to one tap-to-expand toggle. */
@media (max-width: 767px) {
	.esg-grid {
		grid-template-columns: repeat(var(--esg-cols-mobile, 1), minmax(0, 1fr));
		row-gap: 36px !important;
	}

	.esg-toolbar {
		flex-direction: column;
		align-items: flex-start;
		gap: 12px;
		margin-bottom: 24px;
	}

	/* Collapsed category filter: one toggle button, the category list appears
	   only after a tap, as a dropdown panel. */
	.esg-cat-filter {
		display: block;
		position: relative;
		width: 100%;
	}

	.esg-cat-toggle {
		display: inline-flex;
		align-items: center;
		gap: 8px;
		padding: 9px 14px;
		border: 1px solid rgba(0, 0, 0, 0.2);
		border-radius: 0 !important;
		background-color: #ffffff;
		color: #000000;
		font-family: 'Jost', sans-serif;
		font-size: 10px;
		font-weight: 500;
		letter-spacing: 1.4px;
		line-height: 1;
		text-transform: uppercase;
		cursor: pointer;
		box-shadow: none !important;
	}

	.esg-cat-toggle:hover,
	.esg-cat-toggle:focus {
		background-color: #ffffff !important;
		box-shadow: none !important;
		outline: none;
	}

	.esg-cat-toggle-prefix {
		color: #888888;
		font-weight: 400;
	}

	.esg-cat-toggle-caret {
		display: inline-block;
		width: 0;
		height: 0;
		margin-left: 2px;
		border-left: 4px solid transparent;
		border-right: 4px solid transparent;
		border-top: 5px solid currentColor;
	}

	/* Category list hidden until the toggle is tapped. */
	.esg-categories {
		display: none;
		gap: 6px;
	}

	/* Tap-open dropdown panel under the toggle. */
	.esg-cat-filter.is-open .esg-categories {
		display: flex;
		flex-wrap: wrap;
		position: absolute;
		top: calc(100% + 4px);
		left: 0;
		z-index: 20;
		width: 100%;
		box-sizing: border-box;
		padding: 12px;
		background: #ffffff;
		border: 1px solid rgba(0, 0, 0, 0.15);
		box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
		max-height: 50vh;
		overflow-y: auto;
	}

	.esg-cat-toggle[aria-expanded='true'] .esg-cat-toggle-caret {
		border-top: none;
		border-bottom: 5px solid currentColor;
	}

	.esg-cat-btn {
		padding: 6px 12px;
		font-size: 10px !important;
		line-height: 15px;
		letter-spacing: 1px;
	}

	.esg-toolbar-right {
		gap: 12px;
	}

	.esg-count {
		font-size: 11px;
		line-height: 16px;
	}

	.esg-sort {
		width: 150px;
		height: 34px;
		font-size: 11px;
		letter-spacing: 0.8px;
	}

	.esg-badge {
		padding: 2px 7px;
		font-size: 8px !important;
		line-height: 12px;
		letter-spacing: 1px;
	}

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

	.esg-badge--auth {
		top: 8px;
		left: 8px;
	}

	.esg-badge--auth svg {
		width: 9px;
		height: 9px;
	}

	.esg-badges-right {
		top: 8px;
		right: 8px;
		gap: 6px;
	}

	.esg-wishlist-btn {
		width: 24px;
		height: 24px;
	}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

/* Small phones: one more gentle step. */
@media (max-width: 480px) {
	.esg-name {
		font-size: 14px !important;
	}

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

	.esg-cat-btn {
		padding: 5px 10px;
		letter-spacing: 0.8px;
	}

	.esg-wishlist-btn {
		width: 22px;
		height: 22px;
	}
}
