/* Animated SVG and Animated Illustration.
   Artwork starts hidden only when the page's script is running (html.rt-js);
   otherwise, and in the editor, it is simply shown. */
.rt-svg-anim {
	--rt-anim-color: var(--wp--preset--color--accent-3, currentColor);
	position: relative;
	width: 100%;
	max-width: 540px;
	margin-inline: auto;
	color: var(--rt-anim-color);
}
.rt-svg-anim.alignwide, .rt-svg-anim.alignfull { max-width: none; }
.rt-svg-anim svg { display: block; width: 100%; height: auto; overflow: visible; }
.rt-svg-anim svg :is(defs, clipPath, mask) * { animation: none !important; stroke-dasharray: none !important; stroke-dashoffset: 0 !important; }

/* Draw */
.rt-js .rt-svg-anim.rt-effect-draw:not(.is-visible) svg :is(path, circle, ellipse, line, polyline, polygon, rect) { stroke-dasharray: 100; stroke-dashoffset: 100; }
.rt-svg-anim.rt-effect-draw.is-visible svg :is(path, circle, ellipse, line, polyline, polygon, rect) { stroke-dasharray: 100; animation: rt-draw var(--rt-anim-duration, 2.5s) ease-in-out var(--rt-anim-delay, 0s) both; }

/* Fade and grow */
.rt-js .rt-svg-anim.rt-effect-fade:not(.is-visible), .rt-js .rt-svg-anim.rt-effect-grow:not(.is-visible) { opacity: 0; }
.rt-svg-anim.rt-effect-fade.is-visible { animation: rt-fade var(--rt-anim-duration, 2.5s) ease var(--rt-anim-delay, 0s) both; }
.rt-svg-anim.rt-effect-grow.is-visible { animation: rt-grow var(--rt-anim-duration, 2.5s) ease-out var(--rt-anim-delay, 0s) both; }

/* Draw, then fill: an outline layer draws over the original artwork, which fades in. */
.rt-svg-anim :is(.rt-layer-fill, .rt-layer-outline, .rt-layer-progress) { display: block; width: 100%; }
.rt-svg-anim .rt-layer-outline { position: absolute; inset: 0; pointer-events: none; }
.rt-svg-anim .rt-layer-outline svg image { display: none; }
.rt-js .rt-svg-anim.rt-effect-draw-fill:not(.is-visible) .rt-layer-fill { opacity: 0; }
.rt-js .rt-svg-anim.rt-effect-draw-fill:not(.is-visible) .rt-layer-outline svg :is(path, circle, ellipse, line, polyline, polygon, rect) { stroke-dasharray: 100; stroke-dashoffset: 100; }
.rt-svg-anim.rt-effect-draw-fill:not(.is-visible) .rt-layer-outline { opacity: 0; }
.rt-js .rt-svg-anim.rt-effect-draw-fill:not(.is-visible) .rt-layer-outline { opacity: 1; }
.rt-svg-anim.rt-effect-draw-fill.is-visible .rt-layer-fill { animation: rt-fill-in var(--rt-anim-duration, 2.5s) ease var(--rt-anim-delay, 0s) both; }
.rt-svg-anim.rt-effect-draw-fill.is-visible .rt-layer-outline svg :is(path, circle, ellipse, line, polyline, polygon, rect) { stroke-dasharray: 100; animation: rt-outline var(--rt-anim-duration, 2.5s) ease var(--rt-anim-delay, 0s) both; }

/* Reveal (fill across) */
.rt-js .rt-svg-anim.rt-effect-progressive-fill:not(.is-visible) .rt-layer-progress { clip-path: inset(100% 0 0 0); }
.rt-js .rt-svg-anim.rt-effect-progressive-fill.rt-fill-from-top:not(.is-visible) .rt-layer-progress { clip-path: inset(0 0 100% 0); }
.rt-js .rt-svg-anim.rt-effect-progressive-fill.rt-fill-from-left:not(.is-visible) .rt-layer-progress { clip-path: inset(0 100% 0 0); }
.rt-js .rt-svg-anim.rt-effect-progressive-fill.rt-fill-from-right:not(.is-visible) .rt-layer-progress { clip-path: inset(0 0 0 100%); }
.rt-svg-anim.rt-effect-progressive-fill.is-visible .rt-layer-progress { animation: rt-reveal-bottom var(--rt-anim-duration, 2.5s) ease-in-out var(--rt-anim-delay, 0s) both; }
.rt-svg-anim.rt-effect-progressive-fill.rt-fill-from-top.is-visible .rt-layer-progress { animation-name: rt-reveal-top; }
.rt-svg-anim.rt-effect-progressive-fill.rt-fill-from-left.is-visible .rt-layer-progress { animation-name: rt-reveal-left; }
.rt-svg-anim.rt-effect-progressive-fill.rt-fill-from-right.is-visible .rt-layer-progress { animation-name: rt-reveal-right; }

