/**
 * PSAS: Animate-on-scroll + hover helpers (site-wide).
 *
 * Usage: add classes to any block (Advanced → Additional CSS class(es)).
 *
 *   Reveal once when scrolled into view:
 *     psas-anim                     (default effect: fade-up)
 *     psas-anim psas-anim--fade-in
 *     psas-anim psas-anim--fade-up | --fade-down | --slide-left | --slide-right | --zoom-in
 *     + optional  psas-anim--delay-1 … psas-anim--delay-4   (0.15s steps)
 *     + optional  psas-anim--slow | psas-anim--fast
 *
 *   Stagger the direct children of a Columns / Group / List block:
 *     psas-anim-stagger             (children fade up one after another)
 *     psas-anim-stagger psas-anim--zoom-in   (any effect modifier applies to the children)
 *
 *   Hover polish (cards, images, buttons):
 *     psas-hover-lift               (card/tile lifts 4px)
 *     psas-hover-zoom               (on an Image block: photo brightens + soft shadow, no movement)
 *
 * Safety:
 *   - Nothing is hidden unless html.psas-anim-ready is set: by a tiny inline <head> script
 *     (so blocks on screen at load animate without a flash), which removes it again after
 *     3s if psas-anim.js never started. No JS = no hiding; the block editor never hides.
 *   - Visitors with "reduce motion" enabled get no animation at all.
 *   - Only opacity/transform are animated: no layout shift.
 */

.psas-anim,
.psas-anim-stagger > * {
	--psas-anim-x: 0px;
	--psas-anim-y: 28px;
	--psas-anim-scale: 1;
	--psas-anim-duration: 0.7s;
	--psas-anim-delay: 0s;
}

/* Effect modifiers (on .psas-anim itself, or on a .psas-anim-stagger parent) */
.psas-anim--fade-in,
.psas-anim--fade-in.psas-anim-stagger > * { --psas-anim-y: 0px; }
.psas-anim--fade-down,
.psas-anim--fade-down.psas-anim-stagger > * { --psas-anim-y: -28px; }
.psas-anim--slide-left,
.psas-anim--slide-left.psas-anim-stagger > * { --psas-anim-x: 48px; --psas-anim-y: 0px; }
.psas-anim--slide-right,
.psas-anim--slide-right.psas-anim-stagger > * { --psas-anim-x: -48px; --psas-anim-y: 0px; }
.psas-anim--zoom-in,
.psas-anim--zoom-in.psas-anim-stagger > * { --psas-anim-y: 0px; --psas-anim-scale: 0.92; }

.psas-anim--slow,
.psas-anim--slow.psas-anim-stagger > * { --psas-anim-duration: 1.1s; }
.psas-anim--fast,
.psas-anim--fast.psas-anim-stagger > * { --psas-anim-duration: 0.45s; }

.psas-anim--delay-1 { --psas-anim-delay: 0.15s; }
.psas-anim--delay-2 { --psas-anim-delay: 0.3s; }
.psas-anim--delay-3 { --psas-anim-delay: 0.45s; }
.psas-anim--delay-4 { --psas-anim-delay: 0.6s; }

/* Stagger: JS sets --psas-anim-i (0,1,2…) on each child */
.psas-anim-stagger > * {
	--psas-anim-delay: calc(var(--psas-anim-i, 0) * 0.12s);
}

/* Hidden "before" state: ONLY while the script is active and the element hasn't revealed yet */
.psas-anim-ready .psas-anim:not(.is-visible),
.psas-anim-ready .psas-anim-stagger:not(.is-visible) > * {
	opacity: 0;
	transform: translate3d(var(--psas-anim-x), var(--psas-anim-y), 0) scale(var(--psas-anim-scale));
}

/* Explicit resting values with the SAME transform function list as the hidden state, so every
   browser (Firefox especially) interpolates directly instead of via `none`/matrix decomposition. */
.psas-anim-ready .psas-anim.is-visible,
.psas-anim-ready .psas-anim-stagger.is-visible > * {
	opacity: 1;
	transform: translate3d(0, 0, 0) scale(1);
}

.psas-anim-ready .psas-anim,
.psas-anim-ready .psas-anim-stagger > * {
	transition:
		opacity var(--psas-anim-duration) ease var(--psas-anim-delay),
		transform var(--psas-anim-duration) cubic-bezier(0.2, 0.65, 0.3, 1) var(--psas-anim-delay);
}

/* Slide offsets must never create a horizontal scrollbar while elements wait to reveal:
   clip horizontally on the element that CONTAINS a sliding block (or on a sliding stagger
   group). `clip` (unlike `hidden`) creates no scroll container, so position: sticky keeps
   working and vertical overflow (shadows, dropdowns) is untouched. */
