/** @format */

:root {
	--hilite: #6941c6;
	--hilite-dark: #4c2db3;
}
* {
	line-height: 1;
	margin: 0;
	padding: 0;
	box-sizing: border-box;
}

body {
	background: #333;
	color: #fff;
	/* set fonts to default set */
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen,
		Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}

#app {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	min-height: 100vh;
	min-height: -webkit-fill-available;

	display: grid;
	grid-template-rows: min-content 1fr min-content min-content;
	display: none;
}
.viewer {
	width: 100%;
	position: relative;
	display: flex;
	justify-content: center;
	align-items: center;
	padding: 1rem;
}
.preview {
	width: 100%;
	height: 100%;
	background-size: contain;
	background-repeat: no-repeat;
	background-position: center;
	position: relative;
	overflow: hidden;
}

.preview:before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.5);
	-webkit-backdrop-filter: blur(0.5rem);
	backdrop-filter: blur(0.5rem);
	transition: all 0.5s ease-in-out;
	opacity: 0;
}

.preview:after {
	content: '';
	background: #fff;
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='1em' viewBox='0 0 512 512'%3E%3C!--! Font Awesome Pro 6.4.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --%3E%3Cpath d='M208 0V96l96 0V0H208zM0 208v96H96V208H0zM208 512h96V416H208v96zM512 208H416v96h96V208zM41 403.1L108.9 471l67.9-67.9-67.9-67.9L41 403.1zm362 67.9L471 403.1l-67.9-67.9-67.9 67.9L403.1 471zM41 108.9l67.9 67.9 67.9-67.9L108.9 41 41 108.9z'/%3E%3C/svg%3E");
	mask-size: contain;
	mask-repeat: no-repeat;
	mask-position: center;
	height: 20%;
	aspect-ratio: 1/1;
	position: absolute;
	top: calc(50% - 10%);
	left: calc(50% - 5%);
	transform: translate(-50%, -50%);
	transform-origin: center;
	animation: spinner 1s linear infinite;
	z-index: 100;
	opacity: 0;
	transition: all 0.6s ease-in-out;
}

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

.preview.loading:before {
	opacity: 1;
}

.preview.loading:after {
	opacity: 1;
}

.chooser {
	background: rgba(0, 0, 0, 0.3);
	padding: 1rem;

	display: flex;
	flex-direction: row;
	justify-content: center;
	gap: 1rem;
	overflow-x: auto;
	width: 100vw;
}

.thumb {
	height: 100%;
	min-height: 4rem;
	max-height: 7rem;
	aspect-ratio: 1/1;
	background: #000;
	border-radius: 0.5rem;
	background-size: cover;
	background-repeat: no-repeat;
	background-position: center;
	cursor: pointer;
	transition: transform 0.2s ease-in-out;
}

.thumb:hover {
	transform: scale(1.1);
}

.thumb.active {
	border: 2px solid var(--hilite);
}

.prompt {
	padding: 1rem;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 1rem;
	background: rgba(0, 0, 0, 0.3);
}

.row {
	display: flex;
	flex-direction: row;
	align-items: center;
	gap: 1rem;
	width: 100%;
	justify-content: stretch;
	max-width: 960px;
}

