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

xBasic style

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

.sg-header {
	position: fixed;
	height: 50px;
	width: 100%;
	top: 0;
	left: 0;
	box-shadow: 0 1px 1px rgba(#000, .1);
	z-index: 10;

	nav {
		display: inline-block;
	}

	@include MQ(M) {
		height: 80px;
		@include clearfix;
	}
}

.cd-logo {
	display: inline-block;
	height: 100%;
	position: relative;

	img {
		position: absolute;
		display: block;
		top: 50%;
		left: 50%;
		@include transform(translateX(-50%) translateY(-50%));
	}

	@include MQ(L) {
		margin-left: 5%;
	}
}

.cd-nav-trigger {
	display: block;
	position: absolute;
	right: 0;
	top: 0;
	height: 100%;
	width: 50px;
	overflow: hidden;
	white-space: nowrap;
	color: transparent;

	span {
		position: absolute;
		height: 2px;
		width: 20px;
		top: 50%;
		margin-top: -1px;
		left: 50%;
		margin-left: -10px;
		@include transition(background-color .3s .3s);

		&::before, &::after {
			content: '';
			position: absolute;
			width: 100%;
			height: 100%;
			/* Force Hardware Acceleration in WebKit */
			@include transform(translateZ(0));
			-webkit-backface-visibility: hidden;
			backface-visibility: hidden;
			will-change: transform;
			@include transition(transform .3s .3s);
		}

		&::before {
			@include transform(translateY(-6px));
		}

		&::after {
			@include transform(translateY(6px));
		}
	}

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

.cd-main-nav {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100vh;
	padding: 50px 0;
	text-align: center;
	@include transform(translateY(-100%));
	@include transition(transform .3s);

	li a {
		display: block;
		font-size: 1.8rem;
		padding: 1em 0;
		border-bottom-width: 1px;
		border-style: solid;
	}

	li:first-of-type a {
		border-top-width: 1px;
	}

	@include MQ(M) {
		position: static;
		display: table;
		@include transform(translateY(0));
		width: auto;
		height: 80px;
		background: transparent;
		padding: 0 2em;
		text-align: left;

		li {
			display: table-cell;
			vertical-align: middle;
			padding: 0 1em;
		}

		li a {
			display: inline-block;
			font-size: 1.6rem;
			padding: .4em .2em;
			border-bottom: none;
			@include transition(all .2s);
		}

		li:first-of-type a {
			border-top: none;
		}
	}

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

.nav-is-visible {
	.cd-nav-trigger span {

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

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

	.cd-main-nav {
		@include transform(translateY(0));
	}
}

.cd-download {
	position: absolute;
	top: 0;
	right: 0;
	height: 100%;
	width: 80px;
	background-image: url('../assets/icon-download.svg');
	background-position: center center;
	background-repeat: no-repeat;
	display: none;
	@include transition(background-color .2s);

	span {
		/* tooltip */
		position: absolute;
		right: 120%;
		top: 50%;
		margin-top: -20px;
		width: 140px;
		height: 40px;
		line-height: 40px;
		white-space: nowrap;
		text-align: center;
		font-size: 1.2rem;
		-webkit-transition: opacity .2s 0s, visibility 0s .2s;
		-moz-transition: opacity .2s 0s, visibility 0s .2s;
		transition: opacity .2s 0s, visibility 0s .2s;

		&::before {
			/* right arrow */
			content: '';
			position: absolute;
			top: 12px;
			left: 100%;
			height: 0;
			width: 0;
			border-width: 8px;
			border-style: solid;
			border-top-color: transparent;
			border-bottom-color: transparent;
			border-right-color: transparent;
		}
	}

	.no-touch &:hover span {
		opacity: 1;
		visibility: visible;
		-webkit-transition: opacity .2s 0s, visibility 0s 0s;
		-moz-transition: opacity .2s 0s, visibility 0s 0s;
		transition: opacity .2s 0s, visibility 0s 0s;
	}

	@include MQ(M) {
		display: block;

		span {
			opacity: 0;
			visibility: hidden;
		}
	}

	@include MQ(L) {
		right: 5%;
	}
}

main {
	width: 90%;
	max-width: $M;
	margin: 0 auto;
	padding: 50px 0;

	> h1 {
		text-align: center;
		margin: 2em 0;
	}

	@include MQ(M) {
		padding-top: 80px;
	}

	@include MQ(L) {
		max-width: none;
		padding: 120px 0 50px;

		> h1 {
			position: fixed;
			top: 0;
			left: 50%;
			height: 80px;
			line-height: 80px;
			width: 400px;
			margin: 0 0 0 -200px;
			font-size: 2.6rem;
			z-index: 20;
		}
	}
}

section {
	margin: 3em 0;
	@include clearfix;

	&:nth-of-type(1) h2::before {
		content: '1. ';
	}

	&:nth-of-type(2) h2::before {
		content: '2. ';
	}

	&:nth-of-type(3) h2::before {
		content: '3. ';
	}

	&:nth-of-type(4) h2::before {
		content: '4. ';
	}

	&:nth-of-type(5) h2::before {
		content: '5. ';
	}

	&:nth-of-type(6) h2::before {
		content: '6. ';
	}

	@include MQ(S) {
		margin: 3em 0 5em;
	}

	@include MQ(L) {
		@include column(.48);
		margin: 0 4% 4em 0;

		&:nth-of-type(2n) {
			margin-right: 0;
		}
	}
}

/* xBranding section - basic style */

.cd-branding {

	.cd-box {
		margin-bottom: 1em;
	}

	img {
		display: block;
		width: 100%;
	}

	ul:last-of-type {
		padding-top: .6em;

		li {
			display: inline-block;
			margin-right: 1em;
		}

		li:nth-of-type(1) img {
			width: 90px;
			height: 90px;
			border-radius: 1em;
		}

		li:nth-of-type(2) img {
			width: 60px;
			height: 60px;
			border-radius: .6em;
		}

		li:nth-of-type(3) img {
			width: 32px;
			height: 32px;
			border-radius: .4em;
		}

		li:nth-of-type(4) img {
			width: 16px;
			height: 16px;
			border-radius: .2em;
		}
	}

	@include MQ(S) {
		.cd-box {
			@include column(.49);
			margin: 0 2% 2em 0;

			&:nth-of-type(2n) {
				margin-right: 0;
			}
		}

		ul:last-of-type {
			clear: left;

			li {
				margin-right: 3em;
			}
		}
	}
}

/* xColor section - basic style */

.cd-colors {

	li {
		text-align: center;
		@include column(.48);
		margin: 0 4% 1em 0;

		&:nth-of-type(2n) {
			margin-right: 0;
		}
	}

	.cd-color-swatch {
		position: relative;
		width: 100%;
		padding: 50% 0;

		&::before, &::after {
			/* lighter and darker color shades of the same swatch */
			content: '';
			position: absolute;
			bottom: 0;
			width: 50%;
			height: 20%;
		}

		&::before {
			left: 0;
		}

		&::after {
			right: 0;
		}
	}

	b {
		display: block;
		padding: .6em 0;
	}

	li:nth-of-type(1) .cd-color-swatch {
		background: $color-1;

		&::before {
			background: lighten($color-1, 5%);
		}

		&::after {
			background: darken($color-1, 5%);
		}
	}

	li:nth-of-type(2) .cd-color-swatch {
		background: $color-2;

		&::before {
			background: lighten($color-2, 5%);
		}

		&::after {
			background: darken($color-2, 5%);
		}
	}

	li:nth-of-type(3) .cd-color-swatch {
		background: $color-3;

		&::before {
			background: lighten($color-3, 5%);
		}

		&::after {
			background: darken($color-3, 5%);
		}
	}

	li:nth-of-type(4) .cd-color-swatch {
		background: $color-4;

		&::before {
			background: lighten($color-4, 5%);
		}

		&::after {
			background: darken($color-4, 5%);
		}
	}

	li:nth-of-type(5) .cd-color-swatch {
		background: $color-5;

		&::before {
			background: lighten($color-5, 5%);
		}

		&::after {
			background: darken($color-5, 5%);
		}
	}

	@include MQ(S) {
		li {
			@include column(.19);
			margin: 0 1.25% 1em 0;

			&:nth-of-type(2n) {
				margin-right: 1.25%;
			}

			&:nth-of-type(5n) {
				margin-right: 0;
			}
		}
	}
}

.cd-typography .cd-box,
.cd-buttons .cd-box,
.cd-icons .cd-box,
.cd-form .cd-box {
	padding: 1em;

	@include MQ(S) {
		.cd-box {
			padding: 2em;
		}
	} 
}

/* xTypography section - basic style */

.cd-typography {

	h1::before {
		content: 'Aa - ';
		color: $color-1;
	}
}

.cd-buttons {
	.cd-box:first-of-type {
		border-bottom-left-radius: 0;
		border-bottom-right-radius: 0;
	}

	.cd-box:last-of-type {
		margin-top: -1px;
		border-top-left-radius: 0;
		border-top-right-radius: 0;
	}

	button {
		margin: .4em;
	}

	@include MQ(M) {
		button {
			margin: 1em;
		}
	}
}

/* xIcons section - basic style */

.cd-icons {
	li {
		display: inline-block;
		background-position: center center;
		background-repeat: no-repeat;
		margin: 1em;
	}

	.cd-icon-1 {
		background-image: url('../assets/icons/icon-1.svg'); 
	}

	.cd-icon-2 {
		background-image: url('../assets/icons/icon-2.svg'); 
	}

	.cd-icon-3 {
		background-image: url('../assets/icons/icon-3.svg'); 
	}

	.cd-icon-4 {
		background-image: url('../assets/icons/icon-4.svg'); 
	}

	.cd-icon-5 {
		background-image: url('../assets/icons/icon-5.svg'); 
	}

	.cd-icon-6 {
		background-image: url('../assets/icons/icon-6.svg'); 
	}

	.cd-icon-7 {
		background-image: url('../assets/icons/icon-7.svg'); 
	}

	.cd-icon-8 {
		background-image: url('../assets/icons/icon-8.svg'); 
	}
}

/* xForm section - basic style */

.cd-form {
	input[type=text],
	.cd-input-wrapper {
		margin: 1em;
	}

	.cd-input-wrapper {
		position: relative;
		display: inline-block;
	}

	select::-ms-expand {
      display: none;
	}
}

@-moz-document url-prefix(){
	/* hide custom arrow on Firefox */
	.cd-select::after {
		display: none;
	}
}

.no-csstransitions .cd-select::after {
	display: none;
}
