.pcg-grid {
	display: grid;
	grid-template-columns: repeat(var(--pcg-columns, 3), minmax(0, 1fr));
	gap: clamp(16px, 1.8vw, 24px);
	margin-top: -8px;
	width: 100%;
}

/* Tighten the title-to-content gap on the category landing page and archives. */
body.page:has(.pcg-grid) #Subheader,
body.tax-product_cat #Subheader {
	padding-bottom: 14px !important;
}

body.tax-product_cat .section_wrapper.default-woo-list {
	margin-top: -18px !important;
}

.pcg-card {
	display: flex;
	flex-direction: column;
	height: 100%;
	min-width: 0;
	padding: 8px;
	color: #202733;
	text-decoration: none;
	background: #fff;
	border: 1px solid rgba(26, 37, 52, .08);
	border-radius: 16px;
	box-shadow: 0 5px 18px rgba(27, 39, 54, .07);
	transition: transform .22s ease, border-color .22s ease, box-shadow .22s ease;
}

.pcg-card,
.pcg-card:visited,
.pcg-card:hover,
.pcg-card:focus,
.pcg-card * {
	text-decoration: none !important;
}

.pcg-gallery {
	position: relative;
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	grid-template-rows: repeat(2, minmax(0, 1fr));
	gap: 3px;
	width: 100%;
	aspect-ratio: 1.38 / 1;
	margin: auto 0 8px;
	flex: 0 0 auto;
	overflow: hidden;
	border-radius: 12px;
	background: #f4f5f7;
}

.pcg-image-wrap {
	position: relative;
	min-width: 0;
	min-height: 0;
	overflow: hidden;
}

.pcg-image {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform .25s ease;
}

.pcg-gallery-count-1 .pcg-image-wrap {
	grid-column: 1 / -1;
	grid-row: 1 / -1;
}

.pcg-gallery-count-2 .pcg-image-wrap:first-child {
	grid-row: 1 / -1;
}

.pcg-gallery-count-2 .pcg-image-wrap:last-child {
	grid-column: 2;
	grid-row: 1 / -1;
}

.pcg-gallery-count-3 .pcg-image-wrap:first-child {
	grid-row: 1 / -1;
}

.pcg-gallery-count-3 .pcg-image-wrap:nth-child(2) {
	grid-column: 2;
	grid-row: 1;
}

.pcg-gallery-count-3 .pcg-image-wrap:nth-child(3) {
	grid-column: 2;
	grid-row: 2;
}

.pcg-image-cover {
	grid-column: 1 / -1;
	grid-row: 1 / -1;
}

.pcg-title {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto 22px;
	column-gap: 8px;
	align-items: center;
	min-height: 2.5em;
	padding: 1px 4px 2px;
	color: #202733;
	font-size: clamp(15px, 1.25vw, 18px);
	font-weight: 650;
	letter-spacing: -.025em;
	line-height: 1.24;
	text-wrap: balance;
	text-align: left;
	margin-top: auto;
}

.pcg-title::after {
	grid-column: 3;
	grid-row: 1;
	width: 22px;
	height: 3px;
	justify-self: end;
	border-radius: 4px;
	background: #ef762e;
	content: "";
}

.pcg-title-name {
	grid-column: 1;
	grid-row: 1;
	min-width: 0;
	text-align: left !important;
	overflow-wrap: normal;
	word-break: normal;
}

.pcg-count {
	grid-column: 2;
	grid-row: 1;
	margin: 0;
	padding: 0;
	color: #6b7280;
	font-size: .8em;
	font-weight: 500;
	white-space: nowrap;
}

.pcg-card:hover {
	transform: translateY(-3px);
	border-color: rgba(239, 118, 46, .25);
	box-shadow: 0 12px 26px rgba(27, 39, 54, .13);
}

.pcg-card:hover .pcg-layout-mosaic .pcg-image {
	transform: scale(1.045);
}

.pcg-card:focus-visible {
	outline: 3px solid #ef762e;
	outline-offset: 4px;
}