.set {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

select {
	appearance: none;
}

.label {
	font-size: 0.8em;
	font-weight: bold;
	text-transform: uppercase;
	opacity: 0.5;
}

input,
textarea,
select {
	width: 100%;
	padding: 0.5rem 1rem;
	border-radius: 0.5rem;
	border: none;
	background: rgba(0, 0, 0, 0.2);
	color: #fff;
	font-size: 0.8rem;
}
textarea {
	width: 100%;
	max-width: 960px;
	height: 4em;
	font-size: 1rem;
}

.preview.fresh {
	.dl {
		display: block;
	}
}

.dl {
	width: 2rem;
	height: 2rem;
	background: rgba(150, 150, 150, 0.8);
	position: absolute;
	bottom: 1rem;
	right: 1rem;
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='1em' viewBox='0 0 512 512'%3E%3C!--! Font Awesome Pro 6.4.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --%3E%3Cpath d='M256 512A256 256 0 1 1 256 0a256 256 0 1 1 0 512zM384 256H304V128H208V256H128v32L256 416 384 288V256z'/%3E%3C/svg%3E");
	mask-size: contain;
	mask-repeat: no-repeat;
	mask-position: center;
	cursor: pointer;
	border-radius: 100%;
	display: none;
}

.dl:hover {
	transform: scale(1.1);
}

.generate {
	background: var(--hilite);
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='1em' viewBox='0 0 512 512'%3E%3C!--! Font Awesome Free 6.4.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --%3E%3Cpath d='M0 256a256 256 0 1 0 512 0A256 256 0 1 0 0 256zM281 385c-9.4 9.4-24.6 9.4-33.9 0s-9.4-24.6 0-33.9l71-71L136 280c-13.3 0-24-10.7-24-24s10.7-24 24-24l182.1 0-71-71c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0L393 239c9.4 9.4 9.4 24.6 0 33.9L281 385z'/%3E%3C/svg%3E");
	width: 3rem;
	height: 3rem;
	mask-size: contain;
	mask-repeat: no-repeat;
	mask-position: center;
	cursor: pointer;
}

.generate:hover {
	background: var(--hilite-dark);
}

.footer {
	padding: 1rem;
	display: flex;
	flex-direction: row;
	background: #000;
}

.logo {
	background-image: url(logo.png);
	background-size: contain;
	background-repeat: no-repeat;
	background-position: center left;
	width: 100%;
	height: 1.25rem;
	display: block;
	transform: translateY(-3px);
}

#login {
	display: block;
}

body[data-user='yes'] #login {
	display: none;
}

body[data-user='yes'] #app {
	display: grid;
}

#login {
	width: 100vw;
	height: 100vh;
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
}

.popper {
	background: #222;
	border-radius: 1rem;
	padding: 2rem;
	display: flex;
	flex-direction: column;
	gap: 2rem;
	width: 90%;
	max-width: 500px;
}

.btn {
	padding: 1rem;
	border-radius: 0.5rem;
	border: none;
	background: var(--hilite);
	color: #fff;
	font-size: 1rem;
	cursor: pointer;
	text-align: center;
}

.btn:hover {
	background: var(--hilite-dark);
}

.popper .logo {
	height: 2rem;
	background-position: center;
}

#login_form {
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
}

.logout {
	color: #fff;
	cursor: pointer;
	opacity: 0.5;
	display: flex;
	flex-direction: row;
}

.logout:before {
	content: '';
	display: inline-block;
	margin-right: 0.25rem;
	width: 1rem;
	height: 1rem;
	background: #fff;
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='1em' viewBox='0 0 512 512'%3E%3C!--! Font Awesome Free 6.4.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --%3E%3Cpath d='M502.6 278.6c12.5-12.5 12.5-32.8 0-45.3l-128-128c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L402.7 224 192 224c-17.7 0-32 14.3-32 32s14.3 32 32 32l210.7 0-73.4 73.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0l128-128zM160 96c17.7 0 32-14.3 32-32s-14.3-32-32-32L96 32C43 32 0 75 0 128L0 384c0 53 43 96 96 96l64 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-64 0c-17.7 0-32-14.3-32-32l0-256c0-17.7 14.3-32 32-32l64 0z'/%3E%3C/svg%3E");
	mask-size: contain;
	mask-repeat: no-repeat;
	mask-position: center;
}

.logout:hover {
	opacity: 1;
}

@media (max-width: 650px) {
	.chooser {
		justify-content: flex-start;
	}

	.viewer {
		padding: 0;
	}

	.row {
		/* split into rows every 2nd item */
		grid-template-columns: repeat(2, 1fr);
		display: grid;
	}

	/* except for the last row, which should be 1fr min-content */
	.row:last-child {
		grid-template-columns: 1fr min-content;
	}
}
