/* Odisal Shop: product cards on shop grids (classic and block themes). */

/* The heart and quick view sit on the photo, top corner opposite the badges. */
ul.products li.product .oshop-save--card,
.wc-block-product .oshop-save--card {
	position: absolute;
	top: 10px;
	inset-inline-end: 10px;
	z-index: 3;
	width: 40px;
	height: 40px;
	min-height: 0;
	margin: 0;
}

ul.products li.product .oshop-quick--loop,
.wc-block-product .oshop-quick--loop {
	position: absolute;
	top: 10px;
	inset-inline-end: 10px;
	z-index: 3;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	min-height: 0;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.88);
	color: #111;
	backdrop-filter: blur(6px);
	opacity: 0;
	transition: opacity 0.15s ease;
}

ul.products li.product .oshop-save--card + .oshop-quick--loop,
.wc-block-product .oshop-save--card + .oshop-quick--loop {
	top: 56px;
}

ul.products li.product:hover .oshop-quick--loop,
ul.products li.product:focus-within .oshop-quick--loop,
.wc-block-product:hover .oshop-quick--loop,
.wc-block-product:focus-within .oshop-quick--loop {
	opacity: 1;
}

/* Touch screens: tapping the product is quicker than a quick view. */
@media (hover: none) {

	ul.products li.product .oshop-quick--loop,
	.wc-block-product .oshop-quick--loop {
		display: none;
	}
}

/* Badges leave room for the heart. */
ul.products li.product .oshop-badges,
.wc-block-product .oshop-badges {
	max-width: calc(100% - 72px);
}

/* Colours it comes in, under the name. Centred when the card is. */
.wc-block-product:has(.has-text-align-center) .oshop-card-colours {
	text-align: center;
}

.oshop-card-colours {
	margin: 6px 0 4px;
	line-height: 0;
}

.oshop-card-colours .ts-shop__colours {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 4px 0;
	color: inherit;
	text-decoration: none;
}

.oshop-card-colours .ts-shop__dot {
	width: 12px;
	height: 12px;
	border-radius: 50%;
	background: var(--oshop-swatch, transparent);
	box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.16);
}

.oshop-card-colours .ts-shop__dot--none {
	background: repeating-linear-gradient(45deg, #ddd 0 2px, #fff 2px 4px);
}

.oshop-card-colours .ts-shop__dots-more {
	font-size: 12px;
	line-height: 1;
	opacity: 0.7;
}

/* A quiet "Add to basket": an outline pill that fills on hover. */
ul.products li.product .button,
.wc-block-product .wp-block-button .wp-block-button__link.wp-element-button,
.wc-block-product .wp-block-button__link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 40px;
	margin-top: 10px;
	padding: 0 18px;
	border: 1px solid currentColor;
	border-radius: 999px;
	background: transparent;
	color: inherit;
	font-size: 14px;
	font-weight: 500;
	line-height: 1.2;
	white-space: nowrap;
	box-shadow: none;
	transition: background-color 0.15s ease, color 0.15s ease;
}