.psas-anim-ready :has(> .psas-anim--slide-left),
.psas-anim-ready :has(> .psas-anim--slide-right),
.psas-anim-ready .psas-anim-stagger.psas-anim--slide-left,
.psas-anim-ready .psas-anim-stagger.psas-anim--slide-right {
	overflow-x: clip;
	overflow-clip-margin: 24px; /* keep hover shadows (e.g. event cards) from being trimmed */
}

/* Shorter slide distance on phones */
@media (max-width: 600px) {
	.psas-anim--slide-left,
	.psas-anim--slide-left.psas-anim-stagger > * { --psas-anim-x: 24px; }
	.psas-anim--slide-right,
	.psas-anim--slide-right.psas-anim-stagger > * { --psas-anim-x: -24px; }
}

/* Hover lift (pointer devices only, respects reduced motion) */
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
	/* Resting value declared explicitly (same function list as hover) for smooth Firefox interpolation */
	.psas-hover-lift {
		transform: translate3d(0, 0, 0) scale(1);
		transition: transform 0.25s ease, box-shadow 0.25s ease;
	}

	.psas-hover-lift:hover,
	.psas-hover-lift:focus-within,
	.psas-anim-ready .psas-anim-done.psas-hover-lift:hover,
	.psas-anim-ready .psas-anim-done.psas-hover-lift:focus-within {
		transform: translate3d(0, -4px, 0) scale(1);
	}
}

/* After the reveal has finished (JS adds .psas-anim-done), hover must respond immediately:
   hover-lift elements were inheriting the reveal's 0.7s duration + stagger delay (up to ~0.8s). */
.psas-anim-ready .psas-anim-done.psas-hover-lift {
	transition: transform 0.25s ease, box-shadow 0.25s ease;
}

/* Image hover for Image blocks (class name kept as psas-hover-zoom so existing content works):
   NO movement or scaling (scaling made the photo shimmer/shake on release). The photo just
   brightens slightly and the tile gains a soft shadow. Only filter + box-shadow transition,
   with explicit resting values. */
.psas-hover-zoom {
	overflow: hidden;
	border-radius: 20px;
	box-shadow: 0 0 0 rgba(0, 0, 0, 0);
	transition: box-shadow 0.3s ease;
}

.psas-hover-zoom img {
	filter: brightness(1) saturate(1);
	transition: filter 0.3s ease;
}

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
	.psas-hover-zoom:hover,
	.psas-hover-zoom:focus-within {
		box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
	}

	.psas-hover-zoom:hover img,
	.psas-hover-zoom:focus-within img {
		filter: brightness(1.08) saturate(1.1);
	}
}

@media (prefers-reduced-motion: reduce) {
	.psas-anim,
	.psas-anim-stagger > * {
		opacity: 1 !important;
		transform: none !important;
		transition: none !important;
	}
}

/* ==========================================================================
   ShelterSync Animal Grid Progressive Lazy Loading Sentinel & Animations
   ========================================================================== */
.sheltersync-lazy-sentinel {
	display: flex;
	justify-content: center;
	align-items: center;
	padding: 36px 16px 56px 16px;
	width: 100%;
	box-sizing: border-box;
}

.lazy-progress-wrap {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 10px;
	background: #ffffff;
	border: 1px solid #e2e8f0;
	border-radius: 9999px;
	padding: 12px 32px;
	box-shadow: 0 4px 16px -2px rgba(0, 0, 0, 0.06), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
	transition: all 0.25s ease;
}

.lazy-progress-text {
	font-size: 13px;
	font-weight: 500;
	color: #475569;
	letter-spacing: 0.2px;
}

.lazy-progress-text strong {
	color: #0f172a;
	font-weight: 700;
}

.lazy-progress-bar {
	width: 200px;
	height: 5px;
	background: #e2e8f0;
	border-radius: 9999px;
	overflow: hidden;
}

.lazy-progress-fill {
	height: 100%;
	background: linear-gradient(90deg, #5baec2 0%, #00b4d8 100%);
	border-radius: 9999px;
	transition: width 0.35s cubic-bezier(0.2, 0.65, 0.3, 1);
}

.lazy-scroll-hint {
	font-size: 11px;
	color: #94a3b8;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	font-weight: 600;
}

.lazy-completed-wrap {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	font-size: 14px;
	font-weight: 600;
	color: #475569;
	background: #f8fafc;
	border: 1.5px dashed #cbd5e1;
	border-radius: 9999px;
	padding: 12px 32px;
}

.lazy-completed-wrap strong {
	color: #0f172a;
}

