/* =========================================================================
   Hero Slider — no plugins, no libraries.
   Turns a Group block with the "Hero Slider" style into an animated slider.
   Each Cover block inside the Group is one slide (image + text overlay).
   ========================================================================= */

.is-style-hero-slider {
	--hs-speed: 1.1s;           /* slide crossfade length — use seconds */
	--hs-ease: cubic-bezier(.22, .61, .36, 1);
	--hs-text-delay: 1s;        /* text box appears this long after the photo */
	--hs-text-stagger: .15s;    /* gap between heading, paragraph, button… */
	position: relative;
	overflow: hidden;
	isolation: isolate;
	touch-action: pan-y;        /* horizontal swipes go to the slider */
}

/* Full width: when the Group's Align is set to "Full width", stretch edge to edge.
   (Included here so it works even if the theme has no .alignfull styles.) */
.wp-block-group.is-style-hero-slider.alignfull {
	width: 100vw;
	max-width: 100vw !important;
	margin-left: calc(50% - 50vw) !important;
	margin-right: calc(50% - 50vw) !important;
}
body:has(.is-style-hero-slider.alignfull) {
	overflow-x: clip;  /* 100vw includes the scrollbar; prevents a sideways scrollbar */
}

/* Stack every slide in the same grid cell: height = tallest slide, no jumping */
.is-style-hero-slider,
.is-style-hero-slider > .wp-block-group__inner-container {
	display: grid;
	grid-template-columns: minmax(0, 1fr); /* never wider than the slider itself */
}
/* Classic themes wrap Group contents in an inner container: make it fill the slider exactly */
.is-style-hero-slider > .wp-block-group__inner-container {
	width: 100%;
	max-width: none !important;
	margin: 0 !important;
}

.is-style-hero-slider .wp-block-cover {
	grid-area: 1 / 1;
	margin: 0 !important;
	width: 100%;
	max-width: none !important;
	opacity: 0;
	visibility: hidden;
	z-index: 0;
	transition: opacity var(--hs-speed) var(--hs-ease), visibility 0s linear var(--hs-speed);

	/* Slide shape: match your photos (1500×750 = 2 / 1). Also change it in hero-slider-editor.css.
	   min-height:auto overrides the Cover block's own height but lets a slide grow if text needs room. */
	min-height: auto !important;
	aspect-ratio: 2 / 1;
	/* Optional: stop it getting taller than the screen on very wide monitors
	   (crops a little top and bottom there). Remove the comment marks to use. */
	/* max-height: 85vh; */

	/* Defaults: image drifts in from the right, text rises up */
	--hs-img-from: 4% 0;
	--hs-img-to: -4% 0;
	--hs-img-scale: 1.1;
	--hs-txt-from: 0 40px;
	--hs-txt-to: 0 -20px;
}

/* Phones: a 2:1 slide is too short for text, so use a fixed height (sides crop) */
@media (max-width: 600px) {
	.is-style-hero-slider .wp-block-cover {
		aspect-ratio: auto;
		min-height: 420px !important;
	}
}

/* Visible slides. Before the script runs, the first slide shows (good for LCP). */
.is-style-hero-slider:not(.hs-ready) .wp-block-cover:first-child,
.is-style-hero-slider .wp-block-cover.is-active,
.is-style-hero-slider .wp-block-cover.is-leaving {
	opacity: 1;
	visibility: visible;
	transition: opacity var(--hs-speed) var(--hs-ease), visibility 0s;
}
.is-style-hero-slider .wp-block-cover.is-active  { z-index: 2; }
.is-style-hero-slider .wp-block-cover.is-leaving { z-index: 1; }

/* ---- Image motion ------------------------------------------------------ */
.is-style-hero-slider .wp-block-cover__image-background,
.is-style-hero-slider .wp-block-cover__video-background {
	translate: var(--hs-img-from);
	scale: var(--hs-img-scale);
	transition:
		translate calc(var(--hs-speed) * 1.6) var(--hs-ease),
		scale calc(var(--hs-speed) * 1.6) var(--hs-ease);
	will-change: translate, scale;
}
.is-style-hero-slider:not(.hs-ready) .wp-block-cover:first-child .wp-block-cover__image-background,
.is-style-hero-slider .is-active .wp-block-cover__image-background,
.is-style-hero-slider .is-active .wp-block-cover__video-background {
	translate: 0 0;
	scale: 1;
}
.is-style-hero-slider .is-leaving .wp-block-cover__image-background,
.is-style-hero-slider .is-leaving .wp-block-cover__video-background {
	translate: var(--hs-img-to);
}

/* Slow "Ken Burns" zoom for the whole time the slide is showing */
.is-style-hero-slider .hs-zoom.is-active .wp-block-cover__image-background,
.is-style-hero-slider .hs-zoom.is-leaving .wp-block-cover__image-background {
	animation: hs-zoom calc(var(--hs-interval, 6000ms) + var(--hs-speed) * 2) linear forwards;
}
@keyframes hs-zoom { to { scale: 1.12; } }

