/**
 * Reset some basic elements
 */
body, h1, h2, h3, h4, h5, h6,
p, blockquote, pre, hr,
dl, dd, ol, ul, figure {
    margin: 0;
    padding: 0;
}



/**
 * Basic styling
 */
body {
    font: $base-font-weight #{$base-font-size}/#{$base-line-height} $base-font-family;
    color: $text-color;
    background-color: $background-color;
    -webkit-text-size-adjust: 100%;
    -webkit-font-feature-settings: "kern" 1;
    -moz-font-feature-settings: "kern" 1;
    -o-font-feature-settings: "kern" 1;
    font-feature-settings: "kern" 1;
    font-kerning: normal;

    display: flex;
    min-height: 100vh;
    flex-direction: column;
}



/**
 * Set `margin-bottom` to maintain vertical rhythm
 */
h1, h2, h3, h4, h5, h6,
p, blockquote, pre,
ul, ol, dl, figure,
%vertical-rhythm {
    margin-bottom: $spacing-unit / 2;
}



/**
 * Images
 */
img {
    max-width: 100%;
    vertical-align: middle;
}



/**
 * Figures
 */
figure > img {
    display: block;
}

.post figcaption, .post figcaption p {
    font-size: $small-font-size;
    color: $grey-50;
    // font-size: 13px;
    line-height: 1.3;
    // padding-top: .5rem;
    margin-bottom: 1rem;
}



/**
 * Lists
 */
ul, ol {
    margin-left: $spacing-unit;
}

li {
    > ul,
    > ol {
         margin-bottom: 0;
    }
}


/**
 * Links
 */
a {
    color: $brand-color;
    text-decoration: none;
    cursor: pointer;

    &:visited {
        color: $brand-color-dark;
    }

    &:hover {
        color: $text-color;
        text-decoration: underline;
    }

    &:not([class])[href*="//"]::after {
        background-image: url(../images/global/open-in-new-16.svg);
        background-repeat: no-repeat;
        background-size: 16px 16px;
        content: "";
        display: inline-block;
        height: 16px;
        margin: -.3rem .15rem 0 .25rem;
        vertical-align: middle;
        width: 16px;
    }
}

.copyable {
    cursor: pointer;
}

/**
 * Blockquotes
 */
blockquote {
    background-color: $white-100;
    border-radius: 4px;
    box-shadow: 0 4px 16px rgba(12,12,13,.1);
    box-sizing: border-box;
    font-size: 13px;
    margin: 0 0 1rem;
    padding: 1rem 1rem .25rem;

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


/**
 * Tables
 */
table {
    background-color: $white-100;
    border: 1px solid $grey-color-light;
    border-collapse: collapse;
    border-spacing: 0;
    margin-bottom: 1rem;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
    overflow-x: auto;
    vertical-align: top;
    width: 100%;

    th {
        background-color: $grey-color-light;
        font-size: 13px;
        font-weight: 500;
        text-align: left;
    }

    tr:not(:last-child) {
        border-bottom: 1px solid $grey-color-light;
    }

    th, td {
        padding: 8px;

        p {
            margin: 0;
        }
    }
}

/**
 * Code formatting
 */
pre,
code {
    font-family: $code-font-family;
    font-size: 15px;
    border: 1px solid $grey-color-light;
    border-radius: 3px;
    background-color: #eef;
}

code {
    padding: 1px 5px;
}

pre {
    padding: 8px 12px;
    overflow-x: auto;

    > code {
        border: 0;
        padding-right: 0;
        padding-left: 0;
    }
}



/**
 * Wrapper
 */
.wrapper {
    max-width: -webkit-calc(#{$content-width} - (#{$spacing-unit} * 2));
    max-width:         calc(#{$content-width} - (#{$spacing-unit} * 2));
    flex: 1;
    margin: 0 auto;
    padding: 0 $spacing-unit;

    @include media-width(800px) {
        padding: 0 $spacing-unit / 2;
    }

    @extend %clearfix;
}



/**
 * Clearfix
 */
%clearfix {

    &:after {
        content: "";
        display: table;
        clear: both;
    }
}



/**
 * Iconsf
 */
.icon {

    > svg {
        display: inline-block;
        width: 16px;
        height: 16px;
        vertical-align: middle;

        path {
            fill: $grey-color;
        }
    }
}

.do {
    color: $green-70;
    border-top: .25rem solid $green-70;
    margin-top: -1rem;
}

.dont {
    color: $red-60;
    border-top: .25rem solid $red-60;
    margin-top: -1rem;
}

// All our iframes should be examples!s
iframe {
    width: 100%;
    height: 180px;
}

// Make all code copyable…
code {
    position: relative;

    &::after {
      background-color: $grey-70;
      border-radius: 4px;
      color: white;
      content: "Click to copy";
      display: block;
      font-family: "Fira Sans";
      font-size: 11px;
      -webkit-font-smoothing: antialiased;
      -moz-osx-font-smoothing: grayscale;
      font-weight: 500;
      left: 50%;
      line-height: 1;
      opacity: 0;
      padding: .25rem;
      position: absolute;
      text-align: center;
      text-transform: uppercase;
      top: 0;
      transform: translateX(-50%);
      transition: top .3s cubic-bezier(.07, .95, 0, 1), opacity .3s cubic-bezier(.07, .95, 0, 1);
      width: 5.2rem;
      z-index: 1;
    }

    &:hover {
      &::after {
        opacity: 1;
        top: -1.4rem;
      }
    }

    &.copied::after {
      content: "Copied!";
      opacity: 1;
      top: -1.4rem;
      width: 2.8rem;
    }
  }

