/* =========================================================================
 * Z DIZAJN - motion
 *
 * One gesture for the whole site: content settles up into place, once. The
 * documentation is explicit that the movement must be calm - "bez agresivnog
 * zooma, naglih prijelaza ili dodatnih efekata" - so there is no parallax,
 * nothing repeats on scroll-back, and nothing moves while being read.
 *
 * Everything here is gated on html.zd-motion, which js/motion.js adds only
 * when it runs and the visitor has not asked for reduced motion. Without that
 * class the page renders plainly - a broken script can never leave a section
 * invisible.
 * ====================================================================== */

.zd-motion [data-zd-reveal] {
	opacity: 0;
	transform: translate3d(0, 18px, 0);
	transition: opacity var(--zd-dur-slow) var(--zd-ease),
		transform var(--zd-dur-slow) var(--zd-ease);
	will-change: opacity, transform;
}

.zd-motion [data-zd-reveal].is-in {
	opacity: 1;
	transform: none;
}

/* Once it has arrived, drop the hint - keeping a layer per element for the
   rest of the session costs memory on long pages for no benefit. */
.zd-motion [data-zd-reveal].is-in {
	will-change: auto;
}

/* -------------------------------------------------------------------------
 * Image bands
 *
 * The photograph settles at the same time as the text, from very slightly
 * over-scaled. It reads as the image coming to rest rather than as a zoom -
 * the documentation calls for an effect that is "gotovo neprimjetan".
 * ---------------------------------------------------------------------- */

.zd-motion .zd-imgband__media img {
	transform: scale(1.06);
	transition: transform 1.6s var(--zd-ease);
}

.zd-motion .zd-imgband:has([data-zd-reveal].is-in) .zd-imgband__media img {
	transform: scale(1);
}

/* -------------------------------------------------------------------------
 * Hover
 *
 * Project and journal cards lift their image a touch. The split has its own,
 * larger gesture in sections.css and is deliberately left alone.
 * ---------------------------------------------------------------------- */

.portfolio-item-wrapp img,
.post-item img {
	transition: transform var(--zd-dur-slow) var(--zd-ease),
		filter var(--zd-dur-slow) var(--zd-ease);
}

@media (hover: hover) {
	.portfolio-item-wrapp:hover img,
	.post-item:hover img {
		transform: scale(1.035);
	}
}

/* -------------------------------------------------------------------------
 * The opt-out, stated twice on purpose: the class gate above depends on JS,
 * this one does not.
 * ---------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
	.zd-motion [data-zd-reveal],
	.zd-motion [data-zd-reveal].is-in {
		opacity: 1;
		transform: none;
		transition: none;
	}

	.zd-motion .zd-imgband__media img {
		transform: none;
		transition: none;
	}
}
