/* Header wordmark: the letters slam in one at a time, then a short glitch ripples across
   them now and then while the whole mark drifts. Visitors who prefer reduced motion see
   the still logo. See inc/hero-logo.php. */

.dstb-hero-logo a {
	position: relative;
	display: block;
	width: fit-content;
	max-width: 100%;
	margin-inline: auto;
	line-height: 0;
}
.dstb-hero-logo a > img {
	vertical-align: top;
}
.dstb-letters {
	display: none;
}

@media screen and (prefers-reduced-motion: no-preference) {
	.dstb-hero-logo a:has(.dstb-letters) > img {
		opacity: 0;
	}
	.dstb-hero-logo a:has(.dstb-letters) {
		animation: dstb-drift 9s ease-in-out 1.8s infinite;
	}
	.dstb-letters,
	.dstb-letters span {
		position: absolute;
		inset: 0;
		display: block;
		pointer-events: none;
	}
	.dstb-letters span {
		background: var(--logo) 0 0 / 100% 100% no-repeat;
		clip-path: inset(-20% var(--right) -20% var(--left));
		transform-origin: var(--mid) 50%;
		animation:
			dstb-slam 0.65s cubic-bezier(0.2, 0.9, 0.25, 1) calc(0.25s + var(--i) * 0.09s) backwards,
			dstb-glitch 7s linear calc(3s + var(--i) * 0.045s) infinite;
	}
}

@keyframes dstb-slam {
	0% {
		opacity: 0;
		transform: translateY(-10%) scale(1.45);
		filter: blur(8px);
	}
	50% {
		opacity: 1;
		transform: translateY(2%) scale(0.96);
		filter: blur(0) drop-shadow(-5px 0 0 rgba(189, 48, 14, 0.9));
	}
	64% {
		opacity: 0.35;
		transform: translateX(3px);
	}
	78% {
		opacity: 1;
		transform: translateX(-2px);
		filter: drop-shadow(3px 0 0 rgba(189, 48, 14, 0.6));
	}
	100% {
		opacity: 1;
		transform: none;
		filter: none;
	}
}

/* Still for most of the cycle; the jolt takes about a third of a second per letter. */
@keyframes dstb-glitch {
	0%,
	5%,
	100% {
		transform: none;
		filter: none;
	}
	1% {
		transform: translate(-3px, 2px) skewX(-9deg);
		filter: drop-shadow(6px 0 0 rgba(189, 48, 14, 0.9));
	}
	2.2% {
		transform: translate(4px, -3px) skewX(6deg) scale(1.05);
		filter: drop-shadow(-5px 0 0 rgba(189, 48, 14, 0.85)) brightness(1.25);
	}
	3.4% {
		transform: translate(-1px, 1px) skewX(-3deg);
		filter: drop-shadow(2px 0 0 rgba(189, 48, 14, 0.6));
	}
}

@keyframes dstb-drift {
	0%,
	100% {
		transform: none;
	}
	50% {
		transform: translateY(-7px) scale(1.012);
	}
}