/* ---- Text motion (each direct child of the Cover's content animates) ---- */
.is-style-hero-slider .wp-block-cover__inner-container > * {
	opacity: 0;
	translate: var(--hs-txt-from);
	transition: opacity .4s ease, translate .4s ease;
}
.is-style-hero-slider .is-active .wp-block-cover__inner-container > * {
	opacity: 1;
	translate: 0 0;
	transition: opacity .8s var(--hs-ease), translate .9s var(--hs-ease);
	transition-delay: calc(var(--hs-text-delay) + .15s + var(--hs-i, 0) * var(--hs-text-stagger));
}
.is-style-hero-slider .is-leaving .wp-block-cover__inner-container > * {
	opacity: 0;
	translate: var(--hs-txt-to);
}
.is-style-hero-slider .wp-block-cover__inner-container > :nth-child(2) { --hs-i: 1; }
.is-style-hero-slider .wp-block-cover__inner-container > :nth-child(3) { --hs-i: 2; }
.is-style-hero-slider .wp-block-cover__inner-container > :nth-child(4) { --hs-i: 3; }
.is-style-hero-slider .wp-block-cover__inner-container > :nth-child(5) { --hs-i: 4; }
.is-style-hero-slider .wp-block-cover__inner-container > :nth-child(6) { --hs-i: 5; }

/* ---- Text box + full-brightness photo ----------------------------------
   The Cover's text sits in a box. Position it per slide with the Cover's
   content-position control (toolbar grid icon). Change the look here. */
.is-style-hero-slider {
	--hs-box-bg: rgba(255, 255, 255, .95);
	--hs-box-width: 45%;           /* of the slide width (desktop) */
	--hs-box-pad: .6em 1.1em .8em;
	--hs-heading-color: #008127;
	--hs-text-color: #014c4c;
}

/* Space between the box and the slide edges (a Cover's own Padding setting overrides this) */
.is-style-hero-slider .wp-block-cover {
	padding: 4% 5%;
}
@media (max-width: 600px) {
	.is-style-hero-slider .wp-block-cover { padding: 1em; }
}

/* No darkening overlay: photo at full brightness (add hs-overlay to a Cover to keep it) */
.is-style-hero-slider .wp-block-cover:not(.hs-overlay) > .wp-block-cover__background {
	opacity: 0 !important;
}

.is-style-hero-slider .wp-block-cover .wp-block-cover__inner-container {
	box-sizing: border-box;
	max-width: var(--hs-box-width);
	padding: var(--hs-box-pad);
	background: var(--hs-box-bg);
	color: var(--hs-text-color);
	text-align: left;
}
.is-style-hero-slider .wp-block-cover__inner-container > * {
	text-align: left;
	margin-top: 0;
	margin-bottom: .3em;
}
.is-style-hero-slider .wp-block-cover__inner-container > :last-child { margin-bottom: 0; }
.is-style-hero-slider .wp-block-cover__inner-container :is(h1, h2, h3, h4) {
	color: var(--hs-heading-color);
	font-weight: 500;
	font-size: clamp(1.35rem, 2.35vw, 2.4rem);
	line-height: 1.15;
}
.is-style-hero-slider .wp-block-cover__inner-container p {
	color: var(--hs-text-color);
	font-weight: 400;
	font-size: clamp(1rem, 1.55vw, 1.6rem);
	line-height: 1.15;
}

/* The box itself slides/fades in just before its text */
.is-style-hero-slider .wp-block-cover .wp-block-cover__inner-container {
	opacity: 0;
	translate: var(--hs-txt-from);
	transition: opacity .4s ease, translate .4s ease;
}
.is-style-hero-slider .is-active .wp-block-cover__inner-container {
	opacity: 1;
	translate: 0 0;
	transition: opacity .7s var(--hs-ease), translate .8s var(--hs-ease);
	transition-delay: var(--hs-text-delay);
}
.is-style-hero-slider .is-leaving .wp-block-cover__inner-container {
	opacity: 0;
	translate: var(--hs-txt-to);
}

/* Tablets: wider, shorter box and smaller text, room for the dots below */
@media (min-width: 601px) and (max-width: 1024px) {
	.is-style-hero-slider {
		--hs-box-width: 100%;
		--hs-box-pad: .55em 1em .7em;
	}
	.is-style-hero-slider .wp-block-cover {
		padding-bottom: 52px !important;
	}
	.is-style-hero-slider .wp-block-cover__inner-container :is(h1, h2, h3, h4) {
		font-size: 1.5rem !important;
		margin-bottom: .25em;
	}
	.is-style-hero-slider .wp-block-cover__inner-container p {
		font-size: 1rem !important;
		line-height: 1.3;
	}
}

