@import "compass/css3/border-radius";
@import "compass/css3/box-shadow";
@import "compass/css3/images";
//@import "compass/css3/shared";
@import "compass/css3/transform";
@import "compass/css3/transition";

@import "variables";
@import "mixins";
@import "animations";

$polymer-elements-color: rgb(13, 168, 97);
$polymer-platform-color: rgb(205, 55, 45);
$polymer-core-color: rgb(255, 209, 77);
$polymer-applications-color: rgb(35, 100, 215);

/* Architecture stack */
.core {
  color: $polymer-core-color;
}
.core-bg {
  background-color: rgba(255, 209, 77, 1);
}
.platform {
  color: $polymer-platform-color;
}
.platform-bg {
  background-color: rgba(244, 74, 63, 1);
}
.elements {
  color: $polymer-elements-color;
}
.elements-bg {
  background-color: rgba(13, 168, 97, 1);
}
.applications {
  color: $polymer-applications-color;
}
.applications-bg {
  background-color: rgba(67, 135, 253, 1);
}
// -----

// Left sidebar architecture color bars
.platform-bg {
  .sidebar.platform {
    width: 25px;
    &::after {
      content: '\f085 \00a0 platform';
    }
  }
}
.core-bg {
  .sidebar.core {
    width: 25px;
    &::after {
      content: '\f0c3 \00a0 core';
    }
  }
}
.elements-bg {
  .sidebar.elements {
    width: 25px;
    &::after {
      content: '\f12e \00a0 elements';
    }
  }
}

.sidebar {
  overflow: hidden;
  font-family: 'Open Sans', Arial, sans-serif;
  font-size: 35px;
  position: absolute;
  height: 100%;
  left: 0;
  width: 0;
  color: white;
  @include transition(all 400ms ease-in-out);
  // @include transition(all 400ms cubic-bezier(.17,1.67,0,1.33));

  &::after {
    text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.2);
    font-family: FontAwesome;
    position: absolute;
    bottom: -10px;
    left: 5px;
    @include transform(rotateZ(-90deg));
    -webkit-transform-origin: 0 0;
    -moz-transform-origin: 0 0;
    transform-origin: 0 0;
  }

  &.left {
    @include box-shadow(-3px 0 10px rgba(0, 0, 0, 0.3) inset);
  }
  &.right {
    @include box-shadow(3px 0 10px rgba(0, 0, 0, 0.3) inset);
    right: 0;
    left: initial;
    left: -moz-initial;

    &::after {
      @include transform(rotateZ(90deg));
      -webkit-transform-origin: 0 50%;
      -moz-transform-origin: 0 50%;
      transform-origin: 0 50%;
      bottom: initial;
    }
  }
}

body {
  &.black {
    background: black;
  }
  &.gray {
    background: $gray-1;
  }
  &.whatispolymer {
    background: url('../../images/bgs/rings.jpg') no-repeat 50% 50%;
    background-size: cover;
  }
  &.insane {
    background: url('../../images/bgs/insanity_cars.jpg') no-repeat 50% 50%;
    background-size: cover;
  }
  &.site {
    background: url('../../images/polymer/homepage.png') no-repeat 50% 0;
    background-size: cover;
  }
  &.readable {
    background: url('../../images/screenshots/gmail.png') no-repeat 0 0;
    background-size: cover;
  }
  &.howwebuildapps {
    background: url('../../images/gifs/wtf.gif') no-repeat 50% 50%;
    background-size: cover;
  }
  &.googlecomhistory {
    background: url('../../images/bgs/timemachine.jpg') no-repeat 0 0;
    background-size: cover;
  }
  &.b2tf {
    background: url('../../images/bgs/b2tf.jpg') no-repeat 0 0;
    background-size: cover;
  }
  &.freddykrueger {
    background: url('../../images/slides/freddykrueger.jpg') no-repeat 50% 50%;
    background-size: contain;
    background-color: black;
  }
  &.netscape {
    background: url('../../images/bgs/netscape.gif') no-repeat 50% 50%, url('../../images/bgs/bg-rep.png');
    background-color: black;
    background-size: 65%, 20px;
  }
  &.checkers {
    background: url('../../images/bgs/bg-rep.png');
    background-size: 20px;
  }
}

