//
// Code snippets
//

code,
pre {
  font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace;
  font-size: 12px;
}

code {
  color: darken(saturate($main-color, 50%), 10%);
  padding: 0.2em;
  margin: 0;
  font-size: 85%;
  background-color: rgba(0, 0, 0, 0.04);
  border-radius: 3px;
}

pre {
  margin-bottom: 10px;
  // No spacer in code blocks
  code {
    &::after {
      content: none;
    }
  }
}

// make code in headers a bit stronger
h1,
h2,
h3,
h4 {
  code {
    background-color: darken($main-bg-color, 5%);
  }
}

// Code blocks
.highlight {
  margin: 0 0 $spacer-3;
  border-radius: 4px;
  background-color: $gray-0;
  border: $border;

  pre {
    padding: $spacer-3;
    overflow: auto;
    font-size: 16px;
    line-height: 1.45;

    code {
      display: inline;
      max-width: initial;
      padding: 0;
      margin: 0;
      overflow: initial;
      line-height: inherit;
      word-wrap: normal;
      background-color: transparent;
      border: 0;

      &::before,
      &::after {
        content: none;
      }
    }
  }
}

// Example styles

.example {
  padding: $spacer-3;
  border: $border;
  border-top-left-radius: $border-radius;
  border-top-right-radius: $border-radius;

  + .highlight {
    margin-bottom: $spacer-3;
    border-top: 0;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
  }
}

span.shell-one-liner {
  font-family: $code-font-family;
  padding: 10px;
  border-radius: 2px;
  line-height: 2;

  &::before {
    content: "$ ";
    opacity: 0.5;
  }
}
