/**
 * PP Christmas – draped Christmas lights.
 *
 * Resting:  hangs from the bottom edge of the site header (in the gap above
 *           the page content), so it never covers header text or links.
 * Stuck:    once the header has scrolled out of view, the string slides down
 *           and stays pinned to the top of the screen (.is-stuck, set by JS).
 *
 * Bulbs are always lit and keep changing colour: three bulb groups, each with
 * three colour frames that crossfade on their own timing, so the string is
 * always shifting but never changes all at once. Classic C9 colours only:
 * red, green, blue, yellow, orange. Click-through everywhere.
 */

.ppx-lights {
	--ppx-h: 58px;
	--ppx-w: 1184px;
	display: none;               /* shown once the script has placed it */
	position: absolute;
	top: var(--ppx-rest-top, 0px);
	left: 0;
	right: 0;
	height: var(--ppx-h);
	pointer-events: none;
	z-index: 5;                  /* over page content; header menus (z 999999) stay above */
}
.ppx-lights.is-ready { display: block; }

.ppx-lights__layer {
	position: absolute;
	inset: 0;
	background-size: var(--ppx-w) var(--ppx-h);
	background-repeat: repeat-x;
	background-position: center top;
}
.ppx-lights__wire { background-image: url("../img/lights-wire-twisted.svg"); }
.ppx-lights__a1 { background-image: url("../img/lights-bulbs-a1.svg"); }
.ppx-lights__a2 { background-image: url("../img/lights-bulbs-a2.svg"); opacity: 0; animation: ppx-a2 9.6s linear 0s infinite; }
.ppx-lights__a3 { background-image: url("../img/lights-bulbs-a3.svg"); opacity: 0; animation: ppx-a3 9.6s linear 0s infinite; }
.ppx-lights__b1 { background-image: url("../img/lights-bulbs-b1.svg"); }
.ppx-lights__b2 { background-image: url("../img/lights-bulbs-b2.svg"); opacity: 0; animation: ppx-b2 12.3s linear -2.3s infinite; }
.ppx-lights__b3 { background-image: url("../img/lights-bulbs-b3.svg"); opacity: 0; animation: ppx-b3 12.3s linear -2.3s infinite; }
.ppx-lights__c1 { background-image: url("../img/lights-bulbs-c1.svg"); }
.ppx-lights__c2 { background-image: url("../img/lights-bulbs-c2.svg"); opacity: 0; animation: ppx-c2 8.1s linear -1.1s infinite; }
.ppx-lights__c3 { background-image: url("../img/lights-bulbs-c3.svg"); opacity: 0; animation: ppx-c3 8.1s linear -1.1s infinite; }

/* Pinned to the top of the screen once the header is out of view */
.ppx-lights.is-stuck {
	position: fixed;
	top: 0;
	z-index: 998;                /* below the mobile nav (999/1000) and popups */
	animation: ppx-drop .45s ease-out;
}
body.admin-bar .ppx-lights.is-stuck { top: 32px; }
@media (max-width: 782px) {
	body.admin-bar .ppx-lights.is-stuck { top: 46px; }
}
@media (min-width: 1200px) {
	.ppx-lights { --ppx-h: 72px; --ppx-w: 1480px; }   /* full size on wide screens */
}
@media (max-width: 600px) {
	.ppx-lights { --ppx-h: 45px; --ppx-w: 918px; }
	body.admin-bar .ppx-lights.is-stuck { top: 0; } /* WP admin bar scrolls away on phones */
}

@keyframes ppx-drop {
	from { transform: translateY(-100%); opacity: 0; }
	to   { transform: none; opacity: 1; }
}

@keyframes ppx-a2 {
	0%, 33.33% { opacity: 0; }
	36.98%, 70.31% { opacity: 1; }
	70.42%, 100% { opacity: 0; }
}
@keyframes ppx-a3 {
	0% { opacity: 1; }
	3.65%, 66.67% { opacity: 0; }
	70.31%, 100% { opacity: 1; }
}

@keyframes ppx-b2 {
	0%, 33.33% { opacity: 0; }
	36.18%, 69.51% { opacity: 1; }
	69.59%, 100% { opacity: 0; }
}
@keyframes ppx-b3 {
	0% { opacity: 1; }
	2.85%, 66.67% { opacity: 0; }
	69.51%, 100% { opacity: 1; }
}

@keyframes ppx-c2 {
	0%, 33.33% { opacity: 0; }
	37.65%, 70.99% { opacity: 1; }
	71.11%, 100% { opacity: 0; }
}
@keyframes ppx-c3 {
	0% { opacity: 1; }
	4.32%, 66.67% { opacity: 0; }
	70.99%, 100% { opacity: 1; }
}

/* Visitors who prefer less motion get steady bulbs (first colour set) */
@media (prefers-reduced-motion: reduce) {
	.ppx-lights__layer,
	.ppx-lights.is-stuck { animation: none; }
}
