@space-1x: 20px;
@space-2x: 40px;
@space-4x: 80px;
@space-8x: 160px;

@screen-xs: 576px;
@screen-sm: 768px;
@screen-md: 992px;
@screen-lg: 1200px;

.space-1 {
	width: 100%;
	height: @space-1x;
}

.space-2 {
	width: 100%;
	height: @space-2x;
}

.space-4 {
	width: 100%;
	height: @space-4x;
}

.space-8 {
	width: 100%;
	height: @space-8x;
}

* {
	color: @color-gray-900;
	font-family: 'Inter';
	-webkit-tap-highlight-color: transparent;
}

body,
main,
footer{
	overflow-x: hidden;
}

body {

	@media(prefers-color-scheme: dark) {
		background: @color-black;
	}
}

h1 {
	font-size: 36px;
	margin-top: @space-4x;

	sup {
		font-size: 18px;
		font-weight: 600;
		padding-left: 2px;
		vertical-align: top;
	}

	@media(prefers-color-scheme: dark) {
		color: @color-white;
	}
}

h2 {
	font-size: 28px;
	font-weight: 700;
	margin-top: @space-4x;
	margin-bottom: @space-2x;

	@media(prefers-color-scheme: dark) {
		color: @color-white;
	}
	
	@media(min-width: @screen-xs) {
		margin-top: @space-8x;
	}
}

h3 {
	font-size: 24px;
	font-weight: 600;
	margin-top: @space-2x;

	@media(prefers-color-scheme: dark) {
		color: @color-white;
	}
}

h4 {
	font-size: 18px;
	font-weight: 600;
	margin-top: @space-2x;

	@media(prefers-color-scheme: dark) {
		color: @color-white;
	}
}

p {
	color: @color-gray-700;
	font-size: 16px;
	margin-top: @space-2x;
	line-height: 26px;

	@media(prefers-color-scheme: dark) {
		color: @color-gray-400;
	}

	a {
		text-decoration: underline;
	}

	mark {
		background: @color-gray-200;
		border-radius: 2px;
		padding: 2px 4px;
		color: @color-gray-800;
		word-break: break-word;

		@media(prefers-color-scheme: dark) {
			color: @color-gray-400;
			background: darken(@color-gray-900, 8%);
		}
	}

	b {
		font-weight: 500;

		@media(prefers-color-scheme: dark) {
			color: @color-gray-100;
		}

		&.note {
			margin-bottom: calc(@space-1x / 2);
			display: inline-block;

			@media(prefers-color-scheme: dark) {
				color: @color-white;
			}
		}
	}

	span {
		color: inherit;
		display: block;
	}
}

.slogan {
	font-size: 44px;
	margin-bottom: @space-4x;

	@media(min-width: @screen-xs) {
		font-size: 64px;
	}
}

.slogan-subline {
	margin-bottom: @space-4x;
}

.subline {
	margin-top: @space-2x;
	font-weight: 500;
	font-size: 18px;
	line-height: 28px;
	color: @color-gray-600;

	@media(prefers-color-scheme: dark) {
		color: @color-gray-400;
	}
}

a {
	text-decoration: none;
	color: @color-gray-800;

	&:hover {
		text-decoration: underline;
		color: @color-gray-900;
	}

	@media(prefers-color-scheme: dark) {
		color: @color-gray-300;

		&:hover {
			color: @color-gray-100;
		}
	}
}

.list {
	padding-left: @space-1x;

	p {
		margin-left: calc(@space-1x / 2);
	}

	&.list-short {
		margin-top: @space-1x;

		p {
			margin-top: calc(@space-1x / 2);
		}
	}

	@media(prefers-color-scheme: dark) {

		li {
			color: @color-gray-400;
		}
	}
}

.link-list {

	span {
		margin-top: calc(@space-1x / 2);

		a {
			display: inline-block;
			margin-left: calc(@space-1x / 2);
		}
	}
}

&::-webkit-scrollbar {
	width: 10px;
}

&::-webkit-scrollbar-thumb {
	background: @color-gray-400;

	&:hover {
		background: @color-gray-500;
	}
}

.container {
	position: relative;
}

aside {
	position: fixed;
	transform: translate(calc(-100% - @space-2x), 0);
	width: 250px;
	padding-top: @space-4x;
	display: none;

	@media(min-width: @screen-lg) {
		display: block;
	}

	h4 {
		margin: 0;
		cursor: pointer;
		user-select: none;
		margin-bottom: @space-1x;
	}

	ul {
		list-style-type: none;
		margin-top: @space-2x;

		li {
			margin-top: @space-1x;
			cursor: pointer;
			user-select: none;
			font-size: 16px;
			font-weight: 500;
			color: @color-gray-700;
			line-height: 24px;

			&:hover {
				color: @color-gray-900;
			}

			@media(prefers-color-scheme: dark) {
				color: @color-gray-400;

				&:hover {
					color: @color-gray-200;
				}
			}
		}
	}
}

