/**
 * CBC Process
 *
 * Structural styles only. Every colour, size and typographic value below is a
 * neutral fallback that Elementor's Style tab overrides via custom properties.
 */

.cbc-process {
	--cbc-marker-col: 120px;
	--cbc-marker-size: 80px;
	--cbc-marker-bg: rgba( 127, 127, 127, 0.15 );
	--cbc-line-width: 2px;
	--cbc-line-color: currentColor;
	--cbc-line-dash: 10px;
	--cbc-step-gap: 80px;
	--cbc-col-gap: 40px;
	--cbc-stack-gap: 24px;
	--cbc-align: center;
}

/* ---------------------------------------------------------------- Step grid */

.cbc-process__step {
	display: grid;
	grid-template-columns: minmax( 0, 1fr ) var( --cbc-marker-col ) minmax( 0, 1fr );
	grid-template-rows: auto;
	column-gap: var( --cbc-col-gap );
	align-items: var( --cbc-align );
}

.cbc-process__step:not( :last-child ) {
	margin-bottom: var( --cbc-step-gap );
}

.cbc-process__media {
	grid-column: 1;
	grid-row: 1;
	min-width: 0;
	margin: 0;
	justify-self: start;
	width: 100%;
}

.cbc-process__content {
	grid-column: 3;
	grid-row: 1;
	min-width: 0;
}

.cbc-process__step--image-right .cbc-process__media {
	grid-column: 3;
	justify-self: end;
}

.cbc-process__step--image-right .cbc-process__content {
	grid-column: 1;
}

/* ------------------------------------------------------- Marker and the line */

.cbc-process__marker {
	grid-column: 2;
	grid-row: 1;
	align-self: stretch;
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
}

.cbc-process__marker::before {
	content: "";
	position: absolute;
	top: 0;
	bottom: 0;
	left: 50%;
	width: var( --cbc-line-width );
	transform: translateX( -50% );
	background-color: var( --cbc-line-color );
}

/* Bridge the gap to the next step so the line reads as continuous. */
.cbc-process__step:not( :last-child ) .cbc-process__marker::before {
	bottom: calc( -1 * var( --cbc-step-gap ) );
}

/*
 * The line starts at the first circle and ends at the last one, so nothing
 * hangs above step one or below the final step.
 */
.cbc-process__step:first-child .cbc-process__marker::before {
	top: 50%;
}

.cbc-process__step:last-child .cbc-process__marker::before {
	bottom: 50%;
}

/* A single step has nothing to connect to. */
.cbc-process__step:only-child .cbc-process__marker::before {
	display: none;
}

/* Dashed and dotted variants. */
.cbc-process--rule-dashed .cbc-process__marker::before,
.cbc-process--rule-dotted .cbc-process__marker::before {
	background-color: transparent;
	background-image: repeating-linear-gradient(
		to bottom,
		var( --cbc-line-color ) 0,
		var( --cbc-line-color ) var( --cbc-line-dash ),
		transparent var( --cbc-line-dash ),
		transparent calc( var( --cbc-line-dash ) * 2 )
	);
}

.cbc-process--rule-dotted .cbc-process__marker::before {
	background-image: radial-gradient( circle at center, var( --cbc-line-color ) 45%, transparent 47% );
	background-size: 100% var( --cbc-line-dash );
	background-repeat: repeat-y;
	background-position: center top;
}

.cbc-process__number {
	position: relative;
	z-index: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	width: var( --cbc-marker-size );
	height: var( --cbc-marker-size );
	border-radius: 50%;
	background-color: var( --cbc-marker-bg );
	line-height: 1;
	text-align: center;
	font-weight: 700;
}

/* ------------------------------------------------------------------- Content */

.cbc-process__media img {
	display: block;
	width: 100%;
	height: auto;
	max-width: 100%;
}

.cbc-process__title,
.cbc-process__subtitle {
	margin: 0 0 0.5em;
}

.cbc-process__text {
	margin: 0;
}

.cbc-process__text > :first-child {
	margin-top: 0;
}

.cbc-process__text > :last-child {
	margin-bottom: 0;
}

/*
 * The base class carries spacing and focus only. Appearance is left to Elementor's
 * .elementor-button styles (global button settings, theme style) so they apply first;
 * this widget's own Style tab controls are written at a higher specificity and layer
 * on top of them.
 */
.cbc-process__button {
	margin-top: 1.5em;
}

.cbc-process__button:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 3px;
}

