/* ==========================================================================
   Motion system — entrance reveals, hero intro, hover transitions.
   Driven by assets/js/reveal.js. Initial hidden states only apply once
   the script has added `html.tawa-motion`, so content is never hidden
   without JavaScript.
   ========================================================================== */

:root {
	--tawa-reveal-duration: 640ms;
	--tawa-reveal-ease: cubic-bezier(0.22, 0.61, 0.36, 1);
	--tawa-reveal-distance: 20px;
	--tawa-reveal-distance-x: 24px;
	--tawa-hover-duration: 240ms;
}

/* 1. Scroll reveals ------------------------------------------------------ */
.tawa-motion .reveal:not(.is-reveal-done),
.tawa-motion .reveal-stagger:not(.is-reveal-done) > * {
	transition:
		opacity var(--tawa-reveal-duration) var(--tawa-reveal-ease) var(--tawa-reveal-delay, 0ms),
		transform var(--tawa-reveal-duration) var(--tawa-reveal-ease) var(--tawa-reveal-delay, 0ms);
}

.tawa-motion .reveal:not(.is-revealed),
.tawa-motion .reveal-stagger:not(.is-revealed) > * {
	opacity: 0;
	transform: translate3d(0, var(--tawa-reveal-distance), 0);
}

.tawa-motion .reveal-left:not(.is-revealed) {
	transform: translate3d(calc(var(--tawa-reveal-distance-x) * -1), 0, 0);
}

.tawa-motion .reveal-right:not(.is-revealed) {
	transform: translate3d(var(--tawa-reveal-distance-x), 0, 0);
}

.tawa-motion .reveal-fade:not(.is-revealed) {
	transform: none;
}

/* Image reveal: the frame fades in, the picture settles from a gentle zoom. */
.tawa-motion .reveal-image:not(.is-reveal-done) img {
	transition: transform 900ms var(--tawa-reveal-ease) var(--tawa-reveal-delay, 0ms);
}

.tawa-motion .reveal-image:not(.is-revealed) img {
	transform: scale(1.04);
}

/* 2. Hero intro (on load, no JS needed) --------------------------------- */
@keyframes tawa-rise {
	from {
		opacity: 0;
		transform: translate3d(0, 16px, 0);
	}

	to {
		opacity: 1;
		transform: none;
	}
}

@keyframes tawa-settle {
	from {
		transform: scale(1.05);
	}

	to {
		transform: scale(1);
	}
}

.tawa-hero__bg {
	animation: tawa-settle 1400ms var(--tawa-reveal-ease) both;
}

.tawa-hero__content > * {
	animation: tawa-rise 600ms var(--tawa-reveal-ease) both;
}

.tawa-hero__content > :nth-child(1) { animation-delay: 60ms; }
.tawa-hero__content > :nth-child(2) { animation-delay: 140ms; }
.tawa-hero__content > :nth-child(3) { animation-delay: 220ms; }
.tawa-hero__content > :nth-child(4) { animation-delay: 300ms; }
.tawa-hero__content > :nth-child(5) { animation-delay: 380ms; }
.tawa-hero__content > :nth-child(6) { animation-delay: 460ms; }

.tawa-hero__discover {
	animation: tawa-rise 600ms var(--tawa-reveal-ease) 520ms both;
}

/* 3. Hover transitions --------------------------------------------------- */
.tawa-btn {
	transition:
		background-color var(--tawa-hover-duration) ease,
		color var(--tawa-hover-duration) ease,
		border-color var(--tawa-hover-duration) ease,
		box-shadow var(--tawa-hover-duration) ease,
		transform var(--tawa-hover-duration) ease;
}

.tawa-btn:hover,
.tawa-btn:focus-visible {
	transform: translateY(-2px);
	box-shadow: var(--tawa-shadow-md);
}

.tawa-btn:active {
	transform: translateY(0) scale(0.98);
}

/* Cards lift slightly; course cards already lift (main.css). */
.tawa-plan,
.tawa-teacher,
.tawa-feature,
.tawa-step,
.tawa-quote {
	transition:
		box-shadow var(--tawa-hover-duration) ease,
		transform var(--tawa-hover-duration) ease,
		border-color var(--tawa-hover-duration) ease;
}

.tawa-plan:hover,
.tawa-teacher:hover,
.tawa-step:hover {
	transform: translateY(-3px);
	box-shadow: var(--tawa-shadow-md);
}

