* {
	box-sizing: border-box;
}

.menu {
	padding: 0;
	margin: 0;
	border: 1px solid gray;
	border-radius: 4px;
	user-select: none;
	background-color: #f5f5f5;
	list-style: none;
	list-style-type: none;
	min-width: max-content;
	outline: none;
	animation: fade 250ms ease-in-out;
	max-height: 100vh;
	max-width: 100vw;
	min-width: 16rem;
	overflow: visible;
	box-shadow: 2px 2px 2px #0004;
}

@keyframes slide {
	from {
		max-height: 0;
		overflow: hidden;
	}

	to {
		max-height: 100vh;
		overflow: visible;
	}
}

@keyframes fade {
	from {
		opacity: 0;
	}

	to {
		opacity: 1;
	}
}

.context-menu {
	position: fixed;
	left: 0;
	top: 0;
}

.menu .menu {
	display: none;
	position: absolute;
	left: 100%;
	top: -3px;
}

.menu hr {
	appearance: none;
	border: none;
	border-top: 1px solid gray;
}

.menu-item {
	position: relative;
	padding: 4px;
	margin-block-start: 2px;
	margin-block-end: 2px;
	padding-inline-start: calc(1.5em + 6px);
	padding-inline-end: calc(1.5em + 6px);
	outline: none;
}

.menu-item.header {
	font-weight: 700;
	padding: 6px;
}

.menu-item.disabled {
	color: gray;
	pointer-events: none;
}

.menu-item::before {
	content: "";
	position: absolute;
	left: 2px;
	top: 0;
	height: 100%;
	aspect-ratio: 1 / 1;
	background-image: var(--icon);
	background-size: 1em 1em;
	background-repeat: no-repeat;
	background-position: center;
	vertical-align: middle;
	text-align: center;
}

.menu-item:has(.menu)::after {
	content: "▶";
	position: absolute;
	right: 6px;
}

.menu-item:is(:hover, :focus-within) > .menu {
	display: block;
}

.menu > .menu-item:is(:hover, :focus-within):not(.disabled, .header) {
	background-color: rgba(0, 128, 255, 0.5);
}

.menu-shortcut {
	float: right;
	opacity: 0.7;
}
