/**
 * fx-animation v2 companion styles.
 *
 * Loaded when Theme Options "Enable Custom Animation" is on, or ?fx-animation-v2.
 * Hidden states belong inside the desktop gate only; mobile stays visible.
 */

@keyframes fx-anim-v2-btn-pulse-shadow {
	0% {
		box-shadow: 0 0 8px 2px rgba(19, 209, 255, 0.55);
	}

	70% {
		box-shadow: 0 0 14px 5px rgba(19, 209, 255, 0.18);
	}

	100% {
		box-shadow: 0 0 18px 7px rgba(19, 209, 255, 0);
	}
}

@keyframes fx-anim-v2-btn-pulse-shadow-reverse {
	0% {
		box-shadow: 0 0 14px 5px rgba(19, 209, 255, 0.18);
	}

	70% {
		box-shadow: 0 0 10px 3px rgba(19, 209, 255, 0.6);
	}

	100% {
		box-shadow: 0 0 10px 3px rgba(19, 209, 255, 0.6);
	}
}

.fx-animation-custom-v2 {
	/* Reviews: active pagination pill gets a cyan glow. */
	#testimonials .stk-block-carousel__dot--active::before,
	.cbiz-section-case-studies .stk-block-carousel__dot--active::before {
		box-shadow: 0 0 6px 1px rgba(19, 209, 255, 1),
			0 0 14px 4px rgba(19, 209, 255, 0.7),
			0 0 28px 8px rgba(19, 209, 255, 0.35) !important;
	}

	/*
	 * Dotted-wave canvas bg: add .fx-anim-v2-dotted-wave-bg to any section.
	 * .cbiz-section-slim-cta stays supported as a legacy alias.
	 */
	.fx-anim-v2-dotted-wave-bg.fx-anim-v2-has-canvas,
	.cbiz-section-slim-cta.fx-anim-v2-has-canvas {
		background-image: none !important;
		isolation: isolate;
		overflow: hidden;
		position: relative;

		&:before {
			opacity: 0.6 !important;
		}

		.fx-anim-v2-dotted-wave-canvas {
			display: block;
			height: 100%;
			inset: 0;
			pointer-events: none;
			position: absolute;
			width: 100%;
			z-index: 1;
		}
	}

	.stk-block-button--style-cbiz-primary-solid-green .stk-button,
	.stk-a6491a8 .stk-button,
	.tab-section__button,
	.feature-banner__button,
	.image-cards__button {
		box-shadow: 0 0 8px 2px rgba(19, 209, 255, 0.4);
		animation: fx-anim-v2-btn-pulse-shadow 2.4s ease-out infinite alternate;
		transition: box-shadow 0.25s ease-in-out;

		&:hover {
			animation: fx-anim-v2-btn-pulse-shadow-reverse 0.8s ease-out forwards;
		}
	}

	/* Sticky masthead: keep a static soft glow so the pulse does not read as broken. */
	.header-primary .stk-block-button--style-cbiz-primary-solid-green .stk-button,
	.header-primary .stk-a6491a8 .stk-button {
		animation: none;
		box-shadow: 0 0 10px 2px rgba(19, 209, 255, 0.45);
	}

	/* Outlined white: frosted fill + CodePen btn-4 shine on hover. */
	.stk-block-button--style-cbiz-button-outlined-white .stk-button {
		overflow: hidden;
		position: relative;
		transition: background-color 0.35s ease;

		/* Repurpose Stackable hover overlay as the diagonal shine bar. */
		&:after {
			background: #fff !important;
			border-radius: 0;
			content: "";
			height: 155px;
			inset: auto;
			left: -75px;
			opacity: 0.25 !important;
			position: absolute;
			top: -50px;
			transform: rotate(35deg);
			transition: left 550ms cubic-bezier(0.19, 1, 0.22, 1),
				opacity 550ms cubic-bezier(0.19, 1, 0.22, 1);
			width: 50px;
			z-index: 1;
		}

		&:hover,
		&:focus-visible {
			background-color: rgba(255, 255, 255, 0.2) !important;
			filter: none;

			&:after {
				left: 120%;
				opacity: 0.35 !important;
			}

			.stk-button__inner-text {
				color: #fff !important;
			}

			.stk--inner-svg svg:last-child,
			.stk--inner-svg svg:last-child :is(g, path, rect, polygon, ellipse) {
				fill: #fff !important;
			}
		}
	}

	.stk-4bf9b54 .stk-button {
		overflow: hidden;
		position: relative;
		transition: background-color 0.35s ease;

		&:hover,
		&:focus-visible {
			background-color: rgba(255, 255, 255, 0.2) !important;
			
			&:after {
				left: 120%;
				opacity: 0.35 !important;
			}

			.stk-button__inner-text {
				color: #fff !important;
			}

			.stk--inner-svg svg:last-child,
			.stk--inner-svg svg:last-child :is(g, path, rect, polygon, ellipse) {
				fill: #fff !important;
			}
		}

		&:after {
			background: #fff !important;
			border-radius: 0;
			content: "";
			height: 155px;
			inset: auto;
			left: -75px;
			opacity: 0.25 !important;
			position: absolute;
			top: -50px;
			transform: rotate(35deg);
			transition: left 550ms cubic-bezier(0.19, 1, 0.22, 1),
				opacity 550ms cubic-bezier(0.19, 1, 0.22, 1);
			width: 50px;
			z-index: 1;
		}
	}

	.stk-block-posts__item,
	.stk-block-posts__item .stk-container,
	.cbiz-section-articles .cbiz-post-cards {
		overflow: initial !important;
	}

	/* Case studies: restrained lift + cyan wash on hover. */
	.cbiz-section-case-studies .stk-block-card.is-done-animating {
		transition: transform 0.35s ease, box-shadow 0.35s ease !important;
	}

	.cbiz-section-case-studies .stk-block-card.is-done-animating:hover {
		transform: translateY(-6px) !important;
		box-shadow: 0 16px 40px rgba(0, 18, 66, 0.22),
			0 0 28px rgba(19, 209, 255, 0.28) !important;
	}

	/* Reviews: soft depth on hover after flip-in. */
	#testimonials .wp-block-stackable-testimonial.is-done-animating {
		transition: transform 0.35s ease, box-shadow 0.35s ease;
	}

	#testimonials .wp-block-stackable-testimonial.is-done-animating:hover {
		transform: translateY(-4px);
		box-shadow: 0 0 28px rgba(19, 209, 255, 0.22);
	}

	/* Article bottom bar: cyan glow when the bar expands. */
	.stk-block-posts.cbiz-post-cards article:hover:after {
		box-shadow: 0 0 10px 2px rgba(19, 209, 255, 0.7),
			0 0 22px 4px rgba(19, 209, 255, 0.35) !important;
	}

	/* 50/50 media: clip scale reveals inside the image frame. */
	.cbiz-section-contained-50-50-img-left-dark .wp-block-stackable-image,
	.cbiz-section-contained-50-50-img-right-light .wp-block-stackable-image {
		overflow: hidden;
		border-radius: inherit;
	}
}