slide.current {
  pre[data-code-cycle]::before {
    opacity: 1;
  }
}

pre {
  &[data-code-cycle] {
    cursor: pointer;

    // &:hover {
    //   &::before {
    //     opacity: 1;
    //   }
    // }

    &::before {
      content: 'click to cycle';
      color: $gray-3;
      background: url(../../images/icons/arrow_curve_blue.svg) no-repeat 50% 50%;
      position: absolute;
      right: 75px;
      bottom: -20px;
      background-size: contain;
      height: 50px;
      width: 50px;
      font-size: 20px;
      padding-left: 60px;
      font-family: 'Open Sans', Arial, sans-serif;
      letter-spacing: initial;
      letter-spacing: -moz-initial;
      @include transition(opacity 300ms ease-in 500ms);
      opacity: 0;
      @include user-select(none);
    }
  }

  &.nohighlight {
    font-family: 'Source Code Pro', 'Courier New', monospace;
    //font-size: 20px;
    line-height: 1.2;
    background: transparent;
    margin-bottom: 0;
  }

  &.corner {
    position: absolute;
    right: 0;
    top: 0;
    font-size: 16px;
    line-height: 1.5;
    margin: 0 40px;

    [data-tooltip]:hover {
      &:after {
        left: -150px;
      }
    }
  }

  [data-action] {
    border-bottom: 1px dotted black;
    display: inline-block;
    cursor: pointer;
    //@include user-select(none);
    .inactive {
      opacity: 0.5;
    }
  }
}

label.spec {
  background-image: none !important;
  font-size: 60%;
  display: initial !important;
  vertical-align: top;
  margin-left: 25px;
  opacity: 1 !important;
  @include transition(none !important);
  // background: $polymer-platform-color;
  // padding: 3px 10px;
  // border-radius: 5px;
  // color: white;
  color: $gray-2;
  letter-spacing: initial;
  // font-weight: initial;
}

.architecture-diagram {
  article {
    @include transform(rotateY(180deg));
    background: url(../../images/polymer/architecture-diagram.svg) no-repeat;
    background-size: contain;
    background-position: -290px 50%;
    height: 100%;
    margin-top: 0;
    opacity: 0;
    @include transition(opacity 1s ease-in-out);
  }

  .overlay {
    background: rgba(255,255,255,0.8);
    position: absolute;
    z-index: 100;
    height: 0;
    width: 410px;
    @include transition(height 1s ease-in-out 2s);

    &.top {
      top: 0;
    }
    &.bottom {
      bottom: 0;
    }
  }

  // hgroup {
  //   z-index: 1;
  // }
}

// Slide styles
slides > slide {
  @include border-radius(0);
  //border-bottom: 5px solid transparent;

  $slide-left-right-padding: 40px;
  padding: 0 $slide-left-right-padding;

  &:not(.nobackground) {
    //overflow: hidden;
    &::before, &::after {
      bottom: 0;
      line-height: 1.9;
    }
    &::before {
      width: 100%;
      left: 0;
    }
    &::after {
      //right: $slide-left-right-padding;
      right: 10px;
    }
  }

  &.segue {
    &.elements, &.core, &.platform {
      @extend .architecture-diagram;
      padding-left: 40px;
      padding-right: 40px;

      footer {
        display: none;
      }

    }

    h3 {
      font-size: 25px;
      position: absolute;
      .nounderline {
        border: none;
        color: $gray-2;
      }
    }
  }

  &:not(.segue):not(.nobackground)  {
    &.elements, &.platform, &.core {
      &::before {
        text-align: center;
      }
      footer {
        line-height: 1.9;
        font-size: 12pt;
        position: absolute;
        bottom: 0;
        left: 10px;
        [class*="icon-"]::after {
          margin-left: 5px;
        }
      }
    }

    &.elements {
      border-color: $polymer-elements-color;
      footer {
        [class*="icon-"] {
          &::after {
            content: 'elements';
          }
        }
      }
    }
    &.platform {
      border-color: $polymer-platform-color;
      footer {
        [class*="icon-"] {
          &::after {
            content: 'platform';
          }
        }
      }
    }
    &.core {
      border-color: $polymer-core-color;
      footer {
        [class*="icon-"] {
          &::after {
            content: 'core';
          }
        }
      }
    }
  }


  &.elements, &.core, &.platform {
    color: inherit;

    &.current {
      article {
        opacity: 1;
      }
    }
  }

  &.current {

    &.elements {
      .overlay {
        &.top {
          height: 0; 
        }
        &.bottom {
          height: 283px;
        }
      }
    }

    &.core {
      .overlay {
        &.top {
          height: 298px; 
        }
        &.bottom {
          height: 247px;
        }
      }
    }

    &.platform {
      .overlay {
        &.top {
          height: 333px; 
        }
        &.bottom {
          height: 0;
        }
      }
    }

  }

  article.flexbox {
    margin: 0;
  }

}

