/* PAHG's scene (scene.js): its background picture come alive, behind the page and the login's pages. Positions are
   in the picture's pixels (bg.jpg, 1920x1080, drawn as cover, anchored bottom left): --s is one of them on screen.
   html.identify: the reporter's identification, a close-up: the background zooms toward the planet and darkens, and
   the engine (the HUD ring by the title) comes to the front, in the middle, --ring wide, where the login stands.
   The close-up's knobs are the variables below (tuner.html turns them); pictures are named relative to this file. */
:root {
	--s: max(100vw / 1920, 100vh / 1080);
	--ring-size: 79vh;     /* the engine's width in the close-up, at most 92vw */
	--ring: min(var(--ring-size), 92vw);
	--backdrop: 0.24;      /* the picture's brightness behind it */
	--glow: 0.45;          /* the engine's glow, in 160ths of its width */
	--strength: 0.8;       /* its still parts' opacity */
	--background: 1;       /* the whole scene's opacity behind the login */
}

#pahg-scene {
	position: fixed;
	inset: 0;
	z-index: 0;
	overflow: hidden;
	background: #05070c;
	pointer-events: none;
}
#pahg-scene * { pointer-events: none; }

#pahg-scene .world {
	position: absolute;
	inset: 0;
	transform-origin: calc(1709 * var(--s)) calc(100vh - (1080 - 560) * var(--s));
	transition: transform 1.6s cubic-bezier(0.6, 0, 0.2, 1), filter 1.6s ease-in-out;
}
/* The whole picture, past the screen's edges: the close-up's zoom, around the planet, keeps it covering the screen. */
#pahg-scene .bg {
	position: absolute;
	left: 0;
	bottom: 0;
	width: calc(1920 * var(--s));
	height: calc(1080 * var(--s));
	background: url("bg.jpg") no-repeat 0 0 / 100% 100%;
}

/* The planet's core breathes; it flares up when an identification fails (html.flare-up). */
#pahg-scene .core {
	position: absolute;
	left: calc((1709 - 150) * var(--s));
	top: calc(100vh - (1080 - 620 + 150) * var(--s));
	width: calc(300 * var(--s));
	height: calc(300 * var(--s));
	border-radius: 50%;
	background: radial-gradient(circle, rgba(255, 250, 220, 0.95) 0, rgba(255, 196, 90, 0.55) 30%, rgba(255, 120, 20, 0.18) 52%, transparent 70%);
	mix-blend-mode: screen;
	animation: breathe 5.5s ease-in-out infinite;
}
@keyframes breathe {
	0%, 100% { opacity: 0.18; transform: scale(0.9); }
	50% { opacity: 0.6; transform: scale(1.06); }
}
html.flare-up #pahg-scene .core { animation: flare-up 1.8s ease-out 1, breathe 5.5s ease-in-out 1.8s infinite; }
@keyframes flare-up {
	0% { opacity: 0.2; transform: scale(0.9); }
	25% { opacity: 1; transform: scale(1.5); }
	100% { opacity: 0.18; transform: scale(0.9); }
}

/* Light runs along the star's flare (y 193), which the leaderboard's frame rides. */
#pahg-scene .flare {
	position: absolute;
	left: 0;
	top: calc(100vh - (1080 - 193 + 3) * var(--s));
	width: 100%;
	height: calc(6 * var(--s));
	background: linear-gradient(90deg, transparent, rgba(200, 235, 255, 0.95) 50%, transparent) no-repeat;
	background-size: 22% 100%;
	background-position: -30% 0;
	mix-blend-mode: screen;
	filter: blur(calc(1.2 * var(--s)));
	animation: flare 7s cubic-bezier(0.45, 0, 0.2, 1) 0.6s infinite;
}
@keyframes flare {
	0% { background-position: 8% 0; opacity: 0; }
	6% { opacity: 1; }
	45% { background-position: 130% 0; opacity: 0.2; }
	100% { background-position: 130% 0; opacity: 0; }
}

/* The engine: the HUD ring over its place in the picture; scene.js turns it, at the pace of the moment. */
#pahg-scene .engine {
	position: absolute;
	left: calc((1114 - 135) * var(--s));
	top: calc(100vh - (1080 - 989 + 135) * var(--s));
	width: calc(270 * var(--s));
	height: calc(270 * var(--s));
	opacity: 0.5;
	mix-blend-mode: screen;
	transition: left 1.6s cubic-bezier(0.6, 0, 0.2, 1), top 1.6s cubic-bezier(0.6, 0, 0.2, 1),
		width 1.6s cubic-bezier(0.6, 0, 0.2, 1), height 1.6s cubic-bezier(0.6, 0, 0.2, 1), opacity 1.6s, filter 1.6s;
}
#pahg-scene .ring {
	position: absolute;
	inset: 0;
	background: url("hud.svg") center / contain no-repeat;
}
#pahg-scene .ring.inner { inset: 21%; opacity: 0; transition: opacity 1.2s 0.6s; }
/* The engine's still parts (engine.js, drawn by scene.js), after the picture's disc, 160 px around the centre where
   the rings' box is 135; for the close-up only, the picture has its own at rest. */
#pahg-scene .art {
	position: absolute;
	inset: calc(-25 / 270 * 100%);
	opacity: 0;
	transition: opacity 1.6s;
}
#pahg-scene .art svg { display: block; width: 100%; height: 100%; }

html.identify #pahg-scene { opacity: var(--background); }
html.identify #pahg-scene .world { transform: scale(1.45); filter: brightness(var(--backdrop)) blur(2px); }
html.identify #pahg-scene .engine {
	left: calc(50vw - var(--ring) / 2);
	top: calc(50vh - var(--ring) / 2);
	width: var(--ring);
	height: var(--ring);
	opacity: 0.85;
	filter: brightness(1.3) drop-shadow(0 0 calc(var(--ring) / 160 * var(--glow)) #5aa8f0);
}
html.identify #pahg-scene .ring.inner { opacity: 0.55; }
html.identify #pahg-scene .art { opacity: var(--strength); }

/* Straight to a state, without the way there (a login page opened on its own) */
html.scene-still #pahg-scene * { transition: none !important; }

@media (prefers-reduced-motion: reduce) {
	#pahg-scene * { animation: none !important; transition: none !important; }
}
