/* Front-end only: hero slideshow, floating WhatsApp button, service ticker and all motion.
   Not loaded in the editor, so these blocks stay simple to edit there. */

:root {
	--ae-ease: cubic-bezier(0.22, 0.61, 0.36, 1);
	--ae-shadow: 0 14px 34px color-mix(in srgb, var(--wp--preset--color--contrast) 18%, transparent);
	--ae-slide-time: 6s;
}

/* Hero slideshow */
.ae-hero.wp-block-cover { min-height: min(84vh, 700px); overflow: hidden; padding-bottom: 5rem; position: relative; }
.ae-hero .wp-block-cover__inner-container { position: static; z-index: auto; }
.ae-hero .wp-block-cover__inner-container > .alignwide { position: relative; z-index: 2; }

.wp-block-gallery.ae-hero__slides.has-nested-images {
	display: block;
	inset: 0;
	margin: 0 !important;
	max-width: none !important;
	position: absolute;
	width: 100%;
	z-index: 0;
}
.wp-block-gallery.ae-hero__slides.has-nested-images figure.wp-block-image {
	display: block;
	height: 100%;
	inset: 0;
	margin: 0 !important;
	opacity: 0;
	overflow: hidden;
	position: absolute;
	transition: opacity 1.2s ease;
	width: 100% !important;
}
.wp-block-gallery.ae-hero__slides.has-nested-images figure.wp-block-image:first-child { opacity: 1; }
.ae-hero__slides.is-ready.has-nested-images.wp-block-gallery figure.wp-block-image { opacity: 0; }
.ae-hero__slides.is-ready.has-nested-images.wp-block-gallery figure.wp-block-image.is-active { opacity: 1; }
.wp-block-gallery.ae-hero__slides.has-nested-images figure.wp-block-image img {
	display: block;
	height: 100% !important;
	object-fit: cover;
	width: 100% !important;
}
.ae-hero__slides figure.is-active img { animation: ae-ken-burns calc(var(--ae-slide-time) + 2s) linear both; }
.ae-hero__slides figure:nth-child(even).is-active img { animation-name: ae-ken-burns-alt; }

/* Dark overlay keeps the headline readable over any photo */
.wp-block-gallery.ae-hero__slides.has-nested-images figure.wp-block-image::before { display: none; }
.wp-block-gallery.ae-hero__slides.has-nested-images figure.wp-block-image::after {
	background: linear-gradient(100deg,
		color-mix(in srgb, var(--wp--preset--color--contrast) 88%, transparent) 0%,
		color-mix(in srgb, var(--wp--preset--color--contrast) 66%, transparent) 50%,
		color-mix(in srgb, var(--wp--preset--color--contrast) 30%, transparent) 100%);
	content: "";
	inset: 0;
	position: absolute;
}

/* Slide caption and controls, bottom right */
.wp-block-gallery.ae-hero__slides.has-nested-images figure.wp-block-image figcaption {
	background: none;
	bottom: 3.1rem;
	color: var(--wp--preset--color--base);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 600;
	left: auto;
	letter-spacing: 0.02em;
	margin: 0;
	max-height: none;
	max-width: 60%;
	opacity: 0;
	overflow: visible;
	padding: 0;
	position: absolute;
	right: max(1rem, calc((100% - 1200px) / 2));
	text-align: right;
	transform: translateY(8px);
	transition: opacity 0.5s ease 0.5s, transform 0.5s var(--ae-ease) 0.5s;
	width: auto;
	z-index: 2;
}
.wp-block-gallery.ae-hero__slides.has-nested-images figure.is-active figcaption { opacity: 1; transform: none; }

