/* ECD Hero Carousel */

/* Override WordPress constrained layout max-width */
.is-layout-constrained > .wp-block-ecd-hero-carousel {
	max-width: none !important;
	width: 100vw !important;
	position: relative;
	left: 50%;
	right: 50%;
	margin-left: calc(-50vw + 0%) !important;
	margin-right: calc(-50vw + 0%) !important;
}

.wp-block-ecd-hero-carousel {
	width: 100vw;
	position: relative;
	left: 50%;
	right: 50%;
	margin-left: -50vw !important;
	margin-right: -50vw !important;
}

.ecd-hc {
	position: relative;
	width: 100%;
	overflow: hidden;
	background: #000;
}

/* Full height hero behind header */
.ecd-hc--full-height {
	position: relative;
	width: 100%;
	z-index: 0;
	min-height: 100vh;
	--slide-min-height: 100vh;
	margin-top: 0;
}

/* Push page content down when full-height carousel is present */
body:has(.ecd-hc--full-height) {
	padding-top: 0;
}

/* Fix header at top over hero (only when full-height carousel is present) */
body:has(.ecd-hc--full-height) header {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	z-index: 100;
	width: 100%;
}

/* Also target WordPress template part headers (only with full-height carousel) */
body:has(.ecd-hc--full-height) .wp-site-blocks > .wp-block-template-part:first-child {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	z-index: 100;
	width: 100%;
}

/* The template-part wrapper is fixed, so keep its nested header in normal flow */
body:has(.ecd-hc--full-height) .wp-site-blocks > .wp-block-template-part:first-child header {
	position: static;
	top: auto;
}

/* Keep the fixed header below the WordPress admin bar for logged-in users */
body.admin-bar:has(.ecd-hc--full-height) header:not(.wp-block-template-part header),
body.admin-bar:has(.ecd-hc--full-height) .wp-site-blocks > .wp-block-template-part:first-child {
	top: 32px;
}

@media (max-width: 782px) {
	body.admin-bar:has(.ecd-hc--full-height) header:not(.wp-block-template-part header),
	body.admin-bar:has(.ecd-hc--full-height) .wp-site-blocks > .wp-block-template-part:first-child {
		top: 46px;
	}
}

/* Ensure the carousel container can position children absolutely */
.wp-block-template-part:has(.ecd-hc--full-height),
body:has(.ecd-hc--full-height) {
	position: relative;
}

.ecd-hc-slide {
	position: relative;
	width: 100%;
	min-height: var(--slide-min-height, 500px);
	display: none;
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
	background-attachment: local;
}

.ecd-hc-slide.is-active {
	display: flex;
	align-items: center;
	justify-content: center;
}

.ecd-hc-slide__overlay {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.4);
	z-index: 2;
}

.ecd-hc-slide__ghosted {
	position: absolute;
	inset: 0;
	z-index: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: clamp(48px, 12vw, 120px);
	font-weight: 700;
	color: white;
	text-align: center;
	padding: 40px;
	line-height: 1.2;
	text-shadow: 2px 2px 6px rgba(0, 0, 0, 0.2);
	word-break: break-word;
	hyphens: auto;
}

.ecd-hc-slide__content {
	position: relative;
	z-index: 3;
	color: white;
	max-width: 800px;
	padding: 40px;
	width: 100%;
}

/* Default center alignment for inline elements */
.ecd-hc-slide__content {
	text-align: center;
}

/* Respect Gutenberg alignment classes */
.ecd-hc-slide__content.alignleft {
	text-align: left;
}

.ecd-hc-slide__content.aligncenter {
	text-align: center;
}

.ecd-hc-slide__content.alignright {
	text-align: right;
}

/* Allow block-level alignment on child elements */
.ecd-hc-slide__content .wp-block-separator {
	margin-left: auto;
	margin-right: auto;
}

.ecd-hc-slide__content .wp-block-separator.alignleft {
	margin-left: 0;
	margin-right: auto;
}

.ecd-hc-slide__content .wp-block-separator.aligncenter {
	margin-left: auto;
	margin-right: auto;
}

.ecd-hc-slide__content .wp-block-separator.alignright {
	margin-left: auto;
	margin-right: 0;
}

