/* Revamped GY Pimp My Site: front-end effects. */

/*
 * Two fixed layers. .rgy-pms-top frames the site header (top corners, top
 * strip, top-of-page sticker); in "follow the header" mode the script sets
 * each piece's position and the layer's z-index so corners can tuck behind
 * a floating header bar. .rgy-pms holds bottom artwork and the particles.
 */
.rgy-pms,
.rgy-pms-top {
	--rgy-pms-corner: clamp(96px, 12vw, 190px);
	--rgy-pms-classic: clamp(56px, 10vw, 280px);
	--rgy-pms-strip: 40px;
	--rgy-pms-top: calc(var(--wp-admin--admin-bar--height, 0px) + var(--rgy-pms-offset, 0px));
	position: fixed;
	inset: 0;
	/* Above page content and most headers, below chat buttons and cookie bars (usually 9999+). */
	z-index: 9990;
	pointer-events: none;
	overflow: hidden;
}

.rgy-pms-top {
	z-index: var(--rgy-pms-top-z, 9990);
}

/* In "follow the header" mode the script places the top artwork before it shows. */
.rgy-pms-top-auto .rgy-pms-top:not(.is-placed) {
	visibility: hidden;
}

.rgy-pms__canvas {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
}

/* Artwork pieces: outer box (position, entrance), sway box (idle motion), image. */
.rgy-pms-art {
	position: absolute;
	display: block;
	user-select: none;
}

.rgy-pms-art__sway {
	display: block;
	height: 100%;
}

.rgy-pms-art img {
	display: block;
	max-width: none;
	user-select: none;
}

.rgy-pms-art--corner.is-square,
.rgy-pms-art--corner.is-square img {
	width: var(--rgy-pms-corner);
	height: var(--rgy-pms-corner);
}

.rgy-pms-art--corner.is-classic img {
	width: auto;
	height: auto;
	max-width: var(--rgy-pms-classic);
	max-height: var(--rgy-pms-classic);
	object-fit: contain;
}

.rgy-pms-art--top-left { top: var(--rgy-pms-top); left: 0; }
.rgy-pms-art--top-right { top: var(--rgy-pms-top); right: 0; }
.rgy-pms-art--bottom-left { bottom: 0; left: 0; }
.rgy-pms-art--bottom-right { bottom: 0; right: 0; }

/* Classic stickers are drawn for the bottom-left corner and mirrored. */
.rgy-pms-art--top-left.is-classic img { transform: scaleY(-1); }
.rgy-pms-art--top-right.is-classic img { transform: scale(-1); }
.rgy-pms-art--bottom-right.is-classic img { transform: scaleX(-1); }

.rgy-pms-art--strip {
	left: 0;
	width: 100%;
	height: var(--rgy-pms-strip);
}

.rgy-pms-art__strip {
	display: block;
	width: 100%;
	height: 100%;
	background-repeat: repeat-x;
	background-size: auto 100%;
}

.rgy-pms-art--top-strip { top: var(--rgy-pms-top); }
.rgy-pms-art--top-strip .rgy-pms-art__strip { background-position: left top; }
.rgy-pms-art--bottom-strip { bottom: 0; height: calc(var(--rgy-pms-strip) - 8px); }
.rgy-pms-art--bottom-strip .rgy-pms-art__strip { background-position: left bottom; }

.rgy-pms-art--centre {
	left: 50%;
	translate: -50% 0;
}

.rgy-pms-art--centre img {
	width: auto;
	height: auto;
	max-width: 25vw;
	max-height: 4.5vw;
	min-height: 24px;
}

.rgy-pms-art--top { top: var(--rgy-pms-top); }
.rgy-pms-art--top img { transform: scaleY(-1); }
.rgy-pms-art--bottom { bottom: 0; }

