.popover-wrapper {
	position: relative;
	display: inline-flex;
	align-items: center;
}

.popover {
	margin: 0;
	padding: 0;
	border: solid 1px var(--form-field-border-colour);
	position: absolute;
	z-index: 200;
	background: var(--light);
	color: var(--dark);
	border-radius: 10px;
	box-shadow:
		0 1px 4px rgba(0, 0, 0, 0.08),
		0 4px 16px rgba(0, 0, 0, 0.12);
	min-width: 200px;
	max-width: 320px;
	animation: popover-in 0.12s ease;
}

@keyframes popover-in {
	from {
		opacity: 0;
	}
	to {
		opacity: 1;
	}
}

/* Positions */

.popover-bottom {
	top: calc(100% + 8px);
	bottom: auto;
	left: 50%;
	right: auto;
	transform: translateX(-50%);
}

.popover-top {
	bottom: calc(100% + 8px);
	top: auto;
	left: 50%;
	right: auto;
	transform: translateX(-50%);
}

.popover-left {
	right: calc(100% + 8px);
	left: auto;
	top: 50%;
	transform: translateY(-50%);
}

.popover-right {
	left: calc(100% + 8px);
	right: auto;
	top: 50%;
	transform: translateY(-50%);
}

/* Inner layout */

.popover-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: var(--spacer-one) var(--spacer-two) var(--spacer-one)
		var(--spacer-two);
	border-bottom: solid 1px var(--form-field-border-colour);
	min-height: 40px;
}

.popover-title {
	font-size: 14px;
	font-weight: 700;
	flex: 1;
}

.popover-close {
	background: none;
	border: none;
	cursor: pointer;
	font-size: 20px;
	line-height: 1;
	padding: 0;
	color: inherit;
	opacity: 0.5;
	flex-shrink: 0;
	margin-left: var(--spacer-one);
	transition: opacity 0.15s linear;
}

.popover-close:hover {
	opacity: 1;
}

.popover-body {
	padding: var(--spacer-two);
	font-size: 14px;
	line-height: 1.5;
}

@media screen and (prefers-color-scheme: dark) {
	.popover {
		background: var(--dark);
		color: var(--light);
		border-color: rgba(255, 255, 255, 0.12);
		box-shadow:
			0 1px 4px rgba(0, 0, 0, 0.2),
			0 4px 16px rgba(0, 0, 0, 0.5);
	}

	.popover-header {
		border-bottom-color: rgba(255, 255, 255, 0.12);
	}
}
