html {
	height: 100%;
}

body {
	font-family: sans-serif;
	min-height: 100%;
	display: grid;
	grid-template-rows: auto 1fr auto;
	margin: 0;
}

main {
	margin: 1rem;
}

h1,
h2,
h3,
h4,
h5,
h6 {
	text-align: center;
	margin: 0 auto;
	padding: 2rem;
}

.title {
	background: linear-gradient(
		to right,
		#ef5350,
		#f48fb1,
		#7e57c2,
		#2196f3,
		#26c6da,
		#43a047,
		#eeff41,
		#f9a825,
		#ff5722
	);
	background-size: auto;
	background-clip: border-box;
	-webkit-background-clip: text;
	-webkit-text-fill-color: transparent;
	background-size: 50% 100%;
	font-family:
		mallory,
		futura,
		arial black,
		sans-serif;
	font-size: 6rem;
	-webkit-text-stroke: 2px;
	letter-spacing: -4px;
}

p {
	margin: var(--size-6);
}

button {
	appearance: none;
	background: #fff;
	box-shadow: none;
	border: 1px solid #b1b6b7;
	border-radius: 3px;
	padding: 0 0.25rem;
	margin: 0;
	display: inline;
	cursor: pointer;
}

.unstyled_btn {
	appearance: none;
	box-shadow: none;
	border: 0;
	padding: 0;
	background: transparent;
}

nav {
	text-align: center;
	ul {
		list-style: none;
		padding: 0;
		margin: 1rem 0;

		li {
			display: inline-block;
			margin: 0 0.5rem;
		}
	}
}

footer {
	margin-top: 4rem;
	padding: 4rem;
	background: #f9fafc;
	border-top: 1px dotted #b1b6b7;

	.version {
		float: right;
		font-size: 85%;
	}
}

.group_wrapper {
	background: #f9fafc;
	border: 1px solid #b1b6b7;
	border-radius: 1rem;
	padding: 1rem;

	& + .group_wrapper {
		margin-top: 2rem;
	}

	h2 {
		padding-top: 0.5rem;
	}
}

.group {
	list-style: none;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 1rem;

	&:empty {
		border: none;
		padding: 0;
	}
}

.swatch,
.new_swatch {
	border: 1px solid #b1b6b7;
	background: #f9fafc;
	min-width: 9rem;
	min-height: 8rem;
	border-radius: 12px;
	overflow: hidden;

	.swatch_label {
		list-style: none;
		margin: 0.5rem 0 0 0;
		padding: 0.25rem 0.5rem;
		font-size: 0.85rem;

		li {
			display: flex;
			align-items: center;
			gap: 0.5rem;
		}

		li + li {
			margin-top: 0.5rem;
		}

		.swatch_label_name {
			display: grid;
			grid-template-columns: 1fr auto;
		}

		.swatch_label_value {
			color: #777;
		}
	}

	.swatch_color {
		height: 90px;
		margin: 0.25rem 0.25rem 0 0.25rem;
		border-radius: 8px;
	}
}

.new_swatch {
	text-align: center;
	position: relative;

	form {
		padding: 0;
	}

	ul {
		list-style: none;
		padding: 0;
		margin: 0;

		li {
			margin: 0.5rem;
		}

		.new_swatch_name {
			display: flex;
			max-width: 250px;

			input {
				margin-right: 1rem;
			}
		}

		.new_swatch_rgb {
			display: inline-block;

			input {
				width: 5ch;
			}
		}
	}
}

.new_group {
	ul {
		list-style: none;
		margin: 0;
		padding: 0;

		li {
			margin: 0.5rem;
		}
	}
}

.new_group_form {
	.new_group_btn_open {
		position: absolute;
		top: 0;
		right: 0;
		bottom: 0;
		left: 0;
		display: flex;
		align-items: center;
		justify-content: center;
		font-size: 2rem;
	}

	.new_group_btn_close {
		position: absolute;
		right: 0.5rem;
	}
}

.contrast_table {
	width: 100%;
	text-align: left;
	margin-top: 2rem;
	border: 1px solid #000;
	table-layout: fixed;
	border-collapse: collapse;

	td,
	th {
		padding: 0.25rem;
		word-wrap: break-word;
		height: 3rem;
	}

	col.col-label {
		width: 10rem;
	}
}

.contrast_badge {
	display: grid;
	height: 100%;
	align-items: center;
	text-align: center;
	font-size: 2rem;
	padding: 0.5rem;
	border-radius: 6px;
	overflow: hidden;

	&.contrast_badge_nope {
		border: 1px solid #b1b6b7;

		background-image: linear-gradient(
			to top right,
			transparent calc(50% - 1px),
			#b1b6b7 calc(50% - 1px),
			transparent calc(50% + 1px)
		);
	}

	&.contrast_badge_same {
		background: none;
		border: none;
	}

	.contrast_badge_large_text {
		vertical-align: super;
		font-size: 0.75rem;
		margin-left: 0.5rem;
	}
}

.toggle {
	display: inline-block;

	input {
		display: none;

		&,
		&:after,
		& + .toggle_label {
			box-sizing: border-box;
			&::selection {
				background: none;
			}
		}

		+ .toggle_label {
			outline: 0;
			display: block;
			width: 4em;
			height: 2em;
			position: relative;
			cursor: pointer;
			user-select: none;
			background: #fbfbfb;
			border-radius: 2em;
			padding: 2px;
			transition: all 0.4s ease;
			border: 1px solid #736f67;

			&:after {
				position: relative;
				display: block;
				content: "";
				width: 50%;
				height: 100%;
				left: 0;
				border-radius: 2em;
				background: #fbfbfb;
				transition:
					left 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275),
					padding 0.3s ease,
					margin 0.3s ease;
				box-shadow:
					0 0 0 1px rgba(0, 0, 0, 0.1),
					0 4px 0 rgba(0, 0, 0, 0.08);
			}

			&:hover:after {
				will-change: padding;
			}

			&:active {
				box-shadow: inset 0 0 0 2em #e8eae9;
				&:after {
					padding-right: 0.8em;
				}
			}
		}

		&:checked + .toggle_label:after {
			left: 50%;
		}

		&:checked + .toggle_label {
			background: #86d993;
			&:active {
				box-shadow: none;
				&:after {
					margin-left: -0.8em;
				}
			}
		}
	}
}

.toggle.mode_toggle {
	input + .toggle_label {
		background: #86d993;
		box-shadow: none;

		&:after {
			content: "AA";
			display: grid;
			align-items: center;
			text-align: center;
			font-size: 65%;
		}
	}

	input:checked + .toggle_label {
		&:after {
			content: "AAA";
		}
	}
}