/* Desktop-only initial states (pair with gsap.set / body.site-animation--desktop). */
@media (min-width: 1200px) {
	/* Example:
	body.site-animation--desktop .fx-anim-v2-hero-line {
		opacity: 0;
		transform: translate3d(0, 24px, 0);
	}
	*/

	.cbiz-section-hero-home .stk-container > .stk-block-content > *,
	.cbiz-section-cards-horizontal-dark > .stk-inner-blocks > .stk-block-column:first-child .stk-container > .stk-block-content > *,
	.cbiz-section-contained-50-50-img-left-dark > .stk-inner-blocks > .stk-block-column .stk-container > .stk-block-content > *:not(.stk-block-image),
	.cbiz-section-contained-50-50-img-right-light > .stk-inner-blocks > .stk-block-column .stk-container > .stk-block-content > *:not(.stk-block-image),
	#testimonials .stk-row > .wp-block-stackable-column:first-child > .stk-block-column__content > .stk-block-content > *:not(.stk-block-image),
	.cbiz-section-case-studies > .stk-inner-blocks > .stk-block-column:first-child > .stk-container > .stk-block-content > *:not(.stk-block-image),
	.cbiz-section-articles > .stk-inner-blocks > .stk-block-column:first-child > .stk-container > .stk-block-content > *:not(.stk-block-image),
	.cbiz-section-slim-cta > .stk-inner-blocks > .stk-block-column:first-child > .stk-container > .stk-block-content > *:not(.stk-block-image),
	.tab-section__header > *,
	.feature-banner__card > *,
	.image-cards__intro-wrap > *,
	.image-cards__header > .image-cards__button {
		opacity: 0;
		transform: translateY(50px);
		position: relative;
	}

	.cbiz-section-cards-horizontal-dark > .stk-inner-blocks > .stk-block-column:first-child .stk-container > .stk-block-content > .stk-block-heading--style-cbiz-heading-eyebrow,
	.cbiz-section-contained-50-50-img-left-dark > .stk-inner-blocks > .stk-block-column .stk-container > .stk-block-content > .stk-block-heading--style-cbiz-heading-eyebrow,
	.cbiz-section-contained-50-50-img-right-light > .stk-inner-blocks > .stk-block-column .stk-container > .stk-block-content > .stk-block-heading--style-cbiz-heading-eyebrow,
	#testimonials .stk-row > .wp-block-stackable-column:first-child > .stk-block-column__content > .stk-block-content > .stk-block-heading--style-cbiz-heading-eyebrow,
	.cbiz-section-case-studies > .stk-inner-blocks > .stk-block-column:first-child > .stk-container > .stk-block-content > .stk-block-heading--style-cbiz-heading-eyebrow,
	.cbiz-section-articles > .stk-inner-blocks > .stk-block-column:first-child > .stk-container > .stk-block-content > .stk-block-heading--style-cbiz-heading-eyebrow,
	.cbiz-section-slim-cta > .stk-inner-blocks > .stk-block-column:first-child > .stk-container > .stk-block-content > .stk-block-heading--style-cbiz-heading-eyebrow,
	.tab-section__eyebrow,
	.feature-banner__eyebrow,
	.image-cards__eyebrow {
		transform: translate(-20px, 0);
	}

	/* Flexible content: tab list slides in from the left. */
	.tab-section__tab {
		opacity: 0;
		transform: translateX(-24px);
	}

	.tab-section__stage {
		opacity: 0;
		transform: translateY(28px) scale(0.98);
	}

	/* Flexible content: feature banner media frame. */
	.feature-banner__frame {
		opacity: 0;
		transform: scale(1.04);
		transform-origin: center center;
	}

	/* Flexible content: image cards (exclude Slick clones). */
	.image-cards__slide:not(.slick-cloned) .image-cards__card {
		opacity: 0;
		transform: translateY(40px) scale(0.97);
	}

	.wp-block-stackable-columns .wp-block-stackable-image.has-text-align-right {
		position: relative;
		transform: translateX(-40px) scale(1.06);
		opacity: 0;
	}

	.wp-block-stackable-columns .wp-block-stackable-image.has-text-align-left {
		position: relative;
		transform: translateX(40px) scale(1.06);
		opacity: 0;
	}

	.wp-block-stackable-columns.cbiz-same-surface-ahead .wp-block-stackable-image.has-text-align-right,
	.wp-block-stackable-columns.cbiz-same-surface-ahead .wp-block-stackable-image.has-text-align-left {
		opacity: 1;
		transform: none;
	}

	.cbiz-section-cards-horizontal-dark > .stk-inner-blocks > .stk-block-column:last-child .stk-container .stk-row > .stk-block-column {
		transform: translateY(36px) scale(0.96);
		opacity: 0;
		transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
	}

	/* Partner / awards logo bands. */
	.cbiz-section-partner-logos,
	.cbiz-section-awards-logos {
		opacity: 0;
		transform: translateY(24px);
	}

	/* Case study cards (exclude Flickity clones). */
	.cbiz-section-case-studies .stk-block-carousel__slider > .stk-block-column:not([class*="stk-slide-clone"]) .stk-block-card {
		opacity: 0;
		transform: translateY(40px) scale(0.97);
	}

	/* Article cards -- initial (beats hover-ready transform below). */
	.fx-animation-custom-v2 .stk-block-posts.cbiz-post-cards article {
		opacity: 0;
		transform: translateY(36px);
	}

	/* Reviews: cards flip inward (left / right) on scroll reveal. */
	#testimonials .stk-block-carousel__slider {
		perspective: 1400px;
	}

	#testimonials .stk-block-carousel__slider > .stk-block-column .wp-block-stackable-testimonial {
		opacity: 0;
		transform: rotateY(-52deg);
		transform-origin: center center;
		transform-style: preserve-3d;
		backface-visibility: hidden;
	}

	#testimonials .stk-block-carousel__slider > .stk-block-column:nth-child(even) .wp-block-stackable-testimonial {
		transform: rotateY(52deg);
	}

	/* Hero video centering is Stackable's translate(-50%,-50%).
	   Do not override transform here -- parallax keeps xPercent/yPercent in JS. */

	.cbiz-section-hero-home .stk-container > .stk-block-content > .stk-block-heading--style-cbiz-heading-eyebrow {
		transform: translate(-20px, 0);
	}

	/* Scope to v2 wrapper class (always present with the param). Do not use
	   .cbiz-same-surface-ahead — that is JS-only and often absent on card rows. */
	.fx-animation-custom-v2 .stk-block-column--style-cbiz-card {
		transition: none !important;
	}

	.fx-animation-custom-v2 .stk-block-column--style-cbiz-card.is-done-animating {
		position: relative;
		transform: translate(0) scale(1);
		overflow: hidden;
		box-shadow: 0 0 0 0 rgba(19, 209, 255, 0.5) !important;
		transition: transform 0.3s ease-in-out, box-shadow 0.3s ease-in-out !important;
	}

	/* Beat Stackable global: .stk-block-column--style-cbiz-card:before { background:#fff !important } */
	.fx-animation-custom-v2 .stk-block-column--style-cbiz-card:before,
	.fx-animation-custom-v2 .stk-block-posts.cbiz-post-cards article:after {
		content: "" !important;
		display: block !important;
		position: absolute;
		top: 0;
		left: 0;
		width: 100%;
		height: 8px;
		background: linear-gradient(45deg, #00984D 0%, #13D1FF 100%) !important;
		transform: scaleX(0);
		transform-origin: right;
		transition: transform 0.3s ease-in-out !important;
		z-index: 1;
	}

	.fx-animation-custom-v2 .stk-block-posts.cbiz-post-cards article:after {
		bottom: 0;
		top: auto;
	}

	.fx-animation-custom-v2 .stk-block-posts.cbiz-post-cards article {
		position: relative;
		overflow: hidden;
		box-shadow: 0 0 0 0 rgba(19, 209, 255, 0.5) !important;
		transition: box-shadow 0.3s ease-in-out !important;
	}

	.fx-animation-custom-v2 .stk-block-posts.cbiz-post-cards article.is-done-animating {
		transition: transform 0.3s ease-in-out, box-shadow 0.3s ease-in-out !important;
	}

	.fx-animation-custom-v2 .stk-block-column--style-cbiz-card.is-done-animating:hover,
	.fx-animation-custom-v2 .stk-block-posts.cbiz-post-cards article.is-done-animating:hover {
		transform: scale(1.005) translate(-6px,-6px) !important;
		box-shadow: 0 0 30px 0 rgba(19, 209, 255, 0.5) !important;
	}

	.fx-animation-custom-v2 .stk-block-column--style-cbiz-card.is-done-animating:hover {
		&:before {
			transform: scaleX(1);
			transform-origin: left;
		}
	}

	.fx-animation-custom-v2 .stk-block-posts.cbiz-post-cards article:hover {
		&:after {
			transform: scaleX(1);
			transform-origin: left;
		}
	}

	/* Flexible content image cards: cyan lift after reveal. */
	.fx-animation-custom-v2 .image-cards__track {
		margin-block: -40px;
	}

	.fx-animation-custom-v2 .image-cards__slide {
		padding: 50px 20px;
	}

	.fx-animation-custom-v2 .image-cards__card.is-done-animating {
		transition: transform 0.35s ease, box-shadow 0.35s ease !important;
	}

	.fx-animation-custom-v2 .image-cards__card.is-done-animating:hover {
		transform: translateY(-6px) !important;
		box-shadow: 0 16px 20px rgba(0, 18, 66, 0.22),
			0 0 18px rgba(19, 209, 255, 0.28) !important;
	}
}

