/* Config *\
\* ====== */

@drawerWidth: 28rem;
@spacingUnit: 1.6rem;
@lineWidth: .1rem;
@maxContentWidth: (@drawerWidth * 2);
@transitionDuration: .3s;

// Colors
@brand: #09C;
@black: #333;
@white: #FDFDFD;

@footerBackgroundColor: #F6F4F0;
@codeBackgroundColor: @footerBackgroundColor;
@dark: #444;
@darkGrey: #DDDBD7;

/* Mixins *\
\* ====== */

.translate(@x: 0; @y: 0; @z: 0) {
  -webkit-transform: translate3d(@x, @y, @z);
          transform: translate3d(@x, @y, @z);
}

.transition() {
  -webkit-transition: @transitionDuration all;
          transition: @transitionDuration all;
}

* {
  font-family: inherit;
  font-size: 100%;
  font-style: inherit;
  font-weight: inherit;
  text-decoration: none;
  color: inherit;
  line-height: inherit;
  border: 0;
  margin: 0;
  outline: 0;
  padding: 0;
  vertical-align: baseline;
  /*cursor: inherit;*/
}

::selection {
  background: #FFECC0; // #FEFECA; //@brand;
  // color: #FFF;
  text-shadow: none;
}

html {
  width: 100%;
  height: 100%;
  font-size: 10px;
  position: relative;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  position: relative;
  // width: 100%; // This is here to hide the border.
  height: 100%;
  font-size: 1.75rem;
  font-family: "Source Sans Pro", "Myriad Pro", "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Ubuntu, "Segoe UI", Geneva, Verdana, sans-serif;
  color: @black;
  background: @white;
  line-height: 1.4;
  overflow-x: hidden;
}

main, aside {
  overflow: auto;
  display: block;
  height: 100%;
  .transition();
  -webkit-overflow-scrolling: touch;
}

main {
  .translate();
}

// Hack to enable clicking on the button sitting on top of a touch overflow
.ios body:after {
  display: block;
  content: "";
  height: 1px;
}

section {
  max-width: @maxContentWidth;
  padding: 0 @spacingUnit;
  margin: 7rem auto;
}

aside {
  font-size: .9em;
  line-height: 3rem;
  position: absolute;
  background: @black;
  color: @darkGrey;// @white;
  width: @drawerWidth;
  top: 0;
  right: 0;
  z-index: 1;
  .translate(@drawerWidth);

  -webkit-user-select: none;
     -moz-user-select: none;
      -ms-user-select: none;
       -o-user-select: none;
          user-select: none;

  section {
    margin: 0 0 @spacingUnit;
  }

  hr {
    margin: @spacingUnit 0;
    border-color: lighten(@black, 12);
  }

  a {
    display: block;

    &:hover, &.active {
      color: @white;
    }
  }

  h4 a {
    padding: (@spacingUnit / 2) @spacingUnit;
    margin: 0 (-@spacingUnit) 0 (-@spacingUnit);

    &:hover , &.active {
      background: lighten(@black, 6);
    }
  }

  ul ul {
    margin-left: @spacingUnit;

    a {
      font-weight: 400;
    }
  }

  h2 {
    margin-top: 7rem;
  }

  nav + h2 {
    margin-top: 0;
  }
}

nav {
  margin-bottom: @spacingUnit;
  box-shadow: inset 0 (-@lineWidth) lighten(@black, 12);
  color: lighten(@black, 20);// darken(@darkGrey, 12);
  white-space: nowrap;
  overflow: auto;

  a {
    display: inline-block;
    font-weight: bold;
    padding: @spacingUnit 0;

    &.active {
      color: @white;
      border-bottom: @lineWidth solid @darkGrey;
      margin-top: (-@lineWidth);
    }
  }

  a + a {
    margin-left: @spacingUnit;
  }
}

p, main ol, main ul, pre, table {
  margin: .2em 0 1.5em;
}

h1 {
  font-size: 2em;
  text-transform: capitalize;
}

h2 {
  font-size: 1.6em;
  // border-bottom: 1px solid @darkGrey;
}

h3 {
  font-size: 1.2em;
}

h4 {
}

h5 {
  font-size: .9em;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: lighten(@black, 20);
}

h6 {
  /*font-size: .9em;*/
  color: #BBB;
}

h1, h2, h3, h4, h5, h6 {
  line-height: 1.2;
}

table {
  font-size: .9em;
  width: 100%;
  border-collapse: collapse;
}

tbody tr {
  border-top: @lineWidth solid @darkGrey;
}

td, th {
  text-align: left;
  padding: (@spacingUnit / 2);

  &:first-child {
    padding-left: @spacingUnit;
  }

  &:last-child {
    padding-right: @spacingUnit;
  }
}

.left {
  text-align: left;
}

.right {
  text-align: right;
}

.center {
  text-align: center;
}

main a:hover {
  border-bottom: 1px solid @brand;
}

img {
  display: block;
  margin: 0 auto;
  max-width: 100%;
}

del {
  text-decoration: line-through;
}

hr {
  margin: 7rem 0;
  border-bottom: 1px solid @darkGrey;
}

ol, ul {
  list-style: none;
}

main ol {
  counter-reset: c;
}

main ul li, main ol li {
  position: relative;
  margin-left: 2em;
}

main ul li:before, main ol li:before {
  position: absolute;
  right: 100%;
  padding-right: .6em;
  font-weight: bold;
}

main ul li:before {
  content: "\2022";
}

