/**
 * Collection archive additions.
 *
 * Everything structural comes from the reference collection.css / product-card.css
 * files. This stylesheet only adds the pieces those files expect but that our
 * markup needs locally (inline star rows, empty state, filter interactions).
 */

/* Reference grid rhythm (captured section style block). */
.collection-grid {
	justify-content: flex-start;
	column-gap: 1.875rem;
	row-gap: 1.875rem;
}

.collection-grid .product-card {
	flex: 0 1 calc((100% - 3rem - 3.75rem) / 3);
	max-width: 19.6875rem;
}

.product-card-badge,
.product-card .product-badges-container {
	pointer-events: none;
}

/* Star rating row. */
.x-review-product {
	--oke-stars-foregroundColor: #111c35;
	--oke-stars-backgroundColor: #dedacd;
	--oke-stars-borderWidth: 0;
}

.bp-stars {
	display: inline-flex;
	position: relative;
	line-height: 0;
}

.bp-stars__row {
	display: inline-flex;
	align-items: center;
	gap: 0.25rem;
}

.bp-stars__row svg {
	display: block;
	flex: 0 0 auto;
	width: 1.2rem;
	height: 1.2rem;
}

.bp-stars__row--fill {
	position: absolute;
	inset: 0 auto 0 0;
	overflow: hidden;
	width: 0;
}

.x-review-product .rating {
	align-items: center;
}

.x-review-product .rating-count {
	margin: 0 0 0 0.5rem;
}

/* Card button states. */
.product-card-button.is-loading {
	opacity: 0.7;
	pointer-events: none;
}

.product-card-button.is-added {
	background-color: #465985;
}

.product-card-button .bp-cart-spinner {
	width: 1rem;
	height: 1rem;
	border: 2px solid rgba(246, 244, 236, 0.4);
	border-top-color: #f6f4ec;
	border-radius: 50%;
	animation: bp-spin 0.7s linear infinite;
}

@keyframes bp-spin {
	to {
		transform: rotate(360deg);
	}
}

/* Empty collection state. */
.collection-grid .bp-collection-empty {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 1rem;
	width: 100%;
	max-width: 40rem;
	margin: 2rem 0 4rem;
	padding: 2rem;
	background: #efede1;
	border-radius: 1rem;
}

.collection-grid .bp-collection-empty.bp-hidden {
	display: none;
}

.collection-grid .bp-collection-empty__title {
	margin: 0;
	color: #111c35;
	font-family: Montserrat, sans-serif;
	font-size: 1.5rem;
	font-weight: 500;
	line-height: 1.2;
}

.collection-grid .bp-collection-empty__text {
	margin: 0;
	color: #111c35;
	font-family: "DM Sans", sans-serif;
	font-size: 1rem;
	line-height: 1.4;
}

.collection-grid .bp-collection-empty .product-card-button {
	width: auto;
	max-width: 15rem;
}

/* Filter dropdown behaviour. */
.menu-wrapper .shop-by-category-dropdown,
.menu-wrapper .shop-by-benefit-dropdown {
	user-select: none;
}

.menu-wrapper .shop-by-category-dropdown:focus-visible,
.menu-wrapper .shop-by-benefit-dropdown:focus-visible,
.sort-by-dropdown:focus-visible,
.filter-and-sort:focus-visible {
	outline: 2px solid #1d2c4e;
	outline-offset: 3px;
}

.sort-by-dropdown.active .caret-icon,
.menu-wrapper .dropdown-container.active .caret-icon {
	pointer-events: none;
}

.menu-wrapper .dropdown-container:not(.active) .caret-icon {
	transform: translateY(-50%) rotate(180deg);
}

/* Client-side filter results. */
.product-card.bp-hidden {
	display: none;
}

.collection-grid.bp-filtering .product-card {
	transition: opacity 0.15s ease;
}

/* Selected filter bubbles (desktop + mobile) are styled by collection.css. */
.selected-categories-container .category-bubble {
	cursor: default;
}

.selected-categories-container .clear-all-categories {
	background: none;
	border: none;
	padding: 0;
	color: #111c35;
	font-family: "DM Sans", sans-serif;
	font-size: 0.875rem;
	cursor: pointer;
	text-decoration: underline;
}

/* Prevent background scroll while a filter drawer is open. */
body.bp-filters-open {
	overflow: hidden;
}

