@import "code";
@import "thirdparty/bourbon/bourbon";

* {
  padding: 0;
  margin: 0;
}

$pageWidth: 900px;
$baseline: 13px;
$coreGreen: #15a226;

.disabled {
  pointer-events: none;
  opacity: 0.5;
}

.no-focus-outline {
  // FF
  -moz-outline-style: none;
  outline-style: none;
  outline-width: 0px;
  outline-color: -moz-use-text-color;
  // Chrome
  outline: none
}

pre, textarea {
  // Display tabs as 4 spaces
  -moz-tab-size: 4;
  -webkit-tab-size: 4;
  -o-tab-size: 4;
  tab-size: 4;
}

pre {
  // Don't allow overflowing horizontally -- scroll instead
  overflow-x: auto;
}

#header {
  text-align: center;
  font-size: 60px;
  height: 10 * $baseline;
  line-height: 10 * $baseline;
  color: #eee;
  a { color: #eee; }
}

#header, #footer {
  font-family: "Yanone Kaffeesatz", sans-serif;
  text-shadow: 1px 1px 0px black;
  a:hover { text-decoration: none; }
}

#footer {
  height: 8 * $baseline;
  width: $pageWidth;
  text-align: center;
  margin: 0 auto;
  font-size: 30px;
  padding-top: 5px;
  color: $coreGreen;
  a {
    color: $coreGreen;
    text-decoration: underline;
    &:hover { text-decoration: underline; }
  }
}

#controls {
  $contentHeight: 35px;
  $height: 80px;
  $buttonWidth: 90px;
  $buttonSpacing: 5px;
  $controlSpacing: 20px;
  height: $height;
  width: 100%;
  background-color: #ccc;
  border-radius: 3px 3px 0 0;
  @include display-box;
  @include box-orient(horizontal);
  font-size: 20px;
  line-height: $contentHeight;
  text-shadow: 1px 1px 0px #ddd;
  input[type=radio] {
    margin-left: 10px;
    margin-right: 3px;
  }
  select {
    font-size: 16px;
    font-family: "Open Sans", sans-serif;
  }
  #left, #middle, #right { padding-top: ($height - $contentHeight) / 2 }

  #left {
    padding-left: $controlSpacing;
    button {
      border-radius: 0 3px 3px 0;
      &:first-child {
        border-right: none;
        border-radius: 3px 0 0 3px;
      }
      $baseGray: #ccc;
      margin: 0;
      display: inline-block;
      font-size: 20px;
      font-family: "Open Sans", sans-serif;
      color: #222;
      text-shadow: 1px 1px 0px #ddd;
      height: $contentHeight;
      width: $buttonWidth - 20px;
      border: 1px solid darken($baseGray, 30%);
      @include background-image(linear-gradient($baseGray 0%, darken($baseGray, 20%) 100%));
      box-shadow: 0 1px 0 0 lighten($baseGray, 10%) inset;
      cursor: pointer;
      &:hover {
        @include background-image(linear-gradient(lighten($baseGray, 2%) 0%, darken($baseGray, 15%) 100%));
        box-shadow: 0 1px 0 0 lighten($baseGray, 15%) inset;
      }
      &:active, &.selected {
        @include background-image(linear-gradient(darken($baseGray, 5%) 0%, darken($baseGray, 25%) 100%));
        box-shadow: 0 0 8px 4px darken($baseGray, 30%) inset;
      }
    }
  }

  #middle {
    position: relative;
    padding-left: $controlSpacing;
    @include box-flex(1);
    button {
      &:not(:last-child) { margin-right: $buttonSpacing; }
      margin: 0;
      display: inline-block;
      font-size: 20px;
      font-family: "Open Sans", sans-serif;
      color: #efefef;
      text-shadow: -1px -1px 0px #222;
      height: $contentHeight;
      width: $buttonWidth;
      border-radius: 3px;
      border: 1px solid darken($coreGreen, 10%);
      @include background-image(linear-gradient(darken($coreGreen, 1%) 0%, darken($coreGreen, 6%) 100%));
      box-shadow: 0 1px 0 0 lighten($coreGreen, 5%) inset;
      cursor: pointer;
      &:hover {
        @include background-image(linear-gradient(darken($coreGreen, 5%) 0%, darken($coreGreen, 10%) 100%));
        box-shadow: 0 1px 0 0 $coreGreen inset;
      }
      &:active, &.selected {
        @include background-image(linear-gradient(darken($coreGreen, 5%) 0%, darken($coreGreen, 10%) 100%));
        box-shadow: 0 0 8px 4px darken($coreGreen, 15%) inset;
      }
    }
  }

  #right { padding-right: $controlSpacing; }

  #share-message {
    $width: 250px;
    position: absolute;
    left: $controlSpacing + (1.5 * $buttonWidth) + $buttonSpacing - (0.5 * $width);
    top: $height - 10px;
    background-color: #333;
    color: #efefef;
    opacity: 0.95;
    text-shadow: 1px 1px 0px black;
    width: $width;
    border-radius: 3px;
    text-align: center;
    padding: 10px 0;
    input[type=text] {
      font-family: "Open Sans", sans-serif;
      font-size: 16px;
      border: none;
      width: 200px;
      background-color: #555;
      color: #efefef;
      text-shadow: 1px 1px 0px black;
      border-radius: 3px;
    }

    // CSS arrow box magic due to http://cssarrowplease.com/
    &:after {
      pointer-events: none;
      bottom: 100%;
      border: solid transparent;
      content: " ";
      height: 0;
      width: 0;
      position: absolute;
      border-bottom-color: #333;
      border-width: 10px;
      left: 50%;
      margin-left: -10px;
    }
    display: none;
  }
}