.fullviewport {
  width: 100% !important;
  height: 100% !important;
  left: 0 !important;
  top: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
}

.selecty {
  position: absolute;
  z-index: 100;
  bottom: 0;
  right: 0;
  @include align-self(flex-end);
  // margin-right: 40px;
  margin-bottom: $slide-top-bottom-padding * 3;
  margin-right: $slide-left-right-padding * 2;

  width: 100%;

  // http://nicolasgallagher.com/pure-css-speech-bubbles/demo/default.css
  $speech-bubble-border-color: #222;
  $speech-bubble-border-width: 2px;
  $speech-bubble-bg-color: rgb(255,255,204);

  .rectangle-speech-border {
    // position: relative;
    border: $speech-bubble-border-width solid $speech-bubble-border-color;
    border-radius: 20px;

    &:before, &:after {
      display: block;
      content: "";
      position: absolute;
      z-index: 10;
      bottom: -34px;
      right: 60px;
      height: 30px;
      border-color: $speech-bubble-border-color;
      border-style: solid;
      background: transparent;
      margin: 0;
    }

    &:before {
      width: 50px;
      // border-width: 0 $speech-bubble-border-width $speech-bubble-border-width 0;
      border-width: 0 0 $speech-bubble-border-width $speech-bubble-border-width;
    
      // border-bottom-right-radius: 80px 50px;
      border-bottom-left-radius: 80px 50px;
      background: $speech-bubble-bg-color;
    }

    &:after {
      width: 20px;
      // border-width: 0 $speech-bubble-border-width $speech-bubble-border-width 0;
      border-width: 0 0 $speech-bubble-border-width $speech-bubble-border-width;
      // border-bottom-right-radius: 40px 50px;
      border-bottom-left-radius: 40px 50px;
      background: white;
    }

    > :first-child {
      margin: 0;

      // &:before {
      //   content: "";
      //   position: absolute;
      //   bottom: -35px;
      //   right: 58px;
      //   width: 3px;
      //   height: 3px;
      //   background: $speech-bubble-border-color;
      //   border-radius: $speech-bubble-border-width;
      // }
      &:after {
        content: "";
        position: absolute;
        bottom: -10px;
        right: 82px;
        width: 28px;
        height: 15px;
        background: $speech-bubble-bg-color;
      }
    }
  }

  q {
    background-color: $speech-bubble-bg-color;
    padding: 20px;
    border-radius: 5px;
    border: 2px solid #222;
    display: inline-block;
    //margin-left: 15px;
    font-family: 'Architects Daughter', cursive;
    font-size: 20px;
    line-height: 30px;
    max-width: 50%;
    position: relative;

    bottom: 0;
    position: absolute;
    right: 0;

    opacity: 0;
    @include transition(opacity 600ms ease-in-out);
  }

  img {
    // &:hover {
    //   -webkit-animation: none;
    //   + q {
    //     opacity: 1;
    //   }
    // }
    + q {
      opacity: 1;
    }
    height: 75px;
    position: absolute;
    bottom: -80px;
    right: -80px;
    @extend .jitter;
    -webkit-animation-duration: 5s;
  }
}