/* Only used when "Use Elementor button styles" is switched off. */
.cbc-process__button--plain {
	display: inline-block;
	padding: 0.85em 1.9em;
	border-radius: 999px;
	background-color: rgba( 127, 127, 127, 0.15 );
	text-decoration: none;
	line-height: 1.2;
	transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

/* -------------------------------------------------------- Stacked: to tablet */

@media ( max-width: 1024px ) {

	.cbc-process--stack-tablet .cbc-process__step {
		grid-template-columns: var( --cbc-marker-col ) minmax( 0, 1fr );
		grid-template-rows: auto auto;
		align-items: start;
		row-gap: var( --cbc-stack-gap );
	}

	.cbc-process--stack-tablet .cbc-process__marker {
		grid-column: 1;
		grid-row: 1 / span 2;
		align-items: flex-start;
	}

	.cbc-process--stack-tablet .cbc-process__media,
	.cbc-process--stack-tablet .cbc-process__step--image-right .cbc-process__media {
		grid-column: 2;
		grid-row: 1;
		justify-self: start;
	}

	.cbc-process--stack-tablet .cbc-process__content,
	.cbc-process--stack-tablet .cbc-process__step--image-right .cbc-process__content {
		grid-column: 2;
		grid-row: 2;
	}

	.cbc-process--stack-tablet.cbc-process--stacked-content .cbc-process__media,
	.cbc-process--stack-tablet.cbc-process--stacked-content .cbc-process__step--image-right .cbc-process__media {
		grid-row: 2;
	}

	.cbc-process--stack-tablet.cbc-process--stacked-content .cbc-process__content,
	.cbc-process--stack-tablet.cbc-process--stacked-content .cbc-process__step--image-right .cbc-process__content {
		grid-row: 1;
	}

	/* The circle now sits at the top of the cell, so trim from there. */
	.cbc-process--stack-tablet .cbc-process__step:first-child .cbc-process__marker::before {
		top: calc( var( --cbc-marker-size ) / 2 );
	}

	.cbc-process--stack-tablet .cbc-process__step:last-child .cbc-process__marker::before {
		top: 0;
		bottom: auto;
		height: calc( var( --cbc-marker-size ) / 2 );
	}
}

@media ( max-width: 767px ) {

	.cbc-process--stack-tablet {
		--cbc-marker-col: 64px;
		--cbc-marker-size: 48px;
		--cbc-step-gap: 48px;
	}
}

/* -------------------------------------------------------- Stacked: to mobile */

@media ( max-width: 767px ) {

	.cbc-process--stack-mobile {
		--cbc-marker-col: 64px;
		--cbc-marker-size: 48px;
		--cbc-step-gap: 48px;
	}

	.cbc-process--stack-mobile .cbc-process__step {
		grid-template-columns: var( --cbc-marker-col ) minmax( 0, 1fr );
		grid-template-rows: auto auto;
		align-items: start;
		row-gap: var( --cbc-stack-gap );
	}

	.cbc-process--stack-mobile .cbc-process__marker {
		grid-column: 1;
		grid-row: 1 / span 2;
		align-items: flex-start;
	}

	.cbc-process--stack-mobile .cbc-process__media,
	.cbc-process--stack-mobile .cbc-process__step--image-right .cbc-process__media {
		grid-column: 2;
		grid-row: 1;
		justify-self: start;
	}

	.cbc-process--stack-mobile .cbc-process__content,
	.cbc-process--stack-mobile .cbc-process__step--image-right .cbc-process__content {
		grid-column: 2;
		grid-row: 2;
	}

	.cbc-process--stack-mobile.cbc-process--stacked-content .cbc-process__media,
	.cbc-process--stack-mobile.cbc-process--stacked-content .cbc-process__step--image-right .cbc-process__media {
		grid-row: 2;
	}

	.cbc-process--stack-mobile.cbc-process--stacked-content .cbc-process__content,
	.cbc-process--stack-mobile.cbc-process--stacked-content .cbc-process__step--image-right .cbc-process__content {
		grid-row: 1;
	}

	.cbc-process--stack-mobile .cbc-process__step:first-child .cbc-process__marker::before {
		top: calc( var( --cbc-marker-size ) / 2 );
	}

	.cbc-process--stack-mobile .cbc-process__step:last-child .cbc-process__marker::before {
		top: 0;
		bottom: auto;
		height: calc( var( --cbc-marker-size ) / 2 );
	}
}

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

	.cbc-process__button,
	.cbc-process__button--plain {
		transition: none;
	}
}
