/* basic styling */
body {
  background-color: #ECEFF1;
  color: darkSlateGray;
}

h1 {
  font-size: 1.5em;
  margin: 2em 0 1em;
  
  &:first-child {
    margin-top: 0;
  }
}

h2 {
  font-size: 1.2em;
  margin: 2em 0 1em;
}

a {
  color: rgb(204, 175, 106);
}

.wrapper {
  background-color: #fff;
  border: 1px solid #CFD8DC;
  margin: 2em auto;
  max-width: 600px;
  padding: 2em;
}

.icon {
  background-repeat: no-repeat;
  background-position: 0 50%;
  padding: 1em 0 1em 44px;
}

.u-margin-top-none {
  margin-top: 0;
}

.u-margin-bottom-none {
  margin-bottom: 0;
}

.u-text-small {
  font-size: 0.875em;
}



/* ------------------------------------------------- */
/* ==from http://codepen.io/jakob-e/pen/doMoML       */
/* ------------------------------------------------- */
@function svg-url($svg){
    //    
    //  Chunk up string in order to avoid 
    //  "stack level too deep" error
    //     
    $encoded:'';
    $slice: 2000;
    $index: 0;
    $loops: ceil(str-length($svg)/$slice);
    @for $i from 1 through $loops {
        $chunk: str-slice($svg, $index, $index + $slice - 1); 
        //
        //   Encode (may need a few extra replacements)
        //
        $chunk: str-replace($chunk,'"','\'');
        $chunk: str-replace($chunk,'<','%3C');
        $chunk: str-replace($chunk,'>','%3E');
        $chunk: str-replace($chunk,'&','%26');
        $chunk: str-replace($chunk,'#','%23');       
        $encoded: #{$encoded}#{$chunk};
        $index: $index + $slice; 
    }
    @return url("data:image/svg+xml;charset=utf8,#{$encoded}");   
}
            
//  Helper function to replace characters in a string
@function str-replace($string, $search, $replace: '') {
    $index: str-index($string, $search); 
    @if $index { 
        @return str-slice($string, 1, $index - 1) + $replace + 
            str-replace(str-slice($string, $index + 
            str-length($search)), $search, $replace); 
    }
    @return $string; 
}

/* ------------- */
/* ==end         */
/* ------------- */



/* custom mixin to replace a defined fill color with another one */
@function svg-url-with-replaced-fill($svg, $fill-to-replace, $new-fill) {
  $replaced-svg: str-replace($svg, $fill-to-replace, $new-fill);
  $replaced-svg-url: svg-url('#{$replaced-svg}');
  @return $replaced-svg-url;
}



// Custom CSS

/* variables */
$icon-color: #B03032;

