/* Page Sections — Animated text hero */

.ps-animtext {
	position: relative;
	overflow: hidden;
	min-height: clamp(440px, 56vh, 600px);
	display: flex;
	align-items: center;
	isolation: isolate;
}

/* Variants */
.ps-animtext--dark {
	background-color: var(--teal);
	color: #fff;
}
.ps-animtext--light {
	background-color: var(--cream);
	color: var(--teal);
}

/* Image background (dark only) */
.ps-animtext--has-image {
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
}
.ps-animtext__overlay {
	position: absolute;
	inset: 0;
	background: linear-gradient(90deg, rgba(24, 60, 66, .85) 0%, rgba(24, 60, 66, .45) 100%);
	z-index: 1;
}

.ps-animtext__inner {
	position: relative;
	z-index: 2;
	padding-block: clamp(48px, 7vw, 90px);
}
.ps-animtext__copy {
	max-width: 720px;
}

/* Eyebrow */
.ps-animtext__eyebrow {
	color: var(--red);
}
.ps-animtext--dark .ps-animtext__eyebrow {
	color: var(--red);
}

/* Heading */
.ps-animtext__heading {
	font-family: var(--font-heading);
	font-weight: 400;
	font-size: clamp(2.2rem, 5vw, 4rem);
	line-height: 1.1;
	margin: 0 0 18px;
	color: inherit;
	/* Block (not inline): vertical margins don't apply to inline boxes, which
	   silently killed the 18px gap below the heading. The static/rotator spans
	   inside still flow inline. */
	display: block;
}
.ps-animtext--dark .ps-animtext__heading { color: #fff; }
.ps-animtext--light .ps-animtext__heading { color: var(--teal); }

.ps-animtext__static { display: inline; }
.ps-animtext__static--after { display: inline; }

/* Rotator — inline-block sized & baseline-aligned by the hidden sentinel.
   We deliberately DON'T put overflow:hidden on the rotator itself: doing so
   forces the browser to use its bottom-margin edge as the baseline (CSS spec
   for inline-blocks with non-visible overflow), pushing the visible word
   above the line of the static text. The inner .ps-animtext__clip handles
   the animation clipping instead. */
.ps-animtext__rotator {
	position: relative;
	display: inline-block;
	vertical-align: baseline;
	color: var(--red);
}
.ps-animtext--dark .ps-animtext__rotator { color: var(--red); }
.ps-animtext--light .ps-animtext__rotator { color: var(--red); }

/* Sentinel — invisible but takes inline space so the rotator's natural width
   and text baseline match the widest rotating word. */
.ps-animtext__sentinel {
	display: inline-block;
	white-space: nowrap;
	visibility: hidden;
	pointer-events: none;
	user-select: none;
}

/* Clip wrapper — absolutely positioned over the sentinel, clips the
   in/out animation without affecting the rotator's baseline. */
.ps-animtext__clip {
	position: absolute;
	inset: 0;
	overflow: hidden;
}

/* Each word lives in the clip and fades / lifts on swap. */
.ps-animtext__word {
	position: absolute;
	left: 0;
	top: 0;
	display: inline-block;
	white-space: nowrap;
	opacity: 0;
	transform: translateY( 100% );
	transition: opacity .45s ease, transform .45s ease;
	pointer-events: none;
}
.ps-animtext__word.is-active {
	opacity: 1;
	transform: translateY( 0 );
	pointer-events: auto;
}
.ps-animtext__word.is-out {
	opacity: 0;
	transform: translateY( -100% );
}
.ps-animtext__word.is-in {
	opacity: 0;
	transform: translateY( 100% );
}

/* Body text */
.ps-animtext__text {
	max-width: 540px;
	font-size: 1.05rem;
	line-height: 1.6;
	margin: 0 0 28px;
}
.ps-animtext--dark .ps-animtext__text { color: rgba(255, 255, 255, .9); }
.ps-animtext--light .ps-animtext__text { color: var(--grey-700); }

/* CTA — light variant gets the standard teal button, dark variant gets a white
   pill that flips to red on hover. */
.ps-animtext__cta { margin-top: 4px; }
.ps-animtext--dark .ps-animtext__cta {
	background: #fff;
	color: var(--teal);
	border-color: #fff;
}
.ps-animtext--dark .ps-animtext__cta:hover {
	background: var(--red);
	color: #fff;
	border-color: var(--red);
}

/* Reduced motion — snap word swaps. */
@media (prefers-reduced-motion: reduce) {
	.ps-animtext__word,
	.ps-animtext__word.is-active,
	.ps-animtext__word.is-out,
	.ps-animtext__word.is-in {
		transition: none;
		transform: none;
	}
}

/* Desktop — more vertical presence, wider copy column, larger body text */
@media (min-width: 1024px) {
	.ps-animtext { min-height: clamp(460px, 52vh, 520px); }
	.ps-animtext__copy { max-width: 780px; }
	.ps-animtext__text { font-size: 1.04rem; max-width: 580px; margin-bottom: 28px; }
}

@media (min-width: 1280px) {
	.ps-animtext { min-height: 540px; }
	.ps-animtext__copy { max-width: 840px; }
}

/* Responsive */
@media (max-width: 860px) {
	.ps-animtext__overlay {
		background: linear-gradient(180deg, rgba(24, 60, 66, .55) 0%, rgba(24, 60, 66, .85) 100%);
	}
}
@media (max-width: 767px) {
	.ps-animtext { min-height: clamp(380px, 70vw, 520px); }
}
@media (max-width: 479px) {
	.ps-animtext__heading { font-size: clamp(1.9rem, 8vw, 2.4rem); }
	.ps-animtext__text { font-size: 1rem; }
}