main ol li:before {
  counter-increment: c;
  content: counters(c, ".") ".";
}

header {
  position: relative;
}

div {
  position: relative;
  margin: 7rem 0;
}

blockquote {
  // The rounding is to get around floating point substraction issues
  @borderWidth: round(@spacingUnit / 3.8, 2);
  border-left: @borderWidth solid @brand;
  margin-left: -@spacingUnit;
  padding-left: round(@spacingUnit - @borderWidth, 2);
  color: lighten(@black, 20);

  blockquote {
    margin-left: 0;
  }
}

.pullquote {
  padding: 0;
  margin: 0;
  border: 0;
  text-align: center;

  &:before {
    content: "\201C";
    // position: absolute;
    // top: 0;
    display: block;
    height: .7em;
    font-size: 3.6em;
    color: @brand;
  }

  p {
    font-size: 1.2em;
    font-style: italic;
  }
}

footer {
  border-top: 1px solid @darkGrey;
  background: @footerBackgroundColor;
  overflow: hidden;
  // padding: 4rem 0 2rem;
  // font-size: .8em;
}

small {
  font-size: 1.6rem;
}

time {
  position: absolute;
  top: -2rem;
  font-size: 1.35rem;
  color: #BBB;
}

#btn {
  cursor: pointer;
  position: absolute;
  background: @black;
  box-shadow: 0 0 0 .1rem rgba(red(@white), green(@white), blue(@white), .6);
  border-radius: @lineWidth * 2;
  width: 1rem;
  height: 3rem;
  margin: @spacingUnit;
  right: 0;
  z-index: 1;

  &:after {
    content: "";
    position: absolute;
    top: -2rem;
    left: 0;
    bottom: 0;
    right: -2rem;
  }
}

#btn:hover ~ main, aside:hover + main {
  .translate(-@drawerWidth/2);
}

#btn:hover ~ aside, aside:hover {
  .translate();
}

// Section logo
.section {
  @color: darken(@darkGrey, 16);
  color: @color;

  &:hover {
    color: @black;
    border: 0;

    span {
      background: @black;
    }
  }

  span {
    display: inline-block;
    background: @color;
    border-radius: 2px;
    margin-right: .1em;
    vertical-align: middle;

    &:before {
      content: "";
      display: block;
      background: @footerBackgroundColor;
      width: 5px;
      height: 5px;
      border-radius: 50%;
      margin: 5px;
    }
  }
  strong {
    font-size: 15px;
    vertical-align: middle;
  }
}

@media (min-width: 1024px) {
  html {
    font-size: 12px;
  }
}

code {
  // We are only loading the regular font. We don’t want the browser to auto-generate other weights or styles.
  font: normal 400 .9em "Source Code Pro", Monaco, "Lucida Console", "Ubuntu Mono", Consolas, monospace;
  border: @lineWidth solid @darkGrey;
  background: @codeBackgroundColor;
  padding: 0 .2rem;
  // border-radius: 2px;
}

pre code {
  display: block;
  padding: 1em (@spacingUnit - @lineWidth);
  overflow: auto;
}

pre code,
pre .subst,
pre .tag .title,
pre .lisp .title,
pre .clojure .built_in,
pre .nginx .title {
  color: @black;
}

pre .string,
pre .title,
pre .constant,
pre .parent,
pre .tag .value,
pre .rules .value,
pre .rules .value .number,
pre .preprocessor,
pre .haml .symbol,
pre .ruby .symbol,
pre .ruby .symbol .string,
pre .aggregate,
pre .template_tag,
pre .django .variable,
pre .smalltalk .class,
pre .addition,
pre .flow,
pre .stream,
pre .bash .variable,
pre .apache .tag,
pre .apache .cbracket,
pre .tex .command,
pre .tex .special,
pre .erlang_repl .function_or_atom,
pre .header,
pre .coffeescript .attribute {
  color: #690;
}

pre .comment,
pre .annotation,
pre .template_comment,
pre .diff .header,
pre .chunk,
pre .blockquote {
  color: #888;
}

pre .number,
pre .date,
pre .regexp,
pre .literal,
pre .hexcolor,
pre .smalltalk .symbol,
pre .smalltalk .char,
pre .go .constant,
pre .change,
pre .lasso .variable,
pre .bullet,
pre .link_url {
  color: #F80;
}

.on,
main a, a:hover,
pre .char,
pre .variable,
pre .label,
pre .javadoc,
pre .ruby .string,
pre .decorator,
pre .filter .argument,
pre .localvars,
pre .array,
pre .attr_selector,
pre .important,
pre .pseudo,
pre .pi,
pre .haml .bullet,
pre .doctype,
pre .deletion,
pre .envvar,
pre .shebang,
pre .apache .sqbracket,
pre .nginx .built_in,
pre .tex .formula,
pre .erlang_repl .reserved,
pre .prompt,
pre .link_label,
pre .vhdl .attribute,
pre .clojure .attribute,
pre .asciidoc .attribute,
pre .lasso .attribute,
pre .coffeescript .property {
  color: @brand;
}

strong, th, h1, h2, h3, h4, h5 {
  font-weight: bold;
}

header + p {
  font-style: italic;
  font-size: 1.1em;
}

em {
  font-style: italic;
}

pre .coffeescript .javascript,
pre .javascript .xml,
pre .lasso .markup,
pre .tex .formula,
pre .xml .javascript,
pre .xml .vbscript,
pre .xml .css,
pre .xml .cdata {
  opacity: 0.5;
}
