/* This can only be described as functional. */
:root {
	--icon-scale: 1;
	--success-green: #3AB336;
	--error-red: #E24436;
}
body {
	background-image: linear-gradient(#FFFB, #FFFB), url("assets/logo_background.png");
	background-size: 100px;
	/* animation: move-background 10s linear infinite; */
	font-family: "Catamaran", "Trebuchet MS", sans-serif;
	color: #202526;
	line-height: 1.2;
}
@keyframes move-background {
	from {
		background-position: 0 0;
	}
	to {
		background-position: 100px 60px;
	}
}
main {
	margin: auto;
	padding: 20px;
	position: absolute;
	left: 0;
	right: 0;
	top: 0;
	bottom: 0;
	width: 90vw;
	height: 90vh;
	background: #FFF8;
	/* backdrop-filter: blur(1.5px); */
	border: 5px solid #D7B3D7;
	border-radius: 25px;
	box-sizing: border-box;
	text-align: center;
	overflow: auto;
	scroll-behavior: smooth;
}
h1 {
	margin: 6px 0;
}
#responsiveWidthWrapper {
	margin: auto;
	width: 60%;
}
form {
	text-align: left;
}
@media (min-width: 1301px) {
	:root {
		font-size: 1.125em;
		--icon-scale: 1.6;
	}
}
@media (max-width: 1300px) {
	:root {
		--icon-scale: 1.3;
	}
	#responsiveWidthWrapper {
		width: 70%;
	}
}
@media (max-width: 1048px) {
	#responsiveWidthWrapper {
		width: 82.5%;
	}
}
@media (max-width: 748px) {
	:root {
		font-size: 0.875em;
	}
	#responsiveWidthWrapper {
		width: 95%;
	}
}
@media (max-width: 450px) {
	:root {
		font-size: 0.8em;
		--icon-scale: 1;
	}
	main {
		padding: 2px;
	}
	fieldset {
		padding: 5px;
	}
}
input[type="file"]:invalid {
	color: var(--error-red);
	outline: 3px solid var(--error-red);
	contain: paint; /* makes the outline draw on top of neighbouring elements */
}
#structureFileInputCont input[type="file"] ~ div {
	margin: 4px auto;
	padding: 10px;
	box-sizing: border-box;
	width: 70%;
	font-weight: 500;
	text-align: center;
	border: 3px dashed #D899D8;
	border-radius: 25px;
}
#structureFileInputCont fieldset:first-of-type input[type="file"] ~ div {
	border: 3px solid #D899D8;
}
#structureFileInputCont input[type="file"] ~ div p {
	margin: 0;
}
#structureFileInputCont input[type="file"] ~ div p:first-child {
	font-size: 1.4em;
}
#structureFileInputCont input[type="file"] ~ div p:last-child {
	font-size: 0.7em;
}
#structureFileInputCont:not(:has(+ file-input-table[has-files])):not(:has(fieldset label ~ span:not(.hidden))) {
	input[type="file"], ~ * {
		display: none;
	}
}
main:not(:has(file-input-table[has-files])):not(:has(.previewCont)) { /* hide lots of stuff when no files are selected */
	#structureFileInputCont:not(:has(fieldset label ~ span:not(.hidden))) input[type="file"] {
		display: none;
	}
	form ~ *, #structureFileInputCont ~ * {
		display: none;
	}
}
#structureFileInputCont:has(+ file-input-table[has-files]), #structureFileInputCont:has(fieldset label ~ span:not(.hidden)) {
	input[type="file"] ~ div {
		display: none;
	}
}
#structureFileInputCont fieldset label ~ span {
	display: block;
	margin-top: 10px;
	font-weight: 500;
	
	&[id$="success"i] {
		color: var(--success-green);
	}
	&[id$="error"i] {
		color: var(--error-red);
	}
}
#descriptionLinksCont {
	font-weight: 500;
	color: #777;
	font-size: 0.9em;
}
file-input-table {
	margin: 3px;
}
fieldset.expandable {
	display: grid;
	grid-template-rows: 0fr;
	transition: grid-template-rows 0.35s;
}
fieldset.expandable:has(legend input:checked) {
	grid-template-rows: 1fr;
}
fieldset.expandable > *:not(legend) {
	overflow: hidden;
}
fieldset.expandable > legend {
	contain: layout;
}
fieldset.expandable > legend > label {
	padding-left: 1em;
	cursor: pointer;
}
fieldset.expandable > legend > label > input {
	display: none;
}
fieldset.expandable > legend::before {
	content: "";
	margin: auto;
	display: inline-block;
	position: absolute;
	left: 3px;
	top: 3px;
	bottom: 0;
	width: 0.5em;
	height: 0.5em;
	border-right: 1px solid currentColor;
	border-top: 1px solid currentColor;
	transform: rotate(45deg);
	transform-origin: 75% 25%;
	transition: transform 0.35s;
}
fieldset.expandable:has(legend input:checked) > legend::before {
	transform: rotate(135deg);
}
label {
	display: block;
}
input, select {
	font-family: monospace;
}
details {
	padding: 3px;
	width: fit-content;
	border: 1px solid #AAA;
	border-radius: 5px;
	font-size: 0.825em;
}
summary {
	padding: 0 3px;
	font-weight: 500;
	font-size: 1rem;
}
input, button {
	color: inherit; /* iOS fix */
}
button, input[type="checkbox"], input[type="number"], input[type="text"], textarea, input[type="file"]::file-selector-button, select, .buttonlike {
	padding: 1px 4px;
	border: 2px solid #D899D8;
	accent-color: #D899D8;
	border-radius: 7px;
	background: #EEDEEE;
	font-family: inherit;
	color: inherit;
	cursor: pointer;
	transition: background 0.15s, border-color 0.15s;
}
input[type="color"] {
	border: 2px solid #D899D8;
	border-radius: 7px;
	background: #EEDEEE;
	cursor: pointer;
	transition: background 0.15s;
}
input[type="number"], input[type="text"], textarea {
	cursor: text;
	outline-width: thin;
	accent-color: auto;
	line-height: inherit;
}
input[type="text"]::placeholder {
	text-overflow: ellipsis;
}
input[type="text"]:invalid {
	border-color: var(--error-red);
	outline-color: var(--error-red);
}
a.buttonlike {
	color: initial;
	text-decoration: initial;
}
button:not(:disabled):not(.packInfoButton):hover, input[type="file"]:not(:disabled):hover::file-selector-button, select:not(:disabled):hover, .buttonlike:not(.packInfoButton):hover {
	background: #E8C8E8;
}
button:disabled, input[type="file"]:disabled::file-selector-button, select:disabled, .buttonlike:disabled {
	cursor: not-allowed;
}
button:not(#generatePackButton):disabled {
	background: #CCC;
	border-color: #9A9A9A;
}
input[type="number"]:hover, input[type="text"]:hover, input[type="color"]:hover, textarea:hover {
	background: #EAD5EA;
}
button:not(.packInfoButton):not(:disabled):active, input[type="file"]:not(:disabled):active::file-selector-button, select:not(:disabled):active, .buttonlike:not(.packInfoButton):not(:disabled):active:active {
	background: #DABADA;
}
input[type="checkbox"] {
	display: inline-block;
	appearance: none;
	width: 40px;
	height: 20px;
	border-radius: 10px;
}
input[type="checkbox"]:checked {
	background: #E0BEE0;
}
input[type="checkbox"]::after {
	display: inline-block;
	width: 12px;
	height: 12px;
	position: relative;
	bottom: -1px;
	left: -2px;
	background: #C889C8;
	border-radius: 50%;
	content: "close";
	font-family: "Material Symbols";
	font-size: 15px;
	font-weight: bold;
	color: transparent;
	text-shadow: 17px -3px 0 black; /* effectively move the text */
	transition: left 0.2s, text-shadow 0.2s, background 0.15s;
}
input[type="checkbox"]:checked::after {
	left: 18px;
	content: "check";
	text-shadow: -20px -3px 0 black;
}
input[type="checkbox"]:hover::after {
	background: #B778B7;
}
.resetButton {
	position: absolute;
	right: 10px;
	top: 0;
}