/* Placement exceptions carried over from Pimp my Site 1.3.1. */
.rgy-pms-art--top img[src*="valentine/decoration-4."],
.rgy-pms-art--top img[src*="valentine/decoration-5."] { transform: none; }
.rgy-pms-art--centre img[src*="thanksgiving/decoration-10."],
.rgy-pms-art--centre img[src*="thanksgiving/decoration-11."] { min-height: clamp(50px, 10vw, 140px); }
.rgy-pms-art img[src*="thanksgiving/decoration-7."] { max-height: clamp(50px, 10vw, 90px); }

/* Gentle movement: pop in once placed, then sway or bob. */
.rgy-pms-animate .is-placed .rgy-pms-art {
	animation: rgy-pms-pop 0.9s cubic-bezier(0.18, 1.35, 0.4, 1) backwards;
}

.rgy-pms-animate .is-placed .rgy-pms-art--top-left { --rgy-pms-fx: -28%; --rgy-pms-fy: -28%; animation-delay: 0.05s; }
.rgy-pms-animate .is-placed .rgy-pms-art--top-right { --rgy-pms-fx: 28%; --rgy-pms-fy: -28%; animation-delay: 0.15s; }
.rgy-pms-animate .is-placed .rgy-pms-art--bottom-left { --rgy-pms-fx: -28%; --rgy-pms-fy: 28%; animation-delay: 0.25s; }
.rgy-pms-animate .is-placed .rgy-pms-art--bottom-right { --rgy-pms-fx: 28%; --rgy-pms-fy: 28%; animation-delay: 0.35s; }
.rgy-pms-animate .is-placed .rgy-pms-art--top-strip,
.rgy-pms-animate .is-placed .rgy-pms-art--top { --rgy-pms-fx: 0; --rgy-pms-fy: -90%; animation-delay: 0.2s; }
.rgy-pms-animate .is-placed .rgy-pms-art--bottom-strip,
.rgy-pms-animate .is-placed .rgy-pms-art--bottom { --rgy-pms-fx: 0; --rgy-pms-fy: 90%; animation-delay: 0.3s; }

@keyframes rgy-pms-pop {
	from {
		opacity: 0;
		transform: translate(var(--rgy-pms-fx, 0), var(--rgy-pms-fy, -40%)) scale(0.72);
	}
	to {
		opacity: 1;
		transform: none;
	}
}

.rgy-pms-animate .rgy-pms-art--top-left .rgy-pms-art__sway {
	transform-origin: 0 0;
	animation: rgy-pms-sway 5.6s ease-in-out -1s infinite alternate;
}

.rgy-pms-animate .rgy-pms-art--top-right .rgy-pms-art__sway {
	transform-origin: 100% 0;
	animation: rgy-pms-sway 6.2s ease-in-out -3.4s infinite alternate-reverse;
}

.rgy-pms-animate .rgy-pms-art--top .rgy-pms-art__sway {
	transform-origin: 50% 0;
	animation: rgy-pms-sway 4.6s ease-in-out -2s infinite alternate;
}

.rgy-pms-animate .rgy-pms-art--top-strip .rgy-pms-art__sway {
	transform-origin: 50% 0;
	animation: rgy-pms-swing 3.8s ease-in-out infinite alternate;
}

.rgy-pms-animate .rgy-pms-art--bottom-left .rgy-pms-art__sway {
	transform-origin: 0 100%;
	animation: rgy-pms-bob 3.4s ease-in-out -0.8s infinite alternate;
}

.rgy-pms-animate .rgy-pms-art--bottom-right .rgy-pms-art__sway {
	transform-origin: 100% 100%;
	animation: rgy-pms-bob 3.9s ease-in-out -2.1s infinite alternate;
}

.rgy-pms-animate .rgy-pms-art--bottom .rgy-pms-art__sway,
.rgy-pms-animate .rgy-pms-art--bottom-strip .rgy-pms-art__sway {
	transform-origin: 50% 100%;
	animation: rgy-pms-bob 3.6s ease-in-out -1.4s infinite alternate;
}

