// Media query mixins, use with e.g. @media @desktop { .myclass {} }
@desktop: ~"only screen and (min-width: 960px)";
@tablet:  ~"only screen and (min-width: 720px) and (max-width: 959px)";
@mobile:  ~"only screen and (max-width: 719px)";
@non-mobile:  ~"only screen and (min-width: 720px)";




@link-color: #0000CC;
@link-visited-color: #880088;




.clearfix() {
	zoom:1;
	&:before, &:after {content:""; display:table;}
	&:after {clear: both;}
}

* {
	margin: 0;
	padding: 0;
}
html {
	font-family: 'Roboto', sans-serif;
}
html, body {
	overflow-x: hidden;
	max-width: 100%;
}
li {
	line-height: 1.5em;
}
q {
	&:before {
		content: open-quote;
	}
	&:after {
		content: close-quote;
	}
}
h1, h2, h3, h4, h5, h6 {
	font-family: 'Montserrat', sans-serif;
}

nobreak {
	display: inline-block;
	white-space: nowrap;
}


blockquote {
	margin: 2em 0 2em 10px;
    padding-left: 15px;
    border-left: 5px solid #ddf;
    font-family: Georgia, serif;
}



//-- IE --//
main, article, header, footer, figure, figcaption {
	display: block;
}



//-- Common styles --//
header {
	h1 {
		a {
			display: inline-block;
			text-decoration: none !important;
			color: inherit;
		}
		img {
			vertical-align: middle;
			margin-right: 20px;
			border-radius: 50%;
			width: 64px;
			height: 64px;
		}
	}
	.onboarding {
		margin: 1em 0;
		padding: 20px 0;
		background: #eee;

		.inner {
		    max-width: 960px;
			margin: 0 auto;
			font-size: 18px;
			text-align: center;
		}
	}
}


img.small {
	display: block;
	width: 400px;
	margin: 0.5em auto;
}


main {
	article.post {
		h2 .date {
			float: right;
			font-size: 16px;
			margin-top: 4px;
			margin-left: 10px;
		}
		h3 {
			font-size: 1.25em;
			margin: 1.5em 0 0.5em 0;
		}
		h4 {
			margin: 1em 0 0.5em 0;
		}
		img {
			//max-width: 95%;
		}
		p {
			//.clearfix();
			//text-align: justify;

			img.right {
				width: 100px;
				margin: 0 0 10px 10px;
				float: right;
			}
		}
		ol {
			padding-left: 10px;

			&.alphabet {
				list-style-type: lower-alpha;
			}
		}
		ol, ul {
			margin: 0.5em 0 0.5em 20px;
		}
		li {
			margin-bottom: 0.25em;
		}
		p, li, blockquote {
			line-height: 1.5em;
		}
		a {
			text-decoration: none;
			color: @link-color;

			&:visited {
				color: @link-visited-color;
			}
			&:not(:active):hover {
				text-decoration: underline;
			}
			&[target="_blank"]:after {
				content: "\f08e";
				display: inline-block;
				font: normal normal normal 14px/1 FontAwesome;
				text-rendering: auto;
				-webkit-font-smoothing: antialiased;
				-moz-osx-font-smoothing: grayscale;
				font-size: 11px;
				margin-left: 4px;

			}
		}
		figure {
			margin: 1em 0;
			text-align: center;

			img {
				width: 100%;
			}
			figcaption {
				text-align: center;
				font-size: 0.8em;
			}
		}
		.graph {
			width: 100%;
			height: 200px;
		}
		span[title] {
			border-bottom: 1px dashed grey;
			cursor: help;
		}
	}
	.subscribe {
		position: relative;
		padding: 20px 0;
		line-height: 1.5em;

		.background {
			background: #eee;
			position: absolute;
			top: 0;
			bottom: 0;
			left: -10000px;
			right: -10000px;
		}
		.inner {
			position: relative;
		}
		b {
			display: block;
			font-size: 18px;
		}
		p {
		}
		label {
			input[type=email] {
				padding: 2px 10px;
			}
		}
		input[type=submit] {
			padding: 2px 10px;
		}
		.error, .success {
			display: none;
			font-size: 13px;
			margin-top: 0.5em;
		}
		.error {
			color: #880000;
		}
		.success {
			color: #008800;
		}
	}
}


