::selection {
	background-color: rgba($primary, 0.5);
	color: $white;
}

::placeholder {
	color: $light-gray;
}

* {
	margin: 0;
	color: inherit;
	font-size: inherit;
	font-family: inherit;
	line-height: inherit;
	font-weight: inherit;
	box-sizing: border-box;
}

html {
	font-size: 1rem; // 16px
	text-rendering: optimizeLegibility;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	height: 100%;
}

body {
	position: relative;
	height: 100%;
	max-width: 100vw;
	overflow-x: hidden;
	font-size: size(18);
	line-height: size(27);
	font-family: $font-sans-serif;
	color: $black;
	background-color: $white;
	padding: 0 $page-margin;
	@media (max-width: $bp-small) {
		padding: 0 $page-margin-small;
	}
	&.loading {
		header {
			opacity: 0;
			transform: translateY(-10px);
			pointer-events: none;
		}
		section {
			opacity: 0;
			transform: translateY(10px);
			pointer-events: none;
		}
	}
	&.menu-open {
		section,
		article {
			opacity: 0.05;
			pointer-events: none;
		}
		header {
			nav {
				.rgb-r,
				.rgb-g,
				.rgb-b {
					opacity: 1;
				}
				.menu {
					&:before {
						transform: rotate(45deg);
					}
					&:after {
						transform: rotate(-45deg);
						margin-top: -2px;
					}
				}
				ol {
					opacity: 1;
					pointer-events: auto;
					li {
						animation-play-state: running;
					}
				}
			}
		}
	}
}

header {
	position: fixed;
	top: 0;
	left: 0;
	width: 100vw;
	padding: 25px $page-margin;
	z-index: 10;
	transition: all $fast ease-out;
	@media (max-width: $bp-small) {
		padding: 25px $page-margin-small;
	}

	nav {
		position: relative;
		width: 100%;
		max-width: $page-width;
		margin: 0 auto;
		display: flex;
		align-items: stretch;
		align-content: center;
		justify-content: space-between;

		.logo {
			display: block;
			z-index: 10;
		}

		.menu {
			display: block;
			position: relative;
			width: 20px;
			transition: width $fast $transition;
			cursor: pointer;
			display: flex;
			flex-wrap: wrap;
			align-content: center;
			z-index: 10;

			&:before,
			&:after {
				content: "";
				width: 100%;
				height: 2px;
				background-color: $black;
				transition: all $fast $transition;
			}
			&:after {
				margin-top: 4px;
			}
			&:hover {
				&:after {
					margin-top: -2px;
				}
			}
		}

		ol {
			position: relative;
			list-style: none;
			z-index: 9;
			span {
				display: none;
			}
			&.overlay {
				display: flex;
				position: fixed;
				top: 0;
				height: 100vh;
				max-width: 800px;
				margin: 0 auto;
				flex-wrap: wrap;
				align-content: center;
				opacity: 0;
				pointer-events: none;
				transition: $fast $transition opacity;
				li {
					display: block;
					width: 100%;
					text-align: left;
					opacity: 0;

					animation: 500ms ease-out 0s 1 navfadeIn;
					animation-fill-mode: forwards;
					animation-play-state: paused;

					&:nth-of-type(1) { animation-delay: 0.0s; }
					&:nth-of-type(2) { animation-delay: 0.05s; }
					&:nth-of-type(3) { animation-delay: 0.10s; }
					&:nth-of-type(4) { animation-delay: 0.15s; }
					&:nth-of-type(5) { animation-delay: 0.20s; }
					&:nth-of-type(6) { animation-delay: 0.25s; }

					a:hover {
						span {
							margin-left: 40px;
						}
					}
					span {
						display: inline-block;
						font-family: 'Rubik';
						margin-left: 20px;
						transition: all $fast $transition;
					}
				}
			}
			li {
				display: inline-block;
				width: 100px;
				text-align: right;
			}
		}
	}
}

main {
	position: relative;
	max-width: $page-width;
	margin: 0 auto;
	z-index: 9;
}

footer {
	font-size: size(14);
	opacity: 0.1;
	padding: 0 0 25px;
	nav {
		position: relative;
		width: 100%;
		max-width: $page-width;
		margin: 0 auto;
		display: flex;
		align-items: center;
		justify-content: space-between;
	}
}

a {
	color: currentColor;
	transition: $fast $transition all;
	text-decoration: none;
}

