/**
 * AquaGib homepage motion effects.
 *
 * Each effect is scoped to its independently controlled body class. Essential
 * content remains visible until JavaScript has successfully initialised.
 */

/* The plugin becomes the source of homepage entrance motion while active. */
body.ag-motion-managed .reveal {
	opacity: 1;
	transform: none;
	transition-delay: 0ms;
}

body.ag-motion-managed .home-hero__inner.reveal,
body.ag-motion-managed .service-status.reveal,
body.ag-motion-managed .applications-panel.reveal,
body.ag-motion-managed .contact-column.reveal {
	transition: none;
}

body.ag-motion-managed .quick-card.reveal {
	transition: border-color 200ms ease, box-shadow 200ms ease, transform 200ms ease;
}

body.ag-motion-managed .home-hero::before {
	animation: none;
	transform: scale(1.035);
}

/* 1. Cinematic hero reveal. */
body.ag-motion-hero-cinematic .home-hero::before {
	animation: ag-motion-hero-camera 1.45s cubic-bezier(0.2, 0.75, 0.2, 1) both;
}

body.ag-motion-hero-cinematic .home-hero::after {
	animation: ag-motion-hero-light 1.45s 180ms ease-out both;
	background-image:
		linear-gradient(112deg, transparent 28%, transparent 42%, rgba(255, 255, 255, 0.17) 49%, transparent 57%, transparent 100%),
		linear-gradient(180deg, rgba(13, 53, 85, 0.9) 0%, rgba(13, 53, 85, 0.72) 100%);
	background-position: 115% 0, 0 0;
	background-size: 240% 100%, 100% 100%;
}

body.ag-motion-hero-cinematic .home-hero h1 {
	animation: ag-motion-copy-rise 820ms 180ms cubic-bezier(0.2, 0.78, 0.2, 1) both;
}

body.ag-motion-hero-cinematic .home-hero p {
	animation: ag-motion-copy-rise 820ms 300ms cubic-bezier(0.2, 0.78, 0.2, 1) both;
}

/* 2. Quick-action cards surfacing from the hero. */
body.ag-motion-quick-cards .quick-card {
	animation: ag-motion-card-surface 680ms cubic-bezier(0.16, 0.78, 0.22, 1) backwards;
}

body.ag-motion-quick-cards .quick-card:nth-child(1) {
	animation-delay: 420ms;
}

body.ag-motion-quick-cards .quick-card:nth-child(2) {
	animation-delay: 490ms;
}

body.ag-motion-quick-cards .quick-card:nth-child(3) {
	animation-delay: 560ms;
}

body.ag-motion-quick-cards .quick-card:nth-child(4) {
	animation-delay: 630ms;
}

body.ag-motion-quick-cards .quick-card--priority::after {
	animation: ag-motion-priority-glint 800ms 1.25s ease-out both;
	background: linear-gradient(110deg, transparent 20%, rgba(255, 255, 255, 0.22) 48%, transparent 72%);
	content: "";
	inset: 0;
	pointer-events: none;
	position: absolute;
	transform: translateX(-130%);
}

body.ag-motion-quick-cards .quick-card--priority {
	overflow: hidden;
}

/* 3. Bespoke icon micro-animations. */
body.ag-motion-icon-details .quick-card__icon {
	transform-origin: center;
}

body.ag-motion-icon-details .quick-card:nth-child(1):focus-visible .quick-card__icon,
body.ag-motion-icon-details .quick-card:nth-child(1):hover .quick-card__icon {
	animation: ag-motion-icon-application 360ms ease-out;
}

body.ag-motion-icon-details .quick-card:nth-child(2):focus-visible .quick-card__icon,
body.ag-motion-icon-details .quick-card:nth-child(2):hover .quick-card__icon {
	animation: ag-motion-icon-bill 340ms ease-out;
}

body.ag-motion-icon-details .quick-card:nth-child(3):focus-visible .quick-card__icon,
body.ag-motion-icon-details .quick-card:nth-child(3):hover .quick-card__icon {
	animation: ag-motion-icon-meter 420ms ease-out;
}