/* Mobile + reduced-motion: always visible. */
@media (max-width: 1199px), (prefers-reduced-motion: reduce) {
	#testimonials .stk-block-carousel__slider > .stk-block-column .wp-block-stackable-testimonial,
	.cbiz-section-partner-logos,
	.cbiz-section-awards-logos,
	.cbiz-section-case-studies .stk-block-carousel__slider > .stk-block-column .stk-block-card,
	.cbiz-section-articles .cbiz-post-cards article,
	.tab-section__header > *,
	.tab-section__tab,
	.tab-section__stage,
	.feature-banner__frame,
	.feature-banner__card > *,
	.image-cards__intro-wrap > *,
	.image-cards__header > .image-cards__button,
	.image-cards__slide .image-cards__card {
		opacity: 1 !important;
		transform: none !important;
	}
}

@media (prefers-reduced-motion: reduce) {
	.fx-animation-custom-v2 {
		.stk-block-button--style-cbiz-primary-solid-green .stk-button,
		.tab-section__button,
		.feature-banner__button,
		.image-cards__button {
			animation: none;
			box-shadow: 0 0 10px 2px rgba(19, 209, 255, 0.4);
		}

		.stk-block-button--style-cbiz-button-outlined-white .stk-button {
			&:after {
				display: none;
			}

			&:hover,
			&:focus-visible {
				background-color: rgba(255, 255, 255, 0.2) !important;
			}
		}
	}
}
