@import "base";
@import "compass/css3/columns";
@import "compass/css3/user-interface";

@mixin highlight-color($color: $brand-yellow) {
  -webkit-tap-highlight-color: $color;
  -moz-tap-highlight-color: $color;
  -ms-tap-highlight-color: $color;
  -o-tap-highlight-color: $color;
  tap-highlight-color: $color;
}

@mixin backdrop {
  @include background(linear-gradient(white, white 85%, $gray-1));
  background-color: white;
}


/**
 * Theme Styles
 */
::selection {
  color: white;
  background-color: $brand-yellow;
  @include text-shadow(none);
}

::-webkit-scrollbar {
  height: 16px;
  overflow: visible;
  width: 16px;
}
::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, .1);
  background-clip: padding-box;
  border: solid transparent;
  min-height: 28px;
  padding: 100px 0 0;
  @include box-shadow(inset 1px 1px 0 rgba(0,0,0,.1),inset 0 -1px 0 rgba(0,0,0,.07));
  border-width: 1px 1px 1px 6px;
}
::-webkit-scrollbar-thumb:hover {
  background-color: rgba(0, 0, 0, 0.5);
}
::-webkit-scrollbar-button {
  height: 0;
  width: 0;
}
::-webkit-scrollbar-track {
  background-clip: padding-box;
  border: solid transparent;
  border-width: 0 0 0 4px;
}
::-webkit-scrollbar-corner {
  background: transparent;
}

body {
  background: black;
}

slides > slide {
  display: none;
  font-family: 'Open Sans', Arial, sans-serif;
  font-size: 26px;
  color: $gray-3;
  //@include background(linear-gradient(white, white 85%, $gray-1));
  //background-color: white;
  width: $slide-width;
  height: $slide-height;
  margin-left: -$slide-width / 2;
  margin-top: -$slide-height / 2;
  padding: $slide-top-bottom-padding $slide-left-right-padding;

  @include border-radius($slide-border-radius);
  //@include box-shadow(5px 5px 20px $gray-4);
  @include transition(all 0.6s ease-in-out);

  //$translateX: 1020px;
  //$rotateY: 30deg;
  //$rotateX: 45deg;

  &.far-past {
    //display: block;
    display: none;
    //@include transform(translate(-$translateX * 2));
    //@include transform(translate3d(-$translateX * 2, 0, 0));
  }

  &.past {
    display: block;
    //@include transform(translate(-$translateX) rotateY($rotateY) rotateX($rotateX));
    //@include transform(translate3d(-$translateX, 0, 0) rotateY($rotateY) rotateX($rotateX));
    opacity: 0;
  }

  &.current {
    display: block;
    //@include transform(translate(0));
    //@include transform(translate3d(0, 0, 0));
    opacity: 1;

    .auto-fadein {
      opacity: 1;
    }

    .gdbar {
      @include background-size(100% 100%);
    }
  }

  &.next {
    display: block;
    //@include transform(translate($translateX) rotateY(-$rotateY) rotateX($rotateX));
    //@include transform(translate3d($translateX, 0, 0) rotateY(-$rotateY) rotateX($rotateX));
    opacity: 0;
    pointer-events: none;
  }

  &.far-next {
    //display: block;
    display: none;
    //@include transform(translate($translateX * 2));
    //@include transform(translate3d($translateX * 2, 0, 0));
  }

  &.dark {
    background: $gray-4 !important;
  }

  &:not(.nobackground) {
    //background: white url(../../images/google_developers_icon_128.png) ($brand-small-icon-size * 2) 98% no-repeat;
    //@include background-size($brand-small-icon-size $brand-small-icon-size);

    &:before {
      font-size: 12pt;
      content: $social-tags;
      position: absolute;
      bottom: $slide-top-bottom-padding / 2;
      left: $slide-left-right-padding;
      // background: url(../../images/google_developers_icon_128.png) no-repeat 0 50%;
      @include background-size($brand-small-icon-size $brand-small-icon-size);
      padding-left: $brand-small-icon-size + 10;
      height: $brand-small-icon-size;
      line-height: 1.9;
    }
    &:after {
      font-size: 12pt;
      content: attr(data-slide-num) '/' attr(data-total-slides);
      position: absolute;
      bottom: $slide-top-bottom-padding / 2;
      right: $slide-left-right-padding;
      line-height: 1.9;
    }
  }

  &.title-slide {
    &:after {
      content: '';
      //background: url(../../images/io2012_logo.png) no-repeat 100% 50%;
      //@include background-size(contain);
      position: absolute;
      bottom: $slide-top-bottom-padding;
      right: $slide-top-bottom-padding;
      width: 100%;
      height: 60px;
    }
  }

  &.backdrop {
    z-index: -10;
    display: block !important;
    @include backdrop;

    &:after, &:before {
      display: none; // Prevent double set of slide nums and footer icons.
    }
  }

  > hgroup + article {
    margin-top: $article-content-top-padding;

    &.flexbox {
      &.vcenter, &.vleft, &.vright {
        height: 80%;
      }
    }

    p {
      margin-bottom: 1em;
    }
  }

  > article:only-child {
    height: 100%;

    > iframe {
      height: 98%;
    }
  }
}

