/* CLAUDE #1165, #1166: every page's (sites.php's bl_head_motion(), from watermark.php), with js/layout/page-motion.js */

/* #1165: the busy bar, each platform's own, while the next page opens */
#page-busy {
	--page-busy-color: #1a73e8;
	position: fixed;
	left: 0;
	right: 0;
	top: 0;
	height: 3px;
	z-index: 2147483647;
	overflow: hidden;
	pointer-events: none;
}

@media (prefers-color-scheme: dark) {
	#page-busy {
		--page-busy-color: #8ab4f8;
	}
}

/* iOS: Safari's load bar, the system blue, filling from the left */
#page-busy.ios {
	--page-busy-color: #007aff;
}

@media (prefers-color-scheme: dark) {
	#page-busy.ios {
		--page-busy-color: #0a84ff;
	}
}

#page-busy.ios::before,
#page-busy.desktop::before {
	content: "";
	display: block;
	width: 0;
	height: 100%;
	background: var(--page-busy-color);
	animation: page-busy-fill 10s cubic-bezier(0.1, 0.8, 0.2, 1) forwards;
}

@keyframes page-busy-fill {
	10% { width: 35%; }
	to { width: 92%; }
}

/* Android: Material's indeterminate linear progress indicator, two bars over its track */
#page-busy.android {
	height: 4px;
	background: color-mix(in srgb, var(--page-busy-color) 24%, transparent);
}

#page-busy.android::before,
#page-busy.android::after {
	content: "";
	position: absolute;
	top: 0;
	bottom: 0;
	background: var(--page-busy-color);
}

#page-busy.android::before {
	animation: page-busy-long 2.1s cubic-bezier(0.65, 0.815, 0.735, 0.395) infinite;
}

#page-busy.android::after {
	animation: page-busy-short 2.1s cubic-bezier(0.165, 0.84, 0.44, 1) 1.15s infinite;
	left: -200%;
	right: 100%;
}

@keyframes page-busy-long {
	0% { left: -35%; right: 100%; }
	60%, 100% { left: 100%; right: -90%; }
}

@keyframes page-busy-short {
	0% { left: -200%; right: 100%; }
	60%, 100% { left: 107%; right: -8%; }
}

/* the desktop's busy cursor too */
html.page-busy,
html.page-busy * {
	cursor: progress !important;
}

@media (prefers-reduced-motion: reduce) {
	#page-busy.ios::before,
	#page-busy.desktop::before {
		animation: none;
		width: 100%;
	}

	#page-busy.android::before {
		animation: none;
		left: 0;
		right: 0;
	}

	#page-busy.android::after {
		animation: none;
	}
}

/* #1166: the slide between this site's pages, where the browser has cross-document view transitions: the next page slides in from the right
   over this one, which moves a little left, as an iPhone's; Back the other way (page-motion.js's html.vt-back). The top bar and the sidebar
   stay put. None with reduced motion */
@view-transition {
	navigation: auto;
}

@media (prefers-reduced-motion: reduce) {
	@view-transition {
		navigation: none;
	}
}

.app-bar {
	view-transition-name: app-bar;
}

.app-sidebar {
	view-transition-name: app-sidebar;
}

::view-transition-old(root),
::view-transition-new(root) {
	mix-blend-mode: normal;
	animation-duration: 0.35s;
	animation-timing-function: cubic-bezier(0.32, 0.72, 0, 1);
	animation-fill-mode: both;
}

::view-transition-old(root) {
	animation-name: vt-out-left;
}

::view-transition-new(root) {
	animation-name: vt-in-right;
}

html.vt-back::view-transition-old(root) {
	animation-name: vt-out-right;
	z-index: 1;
}

html.vt-back::view-transition-new(root) {
	animation-name: vt-in-left;
}

@keyframes vt-out-left {
	to { transform: translateX(-30%); filter: brightness(0.8); }
}

@keyframes vt-in-right {
	from { transform: translateX(100%); }
}

@keyframes vt-out-right {
	to { transform: translateX(100%); }
}

@keyframes vt-in-left {
	from { transform: translateX(-30%); filter: brightness(0.8); }
}
