@import url('https://fonts.googleapis.com/css2?family=Eagle+Lake&family=Open+Sans:wght@500&family=Source+Code+Pro&display=swap');

@keyframes rotate {
	from {
		transform: rotate(0deg);
	}
	to {
		transform: rotate(360deg);
	}
}

* {
	box-sizing: border-box;
}

@keyframes intro {
  from {
    min-width: 100%;
    opacity: 0;
    transform: scale(1.8, 1.6);
    filter: blur(1em);
  }
  to {}
}

:root {
	--background-color: #27282D;
	--highlight-color: #303438;
	--accent-color: #785F47;
	--accent-highlight-color: #ffd3a8;
	--text-highlight-color: #9b998e;
	--border: 2px solid var(--accent-color);
	--shadow: 0.2em 0.2em 0.4em rgba(0, 0, 0, 0.4);
	
	display: flex;
	justify-content: center;
	align-items: center;
	min-height: 100vh;
	
	font-family: 'Open Sans', sans-serif;
	font-size: 14px;
	font-weight: 500;
	letter-spacing: 0.025em;
	
	background-color: var(--background-color);
	background-image: url('bg.jpg');
	background-size: cover;
	background-position: center center;
	color: #efefef;
}

body {
	display: grid;
	grid-template-columns: 200px 200px 200px;
	justify-content: space-between;
	align-items: center;
	gap: 1em 3em;
	padding: 1em;
	position: relative;
	min-width: 50%;
	animation: intro ease-out 800ms;
	overflow: hidden;
	
  scrollbar-color: var(--text-highlight-color) var(--background-color);
}

::-webkit-scrollbar {
  background-color: var(--background-color);
}

::-webkit-scrollbar-thumb {
  background: var(--text-highlight-color);
  width: 10px;
	border-width: 0 4px;
	border-style: solid;
	border-color: var(--background-color);
}

h1, h2, h3, h4, h5, h6 {
	grid-column-start: 1;
	grid-column-end: 4;
	margin: 0;
}

h1 {
	font-family: 'Eagle Lake', serif;
	color: var(--accent-highlight-color);
	line-height: 1.5rem;
	text-transform: uppercase;
	transform-origin: left;
	transform: scale(0.9, 1);
}

h2, h3, h4, h5, h6 {
	color: var(--text-highlight-color);
	line-height: 1rem;
	font-weight: 500;
	background-image: linear-gradient(90deg, rgba(0, 0, 0, 0.4), transparent);
	border-bottom: 2px solid var(--highlight-color);
	border-radius: 0.1em;
	padding: 0.4em 0.6em;
	margin-left: -0.4em;
}

button {
	display: flex;
	justify-content: center;
	align-items: center;
	
	padding: 0.6em 0.8em;

	background-color: var(--background-color);
	background-image: 
		linear-gradient(45deg, transparent 44%, #2b2f33 45%, #2b2f33 55%, transparent 56%),
		linear-gradient(-45deg, transparent 44%, #2b2f33 45%, #2b2f33 55%, transparent 56%);
	background-size: 12px 12px;
	background-repeat: repeat;
	border: var(--border);
	border-radius: 0.1em;
	
	box-shadow: 
		var(--shadow), 
		inset 0 0 2.2em var(--background-color), 
		inset 0 0 1.8em rgba(0, 0, 0, 0.4);
	
	font-family: inherit;
	color: var(--accent-highlight-color);
	white-space: nowrap;

	cursor: pointer;
}

button:hover {
	background-color: var(--highlight-color);
	
	box-shadow: 
		var(--shadow), 
		inset 0 0 2.2em var(--background-color), 
		inset 0 0 0.3em 0.2em var(--accent-color);
}

button .icon {
	display: inline-block;
	width: 1.6em;
	height: 1.6em;
	margin-right: 0.6em;
}

input[type=range] {
	-webkit-appearance: none;
	width: 100%;
	background: transparent;
}

input[type=range]:focus {
	outline: none;
}

input[type=range]::-webkit-slider-thumb {
	-webkit-appearance: none;
	height: 22px;
	width: 14px;
	
	margin-top: -6px;
	
	background-color: #1a1b1e;
	
	border: var(--border);
	border-radius: 3px;	
	box-shadow: 
		var(--shadow), 
		inset 0 0 4px rgba(0, 0, 0, 0.4);
	
	cursor: pointer;
}

input[type=range]::-webkit-slider-thumb:hover {
	background-color: var(--background-color);
	box-shadow: 
		var(--shadow), 
		inset 0 0 2px 1px var(--accent-color);
}

input[type=range]::-webkit-slider-thumb:active {
	background-color: var(--accent-highlight-color);
}

input[type=range]::-moz-range-thumb {
	height: 18px;
	width: 10px;
	
	background-color: #1a1b1e;
	
	border: var(--border);
	border-radius: 0.2em;	
	box-shadow: 
		var(--shadow), 
		inset 0 0 4px rgba(0, 0, 0, 0.4);
	
	cursor: pointer;
}

input[type=range]::-moz-range-thumb:hover {
	background-color: var(--background-color);
	box-shadow: 
		var(--shadow), 
		inset 0 0 2px 1px var(--accent-color);
}

input[type=range]::-moz-range-thumb:active {
	background-color: var(--accent-highlight-color);
}

input[type=range]::-webkit-slider-runnable-track {
	width: 100%;
	height: 0.8em;
	box-shadow: inset 0.1em 0.1em 0.2em rgba(0, 0, 0, 0.2);
	background-color: rgba(0, 0, 0, 0.2);
	margin-top: 0.25em;
	
	cursor: pointer;
}

input[type=range]::-moz-range-track {
	width: 100%;
	height: 0.8em;
	box-shadow: inset 0.1em 0.1em 0.2em rgba(0, 0, 0, 0.2);
	background-color: rgba(0, 0, 0, 0.2);
	
	cursor: pointer;
}

#uploadForm {
	display: none;
}

#uploadedImage, #previewWrapper {
	width: 200px;
	height: 200px;
	
	border: var(--border);
	outline: none;
	
	background-color: rgba(0, 0, 0, 0.3);
}

