:root {
	font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;

	overflow:hidden;
	--bg-translucent: rgba(255, 255, 255, 0.6);
	--accent: oklch(0.6167 0.1769 252.54);
}

body {
	padding:0;
	margin:0;
	height:100svh;
	width:100vw;
	overflow: hidden;
}

#map {
	width: 100vw;
	height: 100svh;
}

#top-left-info {
	position: absolute;
	top:1rem;
	left:1rem;
	width:fit-content;
	right:1rem;
	z-index: 999;

	display: flex;
	flex-direction: column;
	gap:0.5rem;

	pointer-events: none;
}


.overlay {
	/* padding:1rem; */
	border-radius: calc(1rem + var(--spinny-border-width));
	width:fit-content;
	border: 2px solid transparent;
	
	backdrop-filter: blur(2rem);
	background: #fefefe; /*var(--bg-translucent);*/
	box-shadow: 
	0 0 1rem 1rem rgba(0,0,0,0.015) inset,
	0 0.25rem 1rem 1rem rgba(0,0,0,0.05)
	;
	pointer-events: all;
	transition: backdrop-filter 0.2s, border 0.2s;
}

@media screen and (max-width:500px) {
	#top-left-info {
		/* right:1rem; */
		width:unset;
	}
	
	.overlay {
		width:100%;
		box-sizing: border-box;
	}

	#top-left-info .overlay-interior div.point-selector {
		width: 100%;
	}
}

body:not([data-loading]) .overlay {
	border: 2px solid #aaa;
	right:1rem;
}

.overlay-interior {
	position: relative;
	padding:1rem;
	border-radius:1rem;
	background:#fefefe;

	box-shadow: 
		0 0 1rem 1rem rgba(0,0,0,0.015) inset,
		0 0.25rem 1rem 1rem rgba(0,0,0,0.05)
	;
	transition: background 2s 1s, box-shadow 2s 1s;
}

/* body:not([data-loading]) .overlay-interior {
	background:transparent;
	box-shadow: 0 0 1rem 1rem rgba(0,0,0,0.05) inset,
				0 0.25rem 1rem 1rem rgba(0,0,0,0.05);
} */

body:not([data-loading]) .overlay {
	background:#fefefe;
}

@property --spinny-border-width {
	syntax: "<length>";
	inherits: true;
	initial-value: 2px;
}

body {
	--spinny-border-width: 2px;
	transition: --spinny-border-width 2s;
}

.loading-spinny-container {
	

	overflow:hidden;

	position: absolute;
	z-index: -1;
	inset: calc(-1 * var(--spinny-border-width));
	border-radius: calc(1rem + var(--spinny-border-width));
	background:lightgray;

	transition: opacity 2s;
}

body:not([data-loading]) .loading-spinny-container {
	opacity: 0;
}

.loading-spinny-container::before {
	content: "";
	background:#0885e4;

	position: absolute;
	width:80%;
	height:60%;
	left: -30%;
	top: 25%;
	transform-origin:right center;
	animation: spin 2s linear infinite;
}

body:not([data-loading]) {
	--spinny-border-width: 0;
}

@keyframes spin {
	0% {
		transform: rotate(0deg);
	}
	100% {
		transform: rotate(360deg);
	}

}

h1 {
	margin:0;
	display: block;
}

.info-button {
	position:absolute;
	bottom:1rem;
	right:1rem;
	display: block;
	z-index:999;

	backdrop-filter: blur(2rem);
	background: rgba(255, 255, 255, 0.6);
	border: 2px solid #aaa;
	border-radius:0.5rem;

	font-size: 1rem;
	padding: 0.25rem;
	width: 2rem;
	height:2rem;

	color: #666;

	box-shadow:  0 0.25rem 1rem 1rem rgba(0,0,0,0.05);

	&:hover {
		cursor: pointer;
		background: rgba(200,200,200,0.6)
	}

	&:active {
		bottom: 0.75rem;
	}

	transition: background-color 0.2s, bottom 0.2s;
}

.info-close {
	position:absolute;
	top:2rem;
	right:2rem;

	width:2rem;
	height:2rem;

	backdrop-filter: blur(2rem);
	background: rgba(255, 255, 255, 0.6);
	border: 2px solid #aaa;	
	border-radius:0.5rem;

	&:hover {
		cursor: pointer;
		background: rgba(200,200,200,0.6)
	}

	&:active {
		top: 2.25rem;
	}

	transition: background 0.2s, top 0.2s;
}

@keyframes fade-in {
	0% {
		opacity: 0;
	}
	100% {
		opacity: 1;
	}
}

