/*
 * Kawaii World: a centred card with the friends taking turns peeking out
 * of its corners and edges, each on the same 5.2s loop, staggered.
 *
 * Colours and spacing come from the theme's presets, with the design's
 * values as fallbacks so the block still looks right under another theme.
 */
.wp-block-kawaii-kawaii-world {
	box-sizing: border-box;
	padding: var(--wp--preset--spacing--50, 70px) var(--wp--preset--spacing--40, 30px);
}

.wp-block-kawaii-kawaii-world:not(.alignfull):not(.alignwide) {
	max-width: var(--wp--style--global--content-size, 645px);
}

.kawaii-world__stage {
	position: relative;
	max-width: var(--wp--style--global--wide-size, 1200px);
	margin-right: auto;
	margin-left: auto;
}

.kawaii-world__card {
	box-sizing: border-box;
	padding: 45px 45px 49px;
	border: 1px solid var(--wp--preset--color--accent-6, #f0e5ec);
	border-radius: 30px;
	background-color: #fff;
	box-shadow: 0 12px 35px rgba(80, 50, 80, 0.09);
	text-align: center;
}

/* A centred block rather than inline-block, so the card's taller text
   line does not push it down. */
.kawaii-world__card .kawaii-world__eyebrow {
	display: block;
	width: fit-content;
	margin: 0 auto;
	padding: 9px 15px;
	border-radius: 999px;
	background: #fff;
	color: #8b6280;
	font-size: 11px;
	font-weight: 900;
	line-height: normal;
	text-transform: uppercase;
}

/* A fixed size, as in the design; fluid typography would shrink it. */
.kawaii-world__card .kawaii-world__title {
	margin: 17px 0;
	color: var(--wp--preset--color--contrast, #302a3a);
	font-size: 34px;
	letter-spacing: normal;
	line-height: normal;
}

.kawaii-world__card .kawaii-world__text {
	margin: 7px 0 0;
	color: var(--wp--preset--color--accent-4, #746a78);
	font-size: 14px;
	line-height: 1.8;
}

.kawaii-world__actions {
	display: flex;
	justify-content: center;
	margin-top: 15px;
}

.kawaii-world__actions .wp-block-button {
	line-height: 0;
}

.kawaii-world__card .kawaii-world__button {
	display: inline-block;
	padding: 14px 20px;
	border-radius: 999px;
	background-color: var(--wp--preset--color--accent-1, #ff79a7);
	color: var(--wp--preset--color--base, #fffafc);
	font-size: 12px;
	font-weight: 900;
	letter-spacing: normal;
	line-height: normal;
	text-decoration: none;
	text-transform: uppercase;
}

.kawaii-world__peek.kawaii-world__peek {
	position: absolute;
	z-index: 3;
	width: 80px;
	margin: 0;
	pointer-events: none;
	filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.15));
	opacity: 0;
	transform-origin: center;
	will-change: transform, opacity;
}

.kawaii-world__peek img {
	display: block;
	width: 100%;
	height: auto;
}

/*
 * As in the static design: every spot runs the same 5.2s loop, staggered
 * by 0.65s, so the friends pop out one after another around the card. A
 * friend springs out to 1.1x with a little overshoot and tilt, settles,
 * stays a moment and tucks back in; view.js gives it a new image while it
 * is hidden, never a friend that is still out at another spot.
 *
 * Every spot has its own keyframes with fixed values, rather than shared
 * keyframes reading custom properties, so the browser can run them on the
 * compositor; with var() they ran on the main thread and stuttered.
 */
.kawaii-world__peek--tl {
	top: 0;
	left: 0;
	animation: kawaii-peek-tl 5.2s 0s infinite;
}

.kawaii-world__peek--tr {
	top: 0;
	right: 0;
	animation: kawaii-peek-tr 5.2s 0.65s infinite;
}

.kawaii-world__peek--br {
	right: 0;
	bottom: 0;
	animation: kawaii-peek-br 5.2s 1.3s infinite;
}

.kawaii-world__peek--bl {
	bottom: 0;
	left: 0;
	animation: kawaii-peek-bl 5.2s 1.95s infinite;
}

.kawaii-world__peek--t {
	top: -6px;
	left: 41%;
	animation: kawaii-peek-t 5.2s 2.6s infinite;
}

.kawaii-world__peek--b {
	bottom: -6px;
	left: 62%;
	animation: kawaii-peek-b 5.2s 3.9s infinite;
}

@keyframes kawaii-peek-tl {
	0%,
	12% {
		transform: translate(28px, 28px) scale(0.35) rotate(-16deg);
		opacity: 0;
		animation-timing-function: cubic-bezier(0.34, 1.56, 0.64, 1);
	}

	32% {
		transform: translate(-17px, -17px) scale(1.1) rotate(6deg);
		opacity: 1;
		animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
	}

	42%,
	62% {
		transform: translate(-14px, -14px) scale(1) rotate(0deg);
		opacity: 1;
		animation-timing-function: cubic-bezier(0.6, 0, 0.3, 1);
	}

	88%,
	100% {
		transform: translate(28px, 28px) scale(0.35) rotate(-16deg);
		opacity: 0;
	}
}

@keyframes kawaii-peek-tr {
	0%,
	12% {
		transform: translate(-28px, 28px) scale(0.35) rotate(16deg);
		opacity: 0;
		animation-timing-function: cubic-bezier(0.34, 1.56, 0.64, 1);
	}

	32% {
		transform: translate(17px, -17px) scale(1.1) rotate(-6deg);
		opacity: 1;
		animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
	}

	42%,
	62% {
		transform: translate(14px, -14px) scale(1) rotate(0deg);
		opacity: 1;
		animation-timing-function: cubic-bezier(0.6, 0, 0.3, 1);
	}

	88%,
	100% {
		transform: translate(-28px, 28px) scale(0.35) rotate(16deg);
		opacity: 0;
	}
}

@keyframes kawaii-peek-br {
	0%,
	12% {
		transform: translate(-28px, -28px) scale(0.35) rotate(-16deg);
		opacity: 0;
		animation-timing-function: cubic-bezier(0.34, 1.56, 0.64, 1);
	}

	32% {
		transform: translate(17px, 17px) scale(1.1) rotate(6deg);
		opacity: 1;
		animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
	}

	42%,
	62% {
		transform: translate(14px, 14px) scale(1) rotate(0deg);
		opacity: 1;
		animation-timing-function: cubic-bezier(0.6, 0, 0.3, 1);
	}

	88%,
	100% {
		transform: translate(-28px, -28px) scale(0.35) rotate(-16deg);
		opacity: 0;
	}
}

@keyframes kawaii-peek-bl {
	0%,
	12% {
		transform: translate(28px, -28px) scale(0.35) rotate(16deg);
		opacity: 0;
		animation-timing-function: cubic-bezier(0.34, 1.56, 0.64, 1);
	}

	32% {
		transform: translate(-17px, 17px) scale(1.1) rotate(-6deg);
		opacity: 1;
		animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
	}

	42%,
	62% {
		transform: translate(-14px, 14px) scale(1) rotate(0deg);
		opacity: 1;
		animation-timing-function: cubic-bezier(0.6, 0, 0.3, 1);
	}

	88%,
	100% {
		transform: translate(28px, -28px) scale(0.35) rotate(16deg);
		opacity: 0;
	}
}

@keyframes kawaii-peek-t {
	0%,
	12% {
		transform: translate(-50%, 40px) scale(0.35) rotate(-10deg);
		opacity: 0;
		animation-timing-function: cubic-bezier(0.34, 1.56, 0.64, 1);
	}

	32% {
		transform: translate(-50%, -6px) scale(1.1) rotate(4deg);
		opacity: 1;
		animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
	}

	42%,
	62% {
		transform: translate(-50%, 0) scale(1) rotate(0deg);
		opacity: 1;
		animation-timing-function: cubic-bezier(0.6, 0, 0.3, 1);
	}

	88%,
	100% {
		transform: translate(-50%, 40px) scale(0.35) rotate(-10deg);
		opacity: 0;
	}
}

@keyframes kawaii-peek-b {
	0%,
	12% {
		transform: translate(-50%, -40px) scale(0.35) rotate(10deg);
		opacity: 0;
		animation-timing-function: cubic-bezier(0.34, 1.56, 0.64, 1);
	}

	32% {
		transform: translate(-50%, 6px) scale(1.1) rotate(-4deg);
		opacity: 1;
		animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
	}

	42%,
	62% {
		transform: translate(-50%, 0) scale(1) rotate(0deg);
		opacity: 1;
		animation-timing-function: cubic-bezier(0.6, 0, 0.3, 1);
	}

	88%,
	100% {
		transform: translate(-50%, -40px) scale(0.35) rotate(10deg);
		opacity: 0;
	}
}

/* A spot with no friend free for its turn (view.js) stays empty. */
.kawaii-world__peek.is-resting img {
	visibility: hidden;
}

@media (max-width: 1050px) {
	.kawaii-world__peek.kawaii-world__peek {
		width: 50px;
	}
}

@media (max-width: 650px) {
	.kawaii-world__peek.kawaii-world__peek {
		width: 36px;
	}

	.kawaii-world .kawaii-world__stage {
		max-width: 300px;
	}

	.kawaii-world__card.kawaii-world__card {
		padding: 20px;
	}

	.kawaii-world__card .kawaii-world__eyebrow {
		padding: 0;
	}

	.kawaii-world__card .kawaii-world__title {
		font-size: 29px;
	}
}

@media (max-width: 380px) {
	.kawaii-world .kawaii-world__stage {
		max-width: 288px;
	}
}

/* Without motion the first friend simply sits where it would rest, and the
   others stay tucked away. */
@media (prefers-reduced-motion: reduce) {
	.kawaii-world__peek.kawaii-world__peek {
		animation: none;
	}

	.kawaii-world__peek.kawaii-world__peek:first-child {
		opacity: 1;
	}

	.kawaii-world__peek--tl { transform: translate(-14px, -14px); }
	.kawaii-world__peek--tr { transform: translate(14px, -14px); }
	.kawaii-world__peek--br { transform: translate(14px, 14px); }
	.kawaii-world__peek--bl { transform: translate(-14px, 14px); }
	.kawaii-world__peek--t { transform: translateX(-50%); }
	.kawaii-world__peek--b { transform: translateX(-50%); }
}

/*
 * In the editor the friends animate as on the front end, but can be clicked
 * to swap their image. Hovering a spot holds its friend in view, at its
 * resting pose, so it is easy to click even between peeks.
 */
.kawaii-world.is-editor .kawaii-world__peek.kawaii-world__peek {
	cursor: pointer;
	pointer-events: auto;
}

.kawaii-world.is-editor .kawaii-world__peek.kawaii-world__peek:hover {
	opacity: 1;
	animation: none;
	outline: 2px dashed var(--wp--preset--color--accent-1, #ff79a7);
	outline-offset: 4px;
	border-radius: 8px;
}

/* A resting spot (a repeated friend) shows on hover too, to be replaced. */
.kawaii-world.is-editor .kawaii-world__peek.is-resting:hover img {
	visibility: visible;
}

.kawaii-world.is-editor .kawaii-world__peek--tl:hover { transform: translate(-14px, -14px); }
.kawaii-world.is-editor .kawaii-world__peek--tr:hover { transform: translate(14px, -14px); }
.kawaii-world.is-editor .kawaii-world__peek--br:hover { transform: translate(14px, 14px); }
.kawaii-world.is-editor .kawaii-world__peek--bl:hover { transform: translate(-14px, 14px); }
.kawaii-world.is-editor .kawaii-world__peek--t:hover { transform: translateX(-50%); }
.kawaii-world.is-editor .kawaii-world__peek--b:hover { transform: translateX(-50%); }
