/* <i4k-flip>: letters flip one after another (around the text line) when
   their link/button is hovered or focused, like the frame's letters */

:root {
	--t-flip: 0.7s;
	--t-flip-step: 0.04s;
	--e-flip: cubic-bezier(0.45, 0, 0.55, 1);
}

/* letters are inline-blocks (to rotate), which don't get the parent's
   underline: each letter draws its own, and it flips along */
i4k-flip,
i4k-flip span {
	text-decoration: inherit;
}

i4k-flip span {
	display: inline-block;
}

:is(a, button):is(:hover, :focus-visible) i4k-flip span {
	animation: i4k-flip var(--t-flip) var(--e-flip) both;
	animation-delay: calc(var(--i) * var(--t-flip-step));
}

@keyframes i4k-flip {
	to {
		transform: rotateX(1turn);
	}
}

@media (prefers-reduced-motion: reduce) {
	:is(a, button):is(:hover, :focus-visible) i4k-flip span {
		animation: none;
	}
}