/* InnerBlocks styling */
.ecd-hc-slide__content h1,
.ecd-hc-slide__content h2,
.ecd-hc-slide__content h3,
.ecd-hc-slide__content h4,
.ecd-hc-slide__content h5,
.ecd-hc-slide__content h6 {
	font-size: clamp(32px, 8vw, 64px);
	font-weight: 700;
	line-height: 1.2;
	margin: 0 0 20px 0;
	text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.ecd-hc-slide__content p {
	font-size: clamp(14px, 2vw, 18px);
	line-height: 1.6;
	margin: 0 0 20px 0;
	text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.ecd-hc-slide__content .wp-block-button__link {
	display: inline-block;
	padding: 14px 40px;
	font-size: 16px;
	font-weight: 600;
	background: #0052cc;
	color: white;
	text-decoration: none;
	border-radius: 4px;
	transition: all 0.3s ease;
	border: none;
	cursor: pointer;
	margin-top: 10px;
}

.ecd-hc-slide__content .wp-block-button__link:hover {
	background: #0035a6;
	transform: translateY(-2px);
	box-shadow: 0 6px 16px rgba(0, 82, 204, 0.4);
}

/* Animation Keyframes */
@keyframes fadeIn {
	from {
		opacity: 0;
	}
	to {
		opacity: 1;
	}
}

@keyframes slideInLeft {
	from {
		opacity: 0;
		transform: translateX(-40px);
	}
	to {
		opacity: 1;
		transform: translateX(0);
	}
}

@keyframes slideInRight {
	from {
		opacity: 0;
		transform: translateX(40px);
	}
	to {
		opacity: 1;
		transform: translateX(0);
	}
}

@keyframes slideInUp {
	from {
		opacity: 0;
		transform: translateY(40px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@keyframes zoomIn {
	from {
		opacity: 0;
		transform: scale(1);
	}
	to {
		opacity: 1;
		transform: scale(1.15);
	}
}

/* Effect Classes - Image/Background */
.ecd-hc-slide[data-effect="none"] {
	animation: none;
}

.ecd-hc-slide[data-effect="fade-in"] {
	animation: fadeIn var(--image-animation-duration, 0.8s) ease-out forwards;
}

.ecd-hc-slide[data-effect="zoom-in"] {
	animation: zoomIn var(--image-animation-duration, 0.8s) ease-out forwards;
	overflow: hidden;
}

/* Effect Classes - Content */
.ecd-hc-slide__content[data-effect="none"] {
	animation: none;
}

.ecd-hc-slide.is-active .ecd-hc-slide__content[data-effect="fade-in"] {
	animation: fadeIn var(--content-animation-duration, 0.6s) ease-out forwards;
}

.ecd-hc-slide.is-active .ecd-hc-slide__content[data-effect="slide-in-left"] {
	animation: slideInLeft var(--content-animation-duration, 0.7s) ease-out forwards;
}

.ecd-hc-slide.is-active .ecd-hc-slide__content[data-effect="slide-in-right"] {
	animation: slideInRight var(--content-animation-duration, 0.7s) ease-out forwards;
}

.ecd-hc-slide.is-active .ecd-hc-slide__content[data-effect="slide-in-up"] {
	animation: slideInUp var(--content-animation-duration, 0.7s) ease-out forwards;
}

/* Stagger timing for sequential elements */
.ecd-hc-slide.is-active .ecd-hc-content-item:nth-child(1) {
	animation-delay: 0.1s;
}

.ecd-hc-slide.is-active .ecd-hc-content-item:nth-child(2) {
	animation-delay: 0.3s;
}

.ecd-hc-slide.is-active .ecd-hc-content-item:nth-child(3) {
	animation-delay: 0.5s;
}

.ecd-hc-slide.is-active .ecd-hc-content-item:nth-child(4) {
	animation-delay: 0.7s;
}

.ecd-hc-slide.is-active .ecd-hc-content-item:nth-child(5) {
	animation-delay: 0.9s;
}

/* Navigation Arrows */
.ecd-hc__nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 10;
	background: rgba(255, 255, 255, 0.3);
	color: white;
	border: none;
	width: 50px;
	height: 50px;
	border-radius: 50%;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.3s ease;
}

.ecd-hc__nav:hover {
	background: rgba(255, 255, 255, 0.5);
}

.ecd-hc__nav svg {
	width: 24px;
	height: 24px;
}

.ecd-hc__nav--prev {
	left: 20px;
}

.ecd-hc__nav--next {
	right: 20px;
}

@media (max-width: 768px) {
	.ecd-hc__nav {
		width: 40px;
		height: 40px;
	}

	.ecd-hc__nav svg {
		width: 20px;
		height: 20px;
	}

	.ecd-hc__nav--prev {
		left: 10px;
	}

	.ecd-hc__nav--next {
		right: 10px;
	}
}

/* Character-by-Character Text Animation */
@keyframes charSlideUp {
	from {
		opacity: 0;
		transform: translateY(20px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@keyframes charFadeIn {
	from {
		opacity: 0;
	}
	to {
		opacity: 1;
	}
}

@keyframes charRotate {
	from {
		opacity: 0;
		transform: rotateX(90deg);
	}
	to {
		opacity: 1;
		transform: rotateX(0deg);
	}
}

.ecd-text-char {
	display: inline-block;
	opacity: 0;
}

.ecd-hc-slide.is-active .ecd-text-char {
	animation: charSlideUp var(--text-animation-duration, 0.5s) ease-out forwards;
	animation-delay: calc(var(--char-index, 0) * var(--char-animation-delay, 30ms));
}

/* Word-by-Word Text Animation */
@keyframes wordSlideUp {
	from {
		opacity: 0;
		transform: translateY(30px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@keyframes wordFadeIn {
	from {
		opacity: 0;
	}
	to {
		opacity: 1;
	}
}

@keyframes wordZoom {
	from {
		opacity: 0;
		transform: scale(0.8);
	}
	to {
		opacity: 1;
		transform: scale(1);
	}
}

.ecd-text-word {
	display: inline-block;
	opacity: 0;
	margin-right: 0.25em;
}

.ecd-hc-slide.is-active .ecd-text-word {
	animation: wordSlideUp var(--text-animation-duration, 0.6s) ease-out forwards;
	animation-delay: calc(var(--word-index, 0) * var(--word-animation-delay, 80ms));
}