// Position element in corners.
.corner {
  position: absolute;

  &.top {
    top: 0;
  }
  &.bottom {
    bottom: $slide-left-right-padding / 2;
  }
  &.left {
    left: 0;
  }
  &.right {
    right: 0;
  }
}

// Slides

#title-slide {
  width: 100% !important;
  height: 100% !important;
  left: 0 !important;
  top: 0 !important;
  margin: 0 !important;
  // position: absolute;

  padding: $slide-top-bottom-padding * 2 $slide-left-right-padding * 2;

  [data-config-presenter] {
    margin: 60px 0 0 0;
    line-height: 1.3;
  }

  .auto-fadein {
    @include transition(opacity 300ms ease-in-out 1s);
  }

  article {
    @include align-items(flex-start);
    @include justify-content(flex-end);
    color: white;
    font-weight: 300;
  }

  hgroup {
    background: url(../../images/polymer/architecture-diagram.svg) no-repeat;
    background-size: 195px;
    background-position: -56px 100%;
    padding-left: 150px;

    h1 {
      font-size: 95px;
    }

    h2 {
      font-size: 38px;
      color: inherit;
      margin-top: 10px;
    }
  }
  
  video {
    @extend .fullviewport;
    position: absolute;
    z-index: -1;
    width: auto !important;
  }
}

slide#hangoutsexample {
  .example {
    position: absolute;
    bottom: 0;
    right: 10px;
    @include display-flex();
    @include align-items(flex-end);
  }

  hangout-module {
    margin-left: 10px;
  }
}



#spacevideo {
  p {
    display: none;
  }
  hgroup {
    position: absolute;
    z-index: 1000;
    bottom: 100px;
    left: 100px;
  }
}

slide#polymeroneliner {
  @include transition(all 1s ease-in-out);
  border: 1px solid $gray-2;

  &.active {
    @include transform(scale(4.5) translate3d(-$slide-width-widescreen / 3.3, -55px,0));
  }

  hgroup {
    bottom: $slide-top-bottom-padding / 2;
    left: $slide-left-right-padding / 2;
  }

  .calloutbox {
    border: 10px solid #f44a3f;
    width: 670px;
    height: 120px;
    margin-top: 178px;
    margin-left: 230px;
    border-radius: 5px;
  }
}

slide#whatispolymer {
  padding: $slide-top-bottom-padding * 2 $slide-left-right-padding * 2 !important;
  @extend .bodybg;
  @include transition(-webkit-transform 300ms cubic-bezier(.17,.67,0,1.33));
  
  &:active {
    @include transform(scale(0.50));
    border-radius: 15px;
  }

  h3 {
    font-size: 70px;
    font-weight: 600;
    margin-left: 10%;
    &:nth-child(2) {
      margin-left: 25%;
    }
    &:nth-child(3) {
      margin-left: 50%;
    }
  }
}

slide#philosophy {
  h2 {
    font-size: 45px !important;
  }
}

slide.googlecomtoday {
  &.active {
    @include transform(scale(0) rotateZ(360deg));
    opacity: 0;
    @include transition(-webkit-transform 2s ease-in-out, opacity 1s ease-in-out 1s);
  }
  background: url('../../images/bgs/googlecom_today.jpg') no-repeat 0 0;
  background-size: cover;
}

slide.googlecomyesterday {
  background: url('../../images/bgs/googlecom_1998.jpg') no-repeat 50% 40%;
  background-size: 60%;
  background-color: white;

  @include transition(-webkit-transform 1s cubic-bezier(.17,.67,0,1.35));

  &.next {
    @include transform(scale(0.3) rotateZ(360deg));
  }
}

slide#netscape {
  table, td {
    border-top-color: initial;
    border-top-style: groove;
    border-right-color: initial;
    border-right-style: groove;
    border-bottom-color: initial;
    border-bottom-style: groove;
    border-left-color: initial;
    border-left-style: groove;
  }
  table {
    display: table;
    border-collapse: separate;
    border-spacing: 2px;
    border-color: gray;
    border-top-width: 10px;
    border-right-width: 10px;
    border-bottom-width: 10px;
    border-left-width: 10px;
    border-spacing: 5px;
  }
  tr {
    background-color: white !important;
  }
}

