/* Elementor flex containers default to stretching children full width/height,
   which pins headline content to a corner. Shrink to content width, fill the
   container height, and vertically center the rotator inside. */
.elementor-element.elementor-widget-biobot-rotating-words {
	display: flex !important;
	flex-direction: column;
	justify-content: center;
	width: fit-content !important;
	max-width: 100%;
	height: 100% !important;
	align-self: center !important;
	flex-grow: 0 !important;
	flex-shrink: 0;
	margin-inline: auto;
}

.elementor-widget-biobot-rotating-words > .elementor-widget-container {
	width: fit-content;
	max-width: 100%;
	height: auto;
	flex-grow: 0;
}

.biobot-rotator {
	--brw-active-color: #ffffff;
	--brw-faded-color: #ffffff;
	--brw-static-color: #ffffff;
	font-size: 64px;
	line-height: 1.1;
	font-weight: 500;
	width: fit-content;
	max-width: 100%;
	display: flex;
	flex-direction: column;
	flex-shrink: 0;
	align-items: flex-start;
}

.biobot-rotator--centered {
	align-items: center;
	text-align: center;
}

.biobot-rotator--centered .biobot-rotator__line {
	flex-direction: column;
	align-items: center;
	gap: 0.15em;
	position: relative;
	z-index: 1;
}

.biobot-rotator--centered .biobot-rotator__words {
	margin-bottom: 0.35em;
	z-index: 0;
}

.biobot-rotator__line {
	display: flex;
	align-items: baseline;
	gap: 24px;
	flex-wrap: wrap;
}

/* The rotating column. Height is one line; neighbour words overflow
   above and below. Its width is set in JS to the longest word so the
   blank never resizes and the static text alongside it never bumps. */
.biobot-rotator__words {
	position: relative;
	display: inline-block;
	height: 1.15em;
	min-width: 0.4em;
	flex: 0 0 auto;
	overflow: visible;
	white-space: nowrap;
	font-size: 64px;
	line-height: 1.1;
	font-weight: 500;
	/* Scrubbable: drag up/down or use the mouse wheel over the words. */
	cursor: ns-resize;
	touch-action: none;
}

.biobot-rotator--centered .biobot-rotator__static--before,
.biobot-rotator--centered .biobot-rotator__static--after {
	display: block;
}

.biobot-rotator.is-dragging .biobot-rotator__words {
	cursor: grabbing;
}

/* Snappier transitions while actively scrubbing so it tracks the input. */
.biobot-rotator.is-scrubbing .biobot-rotator__word {
	transition-duration: 0.18s;
}

/* Zero-width anchor that gives the inline-block a real text baseline,
   so the active word lines up with the static text alongside it. */
.biobot-rotator__words::before {
	content: "\200B";
	display: inline;
}

/* The "blank" the words rotate in to fill. Fixed to the column width
   (= longest word), so it stays put as words cycle through. */
.biobot-rotator__words::after {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0.02em;
	height: 2px;
	border-radius: 1px;
	background: var(--brw-active-color);
}

.biobot-rotator__word {
	position: absolute;
	top: 0;
	left: 0;
	white-space: nowrap;
	color: var(--brw-faded-color);
	opacity: 0;
	transform-origin: left center;
	transform: translateY(0) scale(1);
	filter: blur(0);
	will-change: transform, opacity, filter;
	transition:
		transform 0.6s cubic-bezier(0.22, 0.61, 0.36, 1),
		opacity 0.6s ease,
		filter 0.6s ease,
		color 0.6s ease;
	pointer-events: none;
}

.biobot-rotator--centered .biobot-rotator__word {
	left: 50%;
	transform-origin: center center;
}

/* Inline layout: center each word in the underline blank when headline is centered. */
.biobot-rotator.is-headline-centered .biobot-rotator__word {
	left: 50%;
	transform-origin: center center;
}

.biobot-rotator__word.is-active {
	color: var(--brw-active-color);
	opacity: 1;
	filter: blur(0);
}

.biobot-rotator__static {
	color: var(--brw-static-color);
}

.biobot-rotator__subtitle {
	margin: 1.4em 0 0;
	font-size: 18px;
	line-height: 1.35;
	font-weight: 400;
	width: 100%;
	max-width: 100%;
	color: #ffffff;
	/* Honour line breaks typed into the subtitle field. */
	white-space: pre-line;
}

.biobot-rotator__subtitle:empty {
	display: none;
	margin: 0;
}

/* Before JS boots, show only the first word so there is no flash of a
   stacked column of plain text. */
.biobot-rotator:not(.is-ready) .biobot-rotator__word {
	opacity: 0;
}

.biobot-rotator:not(.is-ready) .biobot-rotator__word.is-active {
	opacity: 1;
	position: relative;
}

/* Headline alignment — responsive classes on the Elementor widget wrapper */
.elementor-widget-biobot-rotating-words[class*="brw-headline-align-left"] .biobot-rotator {
	align-items: flex-start;
	text-align: left;
}

.elementor-widget-biobot-rotating-words[class*="brw-headline-align-left"] .biobot-rotator__line {
	justify-content: flex-start;
}

.elementor-widget-biobot-rotating-words[class*="brw-headline-align-center"] .biobot-rotator {
	align-items: center;
	text-align: center;
}

.elementor-widget-biobot-rotating-words[class*="brw-headline-align-center"] .biobot-rotator__line {
	justify-content: center;
}

.elementor-widget-biobot-rotating-words[class*="brw-headline-align-right"] .biobot-rotator {
	align-items: flex-end;
	text-align: right;
}

.elementor-widget-biobot-rotating-words[class*="brw-headline-align-right"] .biobot-rotator__line {
	justify-content: flex-end;
}

/* Respect reduced-motion: drop the animated transitions. */
@media (prefers-reduced-motion: reduce) {
	.biobot-rotator__word {
		transition: opacity 0.3s ease;
	}
}

@media (max-width: 767px) {
	.biobot-rotator__line {
		gap: 12px;
	}

	.elementor-widget-biobot-rotating-words[class*="brw-headline-align-center"] .biobot-rotator,
	.elementor-widget-biobot-rotating-words[class*="brw-headline-align-right"] .biobot-rotator {
		width: 100%;
	}
}
