/*
 * Copyright (c) 2016 by Josh Bader (http://codepen.io/joshbader/pen/EjXgqr)
 * Permission is hereby granted, free of charge, to any person obtaining a copy 
 * of this software and associated documentation files (the "Software"), to deal 
 * in the Software without restriction, including without limitation the rights 
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 
 * copies of the Software, and to permit persons to whom the Software is furnished 
 * to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all 
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 
 * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 
 * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 
 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 
 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 
 * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/


/* Modified 2016-05-01 (set color via variable) by PatharaNor */

:root {
  --weather-border-color: #5A5A5A;
  --weather-sun-color: orange;
  --weather-cloud-color: #82ecff;
  --weather-bg-color: white;
  --weather-bolt-color: yellow;
}

.icon {
  position: relative;
  display: inline-block;
  vertical-align: middle;
  width: 12em;
  font-size: 0.2em; /* control icon size here */
  height: 50px;
}

.cloud {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 50%;
  width: 3.6875em;
  height: 3.6875em;
  margin: -1.84375em;
  background: var(--weather-cloud-color);
  border-radius: 50%;
  box-shadow:
    -2.1875em 0.6875em 0 -0.6875em var(--weather-cloud-color),
    2.0625em 0.9375em 0 -0.9375em var(--weather-cloud-color),
    0 0 0 0.375em var(--weather-bg-color),
    -2.1875em 0.6875em 0 -0.3125em var(--weather-bg-color),
    2.0625em 0.9375em 0 -0.5625em var(--weather-bg-color);
}
.cloud:after {
  content: '';
  position: absolute;
  bottom: 0;
  left: -0.5em;
  display: block;
  width: 4.5625em;
  height: 1em;
  background: var(--weather-cloud-color);
  box-shadow: 0 0.4375em 0 -0.0625em var(--weather-bg-color);
}
.cloud:nth-child(2) {
  z-index: 0;
  background: var(--weather-border-color);
  box-shadow:
    -2.1875em 0.6875em 0 -0.6875em var(--weather-cloud-color),
    2.0625em 0.9375em 0 -0.9375em var(--weather-cloud-color),
    0 0 0 0.375em var(--weather-cloud-color),
    -2.1875em 0.6875em 0 -0.3125em var(--weather-cloud-color),
    2.0625em 0.9375em 0 -0.5625em var(--weather-cloud-color);
  opacity: 0.3;
  transform: scale(0.5) translate(6em, -3em);
  animation: cloud 4s linear infinite;
}
.cloud:nth-child(2):after { background: var(--weather-cloud-color); }

.sun {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2.5em;
  height: 2.5em;
  margin: -1.25em;
  background: var(--weather-sun-color);
  border-radius: 50%;
  box-shadow: 0 0 0 0.375em var(--weather-sun-color);
  animation: spin 12s infinite linear;
}
.rays {
  position: absolute;
  top: -2em;
  left: 50%;
  display: block;
  width: 0.375em;
  height: 1.125em;
  margin-left: -0.1875em;
  background: var(--weather-sun-color);
  border-radius: 0.25em;
  box-shadow: 0 5.375em var(--weather-sun-color);
}
.rays:before,
.rays:after {
  content: '';
  position: absolute;
  top: 0em;
  left: 0em;
  display: block;
  width: 0.375em;
  height: 1.125em;
  transform: rotate(60deg);
  transform-origin: 50% 3.25em;
  background: var(--weather-sun-color);
  border-radius: 0.25em;
  box-shadow: 0 5.375em var(--weather-sun-color);
}
.rays:before {
  transform: rotate(120deg);
}
.cloud + .sun {
  margin: -2em 1em;
}

.rain,
.lightning,
.snow {
  position: absolute;
  z-index: 2;
  top: 50%;
  left: 50%;
  width: 3.75em;
  height: 3.75em;
  margin: 0.375em 0 0 -2em;
}

.rain:after {
  content: '';
  position: absolute;
  z-index: 2;
  top: 50%;
  left: 50%;
  width: 1.125em;
  height: 1.125em;
  margin: -1em 0 0 -0.25em;
  background: #0cf;
  border-radius: 100% 0 60% 50% / 60% 0 100% 50%;
  box-shadow:
    0.625em 0.875em 0 -0.125em rgba(255,255,255,0.2),
    -0.875em 1.125em 0 -0.125em rgba(255,255,255,0.2),
    -1.375em -0.125em 0 rgba(255,255,255,0.2);
  transform: rotate(-28deg);
  animation: rain 3s linear infinite;
}

