/*
 * BluePoint Motion – frontend styles.
 *
 * Every rule is scoped to bpm-* classes that are only ever added to <html>
 * while a transition is running. With no JavaScript (or no classes) nothing
 * here has any effect, so the page always stays visible and usable.
 */

:root {
	--bpm-d: 220ms;
	--bpm-enter: 330ms;
	--bpm-ease: ease-out;
	--bpm-color: #00D4B2;
	--bpm-bar: 3px;
	--bpm-dist: 16px;
}

/* Movement distances (kept small on mobile). */
html.bpm-t-fade-up,
html.bpm-t-fade-down {
	--bpm-dist: 16px;
}

html.bpm-t-slide-left,
html.bpm-t-slide-right,
html.bpm-t-slide-up,
html.bpm-t-slide-down {
	--bpm-dist: 40px;
}

@media (max-width: 767px) {
	html.bpm-t-fade-up,
	html.bpm-t-fade-down {
		--bpm-dist: 8px;
	}

	html.bpm-t-slide-left,
	html.bpm-t-slide-right,
	html.bpm-t-slide-up,
	html.bpm-t-slide-down {
		--bpm-dist: 20px;
	}
}

/* ------------------------------------------------------------------
 * Indicator container (moved outside <body> by motion.js so the page
 * fade never dims it). Never intercepts input.
 * ---------------------------------------------------------------- */
.bpm-root {
	pointer-events: none;
}

.bpm-progress {
	position: fixed;
	top: 0;
	right: 0;
	left: 0;
	height: var(--bpm-bar);
	z-index: 2147483647;
	opacity: 0;
	pointer-events: none;
	transition: opacity 150ms ease-out;
}

.bpm-progress__bar {
	display: block;
	width: 100%;
	height: 100%;
	background: var(--bpm-color);
	transform: scaleX(0);
	transform-origin: 0 50%;
}

.bpm-circle {
	position: fixed;
	top: 50%;
	left: 50%;
	width: 28px;
	height: 28px;
	margin: -14px 0 0 -14px;
	box-sizing: border-box;
	border: 3px solid transparent;
	border-top-color: var(--bpm-color);
	border-radius: 50%;
	z-index: 2147483647;
	opacity: 0;
	pointer-events: none;
}

.bpm-circle::before {
	content: "";
	position: absolute;
	top: -3px;
	right: -3px;
	bottom: -3px;
	left: -3px;
	border: 3px solid var(--bpm-color);
	border-radius: 50%;
	opacity: 0.18;
}

/* Leaving: bar rises to ~70%, spinner fades in after a short beat. */
html.bpm-leaving .bpm-progress {
	opacity: 1;
}

