/**
 * Product Category Navigation widget.
 *
 * Stable structure and progressive-enhancement states live here. Per-instance
 * presentation values are generated by Elementor from the widget controls.
 *
 * @package WC_Product_Card_Elementor
 * @since 2.8.0
 */

/* ===== ELEMENTOR WIDTH GUARD ===== */

.elementor-widget-wcpce_category_navigation,
.elementor-widget-wcpce_category_navigation > .elementor-widget-container {
	min-width: 0;
	width: 100%;
}

/* ===== ROOT ===== */

.wcpce-category-nav {
	--wcpce-category-card-width: 150px;
	--wcpce-category-gap: 20px;
	--wcpce-category-hover-lift: 4px;
	--wcpce-category-hover-scale: 1.05;
	--wcpce-category-arrow-size: 40px;
	--wcpce-category-arrow-colour: #333232;
	--wcpce-category-arrow-hover: #b4211c;
	--wcpce-category-arrow-background: #fefbfb;
	--wcpce-category-arrow-border: #d8d4d3;
	--wcpce-category-dot-colour: #b4211c;
	--wcpce-category-dot-size: 9px;
	background: #fefbfb;
	color: #333232;
	min-width: 0;
	padding: 48px 0 40px;
	width: 100%;
}

.wcpce-category-nav *,
.wcpce-category-nav *::before,
.wcpce-category-nav *::after {
	box-sizing: border-box;
}

/* ===== HEADER ===== */

.wcpce-category-nav__header {
	align-items: flex-end;
	display: flex;
	gap: 24px;
	justify-content: space-between;
	margin-bottom: 28px;
}

.wcpce-category-nav__heading {
	color: #b4211c;
	flex: 1 1 240px;
	margin: 0;
	min-width: 0;
}

.wcpce-category-nav__tools {
	align-items: center;
	display: flex;
	flex: 0 1 auto;
	gap: 24px;
	justify-content: flex-end;
	margin-left: auto;
}

.wcpce-category-nav .wcpce-category-nav__shop-link,
.wcpce-category-nav .wcpce-category-nav__shop-link:visited {
	border-bottom: 1px solid currentColor;
	color: #333232;
	font-family: inherit;
	font-size: 0.875em;
	padding-bottom: 2px;
	text-decoration: none;
	transition: border-color 0.2s ease, color 0.2s ease;
	white-space: nowrap;
}

.wcpce-category-nav .wcpce-category-nav__shop-link:hover,
.wcpce-category-nav .wcpce-category-nav__shop-link:focus-visible {
	color: #b4211c;
	text-decoration: none;
}

.wcpce-category-nav .wcpce-category-nav__shop-link:focus {
	outline: none;
}

.wcpce-category-nav .wcpce-category-nav__shop-link:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 4px;
}

/* ===== CATEGORY TRACK ===== */

.wcpce-category-nav__list {
	align-items: flex-start;
	display: flex;
	gap: var(--wcpce-category-gap);
	list-style: none;
	margin: 0;
	min-width: 0;
	overflow-x: auto;
	overscroll-behavior-x: contain;
	padding: 10px 0 20px;
	scroll-padding-inline: 0;
	scroll-snap-type: inline proximity;
	-webkit-overflow-scrolling: touch;
}

.wcpce-category-nav.is-enhanced .wcpce-category-nav__list {
	-ms-overflow-style: none;
	scrollbar-width: none;
}

.wcpce-category-nav.is-enhanced .wcpce-category-nav__list::-webkit-scrollbar {
	display: none;
	height: 0;
}

.wcpce-category-nav__item {
	flex: 0 0 var(--wcpce-category-card-width);
	margin: 0;
	min-width: 0;
	padding: 0;
	scroll-snap-align: start;
}

.wcpce-category-nav .wcpce-category-nav__card,
.wcpce-category-nav .wcpce-category-nav__card:visited,
.wcpce-category-nav .wcpce-category-nav__card:hover,
.wcpce-category-nav .wcpce-category-nav__card:active {
	align-items: center;
	color: #333232;
	display: flex;
	flex-direction: column;
	font-family: inherit;
	gap: 12px;
	min-width: 0;
	text-decoration: none;
}

.wcpce-category-nav .wcpce-category-nav__card:focus {
	outline: none;
}

.wcpce-category-nav .wcpce-category-nav__card:focus-visible {
	outline: 2px solid #b4211c;
	outline-offset: 4px;
}

.wcpce-category-nav__thumbnail {
	aspect-ratio: 1 / 1;
	background: #fff;
	border-radius: 6px;
	box-shadow: 0 2px 5px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.04);
	display: block;
	overflow: hidden;
	transition: box-shadow 0.3s ease, transform 0.3s ease;
	width: 100%;
}

.wcpce-category-nav__image {
	display: block;
	height: 100% !important;
	max-width: none;
	object-fit: contain;
	transition: transform 0.4s cubic-bezier(0.2, 0.6, 0.2, 1);
	width: 100%;
}

/* Preserve image sizing when an optimizer moves the class to <picture>. */
.wcpce-category-nav__thumbnail picture.wcpce-category-nav__image > img {
	display: block;
	height: 100% !important;
	max-width: none;
	object-fit: contain;
	width: 100%;
}

.wcpce-category-nav__name {
	color: #333232;
	font-family: inherit;
	font-size: 0.875em;
	hyphens: auto;
	line-height: 1.35;
	min-height: 2.7em;
	overflow-wrap: break-word;
	text-align: center;
	text-wrap: pretty;
	transition: color 0.25s ease;
	width: 100%;
}