.bolt {
  position: absolute;
  top: 50%;
  left: 50%;
  margin: -0.25em 0 0 -0.125em;
  color: var(--weather-bolt-color);
  opacity: 0.3;
  animation: lightning 2s linear infinite;
}
.bolt:nth-child(2) {
  width: 0.5em;
  height: 0.25em;
  margin: -1.75em 0 0 -1.875em;
  transform: translate(2.5em, 2.25em);
  opacity: 0.2;
  animation: lightning 1.5s linear infinite;
}
.bolt:before,
.bolt:after {
  content: '';
  position: absolute;
  z-index: 2;
  top: 50%;
  left: 50%;
  margin: -1.625em 0 0 -1.0125em;
  border-top: 1.25em solid transparent;
  border-right: 0.75em solid;
  border-bottom: 0.75em solid;
  border-left: 0.5em solid transparent;
  transform: skewX(-10deg);
}
.bolt:after {
  margin: -0.25em 0 0 -0.25em;
  border-top: 0.75em solid;
  border-right: 0.5em solid transparent;
  border-bottom: 1.25em solid transparent;
  border-left: 0.75em solid;
  transform: skewX(-10deg);
}
.bolt:nth-child(2):before {
  margin: -0.75em 0 0 -0.5em;
  border-top: 0.625em solid transparent;
  border-right: 0.375em solid;
  border-bottom: 0.375em solid;
  border-left: 0.25em solid transparent;
}
.bolt:nth-child(2):after {
  margin: -0.125em 0 0 -0.125em;
  border-top: 0.375em solid;
  border-right: 0.25em solid transparent;
  border-bottom: 0.625em solid transparent;
  border-left: 0.375em solid;
}

.flake:before,
.flake:after {
  content: '\2744';
  position: absolute;
  top: 50%;
  left: 50%;
  margin: -3.025em 0 0 -1.0125em;
  color: var(--weather-bg-color);
  list-height: 1em;
  opacity: 0.8;
  animation: spin 8s linear infinite reverse;
}
.flake:after {
  margin: -0.525em 0 0 -1em;
  font-size: 8em;
  opacity: 1;
  animation: spin 14s linear infinite;
}
.flake:nth-child(2):before {
  margin: -1.2em 0 0 0.25em;
  font-size: 8em;
  opacity: 0.8;
  animation: spin 10s linear infinite;
}
.flake:nth-child(2):after {
  margin: -0.375em 0 0 0.125em;
  font-size: 6em;
  opacity: 1;
  animation: spin 16s linear infinite reverse;
}


/* Animations */ 

@keyframes spin {
  100% { transform: rotate(360deg); }
}

@keyframes cloud {
  0% { opacity: 0; }
  50% { opacity: 0.3; }
  100% {
    opacity: 0;
    transform: scale(0.5) translate(-200%, -3em);
  }
}

@keyframes rain {
  0% {
    background: var(--weather-bg-color);
    box-shadow:
      0.625em 0.875em 0 -0.125em rgba(255,255,255,0.2),
      -0.875em 1.125em 0 -0.125em rgba(255,255,255,0.2),
      -1.375em -0.125em 0 var(--weather-bg-color);;
  }
  25% {
    box-shadow:
      0.625em 0.875em 0 -0.125em rgba(255,255,255,0.2),
      -0.875em 1.125em 0 -0.125em var(--weather-bg-color);,
      -1.375em -0.125em 0 rgba(255,255,255,0.2);
  }
  50% {
    background: rgba(255,255,255,0.3);
    box-shadow:
      0.625em 0.875em 0 -0.125em var(--weather-bg-color);,
      -0.875em 1.125em 0 -0.125em rgba(255,255,255,0.2),
      -1.375em -0.125em 0 rgba(255,255,255,0.2);
  }
  100% {
    box-shadow:
      0.625em 0.875em 0 -0.125em rgba(255,255,255,0.2),
      -0.875em 1.125em 0 -0.125em rgba(255,255,255,0.2),
      -1.375em -0.125em 0 var(--weather-bg-color);;
  }
}

@keyframes lightning {
  45% {
    color: var(--weather-bolt-color);
    background: var(--weather-bolt-color);
    opacity: 0.2;
  }
  50% {
    color: var(--weather-bolt-color);
    background: var(--weather-bolt-color);
    opacity: 1;
  }
  55% {
    color: var(--weather-bolt-color);
    background: var(--weather-bolt-color);
    opacity: 0.2;
  }
}
