/**
 * 1.8.491 — Patch (and similar Choose-blank) archive cards, matched to
 * the dense 480 product grid. Overrides plugin .idxpd-archive-swatches
 * (no side padding, wrap, 10 dots + “21 colors”) and the 480 cramped
 * button (0.68rem, nowrap ellipsis) without editing the plugin.
 */

/* -------------------------------------------------------------------------
   Card chrome: every card identical, same as the 480/shop-archive card.
   Neutralize Woo’s .first / .last so the first tile is not a special case.
   ------------------------------------------------------------------------- */

.idx-shop-archive .idxshop-main ul.products li.product.idx-patch-card-491,
.idx-shop-archive .idxshop-main ul.products li.product.idx-patch-card-491.first,
.idx-shop-archive .idxshop-main ul.products li.product.idx-patch-card-491.last,
.idx-shop-archive .idxshop-main ul.products li.product:has(.idxpd-archive-swatches) {
	display: flex;
	flex-direction: column;
	padding: 0;
	background: #fff;
	border: 1px solid var(--sx-line, #e2e0e8);
	border-radius: var(--sx-radius, 14px);
	overflow: hidden;
	box-shadow: 0 6px 18px rgba(15, 20, 58, .06);
	transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.idx-shop-archive .idxshop-main ul.products li.product.idx-patch-card-491:hover,
.idx-shop-archive .idxshop-main ul.products li.product.idx-patch-card-491.first:hover,
.idx-shop-archive .idxshop-main ul.products li.product:has(.idxpd-archive-swatches):hover {
	transform: translateY(-4px);
	border-color: rgba(15, 20, 58, .18);
	box-shadow: 0 16px 34px rgba(15, 20, 58, .14);
}

/* -------------------------------------------------------------------------
   Image: 1:1, even padding, same on every card.
   ------------------------------------------------------------------------- */

.idx-shop-archive.idx-dense:not(.idx-dense-keep-layout) .idxshop-main ul.products li.product.idx-patch-card-491 a img,
.idx-shop-archive.idx-dense:not(.idx-dense-keep-layout) .idxshop-main ul.products li.product:has(.idxpd-archive-swatches) a img {
	aspect-ratio: 1 / 1;
	width: 100%;
	height: auto;
	object-fit: contain;
	object-position: center;
	padding: 0.65rem;
	margin: 0;
	box-sizing: border-box;
	background: #fff;
	border-bottom: 1px solid var(--sx-line, #e2e0e8);
	display: block;
}

/* -------------------------------------------------------------------------
   Title (Oswald navy) and price on the same left edge.
   Plugin group_price_html wraps “From $X” in a nested .price, which
   doubled the 0.65rem padding and indented the price past the title.
   ------------------------------------------------------------------------- */

.idx-shop-archive.idx-dense:not(.idx-dense-keep-layout) .idxshop-main ul.products li.product.idx-patch-card-491 .woocommerce-loop-product__title,
.idx-shop-archive.idx-dense:not(.idx-dense-keep-layout) .idxshop-main ul.products li.product.idx-patch-card-491 h2.woocommerce-loop-product__title,
.idx-shop-archive.idx-dense:not(.idx-dense-keep-layout) .idxshop-main ul.products li.product:has(.idxpd-archive-swatches) .woocommerce-loop-product__title {
	padding: 0.55rem 0.65rem 0.2rem;
	margin: 0;
	font-family: "Oswald", var(--font-head, sans-serif);
	font-size: 15px;
	font-weight: 600;
	line-height: 1.25;
	letter-spacing: -0.01em;
	color: var(--sx-navy, #0f143a);
	background: transparent;
}

.idx-shop-archive.idx-dense:not(.idx-dense-keep-layout) .idxshop-main ul.products li.product.idx-patch-card-491 .price,
.idx-shop-archive.idx-dense:not(.idx-dense-keep-layout) .idxshop-main ul.products li.product:has(.idxpd-archive-swatches) .price {
	display: block;
	margin: 0;
	padding: 0.15rem 0.65rem 0.25rem;
	font-family: var(--font-body, Montserrat, sans-serif);
	font-size: 14px;
	font-weight: 700;
	color: var(--sx-navy, #0f143a);
	background: transparent;
}

/* Nested .price from IDXPD_Patch::group_price_html — drop the second indent.
   Must beat the dense .price padding rule above (same element is also .price). */
.idx-shop-archive.idx-dense:not(.idx-dense-keep-layout) .idxshop-main ul.products li.product.idx-patch-card-491 .price .price,
.idx-shop-archive.idx-dense:not(.idx-dense-keep-layout) .idxshop-main ul.products li.product:has(.idxpd-archive-swatches) .price .price,
.idx-shop-archive .idxshop-main ul.products li.product.idx-patch-card-491 .price .price,
.idx-shop-archive .idxshop-main ul.products li.product:has(.idxpd-archive-swatches) .price .price {
	display: inline;
	padding: 0 !important;
	margin: 0 !important;
	border: 0;
	background: transparent;
	box-shadow: none;
	font: inherit;
	color: inherit;
}

/* -------------------------------------------------------------------------
   Swatches: one tidy row, 8 dots max, then +N. Never wrap or run edge-to-edge.
   ------------------------------------------------------------------------- */

.idx-shop-archive .idxshop-main ul.products li.product .idxpd-archive-swatches,
.idxpd-archive-swatches {
	display: flex;
	flex-wrap: nowrap;
	align-items: center;
	gap: 0.28rem;
	margin: 0;
	padding: 0.3rem 0.65rem 0.45rem;
	max-width: 100%;
	min-width: 0;
	min-height: 0;
	overflow: hidden;
	box-sizing: border-box;
}

.idx-shop-archive .idxshop-main ul.products li.product .idxpd-archive-swatches__dot,
.idxpd-archive-swatches__dot {
	display: block;
	flex: 0 0 12px;
	width: 12px;
	height: 12px;
	border-radius: 50%;
	border: 1px solid rgba(15, 20, 58, .22);
	box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .35);
	box-sizing: border-box;
}

/* CSS fallback if JS has not yet run: hide dots past 8 (plugin prints 10). */
.idxpd-archive-swatches__dot:nth-child(n+9),
.idxpd-archive-swatches__dot.idx-491-swatch-hidden,
.idxpd-archive-swatches__dot[hidden] {
	display: none !important;
}

.idx-shop-archive .idxshop-main ul.products li.product .idxpd-archive-swatches__count,
.idxpd-archive-swatches__count {
	flex: 0 0 auto;
	margin: 0 0 0 0.15rem;
	padding: 0;
	font-family: var(--font-body, Montserrat, sans-serif);
	font-size: 0.6875rem;
	font-weight: 700;
	letter-spacing: 0.02em;
	line-height: 1;
	color: #5a5f7a;
	white-space: nowrap;
}

/* -------------------------------------------------------------------------
   Button: square, on brand, readable, inset like the title, 423 slide-in.
   Overrides 480’s 0.68rem / 0.4rem / nowrap ellipsis, which cramped the
   long “Choose blank or engraved” label and made it look full-bleed.
   ------------------------------------------------------------------------- */

.idx-shop-archive.idx-dense:not(.idx-dense-keep-layout) .idxshop-main ul.products li.product.idx-patch-card-491 a.button,
.idx-shop-archive.idx-dense:not(.idx-dense-keep-layout) .idxshop-main ul.products li.product.idx-patch-card-491 .button,
.idx-shop-archive.idx-dense:not(.idx-dense-keep-layout) .idxshop-main ul.products li.product:has(.idxpd-archive-swatches) a.button {
	display: flex;
	align-items: center;
	justify-content: center;
	align-self: stretch;
	width: auto;
	box-sizing: border-box;
	margin: auto 0.65rem 0.65rem !important;
	padding: 0.5rem 0.65rem !important;
	min-height: 40px;
	font-family: "Oswald", var(--font-head, sans-serif) !important;
	font-size: 0.75rem !important;
	font-weight: 600 !important;
	letter-spacing: 0.05em !important;
	line-height: 1.25 !important;
	text-transform: uppercase;
	text-align: center;
	white-space: normal !important;
	overflow: visible;
	text-overflow: unset;
	hyphens: manual;
	border-radius: 0 !important;
	color: #fff !important;
	/* 423 slide: navy face, yellow fill on hover */
	--b423-bg: #0f143a;
	--b423-fill: #f3c91a;
	--b423-text: #0f143a;
	background-color: #0f143a !important;
}

/* -------------------------------------------------------------------------
   List view: place swatches in the 480 grid (image | title+swatches | price+btn)
   so they never collide with the price or overflow the image column.
   ------------------------------------------------------------------------- */

html.idx-dense-view-list .idx-shop-archive.idx-dense:not(.idx-dense-keep-layout) .idxshop-main ul.products li.product.idx-patch-card-491 a img,
html.idx-dense-view-list .idx-shop-archive.idx-dense:not(.idx-dense-keep-layout) .idxshop-main ul.products li.product:has(.idxpd-archive-swatches) a img {
	padding: 0.4rem;
	border-bottom: 0;
	width: 160px;
	max-width: 160px;
	height: 160px;
	object-fit: contain;
}

html.idx-dense-view-list .idx-shop-archive.idx-dense:not(.idx-dense-keep-layout) .idxshop-main ul.products li.product.idx-patch-card-491 .woocommerce-loop-product__title,
html.idx-dense-view-list .idx-shop-archive.idx-dense:not(.idx-dense-keep-layout) .idxshop-main ul.products li.product.idx-patch-card-491 h2.woocommerce-loop-product__title,
html.idx-dense-view-list .idx-shop-archive.idx-dense:not(.idx-dense-keep-layout) .idxshop-main ul.products li.product.idx-patch-card-491 .price {
	padding-left: 0;
	padding-right: 0;
}

html.idx-dense-view-list .idx-shop-archive.idx-dense:not(.idx-dense-keep-layout) .idxshop-main ul.products li.product.idx-patch-card-491 .idxpd-archive-swatches,
html.idx-dense-view-list .idx-shop-archive.idx-dense:not(.idx-dense-keep-layout) .idxshop-main ul.products li.product:has(.idxpd-archive-swatches) .idxpd-archive-swatches {
	grid-column: 2;
	grid-row: 2;
	align-self: start;
	padding: 0.15rem 0 0.25rem;
	margin: 0;
}

html.idx-dense-view-list .idx-shop-archive.idx-dense:not(.idx-dense-keep-layout) .idxshop-main ul.products li.product.idx-patch-card-491 a.button {
	margin: 0 !important;
	width: auto;
	max-width: 16rem;
	align-self: start;
	justify-self: end;
	white-space: nowrap !important;
}

@media (max-width: 699.98px) {
	html.idx-dense-view-list .idx-shop-archive.idx-dense:not(.idx-dense-keep-layout) .idxshop-main ul.products li.product.idx-patch-card-491 a img,
	html.idx-dense-view-list .idx-shop-archive.idx-dense:not(.idx-dense-keep-layout) .idxshop-main ul.products li.product:has(.idxpd-archive-swatches) a img {
		width: 100px;
		max-width: 100px;
		height: 100px;
		padding: 0.25rem;
	}
	html.idx-dense-view-list .idx-shop-archive.idx-dense:not(.idx-dense-keep-layout) .idxshop-main ul.products li.product.idx-patch-card-491 .idxpd-archive-swatches {
		grid-column: 2;
		grid-row: 2;
	}
	html.idx-dense-view-list .idx-shop-archive.idx-dense:not(.idx-dense-keep-layout) .idxshop-main ul.products li.product.idx-patch-card-491 .price {
		grid-column: 2;
		grid-row: 3;
		justify-self: start;
		text-align: left;
	}
	html.idx-dense-view-list .idx-shop-archive.idx-dense:not(.idx-dense-keep-layout) .idxshop-main ul.products li.product.idx-patch-card-491 a.button {
		grid-column: 2;
		grid-row: 4;
		justify-self: start;
		margin: 0.25rem 0 0 !important;
		min-width: 0;
		max-width: none;
		width: auto;
		white-space: normal !important;
	}
}

/* -------------------------------------------------------------------------
   Narrow / 390: keep a single swatch row; let the button wrap, no ellipsis.
   ------------------------------------------------------------------------- */

@media (max-width: 600px) {
	.idx-shop-archive.idx-dense:not(.idx-dense-keep-layout) .idxshop-main ul.products li.product.idx-patch-card-491 a.button,
	.idx-shop-archive.idx-dense:not(.idx-dense-keep-layout) .idxshop-main ul.products li.product:has(.idxpd-archive-swatches) a.button {
		font-size: 0.7rem !important;
		letter-spacing: 0.03em !important;
		min-height: 40px;
		white-space: normal !important;
	}
	.idxpd-archive-swatches__dot {
		flex-basis: 11px;
		width: 11px;
		height: 11px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.idx-shop-archive .idxshop-main ul.products li.product.idx-patch-card-491,
	.idx-shop-archive .idxshop-main ul.products li.product.idx-patch-card-491:hover {
		transition: none;
		transform: none;
	}
}