.ae-hero__controls {
	align-items: center;
	bottom: 1.25rem;
	display: flex;
	gap: 0.5rem;
	position: absolute;
	right: max(1rem, calc((100% - 1200px) / 2));
	z-index: 3;
}
.ae-hero__dot, .ae-hero__pause {
	background: none;
	border: 0;
	color: var(--wp--preset--color--base);
	cursor: pointer;
	padding: 0;
}
.ae-hero__dot { height: 24px; position: relative; width: 44px; }
.ae-hero__dot::before, .ae-hero__dot::after {
	content: "";
	height: 3px;
	left: 0;
	position: absolute;
	top: 50%;
	transform-origin: left center;
	width: 100%;
}
.ae-hero__dot::before { background: var(--wp--preset--color--base); opacity: 0.35; transition: opacity 0.2s ease; }
.ae-hero__dot:hover::before { opacity: 0.7; }
.ae-hero__dot::after { background: var(--wp--preset--color--base); transform: scaleX(0); }
.ae-hero__dot[aria-current="true"]::after { transform: scaleX(1); }
.ae-hero__controls.is-playing .ae-hero__dot[aria-current="true"]::after { animation: ae-progress var(--ae-slide-time) linear both; }
.ae-hero__pause { height: 28px; margin-left: 0.25rem; width: 28px; }
.ae-hero__pause svg { display: block; fill: currentColor; height: 16px; margin: auto; width: 16px; }

/* Hero text entrance */
.ae-hero .ae-label,
.ae-hero h1,
.ae-hero .ae-hero__lead,
.ae-hero .wp-block-buttons { animation: ae-rise 0.8s var(--ae-ease) both; }
.ae-hero h1 { animation-delay: 0.1s; }
.ae-hero .ae-hero__lead { animation-delay: 0.22s; }
.ae-hero .wp-block-buttons { animation-delay: 0.34s; }

/* Service ticker */
.ae-ticker {
	background: var(--wp--preset--color--contrast);
	border-top: 1px solid var(--wp--preset--color--muted);
	margin-top: 0 !important;
	max-width: none !important;
	overflow: hidden;
	padding: 0.9rem 0;
}
.ae-ticker__track { animation: ae-ticker 48s linear infinite; display: flex; width: max-content; }
.ae-ticker:hover .ae-ticker__track, .ae-ticker:focus-within .ae-ticker__track { animation-play-state: paused; }
.ae-ticker__list { display: flex; list-style: none; margin: 0; padding: 0; }
.ae-ticker__list li { align-items: center; display: flex; white-space: nowrap; }
.ae-ticker__list li::after { background: var(--wp--preset--color--muted); content: ""; display: block; height: 4px; margin: 0 1.75rem; transform: rotate(45deg); width: 4px; }
.ae-ticker a { color: var(--wp--preset--color--line); font-size: var(--wp--preset--font-size--small); font-weight: 500; text-decoration: none; transition: color 0.2s ease; }
.ae-ticker a:hover, .ae-ticker a:focus-visible { color: var(--wp--preset--color--base); text-decoration: underline; text-underline-offset: 0.25em; }

/* Header reacts to scrolling */
.ae-header { transition: box-shadow 0.25s ease, padding 0.25s var(--ae-ease); }
.ae-header.is-scrolled { box-shadow: 0 6px 22px color-mix(in srgb, var(--wp--preset--color--contrast) 12%, transparent); padding-bottom: 0.5rem; padding-top: 0.5rem; }

/* Menu links: underline draws in from the left */
.ae-header .wp-block-navigation-item__content { background: linear-gradient(currentColor, currentColor) left bottom / 0 1.5px no-repeat; transition: background-size 0.25s var(--ae-ease); }
.ae-header .wp-block-navigation a:hover { text-decoration: none; }
.ae-header .wp-block-navigation-item__content:hover,
.ae-header .wp-block-navigation-item__content:focus-visible { background-size: 100% 1.5px; }
.ae-header .wp-block-navigation__submenu-container .wp-block-navigation-item__content { background: none; transition: padding 0.2s var(--ae-ease); }
.ae-header .wp-block-navigation__submenu-container .wp-block-navigation-item__content:hover { padding-left: 1.3em; text-decoration: underline; }

/* Buttons */
.wp-block-button__link { transition: background-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease, transform 0.2s var(--ae-ease); }
.wp-block-button__link:hover { box-shadow: 0 8px 20px color-mix(in srgb, var(--wp--preset--color--contrast) 26%, transparent); transform: translateY(-2px); }
.wp-block-button__link:active { transform: translateY(0); }
.is-style-phone .wp-block-button__link:hover::before { animation: ae-ring 0.6s ease; }