code {
	display: block;
	background: @color-gray-900;
	border-radius: 4px;
	padding: @space-1x;
	margin-top: @space-2x;
	position: relative;
	overflow-x: auto;

	&::-webkit-scrollbar {
		height: 8px;
	}

	&::-webkit-scrollbar-thumb {
		background: @color-gray-700;

		&:hover {
			background: @color-gray-800;
		}
	}

	@media(prefers-color-scheme: dark) {
		background: darken(@color-gray-900, 8%);
	}

	pre {
		color: @color-gray-400;
		line-height: 22px;
		tab-size: 40px;
		font-family: 'JetBrains Mono', monospace;
		display: inline-block;

		span {
			font-family: 'JetBrains Mono', monospace;
			color: inherit;

			&.n {
				color: @color-gray-50;
			}
		
			&.c {
				color: @color-blue-300;
			}
		
			&.s {
				color: @color-green-300;
			}
		
			&.p {
				color: @color-cyan-300;
			}

			&.x {
				color: @color-teal-400;
			}

			&.ref {
				cursor: pointer;

				&:hover {
					text-decoration: underline;
				}
			}
		}
	}

	.clipboard {
		position: absolute;
		top: 14px;
		right: 14px;
		width: 34px;
		height: 34px;
		padding: 5px;
		border-radius: 50%;
		cursor: pointer;
		color: @color-gray-600;

		&:hover {
			color: @color-gray-700;

			&::before,
			&::after {
				opacity: 1;
			}
		}

		&::before {
			content: '';
			opacity: 0;
			display: inline-block;
			position: absolute;
			user-select: none;
			pointer-events: none;
			left: 50%;
			top: -2px;
			transform: translate(-50%, 0);
			border: 5px solid transparent;
			border-top: 5px solid @color-gray-900;
		}

		&::after {
			content: attr(data-title);
			opacity: 0;
			display: inline-block;
			position: absolute;
			background: @color-gray-900;
			padding: 6px 8px;
			color: @color-white;
			font-family: 'Inter', sans-serif;
			font-size: 12px;
			border-radius: 3px;
			user-select: none;
			pointer-events: none;
			left: 50%;
			top: -25px;
			transform: translate(-50%, 0);
		}
	}
}

.logo {
	margin-top: @space-2x;
	cursor: pointer;
}

.banner {
	display: block;
	margin-top: @space-4x;
	
	img {
		width: 100%;
		height: 100%;
		object-fit: cover;
		display: block;
		border-radius: 4px;
		height: 500px;
	}

	p {
		margin-top: @space-2x;
	}
}

.embed {
	display: block;
	margin-top: @space-4x;

	iframe {
		border-radius: 4px;
		width: 100%;
		height: calc(100vw * 500 / 800);
		pointer-events: none;

		@media(min-width: 800px) {
			width: 100%;
			height: 500px;
		}
	}

	p {
		margin-top: @space-2x;
	}
}

.breadcrumb {
	display: flex;
	padding-top: @space-2x;
	list-style-type: none;

	@media(min-width: @screen-xs) {
		padding-top: @space-4x;
	}

	li {
		color: @color-gray-700;
		font-size: 16px;
		line-height: 24px;
		position: relative;
		padding-right: @space-1x;

		&:not(:last-of-type) {

			&::after {
				content: '/';
				display: inline-block;
				position: absolute;
				right: 7px;
				user-select: none;
			}
		}

		@media(prefers-color-scheme: dark) {
			color: @color-gray-400;

			a {
				color: @color-gray-400;

				&:hover {
					color: @color-gray-200;
				}
			}
		}
	}
}

