@import "theme.css";

:root {
	--content-width: 900px;
	--thumbnail-width: 300px;
	--thumbnail-height: 100px;
}

html {
	background-color: #fff;
}

#notes2 {
	min-height: 100vh;

	display: grid;
	grid-template-areas:
		"tree hum crumbs  crumbs    ding"
		"tree hum name    name      ding"
		"tree hum sync    functions ding"
		"tree hum content content   ding"
		"tree hum blank   blank     ding"
	;
	grid-template-columns: min-content minmax(16px, 1fr) minmax(min-content, 820px) 80px minmax(16px, 1fr);
	grid-template-rows:
		min-content min-content 48px 1fr;


	@media only screen and (max-width: 600px) {
		grid-template-areas:
			"crumbs"
			"sync"
			"name"
			"content"
			"blank"
		;
		grid-template-columns: 1fr;

		#tree {
			display: none;
		}

		n2-syncprogress {
			.el-count {
				top: 4px;
			}
		}
	}

}

#tree {
	grid-area: tree;
	display: grid;
	padding: 16px 0px 16px 16px;
	color: #ddd;
	z-index: 100;
	border-left: 2px solid #333;

	n2-tree {
		border: 2px solid #333;
	}

	&:focus-within {
		n2-tree {
			border: 2px solid #fe5f55;
		}

	}


	#logo {
		display: grid;
		position: relative;
		justify-items: center;
		margin-top: 8px;
		margin-bottom: 8px;
		margin-left: 24px;
		margin-right: 24px;
		cursor: pointer;

		img {
			width: 128px;
			left: -20px;

		}
	}

	.icons {
		display: flex;
		justify-content: center;
		margin-bottom: 32px;
		gap: 8px;
	}

	.node {
		display: grid;
		grid-template-columns: 24px min-content;
		grid-template-rows:
			min-content 1fr;
		margin-top: 12px;


		.expand-toggle {
			user-select: none;

			img {
				width: 16px;
				height: 16px;
			}
		}

		.name {
			white-space: nowrap;
			cursor: pointer;
			user-select: none;

			&:hover {
				color: var(--color1);
			}

			&.selected {
				color: var(--color1);
				font-weight: bold;
			}

		}

		.children {
			padding-left: 24px;
			margin-left: 8px;
			border-left: 1px solid #444;
			grid-column: 1 / -1;

			&.collapsed {
				display: none;
			}
		}
	}
}

#tree-nodes {
	padding: 16px 32px;
	background-color: #333;
	border-radius: 8px;
	box-shadow: 5px 5px 10px -5px rgba(0, 0, 0, 0.75);
}

#crumbs {
	grid-area: crumbs;
	display: grid;
	align-items: start;
	justify-items: center;
	height: min-content;
	margin: 0 16px 16px 16px;

	n2-crumbs {
		background: #e4e4e4;
		display: flex;
		flex-wrap: wrap;
		padding: 8px 16px;
		background: #e4e4e4;
		color: #333;
		border-bottom-left-radius: 5px;
		border-bottom-right-radius: 5px;

		&.node-modified {
			background-color: var(--color1);
			color: var(--color2);

			.crumb:after {
				color: var(--color2);
			}
		}

		n2-crumb {
			margin-right: 8px;
			cursor: pointer;
			user-select: none;
			-webkit-tap-highlight-color: transparent;

			a {
				text-decoration: none;
				color: inherit;
			}
		}

		n2-crumb:after {
			content: ">";
			font-weight: bold;
			color: var(--color1)
		}

		n2-crumb:last-child {
			margin-right: 0;
		}

		n2-crumb:last-child:after {
			content: '';
			margin-left: 0px;
		}

	}

}

n2-syncprogress {
	--radius: 8px;

	display: grid;
	grid-area: sync;
	display: grid;
	justify-items: center;
	align-items: center;

	position: relative;

	opacity: 0;
	transition: height 0s 500ms, opacity 500ms linear, visibility 0s 500ms;

	&.show {
		opacity: 1;
		transition: visibility, height 0s, opacity 500ms linear;
	}

	progress {
		width: 100%;
		height: 24px;
		border-radius: 8px;
	}

	.count {
		position: absolute;
		top: 16px;
		width: 100%;
		white-space: nowrap;
		color: #888;
		text-align: center;
		font-size: 12pt;
		font-weight: bold;
	}

	progress[value]::-webkit-progress-bar {
		background-color: #eee;
		box-shadow: 0 2px var(--radius) rgba(0, 0, 0, 0.25) inset;
		border-radius: var(--radius);
	}

	progress[value]::-moz-progress-bar {
		background-color: #eee;
		box-shadow: 0 2px var(--radius) rgba(0, 0, 0, 0.25) inset;
		border-radius: var(--radius);
	}

	progress[value]::-webkit-progress-value {
		background: rgb(186, 95, 89);
		background: linear-gradient(180deg, rgba(186, 95, 89, 1) 0%, rgba(254, 95, 85, 1) 50%, rgba(186, 95, 89, 1) 100%);
		border-radius: var(--radius);
	}

	progress[value]::-moz-progress-value {
		background: rgb(186, 95, 89);
		background: linear-gradient(180deg, rgba(186, 95, 89, 1) 0%, rgba(254, 95, 85, 1) 50%, rgba(186, 95, 89, 1) 100%);
		border-radius: var(--radius);
	}

}

/* ============================================================= */

n2-nodeui {
	margin-bottom: 32px;

	.el-name {
		grid-area: name;
		color: #333;
		font-weight: bold;
		text-align: center;
		font-size: 1.15em;
		margin-top: 8px;
		margin-bottom: 0px;
	}

	.el-functions {
		grid-area: functions;
	}

	.el-node-content {
		grid-area: content;
		justify-self: center;
		word-wrap: break-word;
		font-family: monospace;
		color: #333;

		width: 100%;
		max-width: var(--content-width);
		field-sizing: content;

		resize: none;
		outline: none;

		padding: 32px 0;
		border-left: none;
		border-right: none;
		border-top: 1px solid #e0e0e0;
		border-bottom: 1px solid #e0e0e0;
		margin-bottom: 32px;

		&:invalid {
			background: #f5f5f5;
			padding-top: 16px;
		}
	}

	.el-node-markdown {
		grid-area: content;
		display: none;

		border-top: 1px solid #e0e0e0;
		border-bottom: 1px solid #e0e0e0;
		margin-bottom: 32px;
	}

	&.show-markdown {
		.el-node-content {
			display: none;
		}

		.el-node-markdown {
			display: block;
		}
	}
}

#blank {
	grid-area: blank;
	height: 32px;
}

dialog.op {
	&::backdrop {
		background: rgba(0, 0, 0, 0.5);
	}

	.header {
		font-weight: bold;
		margin-top: 16px;

		&:first-child {
			margin-top: 0px;
		}
	}

}

#op-search {
	.results {
		display: grid;
		grid-template-columns: min-content min-content;
		grid-gap: 6px 16px;

		div {
			white-space: nowrap;
		}


		.ancestors {
			display: flex;

			.ancestor::after {
				content: ">";
				margin: 0px 8px;
				color: #a00;
			}

			.ancestor:last-child::after {
				content: "";
			}
		}
	}
}