@keyframes rgy-pms-sway {
	from { transform: rotate(-2.4deg); }
	to { transform: rotate(2.4deg); }
}

@keyframes rgy-pms-swing {
	from { transform: translateY(0) skewX(-1.2deg); }
	to { transform: translateY(2px) skewX(1.2deg); }
}

@keyframes rgy-pms-bob {
	from { transform: translateY(0) scale(1); }
	to { transform: translateY(-4px) scale(1.03); }
}

/* Phones. */
@media (max-width: 767px) {
	.rgy-pms,
	.rgy-pms-top {
		--rgy-pms-corner: 72px;
		--rgy-pms-classic: 64px;
		--rgy-pms-strip: 26px;
	}

	.rgy-pms-mobile-light .rgy-pms-art--bottom-left,
	.rgy-pms-mobile-light .rgy-pms-art--bottom-right,
	.rgy-pms-mobile-light .rgy-pms-art--bottom {
		display: none;
	}

	/* Designs with artwork only at the bottom keep it on phones. */
	.rgy-pms-mobile-light.rgy-pms-bottom-only .rgy-pms-art--bottom-left,
	.rgy-pms-mobile-light.rgy-pms-bottom-only .rgy-pms-art--bottom-right,
	.rgy-pms-mobile-light.rgy-pms-bottom-only .rgy-pms-art--bottom {
		display: block;
	}

	.rgy-pms-mobile-off .rgy-pms,
	.rgy-pms-mobile-off .rgy-pms-top,
	.rgy-pms-mobile-off .rgy-pms-toggle {
		display: none;
	}
}

/* Visitors who ask for reduced motion. */
@media (prefers-reduced-motion: reduce) {
	.rgy-pms-art,
	.rgy-pms-art__sway {
		animation: none !important;
	}

	.rgy-pms-motion-off .rgy-pms,
	.rgy-pms-motion-off .rgy-pms-top,
	.rgy-pms-motion-off .rgy-pms-toggle {
		display: none;
	}
}

/* Visitor switched effects off. */
.rgy-pms-off .rgy-pms,
.rgy-pms-off .rgy-pms-top {
	display: none;
}