// insert the svg code in a variable, make sure the svg only contains double quotes and surround the whole code with simple quotes
$svg-icon-code: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 125">
	<title>Deer by Pumpkin Juice from the Noun Project</title>
	<path fill="#000000" d="M52.673 77.548c-.655.49-1.418.71-2.236.71h-.873c-.818 0-1.582-.22-2.29-.71L45.2 76.185c-1.036-.654-2.073-2.072-2.018-3.763 0-1.527.71-2.78 1.636-3.545.927-.71 2.073-1.09 3.11-1.09h4.144c1.036 0 2.182.38 3.055 1.144.927.765 1.69 1.964 1.69 3.49 0 1.583-.98 3.055-2.017 3.71l-.055.054-2.072 1.364zM60.745 55.407c2.236 0 4.09 1.854 4.09 4.09 0 2.29-1.854 4.09-4.09 4.09-2.29 0-4.09-1.8-4.09-4.09 0-2.236 1.8-4.09 4.09-4.09zM39.2 55.407c2.236 0 4.09 1.854 4.09 4.09 0 2.29-1.854 4.09-4.09 4.09-2.29 0-4.09-1.8-4.09-4.09 0-2.236 1.8-4.09 4.09-4.09z"/>
	<path fill="#000000" d="M78.527 47.28c.818.274 1.636.492 2.29.492l.874-.164v.055c.437-.164 1.037-.545 1.637-1.2.273-.273.49-.6.764-.927-.817-.327-1.69-.545-2.344-.545l-.873.165c-.436.11-1.036.49-1.636 1.2-.273.27-.492.598-.71.926zm-44.182-5.235c-.164.218-.327.382-.436.545-.056.11-.11.164-.22.218l-.054.11c-1.582 1.962-2.782 4.307-3.545 6.762-.544 1.963-.872 3.98-.872 6.108V66.04c0 5.727 2.29 10.908 6.055 14.67S44.218 86.82 50 86.82c5.727 0 10.91-2.345 14.673-6.108 3.764-3.763 6.11-8.944 6.11-14.67V55.788c0-2.072-.274-4.036-.874-5.89 0-.11-.056-.273-.11-.436-.818-2.4-2.018-4.69-3.545-6.653l-.218-.22c-.164-.217-.327-.38-.436-.6-.38-.326-.654-.653-.926-.926C60.91 37.3 55.727 35.01 50 35.01c-5.782 0-10.964 2.29-14.727 6.054-.273.327-.6.6-.873.927l-.055.055zm-13.58 4.31c-.6-.71-1.2-1.092-1.692-1.2l-.873-.165c-.655 0-1.473.218-2.29.49.217.328.435.71.708.983.6.654 1.2 1.036 1.69 1.2l.82.11c.654 0 1.526-.22 2.344-.492-.217-.327-.436-.654-.708-.926zM14.872 9.05c.655-1.144 1.364-2.07 2.236-2.944 1.635-1.527 4.254-1.472 5.78.164 1.583 1.636 1.528 4.254-.108 5.78-.164.11-.545.6-.982 1.31-.436.71-.927 1.582-1.31 2.563-.872 2.018-1.417 4.363-1.417 6.163 0 1.31.273 2.236.655 2.836 0 .055.055.055.055.055.382.436.764.764 1.145 1.09.436-3.544 1.964-6.707 4.527-8.943 1.69-1.472 4.31-1.254 5.782.436 1.473 1.745 1.255 4.308-.436 5.78-.926.765-1.854 2.564-1.854 4.8.055 1.8.545 3.818 1.964 5.89 5.072-4.528 11.78-7.2 19.09-7.2s13.964 2.672 19.036 7.2C70.51 31.956 71 29.94 71 28.14c0-2.237-.927-4.09-1.855-4.8-1.69-1.472-1.855-4.09-.382-5.78 1.473-1.692 4.036-1.91 5.782-.383 2.51 2.18 4.09 5.345 4.527 8.89.436-.383.818-.765 1.2-1.146l.055-.054c.327-.6.545-1.527.545-2.78.055-2.728-1.364-6.654-2.727-8.727-.436-.71-.818-1.2-.927-1.31-1.636-1.582-1.69-4.145-.164-5.78 1.582-1.637 4.145-1.692 5.782-.11.873.818 1.582 1.8 2.29 2.89.492.873 1.037 1.854 1.528 2.89.11-.927.164-1.854.164-2.836 0-2.29 1.8-4.09 4.09-4.09 2.237 0 4.092 1.8 4.092 4.09 0 7.8-3 15.325-8.345 20.996-.218.327-.545.6-.818.818-.545.6-1.036 1.09-1.636 1.582l-5.672 4.854c1.09-.382 2.182-.545 3.218-.545 3.164.054 5.727 1.144 7.527 2.07 2.29 1.146 3.6 3.546 3.6 5.945 0 1.036-.273 2.072-.71 3.054h-.054c-.6 1.2-1.474 2.67-2.728 4.035-1.255 1.418-2.945 2.78-5.236 3.49-1.145.382-2.29.545-3.327.545-.656 0-1.256-.055-1.856-.164V66.04C78.964 82.02 65.982 95 50 95c-16.036 0-28.964-12.98-28.964-28.96V55.79c-.6.11-1.255.164-1.91.164-1.035 0-2.18-.164-3.326-.545-2.29-.71-3.982-2.072-5.236-3.49-1.2-1.31-2.073-2.727-2.673-3.927 0-.055-.054-.055-.054-.11-.545-.98-.764-2.126-.764-3.053 0-2.454 1.364-4.8 3.655-5.944 1.8-.927 4.31-2.018 7.473-2.072 1.036 0 2.182.165 3.273.546L15.8 32.5c-.655-.544-1.255-1.09-1.8-1.69-.218-.218-.49-.436-.655-.71C7.945 24.486 5 16.96 5 9.106c0-2.29 1.8-4.09 4.09-4.09 2.237 0 4.092 1.8 4.092 4.09 0 .927.055 1.854.164 2.78.49-1.035.98-1.962 1.527-2.834z"/>
