/*
 * Fly-out sub-menus for the editor's drop-down menus and the canvas context
 * menu (both are `.appNav .subMenu`, the context menu being a clone).
 *
 * The fly-out is position:fixed rather than absolute so it is not clipped by
 * the `overflow-y: auto` on .subMenu; menu.js writes its left/top in viewport
 * coordinates and flips/slides it back in when it would leave the screen.
 */

/* ---------- the row that owns a fly-out ---------- */

.appNav .subMenu > li.hasSubSubMenu {
	padding-right: 34px;
}

/* drawn chevron, so it needs no icon font */
.appNav .subMenu > li.hasSubSubMenu::after {
	content: '';
	position: absolute;
	top: 50%;
	right: 16px;
	width: 6px;
	height: 6px;
	margin-top: -4px;
	border-right: 1.5px solid currentColor;
	border-bottom: 1.5px solid currentColor;
	transform: rotate(-45deg);
	opacity: .45;
	transition: opacity .12s ease;
	pointer-events: none;
}

.appNav .subMenu > li.hasSubSubMenu:hover::after,
.appNav .subMenu > li.hasSubSubMenu.subSubMenuOpen::after {
	opacity: 1;
}

.appNav .subMenu > li.hasSubSubMenu.subSubMenuOpen {
	background-color: var(--cnc-panel-3, #1A2227);
	color: #fff;
}

/* ---------- the fly-out itself ---------- */

.appNav .subMenu .subSubMenu {
	display: none;
	position: fixed;
	z-index: 10;
	margin: 0;
	padding: 4px 0;
	min-width: 190px;
	max-height: calc(100vh - 16px);
	overflow-y: auto;
	overflow-x: hidden;
	background-color: var(--cnc-panel-2, #151C20);
	border: 1px solid var(--cnc-border, #252D32);
	border-top: 2px solid var(--cnc-accent, #FF5A2F);
	border-radius: 0 0 6px 6px;
	box-shadow: 0 10px 24px rgba(0, 0, 0, .45);
}

.appNav .subMenu .subSubMenu.active {
	display: block;
}

.appNav .subMenu .subSubMenu > li {
	position: relative;
	padding: 9px 18px;
	color: var(--cnc-text-muted, #b9bec5);
	font-size: 13px;
	line-height: 1.3;
	white-space: nowrap;
	list-style: none;
	cursor: pointer;
}

.appNav .subMenu .subSubMenu > li:hover {
	background-color: var(--cnc-panel-3, #1A2227);
	color: #fff;
}

/* the hidden file inputs behind "Image" / "SVG" must cover their whole row */
.appNav .subMenu .subSubMenu > li > .fileUploadInput {
	width: 100%;
	height: 100%;
}

/* Coarse pointers get taller rows; a fly-out opened by tap has to be
   comfortably hittable. */
@media (pointer: coarse) {
	.appNav .subMenu .subSubMenu > li {
		padding: 13px 18px;
	}
}


/* ---------- canvas context menu parity with original Sketcut ---------- */

/* The standalone Sheetzer editor does not load the old menu.css file. Give
   the dynamically cloned right-click menu the same row geometry here so its
   hierarchy is obvious and the hover targets are not only one text-line tall. */
#appNavContextMenu {
	position: fixed;
	left: 0;
	top: 0;
	width: 0;
	height: 0;
	z-index: 360;
}

#appNavContextMenu > .subMenu {
	display: block !important;
	min-width: 172px;
	max-width: min(260px, calc(100vw - 16px));
	padding: 0;
	margin: 0;
	overflow-y: auto;
	overflow-x: hidden;
	background: var(--cnc-panel-2, #151C20);
	border: 1px solid var(--cnc-border, #252D32);
	border-top: 2px solid var(--cnc-accent, #FF5A2F);
	border-radius: 0 0 6px 6px;
	box-shadow: 0 10px 24px rgba(0,0,0,.45);
}

#appNavContextMenu > .subMenu > li:not(.space) {
	position: relative;
	box-sizing: border-box;
	min-height: 30px;
	padding: 7px 18px;
	line-height: 16px;
	list-style: none;
	white-space: nowrap;
	cursor: default;
}


#appNavContextMenu > .subMenu > li.space {
	display: block;
	box-sizing: border-box;
	width: 100%;
	height: 1px;
	min-height: 0;
	margin: 2px 0;
	padding: 0;
	border: 0;
	border-top: 1px solid var(--cnc-border, #252D32);
	line-height: 0;
	pointer-events: none;
}

#appNavContextMenu > .subMenu > li:first-of-type.space {
	display: none;
}

#appNavContextMenu > .subMenu > li.hasSubSubMenu {
	padding-right: 34px;
}

#appNavContextMenu > .subMenu > li.hasSubSubMenu:hover,
#appNavContextMenu > .subMenu > li.hasSubSubMenu.subSubMenuOpen {
	background: var(--cnc-panel-3, #1A2227);
	color: #fff;
}

#appNavContextMenu .subSubMenu {
	z-index: 362;
}
