
html { font-size: 10px; }
body {
	font-size: 1.5em;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	margin: 0;
	background: #c5cad0;
}
html, body {
	/* pull to refresh is extremely annoying here */
    overscroll-behavior-y: contain;
}

/** layout **/

.layout {
	display: grid;
	grid-template-columns: 30rem 1fr;
	position: absolute;
	left: 0;
	top: 0;
	width: 100%;
	height: 100%;
	background-color: #eee;
}
.project_pane {
	display: grid;
	grid-template-columns: 1fr;
	grid-template-rows: min-content 1fr;
	overflow-y: auto;
}
.project_head {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	margin-bottom: 1rem;
}
.project_files {
	display: block;
}
.code_pane {
	position: relative;
	/* monaco hovers seem to explode without this */
	overflow: hidden;
}

/** shared **/

input.renamer {
	display: none;
	position: absolute;
	top: 0;
	bottom: 0;
	left: 0;
	/* apparently you can't combine left and right on text inputs */
	/* but you can use width */
	/* why */
	width: 100%;
}
input.renamer.renaming {
	display: block;
}


/** project head **/

.project_head > div {
	position: relative;
	padding: 0.6rem 0;
	text-align: center;
	user-select: none;
}
.project_head > div.disabled {
	color: #888;
	pointer-events: none;
}
.project_head > div.success {
	color: #0c0;
	font-weight: 600;
}
.project_head > div.error {
	color: #d00;
	font-weight: 600;
}
.project_head > div.warning {
	color: #f80;
	font-weight: 600;
}
.project_head > div:hover {
	background: #fff3;
}
.proj_name {
	grid-column-start: 1;
	grid-column-end: 4;
}


/** project files **/

.file_item {
	display: grid;
	position: relative;
}
.file_item.editing {
	background-color: #fff;
}
.file_item > .parent_bar {
	border-right: 0.1rem solid;
}
.file_item > .parent_bar:nth-child(even) {
	background: #ddd;
}
.file_item > .collapser {
	position: relative;
}
.file_item > .collapser:after {
	position: absolute;
	top: 48%;
	left: 96%;
	transform: translate(-50%, -50%);
}
.file_item > .collapser.open:after {
	content: '-';
}
.file_item > .collapser.closed:after {
	content: '+';
}
.file_item > .path {
	padding: 0.1rem 0.6rem 0.1rem 1rem;
	user-select: none;
}
.file_item > .path.dragging {
	opacity: 0.4;
}
.file_item > .path.link::after {
	content: '*';
	display: inline;
}
.parent_bar + div.path, div.path:first-child {
	padding-left: 2.5rem;
}
.filebtn {
	display: none;
	font-size: 1.8rem;
	font-weight: 800;
	cursor: pointer;
	text-align: center;
	line-height: 1.8rem;
}
.file_item > .filebtn.add {
	position: absolute;
	right: 0;
	top: 0;
	bottom: 0;
	width: 2.5rem;
	color: #7d7;
}
.file_item > .filebtn.add:after {
	content: '+';
}
.file_item:hover > .filebtn.add {
	display: block;
}
.file_item > .filebtn.delete {
	position: absolute;
	right: 2.5rem;
	top: 0;
	bottom: 0;
	width: 2.5rem;
	color: #d77;
}
.file_item > .filebtn.delete:after {
	content: '×';
}
.file_item:hover > .filebtn.delete {
	display: block;
}
.project_files > .filebtn.add {
	display: block;
	color: #7d7;
}
.project_files > .filebtn.add:after {
	content: '+';
}
.tgt_hint {
	position: absolute;
	top: 0rem;
	left: 0rem;
	right: 0rem;
	bottom: 0rem;
	background: #55e3;
	pointer-events:none;
	display: none;
}
.tgt_hint.on {
	display: block;
}
.tgt_hint.low {
	top: calc(100% - 0.6rem);
	bottom: -0.6rem;
}
.file_item.context {
	background: #fdd;
}
.file_item.context > .parent_bar {
	grid-row: 1 / 10;
}
.parent_bar ~ .item, div.path:first-child ~ .item {
	padding-left: 2.5rem;
}
.file_item.context .item {
	grid-column: -2;
	font-weight: 600;
	cursor: pointer;
	user-select: none;
}
.file_item.context .item, .file_item.context .path {
	padding-bottom: 0.3rem;
}
.file_item.context .path {
	position: relative;
}
.file_item.context .path .closer {
	position: absolute;
	top: 0;
	right: 1rem;
	font-size: 2.3rem;
	line-height: 1.6rem;
}

/** code pane **/

.code {
	width: 100%;
	height: 100%;
}
.code_pane > textarea.code {
	border: 1.5rem solid white;
	box-sizing: border-box;
}


/** mobile **/

input.collapser, label.collapser { display: none; }
@media (max-width: 940px) {
	.layout {
		grid-template-columns: 1fr;
		grid-template-rows: 100%;
	}
	label.collapser {
		display: block;
		position: fixed;
		right: 13px;
		width: 45px;
		height: 45px;
		top: 5px;
		cursor: pointer;
		z-index: 2;
		background: #ccc;
		opacity: 0.3;
	}
	label.collapser::before {
		content: '';
		position: absolute;
		left: 8px;
		width: 29px;
		height: 5px;
		background: #666;
		box-shadow: 0 12px 0 0 #666, 0 24px 0 0 #666;
		top: 7px;
	}
	input.collapser:checked ~ label.collapser{
		transform: rotate(90deg);
	}
	input.collapser:not(:checked) ~ .project_pane{
		display: none;
	}
	input.collapser:not(:checked) ~ .tool_pane{
		display: none;
	}
	.file_item > .path { padding: 0.3rem 0.6rem 0.3rem 1rem; }
	.project_files { padding-left: 1.5rem; }
}