/* Banner. */
.rgy-pms-banner {
	position: relative;
	z-index: 9991;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 12px;
	padding: 10px 48px;
	background: var(--rgy-pms-accent, #121921);
	color: var(--rgy-pms-accent-text, #fff);
	font-family: Poppins, system-ui, -apple-system, "Segoe UI", sans-serif;
	font-size: 15px;
	font-weight: 500;
	line-height: 1.4;
	text-align: center;
}

.rgy-pms-banner-hidden .rgy-pms-banner {
	display: none;
}

.rgy-pms-banner__text {
	margin: 0;
}

.rgy-pms-banner__text a {
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 3px;
}

.rgy-pms-banner__close {
	position: absolute;
	top: 50%;
	right: 8px;
	display: grid;
	place-items: center;
	width: 36px;
	height: 36px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: inherit;
	cursor: pointer;
	transform: translateY(-50%);
}

.rgy-pms-banner__close:hover {
	background: color-mix(in srgb, currentColor 14%, transparent);
}

.rgy-pms-banner__text a:focus-visible,
.rgy-pms-banner__close:focus-visible,
.rgy-pms-toggle:focus-visible,
.rgy-pms-preview-label a:focus-visible {
	outline: 3px solid #3655F6;
	outline-offset: 2px;
}

@media (max-width: 767px) {
	.rgy-pms-banner {
		padding: 8px 44px 8px 16px;
		font-size: 14px;
		justify-content: flex-start;
		text-align: left;
	}
}

/* Visitor toggle. */
.rgy-pms-toggle {
	position: fixed;
	bottom: 16px;
	z-index: 9992;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-height: 36px;
	margin: 0;
	padding: 6px 14px 6px 10px;
	border: 1px solid rgba(18, 25, 33, 0.16);
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.94);
	box-shadow: 0 2px 10px rgba(18, 25, 33, 0.12);
	color: #121921;
	font: 500 13px/1.2 Poppins, system-ui, -apple-system, "Segoe UI", sans-serif;
	cursor: pointer;
}

.rgy-pms-toggle[hidden] {
	display: none;
}

.rgy-pms-toggle--bottom-left { left: 16px; }
.rgy-pms-toggle--bottom-right { right: 16px; }

/* Keep the switch clear of corner artwork and of a bottom strip. */
.rgy-pms-toggle--beside-art.rgy-pms-toggle--bottom-left { left: calc(max(clamp(96px, 12vw, 190px), clamp(56px, 10vw, 280px)) + 12px); }
.rgy-pms-toggle--beside-art.rgy-pms-toggle--bottom-right { right: calc(max(clamp(96px, 12vw, 190px), clamp(56px, 10vw, 280px)) + 12px); }
.rgy-pms-toggle--above-strip { bottom: 44px; }

.rgy-pms-toggle__dot {
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: var(--rgy-pms-accent, #3655F6);
	box-shadow: 0 0 0 2px #fff, 0 0 0 3px rgba(18, 25, 33, 0.25);
}

.rgy-pms-toggle[aria-pressed="true"] .rgy-pms-toggle__dot {
	background: #9aa3ad;
}

.rgy-pms-toggle:hover {
	background: #fff;
}

@media (max-width: 767px) {
	.rgy-pms-toggle {
		bottom: 12px;
		padding: 6px 12px 6px 9px;
		font-size: 12px;
	}

	.rgy-pms-toggle--bottom-left { left: 12px; }
	.rgy-pms-toggle--bottom-right { right: 12px; }
	.rgy-pms-toggle--beside-art.rgy-pms-toggle--bottom-left { left: 84px; }
	.rgy-pms-toggle--beside-art.rgy-pms-toggle--bottom-right { right: 84px; }
	.rgy-pms-toggle--above-strip { bottom: 30px; }

	/* Lighter phone mode hides the bottom corners, so the switch can use the corner. */
	.rgy-pms-mobile-light .rgy-pms-toggle--beside-art.rgy-pms-toggle--bottom-left { left: 12px; }
	.rgy-pms-mobile-light .rgy-pms-toggle--beside-art.rgy-pms-toggle--bottom-right { right: 12px; }

	.rgy-pms-mobile-light.rgy-pms-bottom-only .rgy-pms-toggle--beside-art.rgy-pms-toggle--bottom-left { left: 84px; }
	.rgy-pms-mobile-light.rgy-pms-bottom-only .rgy-pms-toggle--beside-art.rgy-pms-toggle--bottom-right { right: 84px; }
}

/* Administrator preview label. */
.rgy-pms-preview-label {
	position: fixed;
	left: 50%;
	bottom: 16px;
	z-index: 99993;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px 12px;
	max-width: min(680px, calc(100vw - 32px));
	padding: 10px 16px;
	border-radius: 10px;
	background: #121921;
	color: #fff;
	font: 400 13px/1.45 Poppins, system-ui, -apple-system, "Segoe UI", sans-serif;
	box-shadow: 0 6px 24px rgba(18, 25, 33, 0.28);
	transform: translateX(-50%);
}

.rgy-pms-preview-label strong {
	padding: 2px 8px;
	border-radius: 999px;
	background: #3655F6;
	font-weight: 600;
}

.rgy-pms-preview-label em {
	flex-basis: 100%;
	color: #c9d1ff;
	font-style: normal;
}

.rgy-pms-preview-label a {
	color: #c9d1ff;
	text-decoration: underline;
}

@media print {
	.rgy-pms,
	.rgy-pms-top,
	.rgy-pms-banner,
	.rgy-pms-toggle,
	.rgy-pms-preview-label {
		display: none !important;
	}
}