@media (hover: hover) and (pointer: fine) {
	.wcpce-category-nav--hover .wcpce-category-nav__card:hover .wcpce-category-nav__thumbnail {
		transform: translateY(calc(-1 * var(--wcpce-category-hover-lift)));
	}

	.wcpce-category-nav--hover .wcpce-category-nav__card:hover .wcpce-category-nav__image {
		transform: scale(var(--wcpce-category-hover-scale));
	}

	.wcpce-category-nav--hover .wcpce-category-nav__card:hover .wcpce-category-nav__name {
		color: #b4211c;
	}
}

/* ===== ARROWS ===== */

.wcpce-category-nav__arrows {
	display: flex;
	flex: none;
	gap: 8px;
	visibility: hidden;
}

.wcpce-category-nav.is-ready.has-overflow .wcpce-category-nav__arrows {
	visibility: visible;
}

.wcpce-category-nav .wcpce-category-nav__arrow,
.wcpce-category-nav .wcpce-category-nav__arrow:hover,
.wcpce-category-nav .wcpce-category-nav__arrow:focus,
.wcpce-category-nav .wcpce-category-nav__arrow:active {
	align-items: center;
	background: var(--wcpce-category-arrow-background) !important;
	border: 1px solid var(--wcpce-category-arrow-border) !important;
	border-radius: 4px;
	box-shadow: none;
	color: var(--wcpce-category-arrow-colour) !important;
	cursor: pointer;
	display: flex;
	font: inherit;
	font-size: 22px;
	height: var(--wcpce-category-arrow-size);
	justify-content: center;
	line-height: 1;
	margin: 0;
	min-height: 0;
	min-width: 0;
	padding: 0;
	text-decoration: none;
	width: var(--wcpce-category-arrow-size);
}

.wcpce-category-nav .wcpce-category-nav__arrow:hover:not(:disabled),
.wcpce-category-nav .wcpce-category-nav__arrow:focus-visible:not(:disabled) {
	border-color: var(--wcpce-category-arrow-hover) !important;
	color: var(--wcpce-category-arrow-hover) !important;
}

.wcpce-category-nav .wcpce-category-nav__arrow:active:not(:disabled) {
	background: #efe8e7 !important;
}

.wcpce-category-nav .wcpce-category-nav__arrow:focus {
	outline: none;
}

.wcpce-category-nav .wcpce-category-nav__arrow:focus-visible {
	outline: 2px solid var(--wcpce-category-arrow-hover);
	outline-offset: 2px;
}

.wcpce-category-nav .wcpce-category-nav__arrow:disabled {
	color: #c6bfbe !important;
	cursor: default;
	opacity: 1;
}

/* ===== PAGINATION DOTS ===== */

.wcpce-category-nav__dots {
	align-items: center;
	display: flex;
	justify-content: center;
	margin-top: 14px;
	min-height: 24px;
	visibility: hidden;
}

.wcpce-category-nav.is-ready.has-overflow .wcpce-category-nav__dots {
	visibility: visible;
}

.wcpce-category-nav .wcpce-category-nav__dot,
.wcpce-category-nav .wcpce-category-nav__dot:hover,
.wcpce-category-nav .wcpce-category-nav__dot:focus,
.wcpce-category-nav .wcpce-category-nav__dot:active {
	align-items: center;
	background: transparent !important;
	border: 0 !important;
	box-shadow: none;
	cursor: pointer;
	display: flex;
	height: 24px;
	justify-content: center;
	margin: 0;
	min-height: 24px;
	min-width: 24px;
	padding: 0;
	width: 24px;
}

.wcpce-category-nav__dot::before {
	background: transparent;
	border: 1px solid var(--wcpce-category-dot-colour);
	border-radius: 50%;
	content: '';
	display: block;
	height: var(--wcpce-category-dot-size);
	transition: background-color 0.2s ease;
	width: var(--wcpce-category-dot-size);
}

.wcpce-category-nav__dot[aria-current='true']::before,
.wcpce-category-nav__dot:hover::before {
	background: var(--wcpce-category-dot-colour);
}

.wcpce-category-nav .wcpce-category-nav__dot:focus {
	outline: none;
}

.wcpce-category-nav .wcpce-category-nav__dot:focus-visible {
	outline: 2px solid var(--wcpce-category-dot-colour);
	outline-offset: 0;
}

/* ===== EDITOR NOTICES ===== */

.wcpce-category-nav-editor-notice {
	background: #f5f5f5;
	border-left: 4px solid #8a8a8a;
	color: #333;
	font-size: 13px;
	line-height: 1.5;
	margin-bottom: 12px;
	padding: 10px 12px;
}

.wcpce-category-nav-editor-notice--warning {
	background: #fff8e5;
	border-left-color: #dba617;
}

/* ===== RESPONSIVE ===== */

@media (max-width: 1024px) {
	.wcpce-category-nav {
		--wcpce-category-card-width: 130px;
		--wcpce-category-gap: 16px;
	}
}

@media (max-width: 767px) {
	.wcpce-category-nav {
		--wcpce-category-card-width: 100px;
		--wcpce-category-gap: 12px;
	}

	.wcpce-category-nav__header {
		align-items: stretch;
		flex-direction: column;
		gap: 12px;
	}

	.wcpce-category-nav__heading {
		flex: 0 0 auto;
		width: 100%;
	}

	.wcpce-category-nav__tools {
		justify-content: flex-start;
		margin-left: 0;
		width: 100%;
	}

	.wcpce-category-nav:not(.wcpce-category-nav--arrows-mobile) .wcpce-category-nav__arrows {
		display: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.wcpce-category-nav__shop-link,
	.wcpce-category-nav__thumbnail,
	.wcpce-category-nav__image,
	.wcpce-category-nav__name,
	.wcpce-category-nav__dot::before {
		transition: none !important;
	}
}
