:root {
	--modal-border-width: 1px;
	--modal-border-color: rgba(0, 0, 0, 0.175);
}

/* Dialog */
dialog.modal__container {
	border: var(--modal-border-width) solid var(--modal-border-color);
	border-radius: 0.4rem;
	width: auto;
	max-width: 500px;
	max-height: 90vh;
	padding: 0;
	display: none;
}

dialog[open].modal__container {
	animation-name: slideInTop;
	animation-duration: 0.5s;
	display: flex;
	flex-direction: column;
}

dialog.modal__container.hide {
	animation: slideOutTop 0.4s;
}

dialog.modal__container.attention {
	animation-name: slideInTop, zoomIn;
	animation-duration: 0.5s, 0.5s
}

dialog.modal__container::backdrop {
	background: rgba(0, 0, 0, 0.35);
}

@media (prefers-reduced-motion) {
	dialog[open].modal__container {
		animation: none !important;
	}
	
	dialog.modal__container.hide {
		animation: none !important;
	}
	
	dialog.modal__container.attention {
		animation: none !important;
	}
}

.modal-open {
	/* Prevents background scrolling and page scrolling to top*/
	height: 100vh;
    width: 100vw;
    touch-action: none;
    -webkit-overflow-scrolling: none;
    overflow: hidden;
    overscroll-behavior: none;
}

/* Header */
.modal__header {
	display: flex;
	flex-shrink: 0;
	align-items: center;
	justify-content: space-between;
	padding: 1rem;
	border-bottom: var(--modal-border-width) solid var(--modal-border-color);
}

.modal__header-title {
	margin: 0;
	line-height: 1.5;
}

/* Body */
.modal__body {
	overflow: auto;
	position: relative;
	flex: 1 1 auto;
	padding: 1rem;
}

/* Footer */
.modal__footer {
	display: flex;
	flex-shrink: 0;
	flex-wrap: wrap;
	align-items: center;
	justify-content: flex-end;
	
	padding: 0.75rem;
	border-top: var(--modal-border-width) solid var(--modal-border-color);
}

/* Close button */
button.modal__close-button {
	box-sizing: content-box;
	width: 1em;
	height: 1em;
	color: #000;
	border: 0;
	border-radius: .375rem;
	background: transparent;
	padding: 0.5rem;
	margin: 0.5rem 0.5rem 0.5rem auto;
	cursor: pointer;
	line-height: 1.5;
	
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
}

button.modal__close-button:hover {
	color: #000;
	text-decoration: none;
	opacity: .75;
}

/* Animations */
@keyframes slideInTop {
	from {
		opacity: 0;
		transform: translateY(-30%);
	}
	to {
		opacity: 1;
		transform: translateY(0%);
	}
}

@keyframes slideOutTop {
	from {
		opacity: 1;
		transform: translateY(0%);
	}
	to {
		opacity: 0;
		transform: translateY(-30%);
	}
}

@keyframes zoomIn {
	0% {
		transform: scale(1);
	}
	50% {
		transform: scale(1.05);
	}
	100% {
		transform: scale(1);
	}
}