.multiTabCont {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-evenly;
}
.multiTabCont > input[type="radio"][name^="configTabs"] {
	position: absolute; /* stay at top */
	display: none;
}
.multiTabCont > label {
	flex: 1 1 0;
	text-align: center;
	margin: 10px 5px 5px;
}
.multiTabCont:nth-child(2) > label {
	margin: 0 5px 5px;
}
.multiTabCont > fieldset {
	width: 100%;
	order: 1;
	contain: layout;
}
.multiTabCont > input[type="radio"][name^="configTabs"]:checked + label {
	background: #E8C8E8;
	font-weight: 500;
}
.multiTabCont > input[type="radio"][name^="configTabs"]:not(:checked) + label + fieldset {
	display: none;
}

#dropFileNotice {
	padding: 10px;
	position: fixed;
	top: 0;
	left: 0;
	width: 100vw;
	height: 100vh;
	box-sizing: border-box;
	background: #0002;
	font-size: 1.75em;
	text-align: center;
	display: flex;
	justify-content: center;
	align-items: center;
}
#generatePackButton, .packInfoButton {
	margin: 4px auto;
	padding: 10px;
	box-sizing: border-box;
	width: 70%;
	display: block;
	
	border-width: 3px;
	border-radius: 25px;
	text-align: center;
	font-size: 1.4em;
	font-weight: 500;
}
.packInfoButton {
	--bg-col-1: #E8C8E8;
	--bg-col-2: #D899D8;
	background-image: repeating-linear-gradient(150deg, var(--bg-col-1) 0, var(--bg-col-1) 10px, var(--bg-col-2) 10px, var(--bg-col-2) 20px);
	background-size: 200% !important;
	border-color: var(--bg-col-2);
	transition: transform 0.15s;
	min-width: min-content;
}
.packInfoButton:not(.finished) {
	cursor: wait;
}
.packInfoButton.completed {
	animation: moveButtonBackground 1s linear infinite;
}
@keyframes moveButtonBackground {
	from {
		background-position: -40px 0;
	}
}
.packInfoButton.completed:hover {
	transform: scale(1.05);
}
.packInfoButton.reportIssue:hover {
	transform: scale(1.035);
}
.packInfoButton.completed:active {
	transform: scale(1.02);
}
.packInfoButton.reportIssue:active {
	transform: scale(1.01);
}
.packInfoButton.failed, .packInfoButton.reportIssue {
	--bg-col-1: #ee5350;
	--bg-col-2: #e43b37;
}
.packInfoButton.failed {
	cursor: initial;
}
.packInfoButton.reportIssue {
	cursor: pointer;
}

