
body.page, body.post {
  @media (max-width: 500px) {
    font-size: 0.9em;
  }

  header {
    background: $gray-800;

    @media (min-width: 500px) {
      &.active { background: white; }
    }
  }

}

body.post {
  #body {
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;

    padding: 5px;
  }

  .tweet {
    max-width: 660px;
    margin: 2em auto;
  }
}

body.gdb, body.hrt {

  #body {
    background-color: $gutter-bg;

    @media (max-width: 500px) {
      border-left: 1px solid $gutter-border;
      border-right: 1px solid $gutter-border;
    }
    border-bottom: 1px solid $gutter-border;

    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
  }

  article {
    @media (min-width: 800px) {
      margin-right: 400px;

      @media (max-width: 1000px) {
        margin-right: 300px;
      }
    }

    background: $content-bg;
    border-right: 1px solid $gutter-border;

    padding: 1em 1em;

    > h1:first-child {
      margin-top: 0.5em;
    }

    @media (max-width: 500px) {
      padding: 1em 1em;

      > h1:first-child {
        margin-top: 0.25em;
      }
    }

    h1, h2, h3, h4, h5 { a {
      color: inherit;
      overflow: hidden;
    } }

    .gutter {
      @media (min-width: 800px) {
        position: relative;
        height: 0;
        left: calc(100% + 1em);
        width: 400px;
        padding: 0 1em;

        @media (max-width: 1000px) {
          width: 300px;
        }
      }

      @media (min-width: 500px) and (max-width: 800px) {
        float: right;
        width: 300px;
        margin-left: 1em;
        zoom: 0.9;
      }

      // outline: 1px solid red;

      &.flex, .flex {
        display: flex;
        flex-direction: column;
        align-items: center;
      }

      > a > img:not(.card-img-top), > img {
        max-width: 100%;
        margin-bottom: 5px;
      }
    }

    .full-wide {
      width: calc(100vw - 4em);
      background-color: darken($content-bg, 1%);
      border: 1px solid $gutter-border;
      border-radius: 0.3em;
      padding: 1.2em 1.2em 1em;

      box-shadow: 0 1px 3px rgba($gray-600, 0.5);
      margin-bottom: 1em;
    }
  }
}

body.post {
  $borderColor: #e1e8ed;
  $borderHover: #ccd6dd;
  $textLight: #697882;
  $textDark: #1c2022;
  $textHover: #3b94d9;
  $borderRadius: .35em;
  $articleWidth: 660px;
  $sidebarWidth: 220px;

  .disclaimer {
    margin-bottom: 1em;
  }

  .loading {
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    // background: red;
    color: $gray-400;

    svg {
      width: 80px;
      height: 80px;
      animation: spinner-border 1s linear infinite;
    }
  }

  article {
    max-width: $articleWidth;
    margin: 0 auto 1em;

    background: $gutter-bg;
    padding: 0.6em 1em;
    border-radius: $borderRadius;
    box-shadow: inset 0 1px 2px rgba($gray-600, 0.2);

    .post-head {
      display: flex;
      margin-bottom: 0.5em;

      .post-tags {
        flex: 1;
        display: flex;
        flex-wrap: wrap;
        align-items: stretch;
      }

      align-items: center;
    }

    .tweet {
      box-shadow: 0 1px 2px rgba($gray-600, 0.5);
      border: none;
    }

    .tweet:first-child {
      margin-top: 0;
    }
  }

  .post-link {
    display: flex;
    flex-direction: row;
    align-items: center;
    text-align: center;
    justify-content: center;

    .svg-icon {
      height: 1em;
      width: 1em;
      margin-right: 0.4em;
    }

    background: white;
    color: $gray-700;
    border: 1px solid $borderColor;
    font-size: 10px;
    padding: 2px 5px;
    border-radius: $borderRadius;
    box-shadow: 0 1px 1px rgba($gray-600, 0.2);

    margin: 0.25em 0.5em 0.25em 0;
  }

  .post-link.tag {
    color: $trans-pink-darkest;
    border-color: $trans-pink;
  }

  .post-link.author {
    color: $trans-blue-dark;
    border-color: $trans-blue;
  }

  .post-index {
    max-width: 1200px;
    display: grid;

    section { grid-area: articles; }
    aside {

      h4 { text-align: center; }

      .post-tags {
        display: flex;
        flex-wrap: wrap;
        justify-content: stretch;

        .post-link {
          flex: 1;
          flex-basis: $sidebarWidth / 2;
          white-space: nowrap;
          overflow: hidden;
          text-overflow: ellipsis;
          text-align: center;
        }
      }

      &.authors {
        grid-area: authors;
      }

      &.tags {
        grid-area: tags;
      }
    }

    @media (max-width: $articleWidth + $sidebarWidth) {
      grid-template-columns: 100%;
      grid-row-gap: 1em;
      grid-template-areas:
        'articles'
        'tags'
        'authors'
      ;

      aside {
        max-width: $articleWidth;
        margin: 0 auto;
      }
    }

    @media (min-width: $articleWidth + $sidebarWidth) {
      grid-template-columns: $articleWidth 1fr;
      grid-column-gap: 1em;
      grid-template-areas:
        'articles tags'
        'articles authors'
      ;

      aside {
        position: relative;
        .post-tags {
          display: grid;
          grid-template-columns: repeat( auto-fill, minmax( $sidebarWidth / 2 - 15, 1fr ) );
        }
      }
    }

    @media (min-width: $sidebarWidth + $articleWidth + $sidebarWidth) {
      grid-template-columns: 1fr $articleWidth 1fr;
      grid-column-gap: 1em;
      grid-template-areas:
        'tags articles authors'
      ;
    }
  }

}