#uploadedImage {
	
	object-fit: contain;
	cursor: pointer;
	box-shadow: 
		0 0 0.4em rgba(0, 0, 0, 0.3),
		inset 0 0 2.2em var(--background-color), 
		inset 0 0 1.8em rgba(0, 0, 0, 0.4);
	
	font-family: inherit;
	color: var(--accent-highlight-color);
	white-space: nowrap;

	cursor: pointer;
}

#uploadedImage:hover {
	
	box-shadow: 
		0 0 0.4em rgba(0, 0, 0, 0.3),
		inset 0 0 10em 0 rgba(255, 255, 255, 0.025),
		inset 0 0 0.6em 0.1em var(--accent-color);
}

#previewWrapper {
	display: flex;
	justify-content: center;
	align-items: center;
	
	position: relative;
	
	border-width: 4px;
	border-radius: 0.2em 0.2em 100% 100%;
	
	box-shadow: var(--shadow);
	
	overflow: hidden;
}

#previewWrapper:before {
	content: '';
	background-color: transparent;
	position: absolute;
	inset: 0;
	box-shadow: inset 0.025em 0.025em 0.4em rgba(0, 0, 0, 0.4);
}

#controls {
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
}

#controls label {
	margin-top: 0.7em;
	margin-bottom: 0.3em;
}

#code {
	grid-column-start: 1;
	grid-column-end: 4;

	height: calc(80vh - 200px - 8em);
	
	margin-top: 1em;
	padding: 0.4em 0.8em;
	
	resize: none;
	
	background-color: rgba(0, 0, 0, 0.3);
	
	border: var(--border);
	border-radius: 0.1em;
	
	font-family: 'Source Code Pro', monospace;
	font-size: inherit;
	color: inherit;
	
	transition: all ease-in-out 800ms;
	
	overflow: hidden scroll;
}

#copyCodeBtn {
	position: absolute;
	right: 3.2em;
	bottom: 2em;
}

#copyCodeBtn .icon {
	position: relative;
	background-color: black;
	mix-blend-mode: screen;
}

#copyCodeBtn .icon:before,
#copyCodeBtn .icon:after {
	content: '';
	display: block;
	position: absolute;
	width: 46%;
	height: 62%;
	background-color: var(--accent-color);
	filter: contrast(1.3) brightness(2);
	border: 2px solid black;
}

#copyCodeBtn .icon:before {
	left: 0;
	top: 0;
}

#copyCodeBtn .icon:after {
	right: 0;
	bottom: 0;
}

#code.initial {
	opacity: 0;
	height: 0;
	padding: 0;
	border-width: 0;  
}

#code.initial + #copyCodeBtn {
	opacity: 0;
	height: 0;
	padding: 0;
	border-width: 0;  
}

#loadingScreen {
	display: flex;
	justify-content: center;
	align-items: center;
	
	position: fixed;
	inset: 0;
	background-color: rgba(0, 0, 0, 0.8);
	
	transition: all linear 800ms;
	
	opacity: 0;
	pointer-events: none;
}

#loadingScreen.active {
	opacity: 1;
	pointer-events: all;
}

#loadingScreen .spinner {
	border: 0.8vmin solid rgba(220, 240, 255, 0.2);
	border-top: 0.8vmin solid var(--accent-highlight-color);
	border-radius: 50%;
	box-shadow: 0 0 0.3em black;
	width: 6vmin;
	height: 6vmin;
	animation: rotate 2s linear infinite;
}