// Ridiculously Responsive Social Sharing Buttons
// Team: @dbox, @joshuatuscan
// Site: http://www.kurtnoble.com/labs/rrssb
// Twitter: @therealkni

//        ___           ___
//       /__/|         /__/\        ___
//      |  |:|         \  \:\      /  /\
//      |  |:|          \  \:\    /  /:/
//    __|  |:|      _____\__\:\  /__/::\
//   /__/\_|:|____ /__/::::::::\ \__\/\:\__
//   \  \:\/:::::/ \  \:\~~\~~\/    \  \:\/\
//    \  \::/~~~~   \  \:\  ~~~      \__\::/
//     \  \:\        \  \:\          /__/:/
//      \  \:\        \  \:\         \__\/
//       \__\/         \__\/


// How to use: Add/remove buttons from config settings and $social-list.

// Config settings
$rrssb-txt: #fff !default;
$rrssb-email: #0a88ff !default;
$rrssb-facebook: #306199 !default;
$rrssb-tumblr: #32506d !default;
$rrssb-linkedin: #007bb6 !default;
$rrssb-twitter: #26c4f1 !default;
$rrssb-googleplus: #e93f2e !default;
$rrssb-reddit: #8bbbe3 !default;
$rrssb-youtube: #df1c31 !default;
$rrssb-pinterest: #b81621 !default;
$rrssb-pocket: #ED4054 !default;
$rrssb-github: #444 !default;
$rrssb-instagram: #517fa4 !default;

// Set the border radius for the buttons
$rrssb-border-radius: 2px !default;

$rrssb-main-font: "Helvetica Neue", Helvetica, Arial, sans-serif !default;

// Variable list for all social button colors to be iterated over.
$social-list: (
	rrssb-email				$rrssb-email,
	rrssb-facebook			$rrssb-facebook,
	rrssb-tumblr			$rrssb-tumblr,
	rrssb-linkedin			$rrssb-linkedin,
	rrssb-twitter			$rrssb-twitter,
	rrssb-googleplus		$rrssb-googleplus,
	rrssb-youtube			$rrssb-youtube,
	rrssb-reddit			$rrssb-reddit,
	rrssb-pinterest			$rrssb-pinterest,
	rrssb-pocket			$rrssb-pocket,
	rrssb-github			$rrssb-github,
	rrssb-instagram 		$rrssb-instagram
);

@mixin transition($expression) {
	-webkit-transition: $expression;
	-moz-transition: $expression;
	-o-transition: $expression;
	transition: $expression;
}

%backface-visibility {
	-webkit-backface-visibility: hidden;
	-moz-backface-visibility: hidden;
	-ms-backface-visibility: hidden;
}

%border-box {
	-moz-box-sizing:border-box;
	box-sizing: border-box;
}

// some generic classes
.clearfix {
	*zoom: 1;

	&:after {
		clear: both;
	}

	&:before,
	&:after {
		content: " ";
		display: table;
	}
}

// The meat and potatoes
.rrssb-buttons {
	@extend %border-box;
	font-family: $rrssb-main-font;
	height: 36px;
	margin: 0;
	padding: 0;
	width: 100%;

	li {
		@extend %border-box;
		float: left;
		height: 100%;
		line-height: 13px;
		list-style: none;
		margin: 0;
		padding: 0 2.5px;

		// This generates individual button classes for each item in social list on line 39.
		@each $s-name in $social-list {

			&.#{nth($s-name, 1)} {
				a {
					background-color: nth($s-name, 2);

					&:hover {
						background-color: darken(nth($s-name, 2), 10%);
					}
				}
			}

		} // end @each directive

		a {
			@extend %border-box;
			background-color: #ccc;
			border-radius: $rrssb-border-radius;
			display: block;
			font-size: 11px;
			font-weight: bold;
			height: 100%;
			padding: 11px 7px 12px 27px;
			position: relative;
			text-align: center;
			text-decoration: none;
			text-transform: uppercase;
			width: 100%;
			-webkit-font-smoothing: antialiased;
			-moz-osx-font-smoothing: grayscale;
			@include transition(background-color 0.2s ease-in-out);

			.rrssb-icon {
				display: block;
				height: 100%;
				left: 10px;
				padding-top: 9px;
				position: absolute;
				top: 0;
				width: 10%;

				svg {
					height: 17px;
					width: 17px;

					path, polygon {
						fill: $rrssb-txt;
					}
				}
			}

			.rrssb-text {
				color: $rrssb-txt;
			}

			&:active {
				box-shadow:inset 1px 3px 15px 0 rgba(022,0,0,.25);
			}
		}

		&.small {
			a {
				padding: 0;

				.rrssb-icon {
					height: 100%;
					left: auto;
					margin: 0 auto;
					overflow: hidden;
					position: relative;
					top: auto;
					width: 100%;
				}
				.rrssb-text {
					visibility: hidden;
				}
			}
		}
	}

	&.large-format {
		height: auto;

		li {
			height: auto;

			a {
				border-radius: 0.2em;				
				font-size: 15px; // fallback
				font-size: 1vw;  // scales font with browser
				line-height: 1vw;				
				padding: 7% 0% 7% 12%;
				@extend %backface-visibility;

				.rrssb-icon {
					left: 7%;
					padding-top: 0;
					width: 12%;

					svg {
						height: 100%;
						width: 100%;
						position: absolute;
						top:0;						
					}
				}

				.rrssb-text {
					font-size: 15px;
					font-size: 1vw;
					@extend %backface-visibility;
				}

				&:hover {
					font-size: 15px;
					font-size: 1vw;
					padding: 7% 0% 7% 12%;
					border-radius: 0.2em;
				}
			}
		}
	}

	&.small-format {
		padding-top: 5px;

		li {
			height: 80%;
			padding: 0 1.5px;

			a {
				.rrssb-icon {
					height: 100%;
					padding-top: 0;

					svg {
						height: 48%;
						position: relative;
						top: 6px;
						width: 80%;
					}
				}
			}
		}
	}

	&.tiny-format {
		height: 22px;
		position: relative;

		li {
			padding-right: 7px;

			a {
				background-color: transparent;
				padding: 0;

				.rrssb-icon {
					svg {
						height: 70%;
						width: 100%;
					}
				}

				&:hover, &:active {
					background-color: transparent;
				}
			}

			// This generates individual button classes for each item in social list on line 39.
			@each $s-name in $social-list {

				&.#{nth($s-name, 1)} {
					a {
						.rrssb-icon {
							svg {
								path, polygon {
									fill: nth($s-name, 2);
								}
							}

							&:hover {
								.rrssb-icon {
									svg {
										path, polygon {
											fill: darken(nth($s-name, 2), 20%);
										}
									}
								}
							}
						}
					}
				}
			}  // end @each directive
		}
	}
}