</svg>';





  
/* svg used as background image via data URI */
/* do not work in IE and Firefox as is */
.icon-zoom {
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 125">
	<title>Deer by Pumpkin Juice from the Noun Project</title>
	<path fill="#000000" d="M52.673 77.548c-.655.49-1.418.71-2.236.71h-.873c-.818 0-1.582-.22-2.29-.71L45.2 76.185c-1.036-.654-2.073-2.072-2.018-3.763 0-1.527.71-2.78 1.636-3.545.927-.71 2.073-1.09 3.11-1.09h4.144c1.036 0 2.182.38 3.055 1.144.927.765 1.69 1.964 1.69 3.49 0 1.583-.98 3.055-2.017 3.71l-.055.054-2.072 1.364zM60.745 55.407c2.236 0 4.09 1.854 4.09 4.09 0 2.29-1.854 4.09-4.09 4.09-2.29 0-4.09-1.8-4.09-4.09 0-2.236 1.8-4.09 4.09-4.09zM39.2 55.407c2.236 0 4.09 1.854 4.09 4.09 0 2.29-1.854 4.09-4.09 4.09-2.29 0-4.09-1.8-4.09-4.09 0-2.236 1.8-4.09 4.09-4.09z"/>
	<path fill="#000000" d="M78.527 47.28c.818.274 1.636.492 2.29.492l.874-.164v.055c.437-.164 1.037-.545 1.637-1.2.273-.273.49-.6.764-.927-.817-.327-1.69-.545-2.344-.545l-.873.165c-.436.11-1.036.49-1.636 1.2-.273.27-.492.598-.71.926zm-44.182-5.235c-.164.218-.327.382-.436.545-.056.11-.11.164-.22.218l-.054.11c-1.582 1.962-2.782 4.307-3.545 6.762-.544 1.963-.872 3.98-.872 6.108V66.04c0 5.727 2.29 10.908 6.055 14.67S44.218 86.82 50 86.82c5.727 0 10.91-2.345 14.673-6.108 3.764-3.763 6.11-8.944 6.11-14.67V55.788c0-2.072-.274-4.036-.874-5.89 0-.11-.056-.273-.11-.436-.818-2.4-2.018-4.69-3.545-6.653l-.218-.22c-.164-.217-.327-.38-.436-.6-.38-.326-.654-.653-.926-.926C60.91 37.3 55.727 35.01 50 35.01c-5.782 0-10.964 2.29-14.727 6.054-.273.327-.6.6-.873.927l-.055.055zm-13.58 4.31c-.6-.71-1.2-1.092-1.692-1.2l-.873-.165c-.655 0-1.473.218-2.29.49.217.328.435.71.708.983.6.654 1.2 1.036 1.69 1.2l.82.11c.654 0 1.526-.22 2.344-.492-.217-.327-.436-.654-.708-.926zM14.872 9.05c.655-1.144 1.364-2.07 2.236-2.944 1.635-1.527 4.254-1.472 5.78.164 1.583 1.636 1.528 4.254-.108 5.78-.164.11-.545.6-.982 1.31-.436.71-.927 1.582-1.31 2.563-.872 2.018-1.417 4.363-1.417 6.163 0 1.31.273 2.236.655 2.836 0 .055.055.055.055.055.382.436.764.764 1.145 1.09.436-3.544 1.964-6.707 4.527-8.943 1.69-1.472 4.31-1.254 5.782.436 1.473 1.745 1.255 4.308-.436 5.78-.926.765-1.854 2.564-1.854 4.8.055 1.8.545 3.818 1.964 5.89 5.072-4.528 11.78-7.2 19.09-7.2s13.964 2.672 19.036 7.2C70.51 31.956 71 29.94 71 28.14c0-2.237-.927-4.09-1.855-4.8-1.69-1.472-1.855-4.09-.382-5.78 1.473-1.692 4.036-1.91 5.782-.383 2.51 2.18 4.09 5.345 4.527 8.89.436-.383.818-.765 1.2-1.146l.055-.054c.327-.6.545-1.527.545-2.78.055-2.728-1.364-6.654-2.727-8.727-.436-.71-.818-1.2-.927-1.31-1.636-1.582-1.69-4.145-.164-5.78 1.582-1.637 4.145-1.692 5.782-.11.873.818 1.582 1.8 2.29 2.89.492.873 1.037 1.854 1.528 2.89.11-.927.164-1.854.164-2.836 0-2.29 1.8-4.09 4.09-4.09 2.237 0 4.092 1.8 4.092 4.09 0 7.8-3 15.325-8.345 20.996-.218.327-.545.6-.818.818-.545.6-1.036 1.09-1.636 1.582l-5.672 4.854c1.09-.382 2.182-.545 3.218-.545 3.164.054 5.727 1.144 7.527 2.07 2.29 1.146 3.6 3.546 3.6 5.945 0 1.036-.273 2.072-.71 3.054h-.054c-.6 1.2-1.474 2.67-2.728 4.035-1.255 1.418-2.945 2.78-5.236 3.49-1.145.382-2.29.545-3.327.545-.656 0-1.256-.055-1.856-.164V66.04C78.964 82.02 65.982 95 50 95c-16.036 0-28.964-12.98-28.964-28.96V55.79c-.6.11-1.255.164-1.91.164-1.035 0-2.18-.164-3.326-.545-2.29-.71-3.982-2.072-5.236-3.49-1.2-1.31-2.073-2.727-2.673-3.927 0-.055-.054-.055-.054-.11-.545-.98-.764-2.126-.764-3.053 0-2.454 1.364-4.8 3.655-5.944 1.8-.927 4.31-2.018 7.473-2.072 1.036 0 2.182.165 3.273.546L15.8 32.5c-.655-.544-1.255-1.09-1.8-1.69-.218-.218-.49-.436-.655-.71C7.945 24.486 5 16.96 5 9.106c0-2.29 1.8-4.09 4.09-4.09 2.237 0 4.092 1.8 4.092 4.09 0 .927.055 1.854.164 2.78.49-1.035.98-1.962 1.527-2.834z"/>
</svg>');
}

  
/* custom CSS using mixin */
.svg-fill-replaced {
  background-image: svg-url-with-replaced-fill($svg-icon-code, '#000000', $icon-color);
}

.svg-with-mixin-from-jakob {
  background-image: svg-url($svg-icon-code);
}