dialog {
	backdrop-filter: blur(2rem);
	background: rgba(255, 255, 255, 0.6);
	border: 2px solid #aaa;	
	border-radius:1rem;

	padding: 2rem;

	opacity:0;

	box-sizing: border-box;
	width: min( 80ch, calc( 100% - 4rem ) );
	width: min( 80ch, min(max-content, calc( 100% - 4rem )) ); 
	/* I think chrome's implemented calc with max-content?? idk cant hurt lol*/
}

dialog::backdrop {
	backdrop-filter:blur(1rem);
	opacity:0;
}

dialog[open], dialog[open]::backdrop {
	animation: fade-in 0.5s ease forwards;
}

dialog a {
	color: var(--accent);
	transition: color 0.2s, text-shadow 0.2s;
}

dialog a:hover {
	color: oklch(from var(--accent) 0.8 c h);
	text-shadow: 0 0 1rem white;
}

#output {
	/* font-family: 'Courier New', Courier, monospace; */
}

#output h3 {
	display: flex;
	flex-direction: row;
	align-content: center;
	margin:0.5rem;
}

#output {
	display: flex;
	flex-direction: column;
	gap:1rem;
	padding-right: 2rem;
}

#output div:last-child {
	/* border-top: 1px solid black; */
}

#output h3::before {
	content:"";
	width:1em;
	height: 1em;
	margin-right:1ch;
	display: inline-block;
	background:green;
	border: 1px solid black;
	box-sizing: border-box;
}

#output div:first-child h3::before {
	background: #0f0;
}
#output div:last-child h3::before {
	background: #f0f;
}

.loading-container {
	pointer-events: none;
	position:absolute;
	bottom: 1rem;
	inset-inline:0;
	
	z-index: 999;
	
	display: flex;
	flex-direction: row;
	justify-content: center;

	transition:inset 0.2s cubic-bezier(0.25, 0.1, 0.32, 1.32);

	justify-content: end;
}

.loading-outer {
	pointer-events: all;
	--loading-progress:0%;
	background:var(--bg-translucent);
	width:10rem;

	backdrop-filter: blur(2rem);
	border-radius:0.5rem;
	padding:0.25rem;

	display: flex;
	flex-direction: column;

	position:relative;
	right:3.5rem;
	border: 2px solid #aaa;	
}

.loading-outer span {
	margin-bottom:0.25rem;
	color: gray;
	font-style: italic;
	font-size:0.75rem;
}

.loading-bar-outer {
	width:100%;
	background:lightgray;
}

.loading-bar {
	width: var(--loading-progress);
	background:var(--accent);
	height:100%;

	height: 0.2rem;
	border-radius:0.1rem;

	transition:width 0.2s;
}

.loading-container:has(.empty) {
	bottom:-4rem;
}

/* .loading-container:has(.loading-outer[error]) {
	transition-delay: 10s;
} */

.loading-outer[error] .loading-bar {
	background: red;
}

.input {
	display: flex;
	flex-direction: row;
	flex-wrap: nowrap;
	margin-top:1rem;
}

.input-icons i {
	font-size:1.5rem;
	padding:0.5rem;
	display: block;
}

.input-icons i:first-child {
	position: relative;
	top:-.1rem;
	color: rgb(0, 0, 145);
}

.input-icons i:last-child {
	position: relative;
	top:.1rem;
	left:.15rem;
	color: rgb(134, 0, 0);
}

.input-icons i.fa-ellipsis {
	/* height: 1rem; */
	font-size: 1rem;
	padding:0;
	position: relative;
	transform: rotate(90deg);
	top:10%;
	/* left:25%; */
}

.input-center {
	display: flex;
	flex-direction: column;
	gap:1rem;
	flex-wrap: nowrap;
	width: 100%;
}

.input-center div.point-selector {
	display: flex;
	background: var(--bg-translucent);
	font-size: 1rem;
	/* padding:0.5rem; */
	/* border:1px solid black; */
	border: 2px solid #aaa;
	
	/* height:2.5rem; */
	box-sizing: border-box;
	
	border-radius:0.5rem;
	width:100%;
	width: calc(1rem + 14ch);

	transition:background .2s, transform 0.2s, border 0.2s;
	transform: none;

	box-shadow: 
		0 0 1rem 1rem rgba(0,0,0,0.025) inset,
		0 0.25rem 1rem 1rem rgba(0,0,0,0.025)
	;


	/* overflow: hidden; */
}

div.point-selector input {
	border: none;
	/* background: red; */
	height: 100%;
	width: 100%;
	box-sizing: border-box;
	padding: 0.5rem;
	font-size: 1rem;

	border-bottom-left-radius: calc(0.5rem - 2px);
	border-top-left-radius: calc(0.5rem - 2px);
	border-top-right-radius: calc(0.5rem - 2px);
	border-bottom-right-radius: calc(0.5rem - 2px);

	transition: background 0.2s;
}