@keyframes rt-draw { from { stroke-dashoffset: 100; } to { stroke-dashoffset: 0; } }
@keyframes rt-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rt-grow { from { opacity: 0; transform: scale(.86); } to { opacity: 1; transform: scale(1); } }
@keyframes rt-fill-in { 0%, 55% { opacity: 0; } 100% { opacity: 1; } }
@keyframes rt-outline { 0% { stroke-dashoffset: 100; opacity: 1; } 60% { stroke-dashoffset: 0; opacity: 1; } 100% { stroke-dashoffset: 0; opacity: 0; } }
@keyframes rt-reveal-bottom { from { clip-path: inset(100% 0 0 0); } to { clip-path: inset(0); } }
@keyframes rt-reveal-top { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0); } }
@keyframes rt-reveal-left { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0); } }
@keyframes rt-reveal-right { from { clip-path: inset(0 0 0 100%); } to { clip-path: inset(0); } }

/* Gutenberg live animation preview. The block uses its normal server-rendered SVG,
   with the same animations as the front end, but starts once on each edit/replay. */
.rt-editor-preview .rt-svg-anim.rt-effect-draw:not(.is-visible) svg :is(path, circle, ellipse, line, polyline, polygon, rect) {
	stroke-dasharray: 100;
	stroke-dashoffset: 100;
}
.rt-editor-preview .rt-svg-anim.rt-effect-fade:not(.is-visible),
.rt-editor-preview .rt-svg-anim.rt-effect-grow:not(.is-visible) { opacity: 0; }
.rt-editor-preview .rt-svg-anim.rt-effect-draw-fill:not(.is-visible) .rt-layer-fill { opacity: 0; }
.rt-editor-preview .rt-svg-anim.rt-effect-draw-fill:not(.is-visible) .rt-layer-outline { opacity: 1; }
.rt-editor-preview .rt-svg-anim.rt-effect-draw-fill:not(.is-visible) .rt-layer-outline svg :is(path, circle, ellipse, line, polyline, polygon, rect) {
	stroke-dasharray: 100;
	stroke-dashoffset: 100;
}
.rt-editor-preview .rt-svg-anim.rt-effect-progressive-fill:not(.is-visible) .rt-layer-progress { clip-path: inset(100% 0 0 0); }
.rt-editor-preview .rt-svg-anim.rt-effect-progressive-fill.rt-fill-from-top:not(.is-visible) .rt-layer-progress { clip-path: inset(0 0 100% 0); }
.rt-editor-preview .rt-svg-anim.rt-effect-progressive-fill.rt-fill-from-left:not(.is-visible) .rt-layer-progress { clip-path: inset(0 100% 0 0); }
.rt-editor-preview .rt-svg-anim.rt-effect-progressive-fill.rt-fill-from-right:not(.is-visible) .rt-layer-progress { clip-path: inset(0 0 0 100%); }
.rt-editor-preview .rt-editor-preview-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 12px; }
.rt-editor-preview .rt-editor-preview-hint { font-size: 12px; color: #666; }

/* Reduced motion: no animation, finished artwork. */
@media (prefers-reduced-motion: reduce) {
	.rt-svg-anim, .rt-svg-anim * { animation: none !important; opacity: 1 !important; transform: none !important; clip-path: none !important; stroke-dashoffset: 0 !important; }
	.rt-svg-anim .rt-layer-outline { display: none; }
}

.rt-svg-native-block { width:100%; max-width:540px; margin-inline:auto; }
.rt-svg-native-block.alignwide, .rt-svg-native-block.alignfull { max-width:none; }
.rt-svg-native-block img { display:block; width:100%; height:auto; }