.palette-list {
	display: flex;
	flex-wrap: wrap;
	list-style-type: none;
	margin-top: @space-4x;
	gap: @space-1x;

	.palette {
		display: flex;
		flex-direction: column;
		border-radius: 4px;
		width: calc(50% - @space-1x * 1 / 2);
		margin-bottom: @space-1x;

		@media(min-width: @screen-xs) {
			width: calc(25% - @space-1x * 3 / 4);
		}

		.palette-tone {
			width: 100%;
			color: white;
			font-size: 14px;
			display: inline-flex;
			align-items: center;
			padding: calc(@space-1x / 1.25);
			cursor: pointer;
			user-select: none;
			transition: margin ease 0.2s, width ease 0.2s, height ease 0.2s, padding ease 0.2s, border-radius ease 0.2s;

			&.dark {
				color: @color-gray-900;
				font-weight: 500;
			}

			&:hover {
				margin: -4px;
				width: calc(100% + 8px);
				height: calc(100% + 8px);
				padding: calc(@space-1x / 1.25 + 4px);
				z-index: 1;
				border-radius: 4px;
			}

			&:first-of-type {
				border-top-left-radius: 4px;
				border-top-right-radius: 4px;
			}

			&:last-of-type {
				border-bottom-left-radius: 4px;
				border-bottom-right-radius: 4px;
			}
		}
	}
}

.icon-list {
	display: flex;
	flex-wrap: wrap;
	list-style-type: none;
	margin-top: @space-2x;
	margin-bottom: @space-2x;
	gap: @space-1x;

	.icon {
		display: flex;
		border-radius: 4px;
		justify-content: center;
		align-items: center;
		width: calc(25% - @space-1x * 3 / 4);
		aspect-ratio: 1 / 1;
		background: @color-gray-50;
		cursor: pointer;

		@media(min-width: @screen-xs) {
			width: calc(16.666% - @space-1x * 5 / 6);
		}

		@media(min-width: @screen-sm) {
			width: calc(10% - @space-1x * 9 / 10);
		}
		
		.ico {
			color: @color-gray-600;
			transition: color ease 0.2s;
		}

		&:hover {
			margin: -3px;
			width: calc(10% - @space-1x * 9 / 10 + 6px);

			.ico {
				color: @color-gray-900;
			}
		}

		@media(prefers-color-scheme: dark) {
			background: darken(@color-gray-900, 8%);

			.ico {
				color: @color-gray-500;
			}

			&:hover {

				.ico {
					color: @color-gray-200;
				}
			}
		}
	}
}

footer {
	margin-top: @space-4x;
	margin-bottom: @space-2x;

	@media(min-width: @screen-xs) {
		margin-top: @space-8x;
		margin-bottom: @space-4x;

		a {

			&:first-of-type {
				display: flex !important;
			}
		}
	}

	.container {
		display: flex;
		justify-content: flex-end;
		gap: @space-1x;
	}

	p {
		flex: 1;
		align-self: flex-start;
		color: @color-gray-700;
		margin: 0;
	}

	a {
		font-size: 16px;
		display: flex;
		align-items: center;

		&:first-of-type {
			display: none;
		}
	}

	@media(prefers-color-scheme: dark) {
		
		p {
			color: @color-gray-500;
		}

		a {
			color: @color-gray-500;

			&:hover {
				color: @color-gray-300;
			}
		}
	}
}

.tooltip {
	position: relative;

	&:hover {

		&::before,
		&::after {
			opacity: 1;
			transition-delay: 1s;
		}

		&::before {
			bottom: -13px;
		}

		&::after {
			bottom: -40px;
		}
	}

	&::before,
	&::after {
		opacity: 0;
		content: '';
		display: inline-block;
		position: absolute;
		user-select: none;
		pointer-events: none;
		transition: opacity ease 0.1s, bottom ease 0.1s;
		transition-delay: 0s;
		z-index: 2;
		left: 50%;
		transform: translate(-50%, 0);
	}

	&::before {
		border: 3px solid transparent;
		border-bottom: 3px solid @color-gray-900;
		bottom: -10px;
	}

	&::after {
		content: attr(data-title);
		background: @color-gray-900;
		font-size: 12px;
		color: @color-white;
		white-space: nowrap;
		padding: 6px 10px;
		padding-bottom: 7px;
		border-radius: 3px;
		bottom: -37px;
		height: 15px;
		min-width: 40px;
		text-align: center;
		font-weight: 400;
	}
}

.snackbar {
	background: @color-gray-900;
	position: fixed;
	left: 50%;
	bottom: 0;
	border-radius: 4px;
	color: @color-white;
	padding: 18px 30px;
	pointer-events: none;
	opacity: 0;
	transition: opacity ease 0.2s, bottom ease 0.2s;
	transform: translate(-50%, 0);
	white-space: nowrap;
	z-index: 99;

	&.active {
		opacity: 1;
		bottom: @space-1x;
	}

	@media(min-width: @screen-xs) {
		left: @space-2x;
		bottom: @space-1x;
		transform: none;

		&.active {
			bottom: @space-2x;
		}
	}
}