slides.layout-faux-widescreen > slide {
  padding: $slide-top-bottom-padding 160px;
}

slides.layout-widescreen,
slides.layout-faux-widescreen {

  $translateX: 1130px;

  > slide {
    margin-left: -$slide-width-widescreen / 2;
    width: $slide-width-widescreen;
  }

  > slide.far-past {
    display: block;
    display: none;
    @include transform(translate(-$translateX * 2));
    @include transform(translate3d(-$translateX * 2, 0, 0));
  }

  > slide.past {
    display: block;
    //@include transform(translate(-$translateX));
    //@include transform(translate3d(-$translateX, 0, 0));
    opacity: 0;
  }

  > slide.current {
    display: block;
    //@include transform(translate(0));
    //@include transform(translate3d(0, 0, 0));
    opacity: 1;
  }

  > slide.next {
    display: block;
    //@include transform(translate($translateX));
    //@include transform(translate3d($translateX, 0, 0));
    opacity: 0;
    pointer-events: none;
  }

  > slide.far-next {
    display: block;
    display: none;
    @include transform(translate($translateX * 2));
    @include transform(translate3d($translateX * 2, 0, 0));
  }

  #prev-slide-area {
    margin-left: -$slide-width-widescreen / 2 - $slide-tap-area-width;
  }

  #next-slide-area {
    margin-left: $slide-width-widescreen / 2;
  }
}

b {
  font-weight: 600;
}

a {
  color: $brand-blue-secondary2;
  text-decoration: none;
  border-bottom: 1px solid rgba(42, 124, 223, 0.5);

  &:hover {
    color: black !important;
  }
}

h1, h2, h3 {
  font-weight: 600;
}

h2 {
  font-size: 45px;
  line-height: 45px;
  letter-spacing: -2px;
  color: $gray-4;
}

h3 {
  font-size: 30px;
  letter-spacing: -1px;
  line-height: 2;
  font-weight: inherit;
  color: $gray-3;
}

ul {
  margin-left: 1.2em;
  margin-bottom: 1em;
  position: relative;

  li {
    margin-bottom: 0.5em;

    ul {
      margin-left: 2em;
      margin-bottom: 0;

      li:before {
        content: '-';
        font-weight: 600;
      }
    }
  }

  > li:before {
    content: '\00B7';
    margin-left: -1em;
    position: absolute;
    font-weight: 600;
  }

  ul {
    margin-top: .5em;
  }
}

// Code highlighting only effects the current slide.
.highlight-code slide.current {
  pre > * {
    opacity: 0.25;
    @include transition(opacity 0.5s ease-in);
  }
  b {
    opacity: 1;
  }
}

pre {
  font-family: 'Source Code Pro', 'Courier New', monospace;
  font-size: 20px;
  line-height: 28px;
  padding: 10px 0 10px $slide-left-right-padding;
  letter-spacing: -1px;
  margin-bottom: 20px;
  width: 106%;
  background-color: $gray-1;
  left: -$slide-left-right-padding;
  position: relative;
  @include box-sizing(border-box);
  /*overflow: hidden;*/

  &[data-lang]:after {
    content: attr(data-lang);
    background-color: $gray-2;
    right: 0;
    top: 0;
    position: absolute;
    font-size: 16pt;
    color: white;
    padding: 2px 25px;
    text-transform: uppercase;
  }
}

pre[data-lang="go"] {
  color: #333;
}

code {
  font-size: 95%;
  font-family: 'Source Code Pro', 'Courier New', monospace;
  color: black;
}

iframe {
  width: 100%;
  height: $slide-height - ($slide-top-bottom-padding * 2) - ($article-content-top-padding * 2);
  background: white;
  border: 1px solid $gray-1;
  @include box-sizing(border-box);
}

dt {
  font-weight: bold;
}

