@import 'bourbon'; // http://bourbon.io/

@import '../partials/variables'; // colors, fonts etc...

@import '../partials/mixins'; // custom mixins

@import '../partials/layout'; // responsive grid and media queries

/* -------------------------------- 

Primary style

-------------------------------- */

*, *::after, *::before {
	@include box-sizing(border-box);
}

*::after, *::before {
	content: '';
}

body {
	font: {
		size: 100%;
		family: $primary-font; // variables inside partials > _variables.scss
	}
	color: $color-1;
	background-color: $color-3;

	&::after {
		/* overlay layer visible on small devices when the right panel slides in */
		position: fixed;
		top: 0;
		left: 0;
		width: 100%;
		height: 100%;
		background-color: rgba($color-1, .8);
		visibility: hidden;
		opacity: 0;
		-webkit-transition: opacity .3s 0s, visibility 0s .3s;
		-moz-transition: opacity .3s 0s, visibility 0s .3s;
		transition: opacity .3s 0s, visibility 0s .3s;
	}

	&.cd-overlay::after {
		visibility: visible;
		opacity: 1;
		-webkit-transition: opacity .3s 0s, visibility 0s 0s;
		-moz-transition: opacity .3s 0s, visibility 0s 0s;
		transition: opacity .3s 0s, visibility 0s 0s;
	}

	@include MQ(M) {
		&::after {
			display: none;
		}
	}
}

a {
	color: $color-2;
	text-decoration: none;
}

/* -------------------------------- 

Main components 

-------------------------------- */

header {
	position: relative;
	height: 180px;
	line-height: 180px;
	text-align: center;
	background-color: $color-2;

	h1 {
		color: $color-5;
		@include font-smoothing;
		@include font-size(20px);
	}

	@include MQ(L) {
		height: 240px;
		line-height: 240px;

		h1 {
			@include font-size(36px);
			font-weight: 300;
		}
	}	
}