section {
	position: relative;
	display: flex;
	align-items: flex-start;
	flex-wrap: wrap;
	padding: 0;
	opacity: 1;
	z-index: 2;
	transition: $fast ease-out opacity, $fast ease-out transform;
	& > div {
		max-width: 100%;
	}
	&.fill {
		min-height: 100vh;
	}
	&.center {
		align-content: center;
		h1 {
			margin-bottom: 20px;
			max-width: 75%;

			@media (max-width: $bp-medium) {
				max-width: 75%;
			}
			@media (max-width: $bp-small) {
				max-width: 100%;
			}
		}
		p {
			margin-top: 20px;
			max-width: 62.5%;
			color: #333333;

			@media (max-width: $bp-medium) {
				max-width: 75%;
			}
			@media (max-width: $bp-small) {
				max-width: 100%;
			}
		}
		form {
			display: flex;
			input {
				padding: 20px;
				border: none;
				background-color: $white;
				box-shadow: 0px 2px 10px 0px rgba(0,0,0,0.1);
				width: 100%;
				max-width: calc(62.5% + 1px);
				outline: none;
				transition: $fast $transition all;
				z-index: 2;
				&:hover,
				&:focus {
					box-shadow: 0px 2px 10px 0px rgba(0,0,0,0.2);
				}
				@media (max-width: $bp-medium) {
					max-width: calc(75% + 1px);
				}
				@media (max-width: $bp-small) {
					max-width: calc(87.5% + 1px);
				}
			}
			button {
				color: $white;
				background-color: $black;
				border: none;
				outline: none;
				margin: 0;
				padding-top: 8px;
				width: 12.5%;
				z-index: 1;
				transform: translateX(-100%);
				transition: $fast ease-out all;
				cursor: pointer;
				&:hover {
					padding-top: 12px;
				}
				&:focus {
					padding-top: 12px;
				}
			}
			&.enabled {
				button {
					transform: translateX(0);
				}
			}
		}
	}
}

article {
	padding: 20vh 0;
	time {
		display: block;
	}
	h1 {
		width: 75%;
	}
	.byline {
		opacity: 0.25;
		margin-top: 10px;
	}
	.tags {
		margin-top: 50px;
		span {
			opacity: 0.25;
			margin-right: 10px;
		}
	}
	.body {
		color: #333333;
		margin-top: 50px;
		h2,
		h3 {
			margin: 50px 0 0;
			width: 75%;
		}
		p {
			margin: 15px 0 25px;
			width: 75%;
		}
		blockquote {
			margin: 25px 0 25px -25px;
			padding: 0 0 0 25px;
			border-left: 1px solid $black;
			font-weight: 700;
		}
		figure {
			margin: 40px 0 30px;
			&:hover {
				figcaption {
					opacity: 1;
				}
			}
			figcaption {
				font-size: 1rem;
				opacity: 0.25;
				transition: $fast $transition opacity;
			}
		}
		img {
			border-radius: 3px;
		}
		ul,
		ol {
			padding-left: 25px;
			margin: 15px 0 25px 10px;
			@media (max-width: $bp-medium) {
				margin-left: 0;
			}
		}
		ul {
			list-style-type: disc;
		}
		ol {
			list-style-type: upper-roman;
		}
		hr {
			border: 0;
			margin-top: 40px;
			margin-bottom: 50px;
			text-align: center;
			width: 75%;
			&:after {
				content: "...";
				font-size: 28px;
				letter-spacing: 16px;
				line-height: 0;
				padding-left: 18px;
			}
		}
	}
}

@media (max-width: $bp-medium) {
	article {
		.body {
			h2,
			h3 {
				width: 100%;
			}
			p {
				width: 100%;
			}
			hr {
				width: 100%;
			}
		}
	}
}

code {
	background-color: #F1F1F1;
	border-radius: 2px;
	padding: 0 2px;
	margin: 0 -2px;
}

pre {
	border-radius: 3px;
	padding: 16px 20px;
	margin: 20px 0;
	max-width: calc(62.5% + 1px);
	color: #333333;
	background-color: #F1F1F1;
	overflow-x: scroll;
	@media (max-width: $bp-medium) {
		max-width: calc(100% + 1px);
	}
	&.dark {
		color: #FFFFFF;
		background-color: #000000;
	}
}

.articles {
	list-style: none;
	li {
		margin-top: 100px;
	}
}
