/*
 * La Capacciola — motion layer.
 * Everything here is progressive enhancement: with no JavaScript, with prefers-reduced-motion,
 * or in browsers without scroll-driven animations the page renders fully visible and still.
 * Only transform and opacity are animated.
 */

.is-zone-rehub { overflow: clip; }

@media (prefers-reduced-motion: no-preference) {

	/* ---- reveal on scroll ---- */
	.lc-motion .lc-reveal {
		opacity: 0;
		transform: translate3d(0, var(--lc-rise, 24px), 0);
		will-change: opacity, transform;
	}
	/* Transitions are switched on only after the hidden state has been painted, so nothing flickers on load. */
	.lc-motion.lc-motion-ready .lc-reveal {
		transition:
			opacity 700ms var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1)),
			transform 900ms var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1));
		transition-delay: var(--lc-delay, 0ms);
	}
	.lc-motion .lc-reveal--title { --lc-rise: 44px; }
	/* The element keeps its compositing layer at rest (translate3d(0,0,0), will-change untouched):
	   dropping the layer when the transition ends re-rasterises the text and reads as a small snap. */
	.lc-motion .lc-reveal.is-inview {
		opacity: 1;
		transform: translate3d(0, 0, 0);
	}

	/* ---- parallax: scroll-driven, runs on the compositor ----
	   A script that moves the photo on every scroll event always lags the compositor-scrolled page by a
	   frame, and the photo "snaps" into place when the scroll stops. Scroll-linked CSS animations are
	   evaluated by the compositor itself, so they stay locked to the page. Browsers without support
	   simply show the photo still. */
	@supports (animation-timeline: view()) {
		.wp-block-cover .wp-block-cover__image-background {
			top: -12%;
			height: 124%;
			will-change: translate;
			animation: lc-photo-drift linear both;
			animation-timeline: view();
			animation-range: entry 0% exit 100%;
		}
		/* The first photo of a page starts at rest and only drifts once it begins to leave. */
		.is-align-system > .wp-block-cover:first-child .wp-block-cover__image-background {
			animation-name: lc-photo-drift-hero;
			animation-range: exit 0% exit 100%;
		}
		/* Re|Hub display title crosses the screen sideways. */
		.is-zone-rehub h2.wp-block-heading {
			will-change: translate;
			animation: lc-title-drift linear both;
			animation-timeline: view();
			animation-range: cover 0% cover 100%;
		}
	}
	@keyframes lc-photo-drift      { from { translate: 0 -9%; } to { translate: 0 9%; } }
	@keyframes lc-photo-drift-hero { from { translate: 0 0; }   to { translate: 0 9%; } }
	@keyframes lc-title-drift      { from { translate: 4vw 0; } to { translate: -4vw 0; } }

	/* ---- quiet image hover (clipped inside its frame) ---- */
	.wp-block-post-featured-image,
	.wp-block-gallery .wp-block-image { overflow: hidden; }
	.wp-block-post-featured-image img,
	.wp-block-gallery .wp-block-image img {
		transition: transform 700ms var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1));
	}
	.wp-block-post-featured-image a:hover img,
	.wp-block-gallery .wp-block-image a:hover img { transform: scale(1.035); }
}

/* ---- news cards ---- */
.wp-block-post-template .wp-block-post-title { margin: 0.6rem 0 0.4rem; line-height: 1.2; }
.wp-block-post-template .wp-block-post-title a { color: inherit; text-decoration: none; }
.wp-block-post-template .wp-block-post-title a:hover,
.wp-block-post-template .wp-block-post-title a:focus-visible { text-decoration: underline; text-underline-offset: 0.2em; }
.wp-block-post-template .wp-block-post-date { margin: 0.75rem 0 0; }
.wp-block-post-template .wp-block-post-excerpt { margin-top: 0.5rem; font-size: var(--wp--preset--font-size--small); }
.wp-block-post-template .wp-block-post-excerpt__more-link { white-space: nowrap; }
.wp-block-query-pagination { margin-top: 2rem; gap: 1rem; }

/* ---- single news article ---- */
.lc-article__head { padding: var(--wp--preset--spacing--xl, 3rem) 0 var(--wp--preset--spacing--md, 1.5rem); }
.lc-article__meta {
	margin: 0 0 0.75rem;
	font-size: var(--wp--preset--font-size--x-small);
	text-transform: uppercase;
	letter-spacing: var(--wp--custom--tracking-label);
	color: var(--wp--preset--color--ink-2);
}
.lc-article__head h1 { margin: 0; }
.lc-article__cover img { width: 100%; height: auto; display: block; }
.lc-article__back { margin: var(--wp--preset--spacing--xl, 3rem) 0; }