#termsOfUseNotice {
	display: block;
	text-align: center;
}
img:not(#languageSelectorButton), canvas {
	display: inline-block;
	width: 400px;
	border: 1px solid black;
	background: url("assets/noise.svg");
	/* color: #4C33CC;
	color: #2C33B3;
	color: #4CF0A0
	color: hsl(300, 24%, 53%);
	color: #D899D8;
	color: #D7B3D7; */
}
.previewCont {
	padding: 5px;
	text-align: center;
}
.previewCont > * {
	width: min(80vmin, 100%);
	aspect-ratio: 1;
}
.previewCont canvas {
	touch-action: none;
}
.previewMessage {
	margin: auto;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 2.5vw;
	border: 1px solid black;
}
@media (max-width: 768px) {
	.previewMessage {
		font-size: 3.5vw;
	}
}
@media (max-width: 450px) {
	.previewMessage {
		font-size: 5vw;
	}
}
.previewMessage.clickToView {
	cursor: pointer;
}
#languageSelectorCont {
	position: absolute;
	top: 10px;
	right: 10px;
}
#languageSelectorButton {
	width: calc(22px * var(--icon-scale));
	height: calc(22px * var(--icon-scale));
	background: currentColor;
	mask: url("assets/translate_icon.svg") no-repeat center;
	-webkit-mask: url("assets/translate_icon.svg") no-repeat center; /* No way Chrome didn't support this until a year ago :0 */
	transition: transform 0.15s;
}
#languageSelectorCont:hover > #languageSelectorButton {
	transform: scale(1.125);
}
#languageSelector {
	opacity: 0;
	position: absolute;
	left: 0;
	top: 0;
	width: 100%;
	height: 100%;
}
.hidden {
	display: none !important;
}
/* This magic is taken straight from https://css-loaders.com/bars/#l1 */
.loader {
	margin: 10px auto auto;
	width: 45px;
	aspect-ratio: 1;
	--c: no-repeat linear-gradient(#D899D8 0 0);
	background: var(--c) 0% 50%, var(--c) 50% 50%, var(--c) 100% 50%;
	background-size: 20% 100%;
	animation: l1 1s infinite linear;
}
@keyframes l1 {
	0% {
		background-size: 20% 100%, 20% 100%, 20% 100%;
	}
	33% {
		background-size: 20% 10%, 20% 100%, 20% 100%;
	}
	50% {
		background-size: 20% 100%, 20% 10%, 20% 100%;
	}
	66% {
		background-size: 20% 100%, 20% 100%, 20% 10%;
	}
	100% {
		background-size: 20% 100%, 20% 100%, 20% 100%;
	}
}

fieldset.textureSettings > div {
	display: flex;
	flex-wrap: wrap;
	gap: 15px 0;	
}
fieldset.textureSettings > div > div {
	flex: 1 1 auto;
}
#texturePreviewCont {
	text-align: center;
	min-width: 260px;
}
#texturePreviewCont img {
	margin: 5px;
	display: inline-block;
	border: none;
	width: 40%;
	max-width: 140px;
	image-rendering: pixelated;
}