slide#spoiler {
  background-repeat: no-repeat;
  background-position: 0 50%;

  article {
    @include align-items(flex-end);
  }

  h2 {
    color: rgba(244, 74, 63, 1);
    text-transform: uppercase;
    font-weight: bold;
    font-size: 140px;
    line-height: 170px;
    // -webkit-text-stroke: 3px darkred;
    // -moz-text-stroke: 3px darkred;
    // text-stroke: 3px darkred;
    //@include filter(drop-shadow(1px 1px 5px darkred));
    letter-spacing: -5px;
  }

  h3 {
    margin-right: 8%;
    font-size: 50px;
  }

  img {
    height: 110px;
    margin-top: -20px;
    margin-left: 15px;
    vertical-align: middle;
  }
}

#thumbsup {
  h2 {
    font-size: 400px;
    @include filter(drop-shadow(5px 5px 5px $gray-2));
    @include transform(rotateX(0));
    -webkit-transform-origin: 50% 50%;
    -moz-transform-origin: 50% 50%;
    transform-origin: 50% 50%;
    @include transition(all 600ms cubic-bezier(.17,.67,0,1.35));
    color: $brand-green;
    opacity: 1.0 !important;

    &.to-build {
      @include transform(rotateX(180deg));
      color: $brand-red;
    }
  }
  
}

.component-demo {
  overflow: auto;
  height: 125px;
  //@include experimental-value(height, fill-available);
  output {
    font-size: 16px;
  }
}

#tab-examples {
  img {
    height: 550px;
    position: absolute;
    @include transform(scale(0.8));
    @include transition(all 300ms ease-in-out);

    &:nth-child(2) {
      margin-left: 100px;
    }
    &:nth-child(3) {
      margin-left: 200px;
    }
    &:nth-child(4) {
      margin-left: 300px;
    }
    &:nth-child(5) {
      margin-left: 400px;
    }
    &.build-current {
      @include transform(none);
    }
  }
}

#polymer-flex-demo {
  polymer-flex-layout {
    height: 250px;
    cursor: pointer;

    > * {
      font-weight: bold;
      padding: 10px;
      background-color: purple;
      margin: 5px;
      color: white;
    }
  }
}

#more-complex-elements,
#published-properties {
  textarea {
    display: none;
  }
}

#polymer-ui-elements {
  div > div {
    @include flex-direction(row);
    img {
      height: 200px;
    }
  }
  img {
    margin-bottom: 40px;
    border: 1px solid $gray-1;
  }
}

slide#polymerurl {
  .to-build {
    opacity: 1;
  }
  .build-current {
    a {
      margin-left: 0;
    }

    span {
      @include transform(translateY(0) !important);
      opacity: 1;
      color: $brand-blue-secondary2;
    }
  }

  a {
    border:none;
    color:black;
    @include transition(all 400ms ease-in-out);
    margin-left: -270px;

    span {
      display: inline-block;
      @include transition(all 400ms ease-in-out);
      
      &:first-child {
        @include transform(translateY(-110px) translateX(387px));
      }
      &:last-child {
        @include transform(translateY(110px) translateX(-322px));
      }
    }
  }

  .hide {
    opacity: 0;
  }

  // a {
  //   border:none;
  //   color:black;
  //   margin-left: -270px;
  //   @include transition(all 400ms ease-in-out);

  //   &:hover {
  //     margin-left: 0;

  //     span {
  //       @include transform(translateY(0) !important);
  //       opacity: 1;
  //       color: $brand-blue-secondary2;
  //     }
  //   }

  //   .hide {
  //     opacity: 0;
  //   }

  //   span {
  //     display: inline-block;
  //     @include transition(all 400ms ease-in-out);
      
  //     &:first-child {
  //       @include transform(translateY(-110px) translateX(387px));
  //     }
  //     &:last-child {
  //       @include transform(translateY(110px) translateX(-322px));
  //     }
  //   }
  // }
}


slide.thank-you-slide {
  line-height: 1.3;

  a {
    border-bottom: none;
    color: $brand-blue-secondary2;
    font-size: 24pt;
  }
}