@mixin bpfillall() {
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
}

@keyframes bp-fadein {
	from {
		opacity: 0.01;
	}
	to {
		opacity: 1;
	}
}
@keyframes bp-bar {
	from {
		transform: translateX(-100%);
	}
	to {
		transform: translateX(0);
	}
}
@keyframes bp-o {
	from {
		transform: rotate(0deg);
	}
	to {
		transform: rotate(360deg);
	}
}

.bp-wrap {
	@include bpfillall;
	position: fixed;
	z-index: 999;
	/* If you're mounting on a portion of the screen and need visible
	overflow on .bp-wrap, change contain to "layout" on that instance */
	contain: strict;
	touch-action: none;
	-webkit-tap-highlight-color: transparent;
	> div:first-child {
		position: absolute;
		@include bpfillall;
		background: rgba(0, 0, 0, 0.75);
		animation: bp-fadein 0.48s cubic-bezier(0.215, 0.61, 0.355, 1);
	}
}

.bp-vid {
	audio {
		position: absolute;
		left: 14px;
		width: calc(100% - 28px);
		bottom: 14px;
		height: 50px;
	}
}

.bp-inner {
	@include bpfillall;
	position: absolute;
	display: flex;
}

.bp-html {
	display: contents;
	> :first-child {
		margin: auto;
	}
}

.bp-img-wrap {
	@include bpfillall;
	position: absolute;
	contain: strict;
	.bp-canzoom {
		cursor: zoom-in;
	}
	.bp-drag {
		cursor: grabbing;
	}
}

// when closing a zoomed image contain: strict hides overflow
.bp-close {
	contain: layout size;
}

.bp-img {
	position: absolute;
	top: 50%;
	left: 50%;
	user-select: none;
	background-size: 100% 100%;
	img,
	div {
		position: absolute;
		@include bpfillall;
	}
	.bp-o {
		display: none;
	}
}
.bp-zoomed {
	.bp-img:not(.bp-drag) {
		cursor: grab;
	}
	.bp-cap {
		opacity: 0;
		animation: none !important;
	}
}

// when zoomed on small screens, hide controls
.bp-zoomed.bp-small .bp-controls {
	opacity: 0;
	button {
		pointer-events: none;
	}
}

.bp-controls {
	position: absolute;
	@include bpfillall;
	pointer-events: none;
	text-align: left;
	transition: opacity 0.3s;
	animation: bp-fadein 0.3s;
	button {
		pointer-events: auto;
		cursor: pointer;
		position: absolute;
		border: 0;
		background: rgba(0, 0, 0, 0.15);
		opacity: 0.9;
		transition: all 0.1s;
		contain: content;
		&:hover {
			background-color: rgba(0, 0, 0, 0.2);
			opacity: 1;
		}
	}
	svg {
		fill: #fff;
	}
}

.bp-count {
	position: absolute;
	color: rgba(255, 255, 255, 0.9);
	line-height: 1;
	margin: 16px;
	height: 50px;
	width: 100px;
}

.bp-prev,
.bp-next {
	top: 50%;
	right: 0;
	margin-top: -32px;
	height: 64px;
	width: 58px;
	border-radius: 3px 0 0 3px;
	&:hover {
		&:before {
			transform: translateX(-2px);
		}
	}
	&:before {
		content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23fff'%3E%3Cpath d='M8.59 16.34l4.58-4.59-4.58-4.59L10 5.75l6 6-6 6z'/%3E%3C/svg%3E");
		position: absolute;
		left: 7px;
		top: 9px;
		width: 46px;
		transition: all 0.2s;
	}
}
.bp-prev {
	right: auto;
	left: 0;
	transform: scalex(-1);
}
.bp-x {
	top: 0;
	right: 0;
	height: 55px;
	width: 58px;
	border-radius: 0 0 0 3px;
	&:before {
		content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32' fill='%23fff'%3E%3Cpath d='M24 10l-2-2-6 6-6-6-2 2 6 6-6 6 2 2 6-6 6 6 2-2-6-6z'/%3E%3C/svg%3E");
		position: absolute;
		width: 37px;
		top: 8px;
		right: 10px;
	}
}

.bp-if,
.bp-vid {
	position: relative;
	margin: auto;
	background: #000;
	background-size: 100% 100%;
	iframe,
	video,
	div {
		@include bpfillall;
		position: absolute;
		border: 0;
	}
}

.bp-load {
	display: flex;
	background-size: 100% 100%;
	overflow: hidden;
	z-index: 1;
}
.bp-bar {
	position: absolute;
	top: 0;
	left: 0;
	height: 3px;
	width: 100%;
	transform: translateX(-100%);
	background: rgba(255, 255, 255, 0.9);
	border-radius: 0 3px 3px 0;
	animation: bp-bar 4s both;
}

.bp-o,
.bp-o:after {
	border-radius: 50%;
	width: 90px;
	height: 90px;
}
.bp-o {
	margin: auto;
	border: 10px solid rgba(255, 255, 255, 0.2);
	border-left-color: rgba(255, 255, 255, 0.9);
	animation: bp-o 1s infinite linear;
}

.bp-cap {
	position: absolute;
	bottom: 2%;
	background: rgba(9, 9, 9, 0.8);
	color: rgba(255, 255, 255, 0.9);
	border-radius: 4px;
	max-width: 95%;
	line-height: 1.3;
	padding: 0.6em 1.2em;
	left: 50%;
	transform: translateX(-50%);
	width: fit-content;
	width: -moz-fit-content;
	display: table;
	transition: opacity 0.3s;
	animation: bp-fadein 0.2s;
	a {
		color: inherit;
	}
}

.bp-inline {
	position: absolute;
}

.bp-lock {
	overflow-y: hidden;
	body {
		overflow: scroll;
	}
}

.bp-noclose {
	.bp-x {
		display: none;
	}
	&:not(.bp-zoomed) {
		touch-action: pan-y;
		.bp-img-wrap {
			cursor: zoom-in;
		}
	}
}

@media (prefers-reduced-motion) {
	.bp-wrap * {
		animation-duration: 0s !important;
	}
}

@media (max-width: 500px) {
	.bp-x {
		height: 47px;
		width: 47px;
		&:before {
			width: 34px;
			top: 6px;
			right: 6px;
		}
	}
	.bp-prev,
	.bp-next {
		margin-top: -27px;
		height: 54px;
		width: 45px;
		&:before {
			top: 7px;
			left: 2px;
			width: 43px;
		}
	}
	.bp-o,
	.bp-o:after {
		border-width: 6px;
		width: 60px;
		height: 60px;
	}
	.bp-count {
		margin: 12px 10px;
	}
}
