:root {
	--light-text: white;
	--dark-text: #333;
	--medium-blue: #005bbb;
	--medium-blue-hover: #004288;
	--darker-blue: #010d18;
	--hover-transition: 0.3s;
}

.ru-popup {
	display: none;
	font-family: sans-serif;
}

.ru-popup[open] {
	display: block;
	position: fixed;
	bottom: 0;
	right: 0;
	margin: 1em;
	padding-inline: 1.5em;
	padding-block: 1.5em;
	padding-bottom: calc(1.5em + 0.75em * 2 + 1em);
	border-radius: 0.5em;
	max-width: fit-content;
	width: max(25vw, 300px);
	max-height: calc(100vh - 50px - 6em - 0.75em * 2);
	background-color: rgba(228, 236, 245, 0.75);
	backdrop-filter: blur(20px);
	box-shadow: rgba(197, 207, 217, 0.5) 0 5px 15px;
	color: var(--dark-text);
	z-index: 4;
}

/* Blurry shadow behind the russian flag, in order to make the white stripe stand out more from the light background */
.ru-popup[open]::before {
	content: "";
	height: 48px; /* height of the flag */
	width: 60px;  /* width  of the flag */
	position: absolute;
	top: calc(1.5em + 24px);  /* block padding  + 1/2 height of the flag */
	left: calc(1.5em + 30px); /* inline padding + 1/2 width  of the flag */
	transform: translate(-50%, -50%); /* center the blur relative to the flag */
	background: var(--medium-blue);
	opacity: 0.25;
	filter: blur(15px);
	z-index: -1;
}

.ru-popup-text {
	max-height: calc(100vh - 50px - 6em - 0.75em * 2);
	overflow-y: scroll;
}

.ru-popup > summary {
	color: transparent;
	width: 0;
	height: 0;
}

.ru-popup-close-button {
	display: inline-block;
	padding-inline: 1.5em;
	padding-block: 0.75em;
	background-color: var(--medium-blue);
	border: none;
	color: var(--light-text);
	border-radius: 0.25em;
	position: absolute;
	left: calc(1/0.75 * 1.5em);
	bottom: calc(1/0.75 * 1.5em);
	cursor: pointer;
	transition: var(--hover-transition);
}

.ru-popup-close-button:hover {
	background-color: var(--medium-blue-hover);
	transition: var(--hover-transition);
}

.ru-popup-close-button:focus {
	background-color: var(--darker-blue);
	transition: var(--hover-transition);
}

.ru-popup > summary::marker {
	display: none;
}

.ru-popup-header {
	display: flex;
	column-gap: 0.75em;
	width: 100%;
}

.ru-popup-header > * {
	flex: 1;
}

.ru-popup-flag {
	grid-column: 1;
	position: relative;
	max-height: 48px;
	max-width: 60px;
}

.ru-popup-flag img {
	position: absolute;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.ru-popup[open] .ru-popup-flag img.ru {
	opacity: 1;
	transition: opacity 1s ease-in-out;
}

.ru-popup[open]:has(.ru-popup-close-button:hover) .ru-popup-flag img.ru {
	opacity: 0;
	transition: opacity 1s ease-in-out;
}

.ru-popup-close-button::before {
	content: "";
	display: block;
	background-image: url('https://codeberg.org/api/v1/repos/ForGoodEyesOnly/assets/raw/src%2Fassets%2Fsvg%2Fdove.svg');
	width: 3em;
	height: 3em;
	position: absolute;
	bottom: 0;
	right: -4.5em; /* size + gap */
	opacity: 0;
	transition: opacity 1s ease-in-out;
	animation: peace-dove-fly 2s infinite;
}

.ru-popup-close-button:hover::before {
	opacity: 1;
	transition: opacity 1s ease-in-out;
}

.ru-popup-close-button::after {
	content: "";
	width: 4.5em;
	height: 4.5em;
	position: absolute;
	bottom: -0.75em;
	right: -5.35em;
	background-color: white;
	opacity: 0;
	filter: blur(10px);
	z-index: -1;
	transition: opacity 1s ease-in-out;
	animation: peace-dove-fly 2s infinite;
	border-radius: 50%;
}

.ru-popup-close-button:hover::after {
	opacity: 0.75;
	transition: opacity 1s ease-in-out;
}

.ru-popup-title {
	position: relative;
	font-size: 1.25em;
	font-weight: bold;
	color: var(--medium-blue-hover);
	display: block;
}

.ru-popup p,
.ru-popup-close-button {
	font-size: 0.75em;
	line-height: 1.4em;
}

.ru-popup p b {
	color: black;
}

@keyframes peace-dove-fly {
	0% {
		transform: translateY(0);
	}
	50% {
		transform: translateY(-0.75em);
	}
	100% {
		transform: translateY(0);
	}
}

@media (max-width: 460px) {
	.ru-popup[open] {
		margin: 0.5em;
		width: calc(100vw - 1em);
	}
}

@media (max-width: 370px) {
	.ru-popup-flag {
		display: none;
	}
}

@media (max-height: 350px) {
	.ru-popup[open] {
		max-height: calc(100vh - 50px - 5em - 0.75em * 2);
		padding-block: 1em;
		padding-bottom: calc(1em + 0.75em * 2 + 1em);
	}

	.ru-popup-text {
		max-height: calc(100vh - 50px - 5em - 0.75em * 2);
	}

	.ru-popup[open] .ru-popup-close-button {
		bottom: calc(1/0.75 * 1em);
	}
}