/* Inspired by https://contrast-ratio.com */

* {
	box-sizing: border-box;
}

:root {
	font-size: 150%;
	line-height: 1.3;
}

output {
	font-weight: bold;
}

button {
	font-size: 80%;
	padding: 0.4em 0.6em;
	white-space: nowrap;
}

html,
body {
	margin: 0;
	padding: 0;
}

html {
	background: linear-gradient(45deg, currentColor 25%, transparent 25%, transparent 75%, currentColor 75%, currentColor),
		linear-gradient(45deg, currentColor 25%, transparent 25%, transparent 75%, currentColor 75%, currentColor) 0.5rem 0.5rem;
	background-color: #eee;
	background-size: 1rem 1rem;
}

body {
	display: grid;
	grid-template-rows: min-content 1fr min-content;
	min-height: 100vh;
}

#form {
	display: flex;
	padding: 0.5em;
	gap: 0.5em;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	text-align: center;
}

#form label span {
	display: inline-block;
	margin: 0 0.8rem;
	padding: 0.1em 0.4em;
	white-space: nowrap;
	background-color: #666;
	color: #fff;
	font-size: 70%;
	font-weight: bold;
}

#form input {
	display: block;
	width: 22ch;  /* to fit rgba(255,255,255,0.5) */
	margin-top: -1px;
	padding: 0.2em 0.5ch;
	font-family: monospace;
	font-size: 150%;
	text-align: inherit;
	box-shadow: 0.05em 0.1em 0.2em rgba(0,0,0,.4) inset;
	background: #eee;
	color: #000;
	border-radius: 0.3em;
}

#form label + label {
	order: 2;
}

#display {
	grid-row: 2;
}

#display p {
	max-width: 40em;
	margin: 0 auto;
	padding: 1em;
}

#output {
	grid-row: 3;
	padding: 0.5em;
	background: #eee;
	color: #000;
	text-align: center;
}

#output label {
	display: inline-block;
	margin: 0 1em;
}

.gradient {
	display: inline-block;
	vertical-align: -0.35em;
	width: 1.5em;
	height: 1.5em;
	border-radius: 50%;
	background-color: #ccc;
}

canvas {
	display: none;
}

@media (min-width: 70em) {
	#form {
		flex-direction: row;
	}
	#form button {
		margin-top: 1.2rem;
	}
}
