/**
 * Jedi-Robe WooCommerce checkout progress tracker.
 *
 * Provides one shared Cart -> Checkout -> Confirmation progress component
 * for the classic WooCommerce basket, checkout and order-received screens.
 *
 * Shoptimizer retains ownership of the existing semantic progress markup.
 * Visual state is derived from WooCommerce page body classes rather than
 * Shoptimizer's internal active-state classes.
 *
 * @package Jedi_Theme
 * @subpackage WooCommerce_Checkout_Progress
 * @since 1.0.0
 */


/* ==========================================================================
   Shared progress tokens
   ========================================================================== */

body.jr-dark-commerce:is(
	.woocommerce-cart,
	.woocommerce-checkout
) {
	--jr-checkout-progress-muted: rgba(255, 255, 255, 0.5);
	--jr-checkout-progress-border: rgba(152, 169, 192, 0.34);
	--jr-checkout-progress-rail: rgba(152, 169, 192, 0.24);
}


/* ==========================================================================
   Progress wrapper
   ========================================================================== */

body.jr-dark-commerce:is(
	.woocommerce-cart,
	.woocommerce-checkout
)
	.checkout-wrap {
	position: relative;
	inset: auto;

	display: block;
	float: none;
	clear: both;

	width: 100%;
	height: auto;
	min-height: 5rem;

	margin:
		0
		0
		1.75rem;

	padding: 0;

	overflow: visible;

	border: 0;

	background: transparent;

	box-shadow: none;

	transform: none;
}


/* ==========================================================================
   Progress grid
   ========================================================================== */

body.jr-dark-commerce:is(
	.woocommerce-cart,
	.woocommerce-checkout
)
	.checkout-wrap
	> ul.checkout-bar {
	position: relative;
	inset: auto;

	display: grid;
	float: none;

	grid-template-columns:
		repeat(3, minmax(0, 1fr));

	width: 100%;
	max-width: none;
	height: auto;
	min-height: 4.75rem;

	margin: 0;
	padding: 0;

	overflow: visible;

	border: 0;
	border-radius: 0;

	background: none;
	background-image: none;

	box-shadow: none;

	list-style: none;

	transform: none;

	counter-reset: jr-checkout-step;
}


/**
 * Remove Shoptimizer's original progress rails.
 */
body.jr-dark-commerce:is(
	.woocommerce-cart,
	.woocommerce-checkout
)
	.checkout-wrap
	> ul.checkout-bar::before,
body.jr-dark-commerce:is(
	.woocommerce-cart,
	.woocommerce-checkout
)
	.checkout-wrap
	> ul.checkout-bar::after {
	display: none;

	width: 0;
	height: 0;

	border: 0;

	background: none;

	box-shadow: none;

	content: none;

	transform: none;
}


/* ==========================================================================
   Progress steps
   ========================================================================== */

body.jr-dark-commerce:is(
	.woocommerce-cart,
	.woocommerce-checkout
)
	.checkout-wrap
	> ul.checkout-bar
	> li {
	position: relative;
	inset: auto;
	z-index: 1;

	display: flex;
	float: none;

	box-sizing: border-box;

	width: 100%;
	max-width: none;
	height: auto;
	min-height: 4.75rem;

	flex-direction: column;
	align-items: center;
	justify-content: flex-start;

	margin: 0;
	padding:
		0
		0.5rem;

	overflow: visible;

	border: 0;

	background: none;

	color: var(--jr-checkout-progress-muted);

	font-weight: 650;
	line-height: 1.35;

	text-align: center;

	box-shadow: none;

	transform: none;

	counter-increment: jr-checkout-step;
}


/* ==========================================================================
   Connector rails
   ========================================================================== */

body.jr-dark-commerce:is(
	.woocommerce-cart,
	.woocommerce-checkout
)
	.checkout-wrap
	> ul.checkout-bar
	> li:not(:last-child)::after {
	position: absolute;

	top: 1rem;
	right: calc(-50% + 1.3rem);
	left: calc(50% + 1.3rem);
	z-index: 0;

	display: block;

	width: auto;
	height: 1px;

	margin: 0;

	border: 0;

	background: var(--jr-checkout-progress-rail);

	box-shadow: none;

	content: "";

	transform: none;

	pointer-events: none;
}


/* ==========================================================================
   Numbered nodes
   ========================================================================== */

body.jr-dark-commerce:is(
	.woocommerce-cart,
	.woocommerce-checkout
)
	.checkout-wrap
	> ul.checkout-bar
	> li::before {
	position: relative;
	inset: auto;
	z-index: 2;

	display: grid;

	flex: 0 0 2rem;

	width: 2rem;
	height: 2rem;

	place-items: center;

	margin: 0;
	padding: 0;

	border: 1px solid var(--jr-checkout-progress-border);
	border-radius: 50%;

	background: #07101a;

	color: rgba(255, 255, 255, 0.62);

	font-size: 0.72rem;
	font-weight: 800;
	line-height: 1;

	box-shadow:
		0 0 0 0.3rem #050a10;

	content: counter(jr-checkout-step);

	transform: none;
}