body.ag-motion-icon-details .quick-card:nth-child(4):focus-visible .quick-card__icon,
body.ag-motion-icon-details .quick-card:nth-child(4):hover .quick-card__icon {
	animation: ag-motion-icon-fault 420ms ease-out;
}

/* 4. One-time service-status ripple. */
body.ag-motion-status-ripple .service-status__dot {
	position: relative;
}

body.ag-motion-status-ripple .service-status__dot::after {
	border: 2px solid rgba(46, 158, 91, 0.42);
	border-radius: 50%;
	content: "";
	inset: -2px;
	opacity: 0;
	pointer-events: none;
	position: absolute;
}

body.ag-motion-status-ripple .service-status.ag-motion-in-view .service-status__dot::after {
	animation: ag-motion-status-ring 900ms 180ms ease-out both;
}

/* 5. Water-refraction card interaction. */
body.ag-motion-card-refraction .quick-card {
	overflow: hidden;
	transition: border-color 260ms ease, box-shadow 260ms ease, transform 260ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

body.ag-motion-card-refraction .quick-card::before {
	background: linear-gradient(108deg, transparent 30%, rgba(14, 107, 168, 0.07) 45%, rgba(255, 255, 255, 0.5) 52%, transparent 68%);
	content: "";
	inset: -30% -65%;
	pointer-events: none;
	position: absolute;
	transform: translateX(-58%) rotate(-3deg);
	transition: transform 680ms cubic-bezier(0.2, 0.75, 0.2, 1);
}

body.ag-motion-card-refraction .quick-card--priority::before {
	background: linear-gradient(108deg, transparent 30%, rgba(255, 255, 255, 0.03) 44%, rgba(255, 255, 255, 0.2) 52%, transparent 68%);
}

body.ag-motion-card-refraction .quick-card:focus-visible,
body.ag-motion-card-refraction .quick-card:hover {
	transform: translateY(-4px);
}

body.ag-motion-card-refraction .quick-card:focus-visible::before,
body.ag-motion-card-refraction .quick-card:hover::before {
	transform: translateX(58%) rotate(-3deg);
}

body.ag-motion-card-refraction .quick-card__icon {
	transition: transform 260ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

body.ag-motion-card-refraction .quick-card:focus-visible .quick-card__icon,
body.ag-motion-card-refraction .quick-card:hover .quick-card__icon {
	transform: translate3d(1px, -2px, 0);
}

/* 6. Applications flow line. */
body.ag-motion-applications-flow .task-list {
	padding-left: 16px;
	position: relative;
}

body.ag-motion-applications-flow .task-list::before {
	background: linear-gradient(180deg, var(--aquagib-blue), rgba(14, 107, 168, 0.22));
	border-radius: 2px;
	content: "";
	left: 0;
	position: absolute;
	top: 4px;
	transform-origin: top;
	width: 2px;
}

html.ag-motion-enhanced body.ag-motion-applications-flow .task-list::before {
	bottom: 4px;
	transform: scaleY(0);
}

html.ag-motion-enhanced body.ag-motion-applications-flow .applications-panel.ag-motion-in-view .task-list::before {
	animation: ag-motion-flow-line 740ms ease-out both;
}

html.ag-motion-enhanced body.ag-motion-applications-flow .task-list li {
	opacity: 0;
	transform: translateX(-8px);
}

html.ag-motion-enhanced body.ag-motion-applications-flow .applications-panel.ag-motion-in-view .task-list li {
	animation: ag-motion-task-arrive 480ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

html.ag-motion-enhanced body.ag-motion-applications-flow .applications-panel.ag-motion-in-view .task-list li:nth-child(1) {
	animation-delay: 180ms;
}

html.ag-motion-enhanced body.ag-motion-applications-flow .applications-panel.ag-motion-in-view .task-list li:nth-child(2) {
	animation-delay: 250ms;
}

html.ag-motion-enhanced body.ag-motion-applications-flow .applications-panel.ag-motion-in-view .task-list li:nth-child(3) {
	animation-delay: 320ms;
}

html.ag-motion-enhanced body.ag-motion-applications-flow .applications-panel.ag-motion-in-view .task-list li:nth-child(4) {
	animation-delay: 390ms;
}

body.ag-motion-applications-flow .task-card {
	position: relative;
}

body.ag-motion-applications-flow .task-card::before {
	background: var(--aquagib-green);
	border-radius: 2px;
	content: "";
	height: calc(100% - 20px);
	left: -17px;
	opacity: 0;
	position: absolute;
	top: 10px;
	transform: scaleY(0.35);
	transition: opacity 180ms ease, transform 180ms ease;
	width: 2px;
}

body.ag-motion-applications-flow .task-card:focus-visible::before,
body.ag-motion-applications-flow .task-card:hover::before {
	opacity: 1;
	transform: scaleY(1);
}

/* 7. Curved contact photograph reveal and desktop pointer parallax. */
body.ag-motion-contact-reveal .contact-visual {
	--ag-contact-x: 0px;
	--ag-contact-y: 0px;
}

html.ag-motion-enhanced body.ag-motion-contact-reveal .contact-visual {
	clip-path: inset(48% 48% 48% 48% round 50%);
	opacity: 0.3;
}

html.ag-motion-enhanced body.ag-motion-contact-reveal .contact-visual.ag-motion-in-view {
	animation: ag-motion-contact-open 880ms cubic-bezier(0.16, 0.8, 0.2, 1) both;
}

body.ag-motion-contact-reveal .contact-visual img,
body.ag-motion-contact-reveal .contact-visual:hover img {
	transform: scale(1.025) translate3d(var(--ag-contact-x), var(--ag-contact-y), 0);
	transition: transform 260ms ease-out;
}

/* 8. Header transformation on scroll. */
body.ag-motion-header-transform .site-header {
	background: rgba(13, 53, 85, 0);
	position: fixed;
	transition: background-color 260ms ease, box-shadow 260ms ease;
}

body.ag-motion-header-transform .site-header::after {
	background: linear-gradient(90deg, transparent, var(--aquagib-blue), transparent);
	bottom: 0;
	content: "";
	height: 2px;
	left: 0;
	pointer-events: none;
	position: absolute;
	transform: scaleX(0);
	width: 100%;
}

body.ag-motion-header-transform .site-header__inner,
body.ag-motion-header-transform .site-logo {
	transition: height 260ms ease, transform 260ms ease;
}

body.ag-motion-header-transform.ag-motion-header-scrolled .site-header {
	background: rgba(13, 53, 85, 0.98);
	box-shadow: 0 8px 24px rgba(13, 53, 85, 0.14);
}

body.ag-motion-header-transform.ag-motion-header-scrolled .site-header::after {
	animation: ag-motion-header-line 600ms ease-out both;
}

body.ag-motion-header-transform.ag-motion-header-scrolled .site-header__inner {
	height: 76px;
}

body.ag-motion-header-transform.ag-motion-header-scrolled .site-logo {
	transform: scale(0.88);
	transform-origin: left center;
}

/* 9. Site search control entrance. */
body.ag-motion-chat-entrance .aquagib-search-launcher {
	animation: ag-motion-chat-arrive 620ms 1.25s cubic-bezier(0.16, 0.8, 0.2, 1) both;
}

body.ag-motion-chat-entrance .aquagib-search-launcher::after {
	animation: ag-motion-chat-ring 850ms 1.68s ease-out both;
	border: 2px solid rgba(14, 107, 168, 0.28);
	border-radius: 50%;
	content: "";
	inset: 0;
	opacity: 0;
	pointer-events: none;
	position: absolute;
}

/* 10. Real water footer with a no-script and reduced-motion fallback. */
body.ag-motion-footer-transition .site-footer {
	isolation: isolate;
	margin-top: 100px;
	position: relative;
}

body.ag-motion-footer-transition .site-footer::before {
	background:
		linear-gradient(180deg, rgba(13, 53, 85, 0.04), rgba(13, 53, 85, 0.28) 56%, var(--aquagib-navy) 100%),
		url("../media/water-footer.webp") center 48% / cover no-repeat;
	content: "";
	height: 104px;
	left: 0;
	pointer-events: none;
	position: absolute;
	top: -100px;
	width: 100%;
	z-index: 0;
}

body.ag-motion-footer-transition .site-footer__inner {
	position: relative;
	z-index: 2;
}

.ag-water-footer {
	background: url("../media/water-footer.webp") center 48% / cover no-repeat;
	contain: strict;
	height: 110px;
	left: 0;
	overflow: hidden;
	pointer-events: none;
	position: absolute;
	right: 0;
	top: -104px;
	z-index: 1;
}

.ag-water-footer::after {
	background: linear-gradient(180deg, rgba(13, 53, 85, 0.02), rgba(13, 53, 85, 0.3) 58%, var(--aquagib-navy) 100%);
	content: "";
	inset: 0;
	pointer-events: none;
	position: absolute;
	z-index: 2;
}

.ag-water-footer__video {
	height: 1px;
	left: 0;
	opacity: 0;
	position: absolute;
	top: 0;
	width: 1px;
}

.ag-water-footer--direct .ag-water-footer__video {
	display: block;
	height: calc(100% + 18px);
	left: -2%;
	max-width: none;
	object-fit: cover;
	opacity: 1;
	position: absolute;
	top: -9px;
	width: 104%;
	z-index: 1;
}

.ag-water-footer__canvas {
	display: block;
	height: 100%;
	left: 0;
	position: absolute;
	top: 0;
	width: 100%;
	z-index: 1;
}

.ag-water-footer--canvas::after {
	display: none;
}

body.ag-water-canvas-ready .site-footer::before {
	background: var(--aquagib-navy);
	height: 8px;
	top: -4px;
}

body.ag-water-canvas-ready .ag-water-footer {
	background: transparent;
}

@keyframes ag-motion-hero-camera {
	from {
		filter: saturate(0.88);
		transform: scale(1.085) translate3d(0, 1%, 0);
	}

	to {
		filter: saturate(1);
		transform: scale(1.035) translate3d(0, 0, 0);
	}
}

@keyframes ag-motion-hero-light {
	from {
		background-position: 115% 0, 0 0;
	}

	to {
		background-position: -105% 0, 0 0;
	}
}

@keyframes ag-motion-copy-rise {
	from {
		filter: blur(5px);
		opacity: 0;
		transform: translateY(15px);
	}

	to {
		filter: blur(0);
		opacity: 1;
		transform: translateY(0);
	}
}

@keyframes ag-motion-card-surface {
	from {
		opacity: 0;
		transform: translateY(18px);
	}

	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@keyframes ag-motion-priority-glint {
	from {
		transform: translateX(-130%);
	}

	to {
		transform: translateX(130%);
	}
}

@keyframes ag-motion-icon-application {
	0%,
	100% {
		transform: translateY(0) rotate(0);
	}

	45% {
		transform: translateY(-3px) rotate(-2deg);
	}
}

@keyframes ag-motion-icon-bill {
	0%,
	100% {
		transform: translateY(0);
	}

	50% {
		transform: translateY(-4px);
	}
}

@keyframes ag-motion-icon-meter {
	0%,
	100% {
		transform: rotate(0);
	}

	35% {
		transform: rotate(3deg);
	}

	68% {
		transform: rotate(-2deg);
	}
}

@keyframes ag-motion-icon-fault {
	0%,
	100% {
		filter: brightness(1);
		transform: scale(1);
	}

	45% {
		filter: brightness(1.14);
		transform: scale(1.1);
	}
}

@keyframes ag-motion-status-ring {
	0% {
		opacity: 0;
		transform: scale(0.7);
	}

	24% {
		opacity: 1;
	}

	100% {
		opacity: 0;
		transform: scale(2.7);
	}
}

@keyframes ag-motion-flow-line {
	from {
		transform: scaleY(0);
	}

	to {
		transform: scaleY(1);
	}
}

@keyframes ag-motion-task-arrive {
	from {
		opacity: 0;
		transform: translateX(-8px);
	}

	to {
		opacity: 1;
		transform: translateX(0);
	}
}

@keyframes ag-motion-contact-open {
	from {
		clip-path: inset(48% 48% 48% 48% round 50%);
		opacity: 0.3;
	}

	to {
		clip-path: inset(0 0 0 0 round var(--aquagib-radius-large));
		opacity: 1;
	}
}

@keyframes ag-motion-header-line {
	0% {
		opacity: 0;
		transform: scaleX(0);
	}

	45% {
		opacity: 1;
	}

	100% {
		opacity: 0;
		transform: scaleX(1);
	}
}

@keyframes ag-motion-chat-arrive {
	from {
		opacity: 0;
		transform: translateY(14px) scale(0.94);
	}

	to {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

@keyframes ag-motion-chat-ring {
	0% {
		opacity: 0;
		transform: scale(0.85);
	}

	28% {
		opacity: 1;
	}

	100% {
		opacity: 0;
		transform: scale(1.55);
	}
}

@media (max-width: 760px) {
	body.ag-motion-quick-cards .quick-card {
		animation-duration: 520ms;
	}

	body.ag-motion-quick-cards .quick-card:nth-child(1) {
		animation-delay: 240ms;
	}

	body.ag-motion-quick-cards .quick-card:nth-child(2) {
		animation-delay: 300ms;
	}

	body.ag-motion-quick-cards .quick-card:nth-child(3) {
		animation-delay: 360ms;
	}

	body.ag-motion-quick-cards .quick-card:nth-child(4) {
		animation-delay: 420ms;
	}

	body.ag-motion-applications-flow .task-list {
		padding-left: 12px;
	}

	body.ag-motion-applications-flow .task-card::before {
		left: -13px;
	}

	body.ag-motion-header-transform.ag-motion-header-scrolled:not(.menu-open) .site-header__inner {
		height: 70px;
	}

	body.ag-motion-header-transform.ag-motion-header-scrolled:not(.menu-open) .primary-navigation {
		max-height: calc(100vh - 70px);
		top: 70px;
	}

	body.ag-motion-header-transform.menu-open .site-header__inner {
		height: 82px;
	}

	body.ag-motion-header-transform.menu-open .site-logo {
		transform: none;
	}

	body.ag-motion-header-transform.menu-open .primary-navigation {
		max-height: calc(100vh - 82px);
		top: 82px;
	}

	body.ag-motion-footer-transition .site-footer {
		margin-top: 76px;
	}

	body.ag-motion-footer-transition .site-footer::before {
		height: 80px;
		top: -76px;
	}

	body.ag-water-canvas-ready .site-footer::before {
		height: 8px;
		top: -4px;
	}

	.ag-water-footer {
		height: 86px;
		top: -80px;
	}
}

@media (hover: none), (pointer: coarse) {
	body.ag-motion-contact-reveal .contact-visual img,
	body.ag-motion-contact-reveal .contact-visual:hover img {
		transform: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	body.ag-motion-managed .home-hero::before,
	body.ag-motion-managed .home-hero::after,
	body.ag-motion-managed .home-hero h1,
	body.ag-motion-managed .home-hero p,
	body.ag-motion-managed .quick-card,
	body.ag-motion-managed .quick-card__icon,
	body.ag-motion-managed .task-list::before,
	body.ag-motion-managed .task-list li,
	body.ag-motion-managed .contact-visual,
	body.ag-motion-managed .aquagib-search-launcher {
		animation: none !important;
		filter: none;
		opacity: 1;
		transform: none;
	}

	body.ag-motion-managed .quick-card::after,
	body.ag-motion-managed .service-status__dot::after,
	body.ag-motion-managed .site-header::after,
	body.ag-motion-managed .aquagib-search-launcher::after,
	body.ag-motion-managed .site-footer::after {
		animation: none !important;
		opacity: 0;
	}

	html.ag-motion-enhanced body.ag-motion-contact-reveal .contact-visual {
		clip-path: none;
	}

	body.ag-motion-header-transform .site-header,
	body.ag-motion-header-transform .site-header__inner,
	body.ag-motion-header-transform .site-logo {
		transition: none;
	}

	.ag-water-footer__video {
		display: none;
	}
}