button {
  display: inline-block;
  @include background(linear-gradient(#F9F9F9 40%, #E3E3E3 70%));
  border: 1px solid $gray-2;
  @include border-radius(3px);
  padding: 5px 8px;
  outline: none;
  white-space: nowrap;
  @include user-select(none);
  cursor: pointer;
  @include text-shadow(1px 1px #fff);
  font-size: 10pt;
}

button:not(:disabled):hover {
  border-color: $gray-4;
}

button:not(:disabled):active {
  @include background(linear-gradient(#E3E3E3 40%, #F9F9F9 70%));
}

:disabled {
  color: $gray-2;
}

.blue {
  color: $brand-blue;
}
.blue2 {
  color: $brand-blue-secondary;
}
.blue3 {
  color: $brand-blue-secondary2;
}
.yellow {
  color: $brand-yellow;
}
.yellow2 {
  color: $brand-yellow-secondary;
}
.yellow3 {
  color: $brand-yellow-secondary2;
}
.green {
  color: $brand-green;
}
.green2 {
  color: $brand-green-secondary;
}
.green3 {
  color: $brand-green-secondary2;
}
.red {
  color: $brand-red;
}
.red2 {
  color: $brand-red-secondary;
}
.red3 {
  color: $brand-red-secondary2;
}
.gray {
  color: $gray-1;
}
.gray2 {
  color: $gray-2;
}
.gray3 {
  color: $gray-3;
}
.gray4 {
  color: $gray-4;
}

.white {
  color: white !important;
}
.black {
  color: black !important;
}

.columns-2 {
  @include column-count(2);
}

table {
  width: 100%;
  border-collapse: -moz-initial;
  border-collapse: initial;
  border-spacing: 2px;
  border-bottom: 1px solid $gray-3;

  tr > td:first-child, th {
    font-weight: 600;
    color: $gray-4;
  }

  tr:nth-child(odd) {
    background-color: $gray-1;
  }

  th {
    color: white;
    font-size: 18px;
    @include background(linear-gradient(top, $brand-blue 40%, $brand-blue-secondary2 80%) no-repeat);
  }

  td, th {
    font-size: 18px;
    padding: 1em 0.5em;
  }

  td.highlight {
    color: $gray-4;
    @include background(linear-gradient(top, $brand-yellow 40%, $brand-yellow-secondary2 80%) no-repeat);
  }

  &.rows {
    border-bottom: none;
    border-right: 1px solid $gray-3;
  }
}

q {
  font-size: 45px;
  line-height: 72px;

  &:before {
    content: '“';
    position: absolute;
    margin-left: -0.5em;
  }
  &:after {
    content: '”';
    position: absolute;
    margin-left: 0.1em;
  }
}

slide.fill {
  background-repeat: no-repeat;
  @include border-radius($slide-border-radius);
  @include background-size(cover);
}

/* Size variants */

article.smaller {
  p, ul {
    font-size: 20px;
    line-height: 24px;
    letter-spacing: 0;
  }
  table {
    td, th {
      font-size: 14px;
    }
  }
  pre {
    font-size: 15px;
    line-height: 20px;
    letter-spacing: 0;
  }
  q {
    font-size: 40px;
    line-height: 48px;

    &:before, &:after {
      font-size: 60px;
    }
  }
}

/* Builds */

.build {
  > * {
    @include transition(opacity 0.5s ease-in-out 0.2s);
  }

  .to-build {
    opacity: 0;
  }

  .build-fade {
    opacity: 0.3;

    &:hover {
      opacity: 1.0;
    }
  }
}

.popup .next .build {
  .to-build {
    opacity: 1;
  }

  .build-fade {
    opacity: 1;
  }
}

/* Pretty print */

.prettyprint .str, /* string content */
.prettyprint .atv { /* a markup attribute value */
  color: $brand-green-secondary2; //rgb(0, 138, 53);
}
.prettyprint .kwd, /* a keyword */
.prettyprint .tag { /* a markup tag name */
  color: rgb(0, 102, 204);
}
.prettyprint .com { /* a comment */
  color: $gray-3; //rgb(127, 127, 127);
  font-style: italic;
}
.prettyprint .lit { /* a literal value */
  color: rgb(127, 0, 0);
}
.prettyprint .pun, /* punctuation, lisp open bracket, lisp close bracket */
.prettyprint .opn,
.prettyprint .clo {
  color: $gray-4; //rgb(127, 127, 127);
}
.prettyprint .typ, /* a type name */
.prettyprint .atn, /* a markup attribute name */
.prettyprint .dec,
.prettyprint .var { /* a declaration; a variable name */
  color: $brand-red-secondary2; //rgb(127, 0, 127);
}
.prettyprint .pln {
  color: $gray-4;
}

.note {
  position: absolute;
  z-index: 100;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  padding: 1em;
  background: rgba(0, 0, 0, 0.3);
  opacity: 0;
  pointer-events: none;
  @include flexbox;
  @include flex-center-center;
  @include border-radius($slide-border-radius);

  @include box-sizing(border-box);
  @include transform(translateY($slide-height / 2));@include transition(all 0.4s ease-in-out);

  > section {
    background: #fff;
    @include border-radius($slide-border-radius);
    @include box-shadow(0 0 10px $gray-3);
    width: 60%;
    padding: 2em;
  }
}

// Speaker notes only show the current slide.
.with-notes {

  &.popup {

    slides.layout-widescreen,
    slides.layout-faux-widescreen {
      slide {
        &.next {
          @include transform(translate3d($slide-width-widescreen / 2 + 140, 80px, 0) scale(0.35));
        }
        .note {
          @include transform(translate3d(300px, $slide-height + 100, 0) scale(1.5));
        }
      }
    }

    slide {
      overflow: visible;
      background: white;
      @include transition(none); // No slide transition goodies when in presenter mode.
      pointer-events: none;
      @include transform-origin(0, 0); // For speaker note transition.

      &:not(.backdrop) {
        @include transform(scale(0.6) translate3d(0.5em, 0.5em, 0));
        @include box-shadow(0 0 10px $gray-3);
      }

      &.backdrop {
        //@include background(linear-gradient($gray-1, white 30%, white 60%, $gray-1));
        @include background-image(radial-gradient(50% 50%, #b1dfff 0%,
                                                  $brand-blue 600px));
      }

      &.next {
        @include transform(translate3d($slide-width / 2 + 120, 80px, 0) scale(0.35));
        opacity: 1 !important;

        .note {
          display: none !important; // Prevents seeing notes if we go to previous slide.
        }
      }
    }

    .note {
      width: 109%;
      height: $slide-height / 2 - 90;
      background: $gray-1;
      padding: 0;

      @include box-shadow(0 0 10px $gray-3);

      @include transform(translate3d(250px, $slide-height + 100, 0) scale(1.5));
      @include transition(opacity 400ms ease-in-out);

      > section {
        background: #fff;
        @include border-radius($slide-border-radius);
        height: 100%;
        width: 100%;
        @include box-sizing(border-box);
        @include box-shadow(none);
        overflow: auto;
        padding: 1em;
      }
    }
  }

  .note {
    opacity: 1;
    @include transform(translateY(0));
    pointer-events: auto; // Allow people to do things like open links embedded in the speaker notes.
  }
}

.source {
  font-size: 14px;
  color: $gray-2;
  position: absolute;
  bottom: $slide-top-bottom-padding + 30px;
  left: $slide-left-right-padding;
}

.centered {
  text-align: center;
}

.reflect {
  -webkit-box-reflect: below 3px -webkit-linear-gradient(rgba(255,255,255,0) 85%, white 150%);
  -moz-box-reflect: below 3px -moz-linear-gradient(rgba(255,255,255,0) 85%, white 150%);
  -o-box-reflect: below 3px -o-linear-gradient(rgba(255,255,255,0) 85%, white 150%);
  -ms-box-reflect: below 3px -ms-linear-gradient(rgba(255,255,255,0) 85%, white 150%);
  box-reflect: below 3px linear-gradient(rgba(255,255,255,0) 85%, white 150%);
}

.flexbox {
  @include flexbox;
}

.flexbox.vcenter {
  @include flex-center-center;
  height: 100%;
  width: 100%;
}

.flexbox.vleft {
  @include flex-left-center;
  height: 100%;
  width: 100%;
}

.flexbox.vright {
  @include flex-right-center;
  height: 100%;
  width: 100%;
}

.auto-fadein {
  @include transition(opacity 0.6s ease-in 1s);
  opacity: 0;
}

/* Clickable/tappable areas */
.slide-area {
  z-index: 1000;

  position: absolute;
  left: 0;
  top: 0;
  width: $slide-tap-area-width;
  height: $slide-height;

  left: 50%;
  top: 50%;

  cursor: pointer;
  margin-top: -$slide-height / 2;

  //@include highlight-color(rgba(51, 51, 51, 0.5));
}
#prev-slide-area {
  margin-left: -$slide-width-widescreen / 2;
  //@include border-radius(10px 0 0 10px);
  //@include box-shadow(-5px 0 10px #222 inset);
}
#next-slide-area {
  margin-left: $slide-width / 2;
  //@include border-radius(0 10px 10px 0);
  //@include box-shadow(5px 0 10px #222 inset);
}

/* ===== SLIDE CONTENT ===== */
.logoslide {
  img {
    width: 383px;
    height: 92px;
  }
}

.segue {
  padding: $slide-left-right-padding $slide-left-right-padding * 2;

  h2 {
    color: $gray-1;
    font-size: 60px;
  }
  h3 {
    color: $gray-1;
    line-height: 2.8;
  }
  hgroup {
    position: absolute;
    bottom: 225px;
  }
}

.thank-you-slide {
  background: $brand-blue !important;
  color: white;

  h2 {
    font-size: 60px;
    color: inherit;
  }

  article > p {
    margin-top: 2em;
    font-size: 20pt;
  }

  > p {
    position: absolute;
    bottom: $slide-top-bottom-padding * 2;
    font-size: 24pt;
    line-height: 1.3;
  }
}

aside.gdbar {
  height: 97px;
  width: 215px;
  position: absolute;
  left: -1px;
  top: 125px;
  @include border-radius(0 10px 10px 0);
  @include background(linear-gradient(left, $gray-1, $gray-1) no-repeat);
  @include background-size(0% 100%);
  @include transition(all 0.5s ease-out 0.5s); /* Better to transition only on background-size, but not sure how to do that with the mixin. */

  &.right {
    right: 0;
    left: -moz-initial;
    left: initial;
    top: ($slide-height / 2) - 96; /* 96 is height of gray icon bar */
    @include transform(rotateZ(180deg));

    img {
      @include transform(rotateZ(180deg));
    }
  }

  &.bottom {
    top: -moz-initial;
    top: initial;
    bottom: $slide-left-right-padding;
  }

  img {
    width: 85px;
    height: 85px;
    position: absolute;
    right: 0;
    margin: 8px 15px;
  }
}

.title-slide {

  hgroup {
    bottom: 100px;

    h1 {
      font-size: 65px;
      line-height: 1.4;
      letter-spacing: -3px;
      color: $gray-4;
    }

    h2 {
      font-size: 34px;
      color: $gray-2;
      font-weight: inherit;
    }

    p {
      font-size: 20px;
      color: $gray-3;
      line-height: 1.3;
      margin-top: 2em;
    }
  }
}

.quote {
  color: $gray-1;

  .author {
    font-size: 24px;
    position: absolute;
    bottom: 80px;
    line-height: 1.4;
  }
}

[data-config-contact] {
  a {
    color: rgb(255, 255, 255);
    border-bottom: none;
  }
  span {
    width: 115px;
    display: inline-block;
  }
}

.overview {

  &.popup {
    .note {
      display: none !important;
    }
  }

  slides {
    slide {
      &.backdrop {
        display: none !important;
      }

      display: block;
      cursor: pointer;
      opacity: 0.5;
      pointer-events: auto !important;

      @include backdrop();

      &.far-past,
      &.past,
      &.next,
      &.far-next,
      &.far-past {
        opacity: 0.5;
        display: block;
      }

      &.current {
        opacity: 1;
      }
    }
  }

  .slide-area {
    display: none;
  }
}

@media print {
  slides {
    slide {
      display: block !important;
      position: relative;
      @include backdrop();
      @include transform(none !important);
      width: 100%;
      height: 100%;
      page-break-after:always;
      top: auto !important;
      left: auto !important;
      margin-top: 0 !important;
      margin-left: 0 !important;
      opacity: 1 !important;
      color: #555;

      &.far-past,
      &.past,
      &.next,
      &.far-next,
      &.far-past,
      &.current {
        opacity: 1 !important;
        display: block !important;
      }

      .build {
        > * {
          @include transition(none);
        }

        .to-build,
        .build-fade {
          opacity: 1;
        }
      }

      .auto-fadein {
        opacity: 1 !important;
      }

      &.backdrop {
        display: none !important;
      }

      table.rows {
        border-right: 0;
      }
    }

    slide[hidden] {
      display: none !important;
    }
  }

  .slide-area {
    display: none;
  }

  .reflect {
    -webkit-box-reflect: none;
    -moz-box-reflect: none;
    -o-box-reflect: none;
    -ms-box-reflect: none;
    box-reflect: none;
  }

  pre, code {
    font-family: monospace !important;
  }
}