/* ==========================================================================
   Step labels
   ========================================================================== */

body.jr-dark-commerce:is(
	.woocommerce-cart,
	.woocommerce-checkout
)
	.checkout-wrap
	> ul.checkout-bar
	> li
	> span {
	position: relative;
	inset: auto;
	z-index: 2;

	display: block;
	float: none;

	width: auto;
	height: auto;

	margin:
		0.65rem
		0
		0;

	padding: 0;

	border: 0;

	background: transparent;

	color: inherit;

	line-height: 1.35;

	transform: none;
}


body.jr-dark-commerce:is(
	.woocommerce-cart,
	.woocommerce-checkout
)
	.checkout-wrap
	> ul.checkout-bar
	> li
	> span
	> a {
	position: static;

	display: inline;

	margin: 0;
	padding: 0;

	color: inherit;

	text-decoration: none;

	transform: none;
}


/* ==========================================================================
   CART
   Step 1 = current
   ========================================================================== */

body.jr-dark-commerce.woocommerce-cart
	.checkout-wrap
	> ul.checkout-bar
	> li:nth-child(1) {
	color: var(--jr-text);
}


body.jr-dark-commerce.woocommerce-cart
	.checkout-wrap
	> ul.checkout-bar
	> li:nth-child(1)::before {
	border-color: var(--jr-green-light);

	background:
		linear-gradient(
			145deg,
			rgba(69, 217, 107, 0.18),
			rgba(45, 166, 83, 0.07)
		);

	color: var(--jr-text);

	box-shadow:
		0 0 0 0.3rem #050a10,
		0 0 0.9rem rgba(45, 166, 83, 0.14);
}


/**
 * Step 1 begins the journey toward Checkout.
 */
body.jr-dark-commerce.woocommerce-cart
	.checkout-wrap
	> ul.checkout-bar
	> li:nth-child(1):not(:last-child)::after {
	background:
		linear-gradient(
			90deg,
			rgba(69, 217, 107, 0.72) 0%,
			rgba(69, 217, 107, 0.34) 20%,
			var(--jr-checkout-progress-rail) 42%,
			var(--jr-checkout-progress-rail) 100%
		);
}


/* ==========================================================================
   CHECKOUT
   Step 1 = complete
   Step 2 = current
   ========================================================================== */

body.jr-dark-commerce.woocommerce-checkout:not(.woocommerce-order-received)
	.checkout-wrap
	> ul.checkout-bar
	> li:nth-child(1)::before {
	border-color: rgba(69, 217, 107, 0.68);

	background: rgba(69, 217, 107, 0.09);

	color: var(--jr-text);
}


body.jr-dark-commerce.woocommerce-checkout:not(.woocommerce-order-received)
	.checkout-wrap
	> ul.checkout-bar
	> li:nth-child(1)
	> span {
	color: rgba(255, 255, 255, 0.72);
}


/**
 * Cart -> Checkout is complete.
 */
body.jr-dark-commerce.woocommerce-checkout:not(.woocommerce-order-received)
	.checkout-wrap
	> ul.checkout-bar
	> li:nth-child(1):not(:last-child)::after {
	background:
		linear-gradient(
			90deg,
			rgba(69, 217, 107, 0.72),
			rgba(69, 217, 107, 0.48)
		);
}


/**
 * Checkout is current.
 */
body.jr-dark-commerce.woocommerce-checkout:not(.woocommerce-order-received)
	.checkout-wrap
	> ul.checkout-bar
	> li:nth-child(2) {
	color: var(--jr-text);
}


body.jr-dark-commerce.woocommerce-checkout:not(.woocommerce-order-received)
	.checkout-wrap
	> ul.checkout-bar
	> li:nth-child(2)::before {
	border-color: var(--jr-green-light);

	background:
		linear-gradient(
			145deg,
			rgba(69, 217, 107, 0.18),
			rgba(45, 166, 83, 0.07)
		);

	color: var(--jr-text);

	box-shadow:
		0 0 0 0.3rem #050a10,
		0 0 0.9rem rgba(45, 166, 83, 0.14);
}


/**
 * Checkout -> Confirmation remains incomplete.
 */