.cd-faq {
	width: 90%;
	max-width: $L; // breakpoints inside partials > _layout.scss
	margin: 2em auto;
	box-shadow: 0 1px 5px rgba(#000, .1);
	@include clearfix;

	@include MQ(M) {
		position: relative;
		margin: 4em auto;
		box-shadow: none;
	}
}

.cd-faq-categories {
	a {
		position: relative;
		display: block;
		overflow: hidden;
		height: 50px;
		line-height: 50px;
		padding: 0 28px 0 16px;
		background-color: $color-1;
		@include font-smoothing;
		color: $color-5;
		white-space: nowrap;
		border-bottom: 1px solid lighten($color-1, 3%);
		text-overflow: ellipsis;

		&::before, &::after {
			/* plus icon on the right */
			position: absolute;
			top: 50%;
			right: 16px;
			display: inline-block;
			height: 1px;
			width: 10px;
			background-color: lighten($color-1, 20%);
		}

		&::after {
			@include transform(rotate(90deg));
		}
	}

	li:last-child a {
		border-bottom: none;
	}

	@include MQ(M) {
		width: 20%;
		float: left;
		box-shadow: 0 1px 2px rgba(#000, .08);

		a {
			@include font-size(13px);
			font-weight: 600;
			padding-left: 24px;
			padding: 0 24px;
			@include transition(background .2s, padding .2s);

			&::before, &::after {
				display: none;
			}

			.no-touch &:hover {
				background: lighten($color-1, 3%);
			}
		}

		.no-js & {
			width: 100%;
			margin-bottom: 2em;
		}
	}

	@include MQ(L) {
		position: absolute;
		top: 0;
		left: 0;
		width: 200px;
		z-index: 2;

		a::before {
			/* decorative rectangle on the left visible for the selected item */
			display: block;
			top: 0;
			right: auto;
			left: 0;
			height: 100%;
			width: 3px;
			background-color: $color-2;
			opacity: 0;
			@include transition(opacity .2s);
		}

		.selected {
			background: darken($color-1, 5%) !important;

			&::before {
				opacity: 1;
			}
		}

		&.is-fixed {
			/* top and left value assigned in jQuery */
			position: fixed;
		}

		.no-js & {
			position: relative;
		}
	}
}

.cd-faq-items {
	position: fixed;
	height: 100%;
	width: 90%;
	top: 0;
	right: 0;
	background: $color-5;
	padding: 0 5% 1em;
	overflow: auto;
	-webkit-overflow-scrolling: touch;
	z-index: 1;
	-webkit-backface-visibility: hidden;
	backface-visibility: hidden;
	@include transform(translateZ(0) translateX(100%));
	-webkit-transition: -webkit-transform .3s;
	-moz-transition: -moz-transform .3s;
	transition: transform .3s;

	&.slide-in {
		@include transform(translateZ(0) translateX(0%));
	}

	.no-js & {
		position: static;
		height: auto;
		width: 100%;
		@include transform(translateX(0));
	}

	@include MQ(M) {
		position: static;
		height: auto;
		width: 78%;
		float: right;
		overflow: visible;
		@include transform(translateZ(0) translateX(0));
		padding: 0;
		background: transparent;
	}

	@include MQ(L) {
		float: none;
		width: 100%;
		padding-left: 220px;

		.no-js & {
			padding-left: 0;
		}
	}
}

.cd-close-panel {
	position: fixed;
	top: 5px;
	right: -100%;
	display: block;
	height: 40px;
	width: 40px;
	overflow: hidden;
	text-indent: 100%;
	white-space: nowrap;
	z-index: 2;
	/* Force Hardware Acceleration in WebKit */
	@include transform(translateZ(0));
	-webkit-backface-visibility: hidden;
	backface-visibility: hidden;
	@include transition(right .4s);

	&::before, &::after {
		/* close icon in CSS */
		position: absolute;
		top: 16px;
		left: 12px;
		display: inline-block;
		height: 3px;
		width: 18px;
		background: $color-4;
	}

	&::before {
		@include transform(rotate(45deg));
	}

	&::after {
		@include transform(rotate(-45deg));
	}

	&.move-left {
		right: 2%;
	}

	@include MQ(M) {
		display: none;
	}
}

.cd-faq-group {
	/* hide group not selected */
	display: none;

	&.selected {
		display: block;
	}

	.cd-faq-title {
		background: transparent;
		box-shadow: none;
		margin: 1em 0;

		.no-touch &:hover {
			box-shadow: none;
		}

		h2 {
			text-transform: uppercase;
			@include font-size(12px);
			font-weight: 700;
			color: darken($color-3, 20%);
		}
	}

	.no-js & {
		display: block;
	}

	@include MQ(M) {
		/* all groups visible */
		display: block;

		> li {
			background: $color-5;
			margin-bottom: 6px;	
			box-shadow: 0 1px 2px rgba(#000, .08);
			@include transition(box-shadow .2s);

			.no-touch &:hover {
				box-shadow: 0 1px 10px rgba($color-4, .3);
			}
		}

		.cd-faq-title {
			margin: 2em 0 1em;
		}

		&:first-child .cd-faq-title {
			margin-top: 0;
		}
	}
}

.cd-faq-trigger {
	position: relative;
	display: block;
	margin: 1.6em 0 .4em;
	line-height: 1.2;

	@include MQ(M) {
		@include font-size(24px);
		font-weight: 300;
		margin: 0;
		padding: 24px 72px 24px 24px;

		&::before, &::after {
			/* arrow icon on the right */
			position: absolute;
			right: 24px;
			top: 50%;
			height: 2px;
			width: 13px;
			background: lighten($color-2, 20%);
			-webkit-backface-visibility: hidden;
			backface-visibility: hidden;
			@include transition-property(transform);
			@include transition-duration(.2s);
		}

		&::before {
			@include transform(rotate(45deg));
			right: 32px;
		}

		&::after {
			@include transform(rotate(-45deg));
		}

		.content-visible &::before {
			@include transform(rotate(-45deg));
		}

		.content-visible &::after {
			@include transform(rotate(45deg));
		}
	}
}

.cd-faq-content {

	p {
		@include font-size(14px);
		line-height: 1.4;
		color: $color-4;
	}

	@include MQ(M) {
		display: none;
		padding: 0 24px 30px;

		p {
			line-height: 1.6
		}

		.no-js & {
			display: block;
		}
	}
}