/**
 * NexGen catalog: inner-page hero, shop layout, filters, sorting, product grid
 * and the "added to cart" toast.
 *
 * Figma: Shop Page 6147:24145, Shop Page + toast 6327:10443.
 */

/* Same page gutter as the home sections: 100px desktop, 20px mobile. */
.c-page-title-hero,
.l-main--woocommerce {
	--nx-gutter: var(--pepti-size-spacing-primitive-xl, 100px);
}

@media (max-width: 767px) {
	.c-page-title-hero,
	.l-main--woocommerce {
		--nx-gutter: var(--pepti-size-spacing-primitive-sm, 20px);
	}
}

/* ------------------------------------------------- inner-page hero -- */
/* Background image comes from nexgen_page_title_hero_background() (functions.php). */

.c-page-title-hero {
	--pepti-page-title-hero-padding-block-end: var(--pepti-size-spacing-primitive-lg, 60px);
	--pepti-page-title-hero-radius: var(--pepti-size-radius-primitive-lg, 30px);
}

.c-page-title-hero .c-page-title-hero__container {
	max-inline-size: 1728px;
	padding-inline: var(--nx-gutter, 100px);
}

.c-page-title-hero .c-page-title-hero__inner {
	gap: var(--pepti-size-spacing-primitive-xxs, 10px);
	inline-size: 100%;
}

/* Figma: breadcrumbs sit above the title. */
.c-page-title-hero .c-page-title-hero__inner > :is(.wc-block-breadcrumbs, .wp-block-breadcrumbs, .c-breadcrumbs, nav) {
	order: -1;
}

