/*
 * Motion layer: scroll reveal (plain CSS, no build).
 *
 * Elements rise a few pixels and fade in, once, as they enter the screen.
 * assets/js/motion-reveal.js decides WHAT gets revealed and WHEN (it adds
 * .zd-rv to elements below the fold, then .zd-rv--in as each one enters).
 * This file only says HOW it moves. Values come from the motion tokens in
 * theme.json (settings.custom.motion → --wp--custom--motion--*).
 *
 * Content is never hidden without the script: .zd-rv is only ever added by JS,
 * never to anything visible at load, and never under reduced motion.
 * Task: brain/tasks/task-2026-12-04-reveal-motion/
 */

.zd-rv {
	--zd-rv-duration: var(--wp--custom--motion--reveal--duration, 800ms);
	--zd-rv-ease: var(--wp--custom--motion--easing--out, cubic-bezier(0.16, 1, 0.3, 1));
	--zd-rv-delay: 0ms;

	opacity: 0;
	translate: 0 var(--wp--custom--motion--reveal--distance, 16px);
}

/* Optional soft focus-in. Only when the blur token is non-zero (the script adds
   the class), because any filter, even blur(0), changes stacking and fixed
   positioning for everything inside. */
.zd-rv.zd-rv--blur {
	filter: blur(var(--wp--custom--motion--reveal--blur, 0px));
}

.zd-rv.zd-rv--in {
	opacity: 1;
	translate: 0 0;
	filter: none;
	transition:
		opacity calc(var(--zd-rv-duration) * 0.75) ease-out var(--zd-rv-delay),
		translate var(--zd-rv-duration) var(--zd-rv-ease) var(--zd-rv-delay),
		filter var(--zd-rv-duration) var(--zd-rv-ease) var(--zd-rv-delay);
}

/* Overlays never hide content. The script skips everything inside them, but a
   popup can still receive an element that was already hidden: the doctor's
   „Виж цени“ dialog clones the page's #prices section, `.zd-rv` included, and
   the clone is never observed, so the table stayed at opacity 0 (x-77). Any
   `.zd-rv` that ends up inside a dialog, modal, drawer or popover shows as is. */
:is(dialog, [role="dialog"], [aria-modal="true"], [popover], .modal, .booking-modal, .filters-modal, .side-menu) .zd-rv {
	opacity: 1;
	translate: none;
	filter: none;
	transition: none;
}

@media (prefers-reduced-motion: reduce) {
	.zd-rv,
	.zd-rv.zd-rv--blur {
		opacity: 1;
		translate: none;
		filter: none;
		transition: none;
	}
}

@media print {
	.zd-rv {
		opacity: 1 !important;
		translate: none !important;
		filter: none !important;
	}
}