@media (max-width: 48rem) {
	.collection-grid {
		padding: 0 1rem;
		column-gap: 0.8125rem;
		row-gap: 0.8125rem;
		justify-content: flex-start;
	}

	.collection-grid .product-card {
		flex: 0 0 auto;
		width: calc(50vw - 1.5125rem);
		max-width: none;
		margin-bottom: 1.9rem;
	}

	.collection-grid .product-card-image {
		height: 44.9vw;
		aspect-ratio: auto;
	}

	.collection-grid .product-card-title {
		font-size: 0.8875rem;
		line-height: 1.3;
		padding: 0;
		margin-bottom: 0;
		height: auto;
	}

	.collection-grid .x-review-product .bp-stars__row svg {
		width: 0.875rem;
		height: 0.875rem;
	}

	/* Full width "Filter & Sort" trigger on mobile. */
	.filter-and-sort {
		display: flex;
		align-items: center;
		justify-content: flex-start;
		gap: 0.75rem;
		width: 100%;
		min-height: 2.35rem;
		padding: 0.25rem 0.75rem;
		border: 0.0625rem solid #1d2c4e;
		border-radius: 0.5rem;
		background: #f6f4ec;
		color: #1d2c4e;
		font-family: "DM Sans", sans-serif;
		font-size: 1rem;
		font-weight: 500;
		cursor: pointer;
	}

	.filter-and-sort svg {
		width: 1.8125rem;
		height: 1.8125rem;
		flex: 0 0 auto;
	}
}

@media (max-width: 80rem) and (min-width: 48.01rem) {
	.collection-grid .x-review-product .bp-stars__row svg {
		width: 1rem;
		height: 1rem;
	}
}

/* Inline caret icons: the reference markup ships the svg with width/height 100%,
   which needs an explicitly sized, positioned wrapper to stay small. */
.caret-icon {
	position: absolute;
	top: 1.275rem;
	right: 1rem;
	display: block;
	width: 0.9375rem;
	height: 0.9375rem;
	pointer-events: none;
	z-index: 5;
}

.caret-icon svg {
	display: block;
	width: 100%;
	height: 100%;
}

.menu-wrapper .dropdown-container .caret-icon {
	top: 2.8rem;
	right: 1rem;
	width: 0.9rem;
	height: 0.9rem;
}

.filter-and-sort .caret-icon,
.mobile-filter-accordion-chevron .caret-icon,
button .caret-icon {
	position: static;
	display: inline-block;
	width: 0.75rem;
	height: 0.75rem;
	margin-left: 0.5rem;
}

.mobile-filter-accordion-chevron .caret-icon {
	width: 0.9375rem;
	height: 0.9375rem;
	margin-left: 0;
}

.mobile-filter-accordion[data-open="true"] .mobile-filter-accordion-chevron .caret-icon,
.menu-wrapper .dropdown-container.active > .caret-icon {
	transform: rotate(180deg);
}


/* Reference aligns each card's Add-to-Cart pill to the bottom of the (stretched) card,
   which makes a row grow by one title line when any card title wraps. */
.collection-grid .product-card-button {
	margin-top: auto;
}

/* --- Quick view magnifier on collection cards ---------------------------- */
.product-card .product-card-image {
	position: relative;
}

.product-card .product-card-quickview {
	position: absolute;
	top: 0.75rem;
	right: 0.75rem;
	display: none;
	align-items: center;
	justify-content: center;
	width: 2.5rem;
	height: 2.5rem;
	padding: 0;
	border: 0;
	border-radius: 999px;
	background-color: rgba(17, 28, 53, 0.92);
	box-shadow: 0 6px 18px rgba(17, 28, 53, 0.22);
	font-size: 0;
	line-height: 0;
	color: transparent;
	cursor: pointer;
	z-index: 3;
	transition: background-color 0.15s ease, transform 0.15s ease;
}

.product-card .product-card-quickview > span {
	display: none;
}

@media (min-width: 1024px) {
	.product-card:hover .product-card-quickview,
	.product-card:focus-within .product-card-quickview {
		display: inline-flex;
	}
}

.product-card .product-card-quickview::before,
.product-card .product-card-quickview::after {
	content: none !important;
	display: none !important;
}

.product-card .product-card-quickview {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%23f6f4ec' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='8.7' cy='8.7' r='5.3'/%3E%3Cpath d='M12.7 12.7 16.8 16.8'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: center;
	background-size: 17px 17px;
}

.product-card .product-card-quickview:hover {
	background-color: #1d2c4e;
	transform: translateY(-1px);
}