body.jr-dark-commerce.woocommerce-checkout:not(.woocommerce-order-received)
	.checkout-wrap
	> ul.checkout-bar
	> li:nth-child(2):not(:last-child)::after {
	background:
		linear-gradient(
			90deg,
			rgba(69, 217, 107, 0.72) 0%,
			rgba(69, 217, 107, 0.34) 20%,
			var(--jr-checkout-progress-rail) 42%,
			var(--jr-checkout-progress-rail) 100%
		);
}


/* ==========================================================================
   CONFIRMATION
   Steps 1 + 2 = complete
   Step 3 = current
   ========================================================================== */

body.jr-dark-commerce.woocommerce-checkout.woocommerce-order-received
	.checkout-wrap
	> ul.checkout-bar
	> li:nth-child(1)::before,
body.jr-dark-commerce.woocommerce-checkout.woocommerce-order-received
	.checkout-wrap
	> ul.checkout-bar
	> li:nth-child(2)::before {
	border-color: rgba(69, 217, 107, 0.68);

	background: rgba(69, 217, 107, 0.09);

	color: var(--jr-text);
}


body.jr-dark-commerce.woocommerce-checkout.woocommerce-order-received
	.checkout-wrap
	> ul.checkout-bar
	> li:nth-child(1):not(:last-child)::after,
body.jr-dark-commerce.woocommerce-checkout.woocommerce-order-received
	.checkout-wrap
	> ul.checkout-bar
	> li:nth-child(2):not(:last-child)::after {
	background:
		linear-gradient(
			90deg,
			rgba(69, 217, 107, 0.72),
			rgba(69, 217, 107, 0.48)
		);
}


body.jr-dark-commerce.woocommerce-checkout.woocommerce-order-received
	.checkout-wrap
	> ul.checkout-bar
	> li:nth-child(1)
	> span,
body.jr-dark-commerce.woocommerce-checkout.woocommerce-order-received
	.checkout-wrap
	> ul.checkout-bar
	> li:nth-child(2)
	> span {
	color: rgba(255, 255, 255, 0.72);
}


/**
 * Confirmation is current.
 */
body.jr-dark-commerce.woocommerce-checkout.woocommerce-order-received
	.checkout-wrap
	> ul.checkout-bar
	> li:nth-child(3) {
	color: var(--jr-text);
}


body.jr-dark-commerce.woocommerce-checkout.woocommerce-order-received
	.checkout-wrap
	> ul.checkout-bar
	> li:nth-child(3)::before {
	border-color: var(--jr-green-light);

	background:
		linear-gradient(
			145deg,
			rgba(69, 217, 107, 0.18),
			rgba(45, 166, 83, 0.07)
		);

	color: var(--jr-text);

	box-shadow:
		0 0 0 0.3rem #050a10,
		0 0 0.9rem rgba(45, 217, 107, 0.14);
}


/* ==========================================================================
   Pointer interactions
   ========================================================================== */

@media (hover: hover) and (pointer: fine) {

	body.jr-dark-commerce:is(
		.woocommerce-cart,
		.woocommerce-checkout
	)
		.checkout-wrap
		> ul.checkout-bar
		> li
		> span
		> a:hover {
		color: var(--jr-text);
	}
}


/* ==========================================================================
   Mobile
   ========================================================================== */

@media (max-width: 720px) {

	body.jr-dark-commerce:is(
		.woocommerce-cart,
		.woocommerce-checkout
	)
		.checkout-wrap {
		min-height: 4.5rem;

		margin-bottom: 1.4rem;
	}


	body.jr-dark-commerce:is(
		.woocommerce-cart,
		.woocommerce-checkout
	)
		.checkout-wrap
		> ul.checkout-bar {
		min-height: 4.25rem;
	}


	body.jr-dark-commerce:is(
		.woocommerce-cart,
		.woocommerce-checkout
	)
		.checkout-wrap
		> ul.checkout-bar
		> li {
		min-height: 4.25rem;

		padding:
			0
			0.25rem;

		font-size: 0.66rem;
	}


	body.jr-dark-commerce:is(
		.woocommerce-cart,
		.woocommerce-checkout
	)
		.checkout-wrap
		> ul.checkout-bar
		> li::before {
		flex-basis: 1.75rem;

		width: 1.75rem;
		height: 1.75rem;

		font-size: 0.66rem;

		box-shadow:
			0 0 0 0.25rem #050a10;
	}


	body.jr-dark-commerce:is(
		.woocommerce-cart,
		.woocommerce-checkout
	)
		.checkout-wrap
		> ul.checkout-bar
		> li:not(:last-child)::after {
		top: 0.875rem;

		right: calc(-50% + 1.15rem);
		left: calc(50% + 1.15rem);
	}


	body.jr-dark-commerce:is(
		.woocommerce-cart,
		.woocommerce-checkout
	)
		.checkout-wrap
		> ul.checkout-bar
		> li
		> span {
		margin-top: 0.55rem;
	}
}