/*
 * Scroll motion for hookandbook.co.uk (1 Nov 2026).
 * CSS scroll-driven animations only: no JavaScript, nothing extra to download.
 * Browsers without animation-timeline support, and visitors who prefer reduced
 * motion, get the page exactly as before. Remove this file's enqueue in
 * functions.php to switch it off.
 */
@media (prefers-reduced-motion: no-preference) {
	@supports (animation-timeline: view()) {

		@keyframes hb-rise { from { opacity: 0; transform: translateY(28px); } }
		@keyframes hb-rise-sm { from { opacity: 0; transform: translateY(14px); } }
		@keyframes hb-scale { from { opacity: 0; transform: translateY(24px) scale(.97); } }
		@keyframes hb-clip { from { clip-path: inset(8% 8% 8% 8% round 18px); opacity: .4; transform: scale(1.04); } }
		@keyframes hb-slide { from { opacity: 0; transform: translateX(-18px); } }

		/* Section headings and their intro copy */
		main .section .section-head,
		main .section .container > .h2,
		main .section .container--narrow > .lede,
		main .founder > div,
		main .split__copy {
			animation: hb-rise linear both;
			animation-timeline: view();
			animation-range: entry 0% entry 70%;
		}

		/* Cards, grids and lists: each item reveals as it enters, with a small stagger across a row */
		main .ladder > li,
		main .postcard,
		main .checkcard,
		main .panel:not(.panel--navy) {
			animation: hb-scale linear both;
			animation-timeline: view();
			animation-range: entry 0% entry 65%;
		}
		main .strip li,
		main .process li,
		main .linkgrid li,
		main .steps li,
		main .faq details {
			animation: hb-rise-sm linear both;
			animation-timeline: view();
			animation-range: entry 0% entry 80%;
		}
		main :is(.ladder > li, .strip li, .process li, .linkgrid li):nth-child(3n + 2) { animation-range: entry 8% entry 88%; }
		main :is(.ladder > li, .strip li, .process li, .linkgrid li):nth-child(3n + 3) { animation-range: entry 16% entry 96%; }

		/* Comparison rows slide in one after another */
		main .compare__row:not(.compare__head) {
			animation: hb-slide linear both;
			animation-timeline: view();
			animation-range: entry 0% entry 90%;
		}

		/* Photos open up as they scroll into view */
		main .media img,
		main .founder__img {
			animation: hb-clip linear both;
			animation-timeline: view();
			animation-range: entry 0% cover 40%;
		}

		/* Blog posts: a thin gold reading-progress bar */
		@keyframes hb-progress { from { transform: scaleX(0); } to { transform: scaleX(1); } }
		body.single-post::before {
			content: "";
			position: fixed;
			inset: 0 0 auto 0;
			z-index: 30;
			height: 4px;
			background: var(--gold);
			transform-origin: 0 50%;
			pointer-events: none;
			animation: hb-progress linear both;
			animation-timeline: scroll(root block);
		}
	}
}
