/*
 * ux.css — Frontend enrichment (Batch 1, Level-0, zero-backend)
 * Hand-written CSS served at /static/css/ux.css.
 * (router maps r.Static("/static", "./assets"), so this file lives in assets/css.)
 *
 * Pairs with /static/js/ux.js. All effects are opt-in via data-* attributes
 * and degrade gracefully (no JS, no IntersectionObserver, reduced-motion).
 */

/* ---- Scroll reveal -------------------------------------------------------
   Opt-in via [data-reveal]. ux.js adds .is-visible when the element scrolls
   into view. Optional per-item stagger via [data-reveal-delay] -> --reveal-delay. */
[data-reveal] {
	opacity: 0;
	transform: translateY(16px);
	transition: opacity 0.5s ease, transform 0.5s ease;
	transition-delay: var(--reveal-delay, 0ms);
	will-change: opacity, transform;
}
[data-reveal].is-visible {
	opacity: 1;
	transform: none;
}

/* ---- Lazy image fade -----------------------------------------------------
   Opt-in via [data-fade] on <img>. Gated on html.ux-ready so images stay
   visible if JS is disabled. ux.js adds .img-loaded once the image loads. */
html.ux-ready img[data-fade] {
	opacity: 0;
	transition: opacity 0.5s ease;
}
html.ux-ready img[data-fade].img-loaded {
	opacity: 1;
}

/* ---- HTMX request affordance --------------------------------------------
   A subtle progress cursor while any HTMX request is in flight. */
.htmx-request {
	cursor: progress;
}

/* Count-up numbers use tabular figures so width does not jitter while animating. */
[data-countup] {
	font-variant-numeric: tabular-nums;
}

/* ---- Reduced motion ------------------------------------------------------
   Honor the user's OS preference: no reveal/fade/view-transition animations. */
@media (prefers-reduced-motion: reduce) {
	[data-reveal],
	html.ux-ready img[data-fade] {
		opacity: 1 !important;
		transform: none !important;
		transition: none !important;
	}
	::view-transition-group(*),
	::view-transition-old(*),
	::view-transition-new(*) {
		animation: none !important;
	}
}
