/* Haus - reveal (entrance animations). The hidden state itself is printed inline by
   reveal.php on the rule selectors; this file carries the motion and the safety nets. */

/* Duration and curve are the same in both directions, so leaving and coming back feel like one
   motion. Values, all overridable per element:
     travel      16px  (reveal.php prints the hidden state; --reveal-y)
     duration    1.2s  (--reveal-duration; the hero copy runs 2s)
     curve       cubic-bezier(0.22, 1, 0.36, 1), ease-out (--reveal-ease)
     stagger     110ms between section blocks, 80ms between cards, capped at 560ms
   Read as jumpy at 24px / 0.9s / (0.16, 1, 0.3, 1): a long travel on a fast expo curve puts
   almost all of the movement in the first fifth of the duration. Less distance and more time is
   what makes it calm; the curve only decides how it lands. */
html.haus-reveal [data-reveal] {
	transition:
		opacity var(--reveal-duration, 1.2s) var(--reveal-ease, cubic-bezier(0.22, 1, 0.36, 1)),
		transform var(--reveal-duration, 1.2s) var(--reveal-ease, cubic-bezier(0.22, 1, 0.36, 1));
	transition-delay: var(--reveal-delay, 0ms);
	will-change: opacity, transform;
}

html.haus-reveal .is-inview {
	opacity: 1;
	transform: none;
}

/* Done animating: give the compositor its memory back. The transition stays declared, so an
   element that is reset (scrolled back above) animates out instead of snapping. */
html.haus-reveal .is-inview.is-settled {
	will-change: auto;
}

/* Fade only, no movement. */
html.haus-reveal .reveal-fade,
html.haus-reveal .reveal-fade > * {
	--reveal-y: 0px;
}

/* If the script never runs (error, blocked), show everything after 2.5s. The script adds
   html.haus-reveal-ready as its first act, which switches this off. */
html.haus-reveal:not(.haus-reveal-ready) [data-reveal],
html.haus-reveal:not(.haus-reveal-ready) :where(*) {
	animation: haus-reveal-safety 0s 2.5s forwards;
}

@keyframes haus-reveal-safety {
	to {
		opacity: 1;
		transform: none;
	}
}

/* Reduced motion: the script removes html.haus-reveal, which drops the hidden state. This
   covers the moment before the script runs. */
@media (prefers-reduced-motion: reduce) {
	html.haus-reveal :where(*) {
		opacity: 1;
		transform: none;
		transition: none;
	}
}
