/* Peeker: a crew member rising from behind a card. The body box clips the character at the
   card's top edge, so only head, shoulders and the waving arm show. */
.has-peeker {
	position: relative;
	z-index: 1;
	margin-top: 3.5rem;   /* room for the crew member above the card */
}

.fratoz-peeker {
	position: absolute;
	z-index: 0;
	width: 190px;
	height: 132px;
	pointer-events: none;
}

.fratoz-peeker__body {
	position: absolute;
	right: 0;
	bottom: 0;
	left: 0;
	height: 112px;
	/* clip only at the card's edge; the waving hand may swing out to the sides and up */
	clip-path: inset(-200px -200px 0 -200px);
}

.fratoz-peeker__body svg {
	position: absolute;
	top: 0;
	left: 50%;
	width: auto;
	height: 290px;
	overflow: visible;   /* the waving hand swings past the drawing's edge */
	color: var(--wp--preset--color--ink, #141414);
	transform: translate(-50%, 105%);
	transition: transform 0.45s cubic-bezier(0.5, 0, 0.75, 0);
	filter: drop-shadow(2px 0 0 #fff) drop-shadow(-2px 0 0 #fff) drop-shadow(0 -2px 0 #fff);
}

.fratoz-peeker.is-flip .fratoz-peeker__body svg {
	transform: translate(-50%, 105%) scaleX(-1);
}

.fratoz-peeker.is-up .fratoz-peeker__body svg {
	transform: translate(-50%, 24px);
	transition: transform 0.5s cubic-bezier(0.34, 1.5, 0.64, 1);
}

.fratoz-peeker.is-up.is-flip .fratoz-peeker__body svg {
	transform: translate(-50%, 24px) scaleX(-1);
}

/* the wave: forearm swings at the elbow, hand wiggles at the wrist, head tilts along */
.fratoz-peeker.is-waving .fz-arm {
	animation: fratoz-peek-arm 0.55s ease-in-out infinite alternate;
}

.fratoz-peeker.is-waving .fz-hand {
	animation: fratoz-peek-hand 0.28s ease-in-out infinite alternate;
}

.fratoz-peeker.is-waving .fz-head {
	animation: fratoz-peek-head 1.1s ease-in-out infinite alternate;
}

@keyframes fratoz-peek-arm {
	from { transform: rotate(-8deg); }
	to { transform: rotate(12deg); }
}

@keyframes fratoz-peek-hand {
	from { transform: rotate(-16deg); }
	to { transform: rotate(14deg); }
}

@keyframes fratoz-peek-head {
	from { transform: rotate(-3deg); }
	to { transform: rotate(5deg); }
}

/* speech bubble, above the shoulder away from the waving hand */
.fratoz-peeker__bubble {
	position: absolute;
	top: 34px;
	right: -6px;
	padding: 0.3rem 0.65rem 0.25rem;
	border: 2px solid var(--wp--preset--color--ink, #141414);
	border-radius: 999px 999px 999px 4px;
	background: #fff;
	color: var(--wp--preset--color--ink, #141414);
	font-family: var(--wp--preset--font-family--montserrat, inherit);
	font-size: 0.9375rem;
	font-weight: 900;
	line-height: 1.2;
	white-space: nowrap;
	opacity: 0;
	transform: translateY(8px) scale(0.6);
	transform-origin: 0% 100%;
	transition: opacity 0.2s ease, transform 0.25s ease;
}

.fratoz-peeker.is-flip .fratoz-peeker__bubble {
	right: auto;
	left: -6px;
	border-radius: 999px 999px 4px 999px;
	transform-origin: 100% 100%;
}

.fratoz-peeker.is-talking .fratoz-peeker__bubble {
	opacity: 1;
	transform: none;
	transition: opacity 0.2s ease, transform 0.4s cubic-bezier(0.34, 1.8, 0.64, 1);
}

@media (prefers-reduced-motion: reduce) {
	.fratoz-peeker {
		display: none;
	}
}