html.bpm-leaving .bpm-progress__bar {
	transform: scaleX(0.7);
	transition: transform 700ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

html.bpm-leaving .bpm-circle {
	opacity: 1;
	transition: opacity 150ms ease-out 120ms;
	animation: bpm-spin 700ms linear infinite;
}

/* Entering: bar completes to 100% and disappears (pure CSS, self-terminating). */
html.bpm-entering .bpm-progress {
	animation: bpm-progress-wrap calc(var(--bpm-enter) + 150ms) ease-out both;
}

html.bpm-entering .bpm-progress__bar {
	animation: bpm-progress-fill var(--bpm-enter) ease-out both;
}

@keyframes bpm-progress-wrap {
	0%,
	70% {
		opacity: 1;
	}

	100% {
		opacity: 0;
	}
}

@keyframes bpm-progress-fill {
	from {
		transform: scaleX(0.7);
	}

	to {
		transform: scaleX(1);
	}
}

@keyframes bpm-spin {
	to {
		transform: rotate(360deg);
	}
}

/* ------------------------------------------------------------------
 * Leaving state for body-based transitions: a light opacity dim only.
 * No transform is ever applied while leaving, so fixed headers and
 * other fixed UI never jump.
 * ---------------------------------------------------------------- */
html.bpm-leaving:not(.bpm-t-curtain):not(.bpm-t-split) body {
	opacity: 0.5;
	transition: opacity var(--bpm-d) var(--bpm-ease);
}

/* ------------------------------------------------------------------
 * Entrance animations (run on the destination page, then end on their
 * own; no fill mode, so no styles remain afterwards).
 * ---------------------------------------------------------------- */
html.bpm-entering body {
	animation-duration: var(--bpm-enter);
	animation-timing-function: var(--bpm-ease);
}

html.bpm-entering.bpm-t-fade body {
	animation-name: bpm-in-fade;
}

html.bpm-entering.bpm-t-fade-up body,
html.bpm-entering.bpm-t-slide-up body {
	animation-name: bpm-in-up;
}

html.bpm-entering.bpm-t-fade-down body,
html.bpm-entering.bpm-t-slide-down body {
	animation-name: bpm-in-down;
}

html.bpm-entering.bpm-t-slide-left body {
	animation-name: bpm-in-left;
}

html.bpm-entering.bpm-t-slide-right body {
	animation-name: bpm-in-right;
}

html.bpm-entering.bpm-t-zoom-fade body {
	animation-name: bpm-in-zoom;
	transform-origin: 50% 0;
}

/* Horizontal slides must not flash a horizontal scrollbar. Removed with the class. */
html.bpm-entering.bpm-t-slide-left,
html.bpm-entering.bpm-t-slide-right {
	overflow-x: clip;
}

@keyframes bpm-in-fade {
	from {
		opacity: 0;
	}

	to {
		opacity: 1;
	}
}

@keyframes bpm-in-up {
	from {
		opacity: 0;
		transform: translate3d(0, var(--bpm-dist), 0);
	}

	to {
		opacity: 1;
		transform: translate3d(0, 0, 0);
	}
}

@keyframes bpm-in-down {
	from {
		opacity: 0;
		transform: translate3d(0, calc(var(--bpm-dist) * -1), 0);
	}

	to {
		opacity: 1;
		transform: translate3d(0, 0, 0);
	}
}

@keyframes bpm-in-left {
	from {
		opacity: 0;
		transform: translate3d(var(--bpm-dist), 0, 0);
	}

	to {
		opacity: 1;
		transform: translate3d(0, 0, 0);
	}
}

@keyframes bpm-in-right {
	from {
		opacity: 0;
		transform: translate3d(calc(var(--bpm-dist) * -1), 0, 0);
	}

	to {
		opacity: 1;
		transform: translate3d(0, 0, 0);
	}
}

@keyframes bpm-in-zoom {
	from {
		opacity: 0;
		transform: scale(0.98);
	}

	to {
		opacity: 1;
		transform: scale(1);
	}
}

/* ------------------------------------------------------------------
 * Curtain: navy panel slides up to cover, then continues up to reveal.
 * Drawn with html pseudo-elements: no extra DOM, no page transforms.
 * ---------------------------------------------------------------- */
html.bpm-leaving.bpm-t-curtain::before,
html.bpm-entering.bpm-t-curtain::before {
	content: "";
	position: fixed;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 2147483646;
	background: #0A2540;
	pointer-events: none;
}

html.bpm-leaving.bpm-t-curtain::before {
	animation: bpm-curtain-cover var(--bpm-d) var(--bpm-ease) forwards;
}

html.bpm-entering.bpm-t-curtain::before {
	animation: bpm-curtain-reveal var(--bpm-enter) var(--bpm-ease) forwards;
}

@keyframes bpm-curtain-cover {
	from {
		transform: translate3d(0, 100%, 0);
	}

	to {
		transform: translate3d(0, 0, 0);
	}
}

@keyframes bpm-curtain-reveal {
	from {
		transform: translate3d(0, 0, 0);
	}

	to {
		transform: translate3d(0, -100%, 0);
		visibility: hidden;
	}
}

/* ------------------------------------------------------------------
 * Split: two navy half-screen panels meet in the middle, then part.
 * ---------------------------------------------------------------- */
html.bpm-leaving.bpm-t-split::before,
html.bpm-leaving.bpm-t-split::after,
html.bpm-entering.bpm-t-split::before,
html.bpm-entering.bpm-t-split::after {
	content: "";
	position: fixed;
	right: 0;
	left: 0;
	height: 50%;
	z-index: 2147483646;
	background: #0A2540;
	pointer-events: none;
}

html.bpm-leaving.bpm-t-split::before,
html.bpm-entering.bpm-t-split::before {
	top: 0;
}

html.bpm-leaving.bpm-t-split::after,
html.bpm-entering.bpm-t-split::after {
	bottom: 0;
}

html.bpm-leaving.bpm-t-split::before {
	animation: bpm-split-top-in var(--bpm-d) var(--bpm-ease) forwards;
}

html.bpm-leaving.bpm-t-split::after {
	animation: bpm-split-bottom-in var(--bpm-d) var(--bpm-ease) forwards;
}

html.bpm-entering.bpm-t-split::before {
	animation: bpm-split-top-out var(--bpm-enter) var(--bpm-ease) forwards;
}

html.bpm-entering.bpm-t-split::after {
	animation: bpm-split-bottom-out var(--bpm-enter) var(--bpm-ease) forwards;
}

@keyframes bpm-split-top-in {
	from {
		transform: translate3d(0, -100%, 0);
	}

	to {
		transform: translate3d(0, 0, 0);
	}
}

@keyframes bpm-split-bottom-in {
	from {
		transform: translate3d(0, 100%, 0);
	}

	to {
		transform: translate3d(0, 0, 0);
	}
}

@keyframes bpm-split-top-out {
	from {
		transform: translate3d(0, 0, 0);
	}

	to {
		transform: translate3d(0, -100%, 0);
		visibility: hidden;
	}
}

@keyframes bpm-split-bottom-out {
	from {
		transform: translate3d(0, 0, 0);
	}

	to {
		transform: translate3d(0, 100%, 0);
		visibility: hidden;
	}
}
