/*
 * Casetti: every product card and card list (WooCommerce's ul.products), in the live Keşfet card's look: square image on a
 * warm placeholder, the heart at its top right, the category in small gold capitals, the name in Poppins on two lines,
 * the price, an outlined "SEPETE EKLE" at the card's foot; a thin frame and soft shadow on hover. Lists are grids of
 * the columns WooCommerce names (columns-N), 3 at most to 1024 px, 2 on phones. inc/site/cards.php (the hooks),
 * assets/js/site/cards.js (the same card drawn in the browser; the double tap). The sale and stock badges:
 * assets/css/shop/badges.css; the heart: assets/css/shop/wishlist.css. A list with a grid of its own keeps it (a more
 * specific rule, the product page's related products for example).
 */

/* The list: a grid instead of WooCommerce's floats (its clearfix pseudo-elements would take cells). */
.woocommerce ul.products {
	--c-cols: 4;
	display: grid;
	grid-template-columns: repeat(var(--c-cols), minmax(0, 1fr));
	gap: 28px 22px;
	margin: 0 0 1em;
	padding: 0;
}

.woocommerce ul.products::before,
.woocommerce ul.products::after {
	display: none;
}

.woocommerce ul.products.columns-1 { --c-cols: 1; }
.woocommerce ul.products.columns-2 { --c-cols: 2; }
.woocommerce ul.products.columns-3 { --c-cols: 3; }
.woocommerce ul.products.columns-5 { --c-cols: 5; }
.woocommerce ul.products.columns-6 { --c-cols: 6; }

@media (max-width: 1024px) {
	.woocommerce ul.products.columns-4,
	.woocommerce ul.products.columns-5,
	.woocommerce ul.products.columns-6 { --c-cols: 3; }
}

@media (max-width: 700px) {
	.woocommerce ul.products:not(.columns-1) {
		--c-cols: 2;
		gap: 20px 12px;
	}
}

/* The card. WooCommerce's widths and margins (columns, small screens) give way to the grid. */
.woocommerce ul.products li.product,
.woocommerce ul.products[class*="columns-"] li.product {
	position: relative;
	display: flex;
	flex-direction: column;
	float: none;
	width: auto;
	min-width: 0;
	margin: 0;
	padding: 0;
	border: 1px solid transparent;
	background: var(--myco-color-bg);
	text-align: start;
	transition: border-color 0.2s, box-shadow 0.2s;
}

.woocommerce ul.products li.product:hover {
	border-color: var(--casetti-line);
	box-shadow: var(--myco-shadow-card);
}

.woocommerce ul.products li.product a.woocommerce-LoopProduct-link { /* outranks WooCommerce's a.woocommerce-loop-product__link display:block */
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	gap: 6px;
	color: inherit;
	text-decoration: none;
}

/* The image: square, cover, a placeholder colour until it paints; a slow zoom on hover. */
.woocommerce ul.products li.product .myco-card-media {
	position: relative;
	display: block;
	overflow: hidden;
	aspect-ratio: 1 / 1;
	margin-bottom: 8px;
	background: #f1efec;
}

.woocommerce ul.products li.product .myco-card-media img,
.woocommerce ul.products li.product a img {
	width: 100%;
	height: 100%;
	margin: 0;
	object-fit: cover;
	box-shadow: none;
	transition: transform 0.5s;
}

.woocommerce ul.products li.product:hover .myco-card-media img {
	transform: scale(1.045);
}

/* The category, the name, the price. */
.woocommerce ul.products li.product .c-card-cat {
	overflow: hidden;
	margin: 0 14px;
	color: var(--casetti-gold);
	font: 500 10px/18px var(--myco-font-sans);
	letter-spacing: 0.14em;
	text-overflow: ellipsis;
	text-transform: uppercase;
	white-space: nowrap;
}

.woocommerce ul.products li.product .woocommerce-loop-product__title {
	display: -webkit-box;
	overflow: hidden;
	min-height: calc(1.45em * 2);
	margin: 0 14px;
	padding: 0;
	color: var(--casetti-ink);
	font-family: var(--casetti-font-heading);
	font-size: 14px;
	font-weight: 500;
	line-height: 1.45;
	letter-spacing: 0;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	line-clamp: 2;
}

.woocommerce ul.products li.product a:hover .woocommerce-loop-product__title {
	color: var(--casetti-gold);
}

.woocommerce ul.products li.product .price {
	display: block;
	margin: 2px 14px 0;
	color: var(--casetti-ink);
	font: 500 15px/28px var(--myco-font-sans);
	font-variant-numeric: tabular-nums;
}

