/* !start */
/* --- global --- */
html {
	max-width: 80ch;
	margin: auto;
	background-color: lightcyan;
	font-family: sans-serif;
	overflow-x: clip;
}
:focus-visible {
	outline: medium solid hotpink;
}
::selection {
	color: white;
	background-color: mediumorchid;
}

/* --- title --- */
h1 {
	background: linear-gradient(to left, #ef5350, #f48fb1, #7e57c2, #2196f3, #26c6da, #43a047, #eeff41, #f9a825, #ff5722);
	background-clip: text;
	color: transparent;
	filter: drop-shadow(2px 2px #000);
	margin: auto;
	width: fit-content;
	text-align: center;
	font-size: 3em;
}
h1:before,
h1:after {
	color: black;
	display: inline-block;
	position: relative;
	width: 0;
}
h1:before {
	content: "🌈";
	right: 2.25ch;
}
h1:after {
	content: "🌈";
	transform: scaleX(-1);
	left: 2.25ch;
}

/* --- about --- */
#about {
	width: fit-content;
	margin: auto;
}
#about summary,
#theme-builder summary {
	text-align: center;
	cursor: pointer;
	font-size: 1.1em;
}
summary::marker {
	color: hotpink;
}
li::marker {
	content: "❀ ";
	color: mediumorchid;
}

/* --- main I/O --- */
input[type=button],
input[type=file],
textarea,
#file-content,
#loaders {
	display: block;
	margin: 0 0 1em;
	width: 100%;
	background-color: mistyrose;
	border: 1px solid black;
	box-sizing: border-box;
}
#file-content {
	overflow: auto;
}
#loaders {
	display: flex;
	flex-wrap: wrap;
	padding: 0.15em;
}
#loaders:has(:invalid) ~ #message:before {
	display: block;
	color: firebrick;
	content: 'URL should end with "wander.js"';
}
#file-input,
#url {
	display: flex;
	flex: 1;
	gap: 0.25em;
	width: unset;
	border: 0;
	margin: 0;
	padding: 0.15em;
}
#file-input {
	margin-top: 1px;
}
#url-input {
	flex: 1;
}
/* hidden iframe hack to avoid CORS shamelessly stolen from susam */
#loader-iframe {
	display: none;
}

/* --- main buttons --- */
input[type="button"] {
	background-color: white;
	border: 2px outset black;
	cursor: pointer;
	padding: 0.25em;
	font-weight: bold;
	letter-spacing: 0.1em;
}
input[type="button"]:active {
	border-style: inset;
}
input#update {
	font-size: 1.75em;
	margin: 1.5em auto;
}
input.save {
	background-color: deeppink;
	color: white;
	width: fit-content;
	font-size: 1.2em;
}
input#save {
	margin: 0 0 0 auto;
	position: relative;
	bottom: 0.75em;
}
input#reset {
	width: fit-content;
	color: red;
	background-color: white;
	font-size: 0.9em;
}
input#reset[value="Last chance. Are you sure?"] {
	color: white;
	background-color: red;
}

/* --- I/O labels --- */
body > label {
	font-size: 1.2em;
	display: flex;
}
body > label:before {
	content: "🏳️‍🌈";
	margin-right: 0.25ch;
	clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 100%, 35% 50%, 0% 0%);
	height: 50%;
}
body > label details {
	width: fit-content;
	margin-left: auto;
	font-size: 0.75em;
	text-align: right;
	font-style: italic;
	display: flex;
	justify-content: flex-end;
	flex-direction: row-reverse;
	gap: 2px;
	padding: 0.4em 0 0;
}
body > label details:open {
	padding-left: 2em;
}
body > label details:open:after {
	content: attr(title);
}
body > label summary {
	cursor: help;
	color: blue;
	font-style: normal;
	text-decoration: underline;
	text-decoration-skip-ink: none;
}
body > label summary::marker {
	content: "";
}
label[for=file-content] {
	position: relative;
	top: 0.75em;
}

/* --- style builder --- */
#iframe {
	width: 100%;
	min-height: 33vh;
	box-sizing: border-box;
	flex-grow: 1;
	margin: 0;
	padding: 0;
	border: 0;
}
/* wrapper and flexbox needed to make iframe user resizable */
#iframe-wrap {
	display: flex;
	margin: 0.5em 0;
	padding: 0;
	resize: both;
	overflow: hidden;
}
/* just included for accessibility */
details label {
	display: none;
}
details label.show {
	display: inline;
}
#toolbox,
#theme-export {
	display: flex;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 0.5em;
	margin: 0.5em 0;
}
#toolbox input,
#toolbox select {
	flex-grow: 1;
	flex-shrink: 0;
}
#border-width {
	max-width: 30%;
}
input#save-css {
	width: fit-content;
	margin: 0;
	font-size: 1em;
	letter-spacing: 0;
}
#ffx {
	display: none;
}

/* --- queries --- */
@media screen and (max-width: 700px) {
	h1 {
		font-size: 2em;
	}
}
@media screen and (max-width: 400px) {
	h1 {
		font-size: 1.5em;
	}
	body > label details {
		font-size: 0.65em;
	}
	/* hard to tap otherwise */
	#theme-builder {
		padding: 1em 0;
	}
	/* note about mobile firefox sucking ass */
	#ffx {
		display: block;
		text-align: center;
		font-size: 0.75em;
	}
	#ffx:has(:checked) {
		display: none;
	}
}
@media (prefers-color-scheme: dark) {
	html,
	input[type=file],
	input[type=text],
	#loaders,
	#file-content,
	textarea {
		background-color: black;
		color: mistyrose;
		border-color: hotpink;
	}
	h1 {
		filter: drop-shadow(2px 2px rebeccapurple);
	}
	a,
	body > label summary {
		color: aqua;
	}
	a:visited {
		color: mediumorchid;
	}
	#message {
		filter: brightness(125%);
	}
	input[type=text],
	#file-content,
	textarea {
		color: lightskyblue;
	}
	#save,
	#save-css,
	#update {
		background-color: lightskyblue;
		color: black;
	}
	#update {
		background-color: lightpink;
	}
}
/* !end */
