/* Site animations. CSS only: opacity and transform, no libraries.
   Scroll reveals use animation-timeline: view(); browsers without it simply show everything static. */
@media (prefers-reduced-motion: no-preference) {

	/* Internal hero: text rises in sequence and the photo settles */
	.page-hero-content > * { animation: paz-rise 900ms cubic-bezier(.16, 1, .3, 1) both; }
	.page-hero-content > :nth-child(2) { animation-delay: 120ms; }
	.page-hero-content > :nth-child(3) { animation-delay: 240ms; }
	.page-hero-content > :nth-child(4) { animation-delay: 340ms; }
	.page-hero-photo img { animation: paz-settle 1600ms cubic-bezier(.16, 1, .3, 1) both; }

	/* Buttons and links: arrow nudge and soft lift on cards */
	.button::after { transition: transform 180ms ease-out; }
	.button:is(:hover, :focus-visible)::after { transform: translateX(4px); }
	.steps .step-grid article,
	.approach-story,
	.post-box { transition: translate 300ms cubic-bezier(.16, 1, .3, 1), box-shadow 300ms ease; }
	.steps .step-grid article:hover,
	.approach-story:hover { translate: 0 -4px; box-shadow: 0 14px 30px rgba(56, 62, 44, .08) !important; }
	.approach-story figure img { transition: transform 700ms cubic-bezier(.16, 1, .3, 1); }
	.approach-story:hover figure img { transform: scale(1.04); }

	/* FAQ answers open smoothly (browsers that support animating to auto height) */
	@supports selector(::details-content) {
		:root { interpolate-size: allow-keywords; }
		details::details-content { block-size: 0; overflow: hidden; transition: block-size 450ms cubic-bezier(.16, 1, .3, 1), content-visibility 450ms allow-discrete; }
		details[open]::details-content { block-size: auto; }
	}
	summary::after { transition: transform 300ms ease; }
	details[open] summary::after { transform: rotate(180deg); }

	/* Blog post: a thin reading-progress line at the top of the screen */
	@supports (animation-timeline: scroll()) {
		.post-page::before {
			content: ""; position: fixed; left: 0; right: 0; top: 0; z-index: 1000; height: 3px; background: var(--rust);
			transform-origin: 0 50%; animation: paz-progress linear both; animation-timeline: scroll(root);
		}
		body.admin-bar .post-page::before { top: var(--wp-admin--admin-bar--height, 32px); }
	}

	@supports (animation-timeline: view()) {
		/* Blocks fade up as they enter the screen */
		:is(.ps-path-intro, .ps-what-grid > *, .ps-when-grid > div, .ps-personal > div, .section-head, .steps h2, .steps .wrap > p,
			.faq > *, .post-related h2, .blog-filter, .post-lead, .oc-intro > *, .oc-gallery h2, .oc-visit > *, .oc-online .wrap > *,
			.not-found-links h2, .pp-body > h2) {
			animation: paz-reveal linear both;
			animation-timeline: view();
			animation-range: entry 0% entry 70%;
		}

		/* Cards arrive one after the other */
		:is(.steps .step-grid article, .approach-story, .post-card, .ct-channels li, .not-found-links li) {
			animation: paz-reveal linear both;
			animation-timeline: view();
			animation-range: entry 0% entry 65%;
		}
		:is(.steps .step-grid article, .approach-story, .post-card, .ct-channels li, .not-found-links li):nth-child(3n+2) { animation-range: entry 12% entry 80%; }
		:is(.steps .step-grid article, .approach-story, .post-card, .ct-channels li, .not-found-links li):nth-child(3n) { animation-range: entry 24% entry 95%; }

		/* Step cards: the rust bar on top grows and the number pops in */
		.steps .step-grid article { view-timeline-name: --paz-card; }
		.steps .step-grid article::before { transform-origin: 0 50%; animation: paz-bar linear both; animation-timeline: --paz-card; animation-range: entry 45% entry 100%; }
		.steps .step-grid span { animation: paz-pop linear both; animation-timeline: --paz-card; animation-range: entry 55% cover 30%; }

		/* WhatsApp block: the rounded rust panel opens from the centre */
		.contact { animation: paz-open linear both; animation-timeline: view(); animation-range: entry 0% entry 80%; }

		/* Section photos: a curtain reveal from the bottom, then a slow zoom-out while they cross the screen */
		:is(.ps-path-photo, .ps-what-photo, .ps-when-grid figure, .ps-personal figure, .oc-intro-photo) { overflow: hidden; border-radius: var(--card-radius); }
		.ps-personal figure { border-radius: 160px 160px var(--card-radius) var(--card-radius); }
		:is(.ps-path-photo, .ps-what-photo, .ps-when-grid figure, .ps-personal figure, .oc-intro-photo, .oc-photo, .approach-story figure) {
			animation: paz-curtain linear both;
			animation-timeline: view();
			animation-range: entry 0% entry 85%;
		}
		:is(.ps-path-photo, .ps-what-photo, .ps-when-grid figure, .ps-personal figure, .oc-intro-photo, .oc-photo) img {
			animation: paz-zoom linear both;
			animation-timeline: view();
			animation-range: entry 0% cover 60%;
		}

		/* Check list: each item slides in and its check pops */
		.ps-checks li {
			animation: paz-slide linear both;
			animation-timeline: view();
			animation-range: entry 10% entry 90%;
		}
		.ps-checks li::before {
			animation: paz-pop linear both;
			animation-timeline: view();
			animation-range: entry 40% entry 100%;
		}
	}
}

@keyframes paz-rise { from { opacity: 0; transform: translateY(26px); } to { opacity: 1; transform: none; } }
@keyframes paz-settle { from { transform: scale(1.08); } to { transform: scale(1); } }
@keyframes paz-reveal { from { opacity: 0; transform: translateY(32px); } to { opacity: 1; transform: none; } }
@keyframes paz-zoom { from { transform: scale(1.14); } to { transform: scale(1); } }
@keyframes paz-slide { from { opacity: 0; transform: translateX(-18px); } to { opacity: 1; transform: none; } }
@keyframes paz-pop { from { transform: scale(0); } 70% { transform: scale(1.15); } to { transform: scale(1); } }
@keyframes paz-progress { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes paz-bar { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes paz-curtain { from { clip-path: inset(18% 0 0 0 round 12px); } to { clip-path: inset(0 0 0 0); } }
@keyframes paz-open { from { opacity: 0; clip-path: inset(0 16% 0 16% round 200px 200px 8px 8px); } to { opacity: 1; clip-path: inset(0 0 0 0 round 140px 140px 8px 8px); } }
@media (max-width: 650px) {
	@keyframes paz-open { from { opacity: 0; clip-path: inset(0 10% 0 10% round 120px 120px 7px 7px); } to { opacity: 1; clip-path: inset(0 0 0 0 round 80px 80px 7px 7px); } }
}