.c-page-title-hero .woocommerce-breadcrumb {
	color: var(--pepti-color-component-breadcrumb-content-current, #fff);
	line-height: 1.4;
}

.c-page-title-hero .c-page-title-hero__title {
	line-height: 1;
	color: var(--pepti-color-global-content-primary, #fff);
}

/* ------------------------------------------------------ shop layout -- */

.l-main.l-main--woocommerce {
	max-width: none;
}

.l-main--woocommerce .l-page-content--commerce.l-container {
	max-inline-size: 1728px;
	padding-inline: var(--nx-gutter, 100px);
}

.l-main--woocommerce .l-page-content--commerce > .alignwide {
	max-width: none;
	max-inline-size: none;
}

@media (min-width: 1200px) {
	.l-main--woocommerce .wp-block-columns.l-commerce-grid {
		grid-template-columns: 340px minmax(0, 1fr);
		column-gap: var(--pepti-size-spacing-primitive-xl, 100px) !important;
	}
}

.l-main--woocommerce .l-commerce-grid .wc-block-product-template {
	gap: var(--pepti-size-spacing-primitive-xs, 20px);
}

/* The toast replaces WooCommerce's inline "View cart" link. */
.nx-product-card .added_to_cart.wc-forward {
	display: none;
}

/* ---------------------------------------------------------- filters -- */

.pepti-product-filters > .wp-block-heading {
	position: absolute;
	inline-size: 1px;
	block-size: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

.pepti-product-filters .pepti-filter-section {
	margin: 0;
	padding: 0 0 var(--pepti-size-spacing-primitive-xs, 20px);
	border: 0;
	border-block-end: 1px solid var(--pepti-color-global-border-base, #041e42);
	background: none;
}

.pepti-product-filters .pepti-filter-section {
	display: flex;
	flex-direction: column;
	gap: var(--pepti-size-spacing-primitive-xs, 20px);
}

.pepti-product-filters .pepti-filter-section:last-of-type {
	border-block-end: 0;
}

.pepti-product-filters .pepti-filter-section > summary {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin: 0;
	padding: 0 var(--pepti-size-spacing-primitive-xs, 20px);
	font-family: var(--pepti-type-heading-h3-desktop-semi-bold-font-family, "Space Grotesk", sans-serif);
	font-size: var(--pepti-type-heading-h3-desktop-semi-bold-font-size, 24px);
	font-weight: var(--pepti-type-heading-h3-desktop-semi-bold-font-weight, 600);
	line-height: 1.2;
	color: var(--pepti-color-global-content-primary, #fff);
	list-style: none;
	cursor: pointer;
}

.pepti-product-filters .pepti-filter-section > summary::-webkit-details-marker {
	display: none;
}

.pepti-product-filters .pepti-filter-section > summary::after {
	content: "";
	flex: none;
	inline-size: 24px;
	block-size: 24px;
	margin: 0;
	border: 0;
	background-color: currentColor;
	-webkit-mask: url("../images/shop/filter-chevron.svg") center / 24px 24px no-repeat;
	mask: url("../images/shop/filter-chevron.svg") center / 24px 24px no-repeat;
	transform: rotate(180deg);
	transition: transform 0.18s ease;
}

.pepti-product-filters .pepti-filter-section[open] > summary::after {
	transform: none;
}

.pepti-product-filters .pepti-filter-section > summary + * {
	margin-block-start: 0;
}

.pepti-product-filters .pepti-filter-section > summary::before {
	content: none;
}

/* Pepti draws its own divider; the section border above replaces it. */
.pepti-product-filters .pepti-filter-section::after {
	content: none;
}

.pepti-product-filters .wc-block-product-filter-checkbox-list__items {
	display: flex;
	flex-direction: column;
	gap: var(--pepti-size-spacing-primitive-xxs, 10px);
}

.pepti-product-filters .wc-block-product-filter-checkbox-list__item {
	margin: 0;
}

.pepti-product-filters .wc-block-product-filter-checkbox-list__label {
	display: flex;
	align-items: center;
	gap: var(--pepti-size-spacing-primitive-xxs, 10px);
	min-block-size: 31px;
	margin: 0;
	padding: 0 var(--pepti-size-spacing-primitive-xs, 20px);
	border-radius: var(--pepti-size-radius-primitive-pill, 100px);
	cursor: pointer;
}

/* Figma: the selected row gets the subtle pill surface. */
.pepti-product-filters .wc-block-product-filter-checkbox-list__label:has(input:checked) {
	min-block-size: 44px;
	background: var(--pepti-color-global-surface-subtle, #081017);
}

.pepti-product-filters .wc-block-product-filter-checkbox-list__input-wrapper {
	position: relative;
	display: block;
	flex: none;
	box-sizing: border-box;
	inline-size: 24px;
	block-size: 24px;
	border: 1px solid var(--pepti-color-component-form-choice-border-default, #041e42);
	border-radius: 5px;
	background: var(--pepti-color-component-form-choice-surface-default, #081017);
}

.pepti-product-filters .wc-block-product-filter-checkbox-list__input-wrapper:has(input:checked) {
	border-color: var(--pepti-color-component-form-choice-border-selected, #05f4f9);
	background: var(--pepti-color-component-form-choice-surface-selected, #081017);
}

/* Figma flips the checkmark artwork vertically (-scale-y-100). */
.pepti-product-filters .wc-block-product-filter-checkbox-list__input-wrapper:has(input:checked)::after {
	content: "";
	position: absolute;
	inset: -1px auto auto -1px;
	box-sizing: border-box;
	inline-size: 24px;
	block-size: 24px;
	margin: 0;
	border: 0;
	border-radius: 0;
	background: url("../images/shop/icon-checkmark.svg") center / 24px 24px no-repeat;
	-webkit-mask: none;
	mask: none;
	opacity: 1;
	transform: scaleY(-1);
	pointer-events: none;
}

.pepti-product-filters .wc-block-product-filter-checkbox-list__input-wrapper:has(input:focus-visible) {
	outline: 2px solid var(--pepti-color-component-form-choice-border-selected, #05f4f9);
	outline-offset: 2px;
}

/* The native input stays clickable but invisible; the wrapper is the box. */
.pepti-product-filters .wc-block-product-filter-checkbox-list__input {
	-webkit-appearance: none;
	appearance: none;
	position: absolute;
	inset: -1px;
	inline-size: 24px;
	block-size: 24px;
	margin: 0;
	border: 0;
	background: none;
	opacity: 0;
	cursor: pointer;
}

.pepti-product-filters .wc-block-product-filter-checkbox-list__mark {
	display: none;
}

.pepti-product-filters .wc-block-product-filter-checkbox-list__text-wrapper {
	display: flex;
	flex: 1;
	align-items: center;
	justify-content: space-between;
	gap: var(--pepti-size-spacing-primitive-xxs, 10px);
	min-inline-size: 0;
}

.pepti-product-filters .wc-block-product-filter-checkbox-list__text {
	font-family: var(--pepti-type-body-default-desktop-regular-font-family, "Poppins", sans-serif);
	font-size: var(--pepti-type-body-default-desktop-regular-font-size, 16px);
	font-weight: var(--pepti-type-body-default-desktop-regular-font-weight, 400);
	line-height: 1.4;
	color: var(--pepti-color-global-content-primary, #fff);
}

.pepti-product-filters .wc-block-product-filter-checkbox-list__count {
	flex: none;
	font-family: var(--pepti-type-caption-desktop-regular-font-family, "Space Grotesk", sans-serif);
	font-size: var(--pepti-type-caption-desktop-regular-font-size, 14px);
	font-weight: var(--pepti-type-caption-desktop-regular-font-weight, 400);
	line-height: 1.4;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	color: var(--pepti-color-global-content-secondary, #cccecf);
}

/* ---------------------------------------------------------- sorting -- */

.pepti-catalog-toolbar {
	justify-content: flex-end;
	margin-block-end: var(--pepti-size-spacing-primitive-xs, 20px);
}

.l-main--woocommerce .pepti-catalog-toolbar > .wc-block-catalog-sorting {
	inline-size: 313px !important;
	width: 313px !important;
	max-inline-size: 100%;
	margin: 0;
}

.pepti-catalog-toolbar :is(.c-select__trigger, select.orderby) {
	box-sizing: border-box;
	block-size: 54px;
	padding-block: 4px;
	padding-inline: var(--pepti-size-spacing-primitive-xs, 20px) 50px;
	border: 1px solid var(--pepti-color-component-form-field-border-filled, #041e42);
	border-radius: var(--pepti-size-radius-primitive-sm, 10px);
	background-color: var(--pepti-color-component-form-field-surface-filled, #081017);
	font-family: var(--pepti-type-form-input-desktop-regular-font-family, "Poppins", sans-serif);
	font-size: var(--pepti-type-form-input-desktop-regular-font-size, 14px);
	line-height: 1.4;
	color: var(--pepti-color-component-form-field-content-filled, #fff);
}

@media (max-width: 767px) {
	.l-main--woocommerce .pepti-catalog-toolbar > .wc-block-catalog-sorting {
		inline-size: 100% !important;
		width: 100% !important;
	}
}

/* ------------------------------------------------- added-to-cart toast -- */
/* Figma 6327:10850. Markup is built by assets/js/cart-toast.js. */

.nx-cart-toast {
	position: fixed;
	inset-block-start: 40px;
	inset-inline-end: 0;
	z-index: 100000;
	box-sizing: border-box;
	inline-size: min(550px, 100vw);
	padding: var(--pepti-size-spacing-primitive-xs, 20px) var(--pepti-size-spacing-primitive-xs, 20px) var(--pepti-size-spacing-primitive-md, 40px) var(--pepti-size-spacing-primitive-md, 40px);
	background-image: linear-gradient(211deg, #000 0%, rgb(0 0 0 / 0) 49%);
	pointer-events: none;
	opacity: 0;
	transform: translateY(-8px);
	transition: opacity 0.2s ease, transform 0.2s ease;
}

.nx-cart-toast.is-visible {
	opacity: 1;
	transform: none;
}

.nx-cart-toast__card {
	display: flex;
	align-items: flex-start;
	gap: var(--pepti-size-spacing-primitive-xs, 20px);
	box-sizing: border-box;
	padding: var(--pepti-size-spacing-primitive-xs, 20px);
	border: 1px solid var(--pepti-color-global-border-base, #041e42);
	border-radius: 16px;
	background: var(--pepti-color-global-surface-subtle, #081017);
	box-shadow: 0 12px 16px -4px rgb(33 42 54 / 0.08), 0 4px 6px -2px rgb(33 42 54 / 0.03);
	pointer-events: auto;
}

.nx-cart-toast__icon {
	position: relative;
	display: flex;
	flex: none;
	align-items: center;
	justify-content: center;
	inline-size: 32px;
	block-size: 32px;
}

.nx-cart-toast__icon::before,
.nx-cart-toast__icon::after {
	content: "";
	position: absolute;
	border: 1px solid var(--pepti-color-global-content-accent, #05f4f9);
	border-radius: 50%;
}

.nx-cart-toast__icon::before {
	inset: -10px;
	opacity: 0.3;
}

.nx-cart-toast__icon::after {
	inset: -2px;
	opacity: 0.6;
}

.nx-cart-toast__icon img {
	display: block;
	inline-size: 20px;
	block-size: 20px;
}

.nx-cart-toast__body {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: var(--pepti-size-spacing-primitive-xs, 20px);
	min-inline-size: 0;
}

.nx-cart-toast__header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 0;
}

.nx-cart-toast__text {
	display: flex;
	flex-direction: column;
	gap: 10px;
	min-inline-size: 0;
}

.nx-cart-toast__title {
	margin: 0;
	font-family: var(--pepti-type-heading-h6-desktop-semi-bold-font-family, "Space Grotesk", sans-serif);
	font-size: var(--pepti-type-heading-h6-desktop-semi-bold-font-size, 18px);
	font-weight: var(--pepti-type-heading-h6-desktop-semi-bold-font-weight, 600);
	line-height: 1.2;
	color: var(--pepti-color-global-content-primary, #fff);
}

.nx-cart-toast__message {
	margin: 0;
	font-family: var(--pepti-type-body-small-desktop-regular-font-family, "Poppins", sans-serif);
	font-size: var(--pepti-type-body-small-desktop-regular-font-size, 14px);
	line-height: 1.4;
	color: var(--pepti-color-global-content-secondary, #cccecf);
}

.nx-cart-toast__close {
	display: flex;
	flex: none;
	align-items: center;
	justify-content: center;
	inline-size: 22px;
	block-size: 22px;
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	cursor: pointer;
}

.nx-cart-toast__close img {
	display: block;
	inline-size: 22px;
	block-size: 22px;
}

.nx-cart-toast__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.nx-cart-toast__actions .c-button {
	min-block-size: 44px;
	padding-block: var(--pepti-size-spacing-primitive-xxs, 10px);
	padding-inline: var(--pepti-size-spacing-primitive-xs, 20px);
}

.nx-cart-toast__actions .c-button--style-primary {
	font-size: var(--pepti-type-button-small-desktop-medium-font-size, 14px);
}

@media (max-width: 767px) {
	.nx-cart-toast {
		inset-block-start: 0;
		padding: var(--pepti-size-spacing-primitive-xs, 20px);
	}

	.nx-cart-toast__card {
		gap: 16px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.nx-cart-toast {
		transition: none;
	}
}