/* Keep product-category archive subcategories in the same card system. */
body.tax-product_cat ul.products li.product-category {
	display: flex;
	height: 100%;
	box-sizing: border-box;
	padding: 8px;
	background: #fff;
	border: 1px solid rgba(26, 37, 52, .08);
	border-radius: 16px;
	box-shadow: 0 5px 18px rgba(27, 39, 54, .07);
	transition: transform .22s ease, border-color .22s ease, box-shadow .22s ease;
}

body.tax-product_cat ul.products li.product-category > a {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	width: 100%;
	color: #202733;
	text-decoration: none;
}

body.tax-product_cat ul.products li.product-category:hover {
	transform: translateY(-3px);
	border-color: rgba(239, 118, 46, .25);
	box-shadow: 0 12px 26px rgba(27, 39, 54, .13);
}

body.tax-product_cat ul.products li.product-category .pcg-gallery {
	margin: auto 0 8px;
}

body.tax-product_cat ul.products li.product-category .woocommerce-loop-category__title {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto 22px;
	column-gap: 8px;
	align-items: center;
	min-height: 2.5em;
	margin: 0;
	padding: 1px 4px 2px;
	color: #202733;
	font-size: clamp(15px, 1.25vw, 18px);
	font-weight: 650;
	letter-spacing: -.025em;
	line-height: 1.24;
	text-wrap: balance;
	text-align: left !important;
	margin-top: auto !important;
	justify-items: start;
	word-break: normal;
	overflow-wrap: normal;
}

body.tax-product_cat ul.products li.product-category .woocommerce-loop-category__title .count {
	grid-column: 2;
	grid-row: 1;
	margin: 0;
	padding-left: 6px;
	color: #6b7280;
	font-size: .8em;
	font-weight: 500;
}

body.tax-product_cat ul.products li.product-category .woocommerce-loop-category__title::after {
	grid-column: 3;
	grid-row: 1;
	width: 22px;
	height: 3px;
	justify-self: end;
	border-radius: 4px;
	background: #ef762e;
	content: "";
}

/* Optional fan of overlapping photo cards: use layout="stacked". */
.pcg-layout-stacked {
	display: block;
	overflow: visible;
	background: transparent;
	isolation: isolate;
}

.pcg-layout-stacked.pcg-gallery-fallback::before,
.pcg-layout-stacked.pcg-gallery-fallback::after {
	display: none;
}

.pcg-layout-stacked .pcg-image-wrap {
	position: absolute;
	top: 12%;
	left: 20%;
	width: 60%;
	height: 76%;
	border: 4px solid #fff;
	border-radius: 14px;
	background: #fff;
	box-shadow: 0 8px 20px rgba(21, 31, 46, .24);
}

.pcg-layout-stacked .pcg-image {
	border-radius: 7px;
}

.pcg-layout-stacked.pcg-gallery-count-1 .pcg-image-wrap {
	top: 5%;
	left: 5%;
	width: 90%;
	height: 90%;
	transform: rotate(-1deg);
}

.pcg-layout-stacked.pcg-gallery-count-1::before,
.pcg-layout-stacked.pcg-gallery-count-1::after {
	display: none;
}

.pcg-layout-stacked.pcg-gallery-fallback .pcg-image-wrap {
	top: 5%;
	left: 5%;
	width: 90%;
	height: 90%;
	transform: none;
}

.pcg-layout-stacked.pcg-gallery-count-2 .pcg-image-wrap:first-child {
	top: 11%;
	left: 2%;
	width: 58%;
	height: 78%;
	z-index: 1;
	transform: rotate(-7deg) translateY(1%);
}

.pcg-layout-stacked.pcg-gallery-count-2 .pcg-image-wrap:last-child {
	top: 8%;
	left: 41%;
	width: 58%;
	height: 78%;
	z-index: 2;
	transform: rotate(7deg) translateY(-1%);
}

.pcg-layout-stacked.pcg-gallery-count-3 .pcg-image-wrap:first-child {
	top: 12%;
	left: 2%;
	width: 58%;
	height: 76%;
	z-index: 1;
	transform: rotate(-13deg) translateY(1%);
}

