@mixin md-typography {
  color: $md-text-color;
  word-wrap: break-word;

  a {
    color: $md-link-color;
  }

  img {
    max-width: 100%;
  }

  *:first-child {
    margin-top: 0;
  }

  code {
    font-family: $monospace_font;
    white-space: pre;
    word-wrap: normal;
  }

  kbd {
    display: inline-block;
    padding: 3px 5px;
    font-size: 11px;
    line-height: 10px;
    color: #555;
    vertical-align: middle;
    background-color: #fcfcfc;
    border-width: 1px;
    border-style: solid;
    border-color: #ccc #ccc #bbb;
    border-image: none;
    border-radius: 3px;
    box-shadow: 0 -1px 0 #bbb inset;
  }

  h1 {
    font-size: 1.3em;
    font-weight: 600;
    margin: 24px 0 12px;
    padding: 0 0 10px;
    border-bottom: 1px solid #e7e9ed;
    color: $gl-gray-dark;
  }

  h2 {
    font-size: 1.2em;
    font-weight: 600;
    margin: 24px 0 12px;
    color: $gl-gray-dark;
  }

  h3 {
    margin: 24px 0 12px;
    font-size: 1.1em;
  }

  h4 {
    margin: 24px 0 12px;
    font-size: 0.98em;
  }

  h5 {
    margin: 24px 0 12px;
    font-size: 0.95em;
  }

  h6 {
    margin: 24px 0 12px;
    font-size: 0.90em;
  }

  blockquote {
    color: #7f8fa4;
    font-size: inherit;
    padding: 8px 21px;
    margin: 12px 0;
    border-left: 3px solid #e7e9ed;
  }

  blockquote p {
    color: #7f8fa4 !important;
    font-size: inherit;
    line-height: 1.5;
  }

  p {
    color: #5c5d5e;
    margin: 6px 0 0;
  }

  table {
    @extend .table;
    @extend .table-bordered;
    margin: 12px 0;
    color: #5c5d5e;
    th {
      background: #f8fafc;
    }
  }

  pre {
    margin: 12px 0;
    font-size: 13px;
    line-height: 1.6em;
    overflow-x: auto;
    @include border-radius(2px);
  }

  p > code {
    font-weight: inherit;
  }

  ul, ol {
    padding: 0;
    margin: 6px 0 6px 28px !important;
  }

  li {
    line-height: 1.6em;
  }

  a[href*="/uploads/"], a[href*="storage.googleapis.com/google-code-attachments/"] {
    &:before {
      margin-right: 4px;

      font: normal normal normal 14px/1 FontAwesome;
      font-size: inherit;
      text-rendering: auto;
      -webkit-font-smoothing: antialiased;
      content: "\f0c6";
    }

    &:hover:before {
      text-decoration: none;
    }
  }

  a.no-attachment-icon {
    &:before {
      display: none;
    }
  }

  /* Link to current header. */
  h1, h2, h3, h4, h5, h6 {
    position: relative;

    a.anchor {
      // Setting `display: none` would prevent the anchor being scrolled to, so
      // instead we set the height to 0 and it gets updated on hover.
      height: 0;
    }

    &:hover > a.anchor {
      $size: 14px;
      position: absolute;
      right: 100%;
      top: 50%;
      margin-top: -11px;
      margin-right: 0;
      padding-right: 15px;
      display: inline-block;
      width: $size;
      height: $size;
      background-image: image-url("icon-link.png");
      background-size: contain;
      background-repeat: no-repeat;
    }
  }
}


/**
 * Headers
 *
 */
body {
  -webkit-text-shadow: rgba(255,255,255,0.01) 0 0 1px;
}

.page-title {
  margin-top: $gl-padding;
  line-height: 1.3;
  font-size: 1.25em;
  font-weight: 600;

  &:last-child {
    margin-bottom: 0;
  }
}

.page-title-empty {
  margin-top: 0;
  line-height: 1.3;
  font-size: 1.25em;
  font-weight: 600;
  margin: 12px 7px;
}

h1, h2, h3, h4, h5, h6 {
  color: $gl-header-color;
  font-weight: 600;
}

.light-header {
  font-weight: 600;
}

/** CODE **/
pre {
  font-family: $monospace_font;

  &.plain-readme {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    font-size: 14px;
  }
}

.monospace {
  font-family: $monospace_font;
  font-size: 90%;
}

code {
  &.key-fingerprint {
    background: $body-bg;
    color: $text-color;
  }
}

a > code {
  color: $link-color;
}

/**
 * Apply Markdown typography
 *
 */
.wiki {
  @include md-typography;
}

.md {
  @include md-typography;
}

/**
 * Textareas intended for GFM
 *
 */
.strikethrough {
  text-decoration: line-through;
}

h1, h2, h3, h4 {
  small {
    color: $gl-gray;
  }
}

.text-right-lg {
  @media (min-width: $screen-lg-min) {
    text-align: right;
  }
}

.idiff.deletion {
  background: $line-removed-dark;
}

.idiff.addition {
  background: $line-added-dark;
}