footer {
	p {
		line-height: 3em;
		text-align: center;
		border-top: 1px solid #ddd;
		color: #aaa;
		font-size: 12px;
		font-family: "Montserrat",sans-serif;
	}
}




//-- Index styles --//
body.index {
	header {
	}

	main {
		article {
			position: relative;
			margin-top: 100px;
			margin-bottom: 150px;
			overflow-y: hidden;

			&:before {
				content: " ";
				position: absolute;
				left: 0;
				right: 0;
				bottom: 0;
				height: 200px;
				background: linear-gradient(to top, white 0%, rgba(255,255,255,0) 100%);
				pointer-events: none;
			}
			a.more {
				position: absolute;
				left: 0;
				right: 0;
				bottom: 0;
				color: @link-color;
				text-align: center;
				font-weight: bold;
				cursor: pointer;
				line-height: 2em;
			}
			a.post {
				display: block;
				text-decoration: none !important;
				color: inherit;

				&:hover {
					h2 {
						text-decoration: underline;
					}
					img {
						box-shadow: 0 0 1px black;
					}
				}
			}
			h2 {
				margin: 0.5em 0;
			}
			.cover {
				position: relative;
				font-size: 0;

				img {
					width: 100%;
					position: relative;
				}
			}
			/*.overlay {
				position: absolute;
				left: 0;
				top: 0;
				right: 0;
				bottom: 0;
				background: linear-gradient(to bottom, white 0%, rgba(255,255,255,0.75) 25%, rgba(0,0,0,0) 50%);
			}*/
		}
		.subscribe {
			margin-top: -75px;
			margin-bottom: 25px;
		}
	}

	footer {
	}
}




//-- Post styles --//
body.post {
	position: relative;

	.cover {
		height: 65vh;
		background-size: cover;
		background-position: 50% 50%;
		transition: height 999999s;  // Prevents resize jumping on mobile when scrolling because element height depends on whether the URL bar is visible
	}
	header {
		position: absolute;
		top: 0;
		left: 0;
	}
	main {
		margin-bottom: 100px;

		article {
			h2 {
				margin: 1em 0 .5em 0;
				font-size: 30px;
			}
		}
		.subscribe {
			margin-top: 100px;
		}
		a.home {
			display: block;
			margin-top: 100px;
			color: black;
			text-align: center;
			text-decoration: none;

			&:not(active):hover {
				text-decoration: underline;
			}
		}
		section.prev-next {
			display: table;
			width: 100%;
			margin: 50px 0;

			div.prev, div.next {
				display: table-cell;
				width: 50%;

				&.prev {
					padding-right: 3%;
				}
				&.next {
					padding-left: 3%;
				}
				p:first-child {
					text-align: center;
					margin-bottom: 0.25em;
				}
				p:last-child {
					margin: 0.25em 0;
					font-size: 1.1em;
					font-weight: bold;
				}
				a {
					display: block;

					img {
						width: 100%;
					}
					&:hover {
						img {
							box-shadow: 0 0 1px black;
						}
					}
				}
			}
		}
	}
}




@media @desktop {
	header h1 {
		padding: 20px 0 0 40px;
	}
	main {
		width: 640px;
		margin: 0 auto;
	}
	body.index {
		main article {
			max-height: 650px;
		}
	}
	footer {
		width: 400px;
		margin: 50px auto 0 auto;
	}
}

@media @tablet {
	header h1 {
		padding: 20px 0 0 40px;
	}
	main {
		width: 80%;
		margin: 0 auto;
	}
	body.index {
		main article {
			max-height: 650px;
		}
	}
	footer {
		width: 400px;
		margin: 50px auto 0 auto;
	}
}

@media @mobile {
	body {
		header {
			h1 {
				padding: 5px 0 0 5px;
				font-size: 16px;

				img {
					margin-right: 10px;
				}
			}
		}
	}
	body.index {
		main {
			article {
				max-height: 500px;
			}
			article h2,
			article h3,
			article ul,
			article p,
			.subscribe .inner {
				padding: 0 2%;
			}
		}
	}
	body.post {
		header {
			padding: 5px;
		}
		main {
			padding: 2%;
		}
	}
	footer {
		max-width: 400px;
		margin: 0 auto;
	}
}