ul.products li.product .button:hover,
ul.products li.product .button:focus-visible,
.wc-block-product .wp-block-button .wp-block-button__link.wp-element-button:hover,
.wc-block-product .wp-block-button .wp-block-button__link.wp-element-button:focus-visible,
.wc-block-product .wp-block-button__link:hover,
.wc-block-product .wp-block-button__link:focus-visible {
	background: var(--tc-text, #1d1d1f);
	border-color: var(--tc-text, #1d1d1f);
	color: var(--tc-surface, #fff);
}

/* Sold out: a plain line, not a button asking to be pressed. */
ul.products li.product.outofstock .button,
.wc-block-product.outofstock .wp-block-button .wp-block-button__link.wp-element-button,
.wc-block-product.outofstock .wp-block-button__link {
	border-color: transparent;
	opacity: 0.65;
}

/* "View basket" after adding: WooCommerce's extra link, kept small. */
ul.products li.product .added_to_cart,
.wc-block-product .added_to_cart {
	display: block;
	margin-top: 6px;
	font-size: 13px;
}

@media (max-width: 600px) {

	ul.products li.product .button,
	.wc-block-product .wp-block-button__link {
		min-height: 38px;
		padding: 0 14px;
		font-size: 13px;
	}
}

@media (prefers-reduced-motion: reduce) {

	ul.products li.product .oshop-quick--loop,
	.wc-block-product .oshop-quick--loop,
	ul.products li.product .button,
	.wc-block-product .wp-block-button__link {
		transition: none;
	}
}

/* Buttons line up across a row, whatever sits above them. */
.wc-block-product {
	display: flex;
	flex-direction: column;
}

.wc-block-product > .wp-block-button,
.wc-block-product > .wc-block-components-product-button {
	margin-top: auto;
}

/* On the photo: a small frosted pill in the bottom corner. */
.oshop-card-colours--photo {
	position: absolute;
	bottom: 10px;
	inset-inline-start: 10px;
	z-index: 2;
	margin: 0;
}

.oshop-card-colours--photo .ts-shop__colours {
	gap: 5px;
	padding: 6px 9px;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.85);
	color: #1d1d1f;
	backdrop-filter: blur(6px);
}

.oshop-card-colours--photo .ts-shop__dot {
	width: 11px;
	height: 11px;
}

/* ---------- Compact shop: four a row, details close to the photo ---------- */
.wc-block-components-product-image {
	position: relative;
}

body.oshop-compact .wc-block-product-template {
	column-gap: 20px;
	row-gap: 40px;
}

@media (min-width: 1100px) {

	body.oshop-compact .wc-block-product-template:is(.columns-3, .columns-4, .columns-5) {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}
}

@media (max-width: 600px) {

	body.oshop-compact .wc-block-product-template {
		column-gap: 12px;
		row-gap: 28px;
	}
}

body.oshop-compact .wc-block-product > * {
	margin-block: 0;
}

body.oshop-compact .wc-block-product :is(.has-text-align-center, .wp-block-post-title, .wc-block-components-product-price, .wp-block-woocommerce-product-price) {
	justify-content: flex-start;
	text-align: start;
}

body.oshop-compact .wc-block-product .wp-block-post-title {
	margin-top: 12px;
	font-size: 15px;
	font-weight: 500;
	line-height: 1.35;
}

body.oshop-compact .wc-block-product .wp-block-woocommerce-product-price {
	margin-top: 2px;
	font-size: 14px;
	opacity: 0.75;
}

/* The "+" on the photo does the adding; products with options open their page. */
body.oshop-compact .wc-block-product .wp-block-woocommerce-product-button {
	display: none;
}

a.oshop-plus,
.wc-block-components-product-image a.oshop-plus {
	position: absolute;
	bottom: 10px;
	inset-inline-end: 10px;
	z-index: 3;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	padding: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.9);
	color: #111;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
	backdrop-filter: blur(6px);
	transition: background-color 0.15s ease, color 0.15s ease;
}

.oshop-plus:hover,
.oshop-plus:focus-visible,
.oshop-plus.added {
	background: #1d1d1f;
	color: #fff;
}

.oshop-plus.loading {
	opacity: 0.6;
}

/* WooCommerce's "View basket" link after adding: the basket opens anyway. */
.wc-block-components-product-image .added_to_cart {
	display: none;
}

@media (prefers-reduced-motion: reduce) {

	.oshop-plus {
		transition: none;
	}
}

/* Sold out, said quietly on the photo. */
.oshop-card-sold {
	position: absolute;
	bottom: 10px;
	inset-inline-end: 10px;
	z-index: 2;
	padding: 5px 10px;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.88);
	color: #1d1d1f;
	font-size: 12px;
	line-height: 1.2;
	backdrop-filter: blur(6px);
}

/* Phones: two a row everywhere, related products included. */
@media (max-width: 600px) {

	body.oshop-compact .wc-block-product-template,
	body.oshop-compact .wc-block-product-template.wc-block-product-template__responsive {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

/* Some grids (related products) are flex rows: give them the same grid. */
body.oshop-compact .wc-block-product-template.is-flex-container {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

body.oshop-compact .wc-block-product-template.is-flex-container > li {
	width: auto !important;
	margin: 0;
}

@media (min-width: 700px) {

	body.oshop-compact .wc-block-product-template.is-flex-container {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

@media (min-width: 1100px) {

	body.oshop-compact .wc-block-product-template.is-flex-container {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}
}