/* Cards */
.ae-card, .ae-contact-card { transition: border-color 0.25s ease, box-shadow 0.3s ease, transform 0.3s var(--ae-ease); }
.ae-card:not(.ae-card--cta):hover, .ae-contact-card:hover { border-color: var(--wp--preset--color--muted); box-shadow: var(--ae-shadow); transform: translateY(-5px); }
.ae-card > .wp-block-image img { transition: transform 0.6s var(--ae-ease); }
.ae-card:hover > .wp-block-image img { transform: scale(1.06); }
.ae-card h2 a, .ae-card h3 a { background: linear-gradient(currentColor, currentColor) left bottom / 0 1.5px no-repeat; transition: background-size 0.3s var(--ae-ease); }
.ae-card:hover h2 a, .ae-card:hover h3 a { background-size: 100% 1.5px; text-decoration: none; }
.ae-card p:last-child > a::after { content: " \2192"; display: inline-block; margin-left: 0.15em; transition: transform 0.25s var(--ae-ease); }
.ae-card:hover p:last-child > a::after { transform: translateX(5px); }

/* Service boxes: the whole box is the link, colour returns to the photo, the bottom strip turns dark */
.ae-card--service { transition: border-color 0.25s ease, box-shadow 0.3s ease, transform 0.3s var(--ae-ease); }
.ae-card--service:hover { border-top-color: var(--wp--preset--color--contrast); }
.ae-card--service :is(h2, h3) a::after { content: ""; inset: 0; position: absolute; z-index: 1; }
.ae-card--service > .wp-block-image img { transition: filter 0.4s ease, transform 0.6s var(--ae-ease); }
.ae-card--service:hover > .wp-block-image img { filter: none; }
.ae-card--service > .ae-card__more a { transition: background-color 0.25s ease, color 0.25s ease; }
.ae-card--service:hover > .ae-card__more a { background: var(--wp--preset--color--contrast); color: var(--wp--preset--color--base); }
.ae-card--service > .ae-card__more a::after { margin-left: 0; }

/* Sector columns: the rule sweeps across on hover */
.ae-sector { position: relative; transition: background-color 0.25s ease; }
.ae-sector:hover { background: var(--wp--preset--color--stone); }
.ae-sector::before { background: var(--wp--preset--color--contrast); content: ""; height: 3px; left: 0; position: absolute; top: -3px; transform: scaleX(0.18); transform-origin: left; transition: transform 0.45s var(--ae-ease); width: 100%; }
.ae-sector:hover::before { transform: scaleX(1); }

/* Galleries */
.ae-photos figure { overflow: hidden; }
.ae-photos figure img { transition: transform 0.6s var(--ae-ease); }
.ae-photos figure:hover img { transform: scale(1.05); }
.ae-lead .wp-block-image { overflow: hidden; }
.ae-lead .wp-block-image img { transition: transform 0.8s var(--ae-ease); }
.ae-lead .wp-block-image:hover img { transform: scale(1.03); }

/* Page titles */
.ae-page-head h1::after { animation: ae-rule 0.7s var(--ae-ease) 0.25s both; background: var(--wp--preset--color--contrast); content: ""; display: block; height: 3px; margin-top: 1rem; transform-origin: left; width: 3.5rem; }
.ae-page-head h1, .ae-breadcrumbs { animation: ae-rise 0.7s var(--ae-ease) both; }

/* Footer links */
.ae-footer__links a { display: inline-block; transition: transform 0.2s var(--ae-ease); }
.ae-footer__links a:hover { transform: translateX(4px); }

/* Scroll reveal. site.js only applies this to content below the fold, so nothing depends on it. */
.ae-reveal { opacity: 0; transform: translateY(26px); }
.ae-reveal.is-in {
	opacity: 1;
	transform: none;
	transition: opacity 0.7s ease var(--ae-delay, 0ms), transform 0.7s var(--ae-ease) var(--ae-delay, 0ms);
}