.tawa-feature:hover,
.tawa-quote:hover {
	border-color: var(--tawa-neutral-80, #b9cbbe);
	box-shadow: var(--tawa-shadow-sm);
}

/* Teacher card photo zoom: assets/css/teachers.css. */

.tawa-faq__item summary .tawa-title-md {
	transition: color var(--tawa-hover-duration) ease;
}

.tawa-faq__item summary:hover .tawa-title-md {
	color: var(--tawa-primary);
}

/* Header navigation: colour + underline grow (desktop). */
body.tawa .main-header-menu > .menu-item > .menu-link {
	position: relative;
	transition: color var(--tawa-hover-duration) ease;
}

@media (min-width: 922px) {
	body.tawa .main-header-menu > .menu-item > .menu-link,
	body.tawa .main-header-menu > .menu-item > .menu-link:hover {
		text-decoration: none;
	}

	/* Underline sits just below the word (not across it): anchored to the
	   vertical centre of the link + ~0.85em, spanning the text only. It
	   slides in from the left on hover and leaves to the right. */
	body.tawa .main-header-menu > .menu-item > .menu-link::after {
		content: "";
		position: absolute;
		left: var(--tawa-nav-pad, 1em);
		right: var(--tawa-nav-pad, 1em);
		top: calc(50% + 0.85em);
		height: 3px;
		border-radius: 3px;
		background: linear-gradient(90deg, var(--tawa-brand-green), var(--tawa-olive-green));
		opacity: 0;
		transform: scaleX(0);
		transform-origin: right center;
		transition:
			transform 380ms cubic-bezier(0.65, 0, 0.35, 1),
			opacity 200ms ease;
		pointer-events: none;
	}

	/* Items with a dropdown arrow: stop the line before the arrow. */
	body.tawa .main-header-menu > .menu-item-has-children > .menu-link::after {
		right: calc(var(--tawa-nav-pad, 1em) + 19px);
	}

	body.tawa .main-header-menu > .menu-item:hover > .menu-link::after,
	body.tawa .main-header-menu > .menu-item > .menu-link:focus-visible::after,
	body.tawa .main-header-menu > .current-menu-item > .menu-link::after,
	body.tawa .main-header-menu > .current-menu-ancestor > .menu-link::after {
		opacity: 1;
		transform: scaleX(1);
		transform-origin: left center;
	}

	/* Active page: a slightly calmer, permanent underline. */
	body.tawa .main-header-menu > .current-menu-item:not(:hover) > .menu-link::after,
	body.tawa .main-header-menu > .current-menu-ancestor:not(:hover) > .menu-link::after {
		opacity: 0.85;
	}
}

/* Existing Spectra buttons and links on inner pages. */
body.tawa .uagb-buttons-repeater,
body.tawa .wp-block-button__link,
body.tawa .ast-custom-button {
	transition:
		background-color var(--tawa-hover-duration) ease,
		color var(--tawa-hover-duration) ease,
		transform var(--tawa-hover-duration) ease,
		box-shadow var(--tawa-hover-duration) ease;
}

body.tawa .uagb-buttons-repeater:hover,
body.tawa .wp-block-button__link:hover,
body.tawa .ast-custom-button:hover {
	transform: translateY(-2px);
}

body.tawa .entry-content a,
body.tawa .site-footer a {
	transition: color var(--tawa-hover-duration) ease;
}

/* Touch devices: no hover lift (avoids sticky hover states). */
@media (hover: none) {
	.tawa-btn:hover,
	.tawa-plan:hover,
	.tawa-teacher:hover,
	.tawa-step:hover,
	.tawa-course:hover,
	body.tawa .uagb-buttons-repeater:hover,
	body.tawa .wp-block-button__link:hover,
	body.tawa .ast-custom-button:hover {
		transform: none;
	}
}

/* 4. Reduced motion ------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
	.reveal,
	.reveal-stagger > *,
	.reveal-image img,
	.tawa-hero__bg,
	.tawa-hero__content > *,
	.tawa-hero__discover {
		opacity: 1 !important; /* Accessibility override: never keep content hidden. */
		transform: none !important;
		animation: none !important;
		transition: none !important;
	}

	.tawa-btn:hover,
	.tawa-plan:hover,
	.tawa-teacher:hover,
	.tawa-step:hover,
	.tawa-teacher:hover .tawa-teacher__photo,
	body.tawa .uagb-buttons-repeater:hover,
	body.tawa .wp-block-button__link:hover,
	body.tawa .ast-custom-button:hover {
		transform: none;
	}

	body.tawa .main-header-menu > .menu-item > .menu-link::after {
		transition: none;
	}
}

@media print {
	.reveal,
	.reveal-stagger > * {
		opacity: 1 !important;
		transform: none !important;
	}
}
