/*
 * biggym-separator.css
 * Styles for the BigGym Separator Elementor widget. The variables are set per widget by its settings in Elementor.
 */

.biggym-separator {
	--biggym-separator-width: 24em;
	--biggym-separator-thickness: 1px;
	--biggym-separator-color: #474747;
	--biggym-separator-justify: flex-start;
	/* The side the line grows from: the same as its alignment. */
	--biggym-separator-origin: left;
	--biggym-separator-duration: 0.9s;

	display: flex;
	justify-content: var(--biggym-separator-justify);
}

.biggym-separator__line {
	display: block;
	width: min(var(--biggym-separator-width), 100%);
	height: var(--biggym-separator-thickness);
	background-color: var(--biggym-separator-color);
	transform-origin: var(--biggym-separator-origin) center;
}

/*
 * The animation: the line starts at zero width and grows to its full width once the script adds the revealed class.
 * It is scaled rather than resized, which looks the same but does not make the browser redo the page layout.
 * Not in the Elementor editor, and not for visitors who prefer reduced motion: they see the line straight away.
 */
@media (prefers-reduced-motion: no-preference) {
	body:not(.elementor-editor-active) .biggym-separator--animated:not(.biggym-separator--revealed) .biggym-separator__line {
		scale: 0 1;
	}

	/* Failsafe: if the script does not run (blocked, delayed or failed), the line still appears after 3 seconds. */
	body:not(.elementor-editor-active) .biggym-separator--animated:not(.biggym-separator--ready) .biggym-separator__line {
		animation: biggym-separator-failsafe 0s linear 3s forwards;
	}

	/* The same duration and easing as the line_reveal heading animation. */
	body:not(.elementor-editor-active) .biggym-separator--animated.biggym-separator--revealed .biggym-separator__line {
		animation: biggym-separator-reveal var(--biggym-separator-duration) cubic-bezier(0.16, 1, 0.3, 1) both;
	}
}

@keyframes biggym-separator-failsafe {
	to {
		scale: 1 1;
	}
}

@keyframes biggym-separator-reveal {
	from {
		scale: 0 1;
	}

	to {
		scale: 1 1;
	}
}