/* Phones: compact box spanning the slide, smaller text, room for the dots below.
   !important overrides per-slide Padding and the editor's font-size presets on phones only. */
@media (max-width: 600px) {
	.is-style-hero-slider {
		--hs-box-pad: .5em .8em .6em;
	}
	.is-style-hero-slider .wp-block-cover {
		padding: 14px 14px 48px !important;
	}
	.is-style-hero-slider .wp-block-cover .wp-block-cover__inner-container {
		max-width: 100%;
	}
	.is-style-hero-slider .wp-block-cover__inner-container :is(h1, h2, h3, h4) {
		font-size: 1.2rem !important;
		margin-bottom: .25em;
	}
	.is-style-hero-slider .wp-block-cover__inner-container p {
		font-size: .875rem !important;
		line-height: 1.3;
	}
}

/* ---- Per-slide options (add to a Cover block's "Additional CSS class") -- */
/* Image */
.is-style-hero-slider .hs-from-left   { --hs-img-from: -4% 0; --hs-img-to: 4% 0; }
.is-style-hero-slider .hs-from-top    { --hs-img-from: 0 -4%; --hs-img-to: 0 4%; }
.is-style-hero-slider .hs-from-bottom { --hs-img-from: 0 4%;  --hs-img-to: 0 -4%; }
.is-style-hero-slider .hs-fade        { --hs-img-from: 0 0;   --hs-img-to: 0 0; --hs-img-scale: 1; }
.is-style-hero-slider .hs-zoom        { --hs-img-from: 0 0;   --hs-img-to: 0 0; --hs-img-scale: 1; }
/* Text */
.is-style-hero-slider .hs-text-left   { --hs-txt-from: -60px 0; --hs-txt-to: 40px 0; }
.is-style-hero-slider .hs-text-right  { --hs-txt-from: 60px 0;  --hs-txt-to: -40px 0; }
.is-style-hero-slider .hs-text-down   { --hs-txt-from: 0 -40px; --hs-txt-to: 0 20px; }
.is-style-hero-slider .hs-text-fade   { --hs-txt-from: 0 0;     --hs-txt-to: 0 0; }

/* ---- Controls (created by hero-slider.js) ------------------------------ */
.is-style-hero-slider button.hs-arrow,
.is-style-hero-slider .hs-bar button {
	all: unset;
	box-sizing: border-box;
	cursor: pointer;
	color: #fff;
	-webkit-tap-highlight-color: transparent;
}
.is-style-hero-slider button.hs-arrow {
	position: absolute;
	top: 50%;
	translate: 0 -50%;
	z-index: 5;
	width: 48px;
	height: 48px;
	display: grid;
	place-items: center;
	border-radius: 50%;
	background: rgb(0 0 0 / .35);
	opacity: 0;
	transition: opacity .3s, background .2s;
}
.is-style-hero-slider button.hs-prev { left: 16px; }
.is-style-hero-slider button.hs-next { right: 16px; }
.is-style-hero-slider:hover button.hs-arrow,
.is-style-hero-slider button.hs-arrow:focus-visible { opacity: 1; }
.is-style-hero-slider button.hs-arrow:hover { background: rgb(0 0 0 / .6); }
@media (hover: none) {
	.is-style-hero-slider button.hs-arrow { opacity: .85; }
}

.is-style-hero-slider .hs-bar {
	position: absolute;
	left: 50%;
	bottom: 20px;
	translate: -50% 0;
	z-index: 5;
	display: flex;
	align-items: center;
	gap: 10px;
}
.is-style-hero-slider .hs-bar button.hs-dot {
	width: 12px;
	height: 12px;
	border: 2px solid #fff;
	border-radius: 50%;
	transition: background .3s, scale .3s;
}
.is-style-hero-slider .hs-bar button.hs-dot[aria-current="true"] {
	background: #fff;
	scale: 1.2;
}
.is-style-hero-slider .hs-bar button.hs-toggle {
	width: 28px;
	height: 28px;
	margin-left: 6px;
	display: grid;
	place-items: center;
	border-radius: 50%;
	background: rgb(0 0 0 / .35);
}
.is-style-hero-slider .hs-bar [hidden] { display: none; }
.is-style-hero-slider button:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 3px;
}

/* ---- Respect "reduce motion": keep crossfades, drop movement ----------- */
@media (prefers-reduced-motion: reduce) {
	.is-style-hero-slider .wp-block-cover {
		--hs-img-from: 0 0; --hs-img-to: 0 0; --hs-img-scale: 1;
		--hs-txt-from: 0 0; --hs-txt-to: 0 0;
	}
	.is-style-hero-slider .wp-block-cover__image-background { animation: none !important; }
}