/* Floating WhatsApp button */
.wp-block-buttons.ae-float-wa {
	animation: ae-pop 0.5s var(--ae-ease) 1s both;
	bottom: 1.5rem;
	display: block;
	margin: 0 !important;
	position: fixed;
	right: 1.5rem;
	z-index: 45;
}
.ae-float-wa .wp-block-button { position: relative; }
.ae-float-wa .wp-block-button::before {
	animation: ae-pulse 3s ease-out 2s 5;
	background: var(--wp--preset--color--whatsapp);
	border-radius: 999px;
	content: "";
	height: 3.5rem;
	opacity: 0;
	pointer-events: none;
	position: absolute;
	right: 0;
	top: 0;
	width: 3.5rem;
}
.ae-float-wa.wp-block-buttons .wp-block-button__link {
	align-items: center;
	background: var(--wp--preset--color--whatsapp);
	border: 0;
	border-radius: 999px;
	box-shadow: 0 8px 22px color-mix(in srgb, var(--wp--preset--color--contrast) 32%, transparent);
	color: #fff;
	display: flex;
	font-size: var(--wp--preset--font-size--small);
	height: 3.5rem;
	margin-left: auto;
	overflow: hidden;
	padding: 0;
	position: relative;
	text-decoration: none;
	transition: box-shadow 0.25s ease, transform 0.25s var(--ae-ease), width 0.35s var(--ae-ease);
	white-space: nowrap;
	width: 3.5rem;
}
.ae-float-wa.wp-block-buttons .wp-block-button__link::before {
	flex: 0 0 3.5rem;
	height: 1.75rem;
	margin: 0;
	mask-size: 1.75rem;
	-webkit-mask-size: 1.75rem;
	vertical-align: baseline;
	width: 3.5rem;
}
.ae-float-wa.wp-block-buttons .wp-block-button__link:hover,
.ae-float-wa.wp-block-buttons .wp-block-button__link:focus-visible { background: var(--wp--preset--color--whatsapp); color: #fff; transform: translateY(-2px); width: 13.25rem; }

@media (max-width: 782px) {
	.ae-hero.wp-block-cover { min-height: 600px; padding-bottom: 6.5rem; }
	.wp-block-gallery.ae-hero__slides.has-nested-images figure.wp-block-image::after {
		background: color-mix(in srgb, var(--wp--preset--color--contrast) 72%, transparent);
	}
	.wp-block-gallery.ae-hero__slides.has-nested-images figure.wp-block-image figcaption { bottom: 3rem; left: 1rem; max-width: none; right: 1rem; text-align: left; }
	.ae-hero__controls { left: 1rem; right: auto; }
	/* Sit above the fixed call bar */
	.wp-block-buttons.ae-float-wa { bottom: 4.5rem; right: 0.9rem; }
	.ae-card:hover > .wp-block-image img { transform: none; }
}

@keyframes ae-ken-burns { from { transform: scale(1); } to { transform: scale(1.09); } }
@keyframes ae-ken-burns-alt { from { transform: scale(1.09); } to { transform: scale(1); } }
@keyframes ae-progress { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes ae-rise { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: none; } }
@keyframes ae-rule { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes ae-ticker { to { transform: translateX(-50%); } }
@keyframes ae-pop { from { opacity: 0; transform: scale(0.6) translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes ae-pulse { 0% { opacity: 0.5; transform: scale(1); } 70%, 100% { opacity: 0; transform: scale(1.7); } }
@keyframes ae-ring { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-14deg); } 50% { transform: rotate(12deg); } 75% { transform: rotate(-8deg); } }

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		scroll-behavior: auto !important;
		transition-duration: 0.01ms !important;
	}
	.ae-ticker { overflow-x: auto; }
	.ae-ticker__track { animation: none; }
}
@media print {
	.ae-float-wa, .ae-hero__controls, .ae-ticker { display: none !important; }
	.ae-reveal { opacity: 1 !important; transform: none !important; }
}