.input-center div.point-selector[data-unselected] {
	color: #666;
	font-style: italic;
}

.input-center div.point-selector:hover {
	/* cursor: pointer; */
	background: rgba(200,200,200,0.6)
}

.input-center div.point-selector:has(input:active) {
	transform:scale(0.95);
}

div.point-selector input:focus,
div.point-selector:has(button:active) input {
	border-top-right-radius: 0;
	border-bottom-right-radius: 0;
}

div.point-selector:has(input:hover) {
	border-color: #777;
}

div.point-selector input:focus-visible {
	outline: none; /*2px solid var(--accent);*/
}

div.point-selector:has(input:focus-visible),
body[last-focused="0"] div.point-selector:first-child,
body[last-focused="1"] div.point-selector:last-child {
	border-color:var(--accent);
}

div.point-selector:has(input:focus-visible) input,
body[last-focused="0"] div.point-selector:first-child input,
body[last-focused="1"] div.point-selector:last-child input {
	background: color-mix(in lch shorter hue, var(--accent) 10%,white 90%);
}

div.point-selector button.submit-point {
	/* opacity: 0; */
	border:none;
	background:var(--accent);
	width:2.5rem;
	padding: 0;
	max-width:0;
	
	border-top-right-radius: calc(0.5rem - 2px);
	border-bottom-right-radius: calc(0.5rem - 2px);

	position: relative;
	top:0;
	border:0px solid transparent;
	transform: scale(1);
	transition: transform 0.2s, border 0.2s, max-width 0.2s;
	overflow:hidden;
	color:black;
	&:hover {
		cursor: pointer;
		border:1px solid white;
		
	}
}

div.point-selector:has(input:focus) button.submit-point,
div.point-selector button.submit-point:active {
	max-width:2.5rem;
	padding:0.25rem;
}

div.point-selector button.submit-point:active {
	transform: scale(0.95);
	background:oklch(from var(--accent) calc(l + 0.1) c h);
}


.directions {
	padding:1rem;
	border: 2px solid #aaa;
}

.directions {
	left: calc( -100% - 1rem);
	position: relative;
	transition: left 0.5s;
}

.directions:has(#output[has-content]):not(.hidden) {
	left:0;
}

button.unhide {
	position:absolute;
	left:calc(-1rem - 100%);
	/* top:0rem; */
	bottom:33%;

	border:none;
	background: white;/*rgba(255, 255, 255, 0.6);*/
	backdrop-filter: blur(2rem);
	
	font-size: 0.75rem;
	padding:0.25rem;
	width: 1.5rem;
	height: 3rem;
	
	display: flex;
	align-items: center;
	justify-content: center;
	border-top-right-radius: 0.25rem;
	border-bottom-right-radius: 0.25rem;
	border: 2px solid #aaa;
	border-left:none;
	opacity:0;
	transform-origin: center left;
	transition: opacity 0.2s, background 0.2s, border 0.2s, transform 0.2s;
	color:black;

	&:hover {
		cursor: pointer;
		background: rgba(200, 200, 200, 0.6);
		border: 2px solid #ccc;
	}

	&:active {
		transform: scale(0.9);
	}
}

/* I hate this */
#top-left-info:has(.directions.hidden):has(#output[has-content]) button.unhide {
	opacity: 1;
	left: -1rem;
	pointer-events: all;
}

.leaflet-grab {
	cursor: crosshair;
}

body:not(.leaflet-dragging) .leaflet-grab:active {
	cursor: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><text y="12" font-size="10" fill="black">●</text></svg>') 2 2, auto;
}

button.route-control {
	position: absolute;
	right: 1rem;
	height: 1.5rem;
	width: 1.5rem;
	border:none;
	border-radius:0.25rem;
	background: rgba(255, 255, 255, 0.6);
	outline: 2px solid #aaa;
	box-sizing: border-box;
	color:black;

	transition: outline 0.2s, background 0.2s, transform 0.2s;

	&:hover {
		cursor: pointer;
		background: rgba(200,200,200,0.6);
		outline: 2px solid #ccc;
	}

	&:active {
		transform:scale(0.95);
	}
}

button.route-control.hide {
	top:1rem;
}

button.route-control.clear {
	bottom:1rem;
}

#intro-text {
	color:gray;
	margin:0;
	font-style: italic;
	margin-top:0.5rem;
	font-size:0.75rem;
}

.leaflet-bottom .leaflet-control-scale {
	margin-bottom:1rem;
}

.leaflet-left .leaflet-control-scale {
	margin-left:1rem;
}