.pcg-layout-stacked.pcg-gallery-count-3 .pcg-image-wrap:nth-child(2) {
	top: 8%;
	left: 24%;
	width: 58%;
	height: 76%;
	z-index: 2;
	transform: rotate(-2deg) translateY(-1%);
}

.pcg-layout-stacked.pcg-gallery-count-3 .pcg-image-wrap:nth-child(3) {
	top: 13%;
	left: 40%;
	width: 58%;
	height: 76%;
	z-index: 3;
	transform: rotate(12deg) translateY(2%);
}

.pcg-layout-stacked.pcg-gallery-count-4 .pcg-image-wrap:nth-child(1) {
	top: 14%;
	left: 1%;
	width: 53%;
	height: 72%;
	z-index: 1;
	transform: rotate(-15deg) translateY(1%);
}

.pcg-layout-stacked.pcg-gallery-count-4 .pcg-image-wrap:nth-child(2) {
	top: 9%;
	left: 20%;
	width: 53%;
	height: 72%;
	z-index: 2;
	transform: rotate(-5deg) translateY(-1%);
}

.pcg-layout-stacked.pcg-gallery-count-4 .pcg-image-wrap:nth-child(3) {
	top: 11%;
	left: 39%;
	width: 53%;
	height: 72%;
	z-index: 3;
	transform: rotate(11deg) translateY(1%);
}

.pcg-layout-stacked.pcg-gallery-count-4 .pcg-image-wrap:nth-child(4) {
	top: 16%;
	left: 24%;
	width: 53%;
	height: 72%;
	z-index: 4;
	transform: rotate(4deg) translateY(2%);
}

@media (max-width: 767px) {
	body.tax-product_cat #Subheader {
		padding-bottom: 4px !important;
	}

	body.tax-product_cat .section_wrapper.default-woo-list {
		margin-top: -20px !important;
	}

	body.tax-product_cat .products_wrapper.mfn-woo-products ul.products:has(> li.product-category) {
		display: grid !important;
		grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
		grid-auto-flow: row !important;
		gap: 14px !important;
		margin: 0 !important;
		direction: ltr !important;
	}

	body.tax-product_cat .products_wrapper.mfn-woo-products ul.products:has(> li.product-category) > li.product-category {
		float: none !important;
		clear: none !important;
		width: auto !important;
		margin: 0 !important;
	}

	body.tax-product_cat .products_wrapper.mfn-woo-products ul.products:has(> li.product-category) > li.product-category:first-child {
		grid-area: 1 / 1 / 2 / 2 !important;
	}

	body.tax-product_cat .products_wrapper.mfn-woo-products ul.products:has(> li.product-category) > li.product-category:nth-child(2) {
		grid-area: 1 / 2 / 2 / 3 !important;
	}

	.pcg-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 12px;
	}

	.pcg-card {
		padding: 6px;
		border-radius: 12px;
	}

	.pcg-gallery {
		aspect-ratio: 1.05 / 1;
		margin: auto 0 6px;
		border-radius: 9px;
	}

	.pcg-title {
		min-height: 2.4em;
		padding: 1px 2px 2px;
		font-size: 14px;
	}

	.pcg-title::after {
		width: 14px;
		height: 2px;
		grid-column: 3;
		grid-row: 1;
	}

	.pcg-layout-stacked .pcg-image-wrap {
		border-width: 3px;
		border-radius: 8px;
	}

	.pcg-layout-stacked.pcg-gallery-count-1 {
		aspect-ratio: 1.25 / 1;
	}

	body.tax-product_cat ul.products li.product-category {
		padding: 6px;
		border-radius: 12px;
	}

	body.tax-product_cat ul.products li.product-category > a {
	min-height: 100%;
	}

	body.tax-product_cat ul.products li.product-category .woocommerce-loop-category__title {
		min-height: 2.4em;
		padding: 1px 2px 2px;
		font-size: 14px;
	}

	body.tax-product_cat ul.products li.product-category .woocommerce-loop-category__title::after {
		width: 14px;
		height: 2px;
		grid-column: 3;
		grid-row: 1;
	}
}