a {
  color: darken($coreGreen, 5%);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

body {
  font: 16px / 24px "Open Sans", sans-serif;
  background-image: url("wild_oliva.png");
  background-color: #333;
  color: #222;
}

#main {
  border-radius: 3px;
  box-shadow: 1px 1px 0 1px black;
  width: $pageWidth;
  margin: 0 auto;
  background-color: #efefef;
}

#spacer { padding: $baseline; }

#edit-box {
  font: 16px / 18px "Inconsolata", monospace;
  $padding: 10px;
  width: $pageWidth - ($baseline * 2) - ($padding * 2);
  height: 500px;
  border-radius: 3px;
  resize: vertical;
  border: none;
  overflow: auto;
  padding: $padding;
}

#contents {
  width: 100%;
  min-height: 100px;
  .error {
    text-align: center;
    font-style: italic;
    line-height: 100px;
    height: 100px;
  }
  &[data-format="plain-text"], &[data-format="code"] {
    line-height: 20px;
    font-family: "Inconsolata", monospace;
    pre {
      font-family: "Inconsolata", monospace;
    }
  }
  &[data-format="markdown"] {
    line-height: 2 * $baseline;
    pre, code, {
      font-family: "Inconsolata", monospace;
    }
    h1, h2, h3, h4, h5, h6 {
      font-weight: normal;
    }
    h1 {
      font-size: 40px;
      padding-top: $baseline;
      padding-bottom: 2 * $baseline;
    }
    h2 {
      padding-top: $baseline;
      font-size: 30px;
      padding-bottom: 2 * $baseline;
    }
    h3 {
      font-size: 26px;
      padding-bottom: $baseline;
    }
    h4 {
      font-size: 22px;
      padding-bottom: $baseline;
    }
    h5 {
      font-size: 18px;
      padding-bottom: $baseline;
    }
    h6 {
      font-size: 15px;
      font-weight: bold;
      padding-bottom: $baseline;
    }
    p {
      padding-bottom: $baseline;
      text-align: justify;
    }
    code {
      padding: 2px;
      background-color: #ddd;
      border-radius: 3px;
    }
    blockquote {
      color: #666;
      border-left: 1px solid #999;
      margin-bottom: $baseline;
      padding-left: $baseline;
      p:last-child {
        padding-bottom: 0;
      }
    }
    pre {
      line-height: 2 * $baseline;
      background-color: #ddd;
      border-radius: 3px;
      padding: $baseline;
    }
    .highlight {
      padding-bottom: $baseline;
    }
    ul, ol {
      margin-bottom: $baseline;
      padding-left: 20px;
    }
    hr {
      height: 4px;
      border-radius: 2px;
      background-color: #ddd;
      border: none;
      margin-bottom: $baseline;
    }
    table {
      border-collapse: collapse;
      margin: $baseline 0 (2 * $baseline) 0;
      thead { font-weight: bold; }
      tbody {
        tr:nth-child(odd) {
          background-color: #ddd;
        }
      }
      th, td {
        border: 1px solid #ccc;
        padding: 6px $baseline;
      }
    }
    img {
      max-width: 600px;
      max-height: 600px;
    }
  }
}
