/**
 * Polish layer, module "reveal" (docs.ia/build/polish-design.md §16.2,
 * design §8.7, §8.8). Load sequence of the hero, scroll entrances, eyebrow
 * dash, icons that draw. Script 6.1 (reveal) and 6.5 (timeline icons) live
 * in polish.js, gated on this module. Needs the base module (tokens). All
 * motion, part 2 only (design §4): with reduced motion the hero, the
 * reveal targets and their icons render at rest, unanimated.
 *
 * The "services" module's active timeline marker (design §8.5) also needs
 * script 6.5's pathLength="1" setup, which lives here: with this module
 * disabled the marker's stroke-dasharray/dashoffset animation has no
 * pathLength to draw against.
 */

@media screen and (prefers-reduced-motion: no-preference) {
	/* Entrances: time-based, translate/scale only (K19/K20). Hero root
	   verified on all 13 templates; never animates it, a section, or a
	   direct child of main (K30/K31) — only these descendants. */
	@keyframes precoin-hero-dash { from { scale: 0 1; } }
	@keyframes precoin-hero-rise-3 { from { translate: 0 var(--precoin-shift-3); } }
	@keyframes precoin-hero-rise-2 { from { translate: 0 var(--precoin-shift-2); } }
	@keyframes precoin-hero-settle { from { scale: 1.04; } }

	/* Round 5 (owner review): slower entrances. Literal values, not the
	   shared --precoin-t-3/--precoin-t-4/--precoin-stagger tokens (also
	   image zoom, timeline rail, sum sequence) — a custom-property override
	   here would inherit into any of those on a descendant of a reveal
	   target (an article card's own image zoom is one: main li.wp-block-post
	   is itself a reveal target), which is exactly the leak into "the
	   controls' transitions" the owner said this must not cause. */
	:is(main > .wp-block-group.alignfull:first-child, .page-template-page-no-title .entry-content > .wp-block-group.alignfull:first-child) {
		& .has-accent-background-color[style*="min-height:2px"] {
			transform-origin: left;
			animation: precoin-hero-dash 560ms var(--precoin-ease-out) both;
		}
		& h1 {
			animation: precoin-hero-rise-3 560ms var(--precoin-ease-out) both;
		}
		& h1 ~ p:first-of-type {
			animation: precoin-hero-rise-2 560ms var(--precoin-ease-out) both;
			animation-delay: 80ms;
		}
		& .wp-block-buttons:first-of-type {
			animation: precoin-hero-rise-2 560ms var(--precoin-ease-out) both;
			animation-delay: 160ms;
		}
		& .wp-block-buttons:first-of-type + .wp-block-group {
			animation: precoin-hero-rise-2 560ms var(--precoin-ease-out) both;
			animation-delay: 240ms;
		}
		& :is(figure.wp-block-image, figure.wp-block-post-featured-image) {
			overflow: clip;
			& img { animation: precoin-hero-settle 900ms var(--precoin-ease-out) both; }
		}
	}

	/* Reveal below the first screen, driven by assets/js/polish.js §6.1.
	   Round 5: same slower, literal timing as the hero above. */
	.precoin-rv { opacity: 0; translate: 0 var(--precoin-shift-2); }
	.precoin-rv-in {
		transition: opacity 560ms var(--precoin-ease-out), translate 560ms var(--precoin-ease-out);
		transition-delay: calc(var(--precoin-i, 0) * 90ms);
	}
	.precoin-rv .has-accent-background-color[style*="min-height:2px"] {
		scale: 0 1;
		transform-origin: left;
	}
	.precoin-rv-in .has-accent-background-color[style*="min-height:2px"] {
		scale: 1 1;
		transition: scale 560ms var(--precoin-ease-out);
		transition-delay: calc(var(--precoin-i, 0) * 90ms);
	}

	/* Icons that draw: stroke icons in a reveal target. No colour/box change
	   (K44). The active timeline marker's own draw lives in the services
	   module. --precoin-t-pen (the pen speed) is unchanged — not part of
	   this round's request. */
	.precoin-rv svg[fill="none"] [pathLength] { stroke-dasharray: 1; stroke-dashoffset: 1; }
	.precoin-rv-in svg[fill="none"] [pathLength] {
		stroke-dasharray: 1;
		stroke-dashoffset: 0;
		transition: stroke-dashoffset var(--precoin-t-pen) var(--precoin-ease-out);
		transition-delay: calc(var(--precoin-i, 0) * 90ms + 120ms);
	}
}