.woocommerce ul.products li.product .price del {
	display: inline;
	margin-inline-end: 7px;
	color: #7a736c;
	font-size: 13px;
	font-weight: 400;
	opacity: 1;
}

.woocommerce ul.products li.product .price ins {
	display: inline;
	background: none;
	font-weight: 500;
	text-decoration: none;
}

/* The button: outlined, full width at the card's foot; filled on hover and once added. */
.woocommerce ul.products li.product .button {
	display: block;
	min-height: 0;
	height: auto;
	margin: 6px 14px 18px;
	padding: 11px 12px;
	border: 1px solid var(--casetti-ink);
	border-radius: 0;
	background: transparent;
	color: var(--casetti-ink);
	font: 700 12px/1.2 var(--casetti-font-heading);
	letter-spacing: 0.08em;
	text-align: center;
	text-decoration: none;
	text-transform: uppercase;
	transition: background-color 0.18s, color 0.18s;
}

.woocommerce ul.products li.product .button:hover,
.woocommerce ul.products li.product .button:focus-visible,
.woocommerce ul.products li.product .button.added {
	background: var(--casetti-ink);
	color: #fff;
}

.woocommerce ul.products li.product .button.loading {
	padding-inline-end: 12px;
	opacity: 0.55;
	pointer-events: none;
}

.woocommerce ul.products li.product .button.loading::after,
.woocommerce ul.products li.product .button.added::after {
	display: none;
}

/* WooCommerce's "View cart" link after an AJAX add stays hidden on cards (as on the live cards); the cart shows the count. */
.woocommerce ul.products li.product .added_to_cart {
	display: none;
}

/* A card waiting for its product (a list loading). */
.woocommerce ul.products li.c-card--bekle {
	pointer-events: none;
}

.woocommerce ul.products li.c-card--bekle .myco-card-media,
.woocommerce ul.products li.c-card--bekle .c-card-cat,
.woocommerce ul.products li.c-card--bekle .woocommerce-loop-product__title,
.woocommerce ul.products li.c-card--bekle .price,
.woocommerce ul.products li.c-card--bekle .button {
	border-color: transparent;
	background: linear-gradient(90deg, #f1efec, #f7f5f2, #f1efec) 0 0 / 200% 100%;
	animation: c-card-bekle 1.3s infinite;
}

.woocommerce ul.products li.c-card--bekle .c-card-cat { width: 40%; }
.woocommerce ul.products li.c-card--bekle .price { width: 30%; }

@keyframes c-card-bekle {
	0% { background-position: 200% 0; }
	100% { background-position: -200% 0; }
}

/* The double tap's heart in the middle of the image (756937). */
.c-card-pop {
	position: absolute;
	z-index: 3;
	top: 50%;
	left: 50%;
	width: 88px;
	height: 88px;
	margin: -44px 0 0 -44px;
	opacity: 0;
	pointer-events: none;
	animation: c-card-pop 0.9s ease-out forwards;
}

.c-card-pop svg {
	display: block;
	width: 100%;
	height: 100%;
}

.c-card-pop path {
	fill: #e0245e;
	stroke: #fff;
	stroke-width: 1;
}

.c-card-pop--off path {
	fill: rgba(255, 255, 255, 0.92);
	stroke: #e0245e;
	stroke-width: 1.5;
}

@keyframes c-card-pop {
	0% { opacity: 0; transform: scale(0.35); }
	25% { opacity: 1; transform: scale(1.18); }
	55% { opacity: 1; transform: scale(1); }
	100% { opacity: 0; transform: scale(1.12); }
}

@media (hover: none), (pointer: coarse) {
	.woocommerce ul.products li.product .myco-card-media {
		touch-action: manipulation;
	}
}

@media (max-width: 700px) {
	.woocommerce ul.products li.product .c-card-cat,
	.woocommerce ul.products li.product .woocommerce-loop-product__title,
	.woocommerce ul.products li.product .price {
		margin-inline: 10px;
	}

	.woocommerce ul.products li.product .button {
		margin: 6px 10px 15px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.woocommerce ul.products li.product,
	.woocommerce ul.products li.product .myco-card-media img,
	.woocommerce ul.products li.product .button {
		transition: none;
	}

	.woocommerce ul.products li.product:hover .myco-card-media img {
		transform: none;
	}

	.woocommerce ul.products li.c-card--bekle * ,
	.c-card-pop {
		animation: none;
	}
}
