$post-background-gutter: 10px;

@mixin post-body() {
  margin-top: 15px;
  font-size: 21px;
  line-height: 1.5;

  code {
    font-family: $font-family-monospace;
  }

  p {
    margin-bottom: $post-vertical-rythm;

    @include media(">=medium") {
      text-align: justify;
    }
  }

  li {
    p {
      display: inline;
      padding: 0;
    }

    ol, ul {
      margin-top: 10px;
    }
  }

  a {
    @include link(true);
  }

  @include media(">=medium") {
    margin-top: $post-vertical-rythm;
  }

  .video-embed {
    margin: 0 auto;
  }
}

@mixin post-title-variation($variation) {
  @include media(">=medium") {
    font-family: $font-family-primary;
    font-weight: normal;

    @if $variation == 1 {
      font-weight: bold;
    }

    @if $variation == 2 {
      font-style: italic;
    }

    @if $variation == 3 {
      font-family: $font-family-secondary;
      font-size: 45px;
      font-weight: bold;
      text-transform: uppercase;
    }

    @if $variation == 4 {
      font-weight: bold;
      font-style: italic;
    }

    @if $variation == 5 {
      letter-spacing: 3px;
    }

    @if $variation == 6 {
      font-family: sans-serif;
      font-weight: bold;
    }
  }
}

.post {
  position: relative;
  display: block;
  max-width: 100%;
}

.post__content {
  > p:first-child {
    @include drop-cap;
  }
}

.post--small {
  padding: $post-padding;
  margin-bottom: 30px;

  &.post--headline {
    padding-top: 0;
    padding-bottom: 0;
  }

  @include media(">=medium") {
    text-align: justify;

    .post__title {
      text-align: center;
    }
  }

  .post__title:not(.feature-title) {
    @include post-title;

    .post-wrapper:nth-child(6n - 5) & {
      @include post-title-variation(1);
    }

    .post-wrapper:nth-child(6n - 4) & {
      @include post-title-variation(2);
    }

    .post-wrapper:nth-child(6n - 3) & {
      @include post-title-variation(3);
    }

    .post-wrapper:nth-child(6n - 2) & {
      @include post-title-variation(4);
    }

    .post-wrapper:nth-child(6n - 1) & {
      @include post-title-variation(5);
    }

    .post-wrapper:nth-child(6n) & {
      @include post-title-variation(3);
    }
  }

  .post__body {
    font-size: 18px;
  }

  .post__meta {
    display: inline-block;
  }
}

a > .post--small {
  @include transition(transform opacity);

  &:hover {
    transform: translateY(-3px);
    opacity: 0.6;

    .post__cta {
      @include cta-hover;
    }
  }
}

.post--video {
  filter: grayscale(1);

  &:before {
    content: '';
    background: url(/assets/images/noise.gif) repeat;
    opacity: 0.7;
    position: absolute;
    z-index: 20;
    height: 100%;
    width: 100%;
  }
}

.post--tweet {
  padding: $post-background-gutter;
  text-align: center;
  
  .post-inner-wrapper {
    background-color: $colour-light-grey;
    box-shadow: 1px 1px 2px 0px rgba(0, 0, 1, 0.25); 
    padding: $post-padding - $post-background-gutter;
  }
  
  .post__body {
    filter: grayscale(0.6);
    text-align: left;
  }

  .post__ribbon-wrapper {
    position: relative;
    right: 10px;
    top: -$post-padding + $post-background-gutter - 5px;
    width: 40px;
    height: 60px;
    float: right;
    margin: 0 0 15px 15px;
  }

  .ribbon {
    color: #78beee;

    &:before {
      color: #14669e;
    }

    .ribbon__icon {
      fill: white;
    }
  }
}

.post--featured {
  @include media(">=large") {
    border: 1px solid #d4d4d3;

    .post__body {
      column-count: 2;
    }
  }
}

.post--room {
  margin-bottom: 70px;
}

.post--tint {
  background-color: $colour-light-grey;
}

.post--full {
  .constrain {
    padding-left: 20px;
    padding-right: 20px;
  }
}

.post__meta {
  text-align: center;

  @include media(">=medium") {
    margin-top: 20px;
  }
}

.post__meta-icon {
  position: relative;
  top: -2px;
  margin-left: 10px;
  width: 16px;
  height: 16px;
  vertical-align: middle;
}

.post__cta {
  margin-top: $post-vertical-rythm;

  & + & {
    margin-left: 10px;
  }
}

.post__hero-wrapper {
  padding: 0 5px;

  &:first-child {
    margin-left: -5px;
  }

  &:last-child {
    margin-right: -5px;
  }
}

.post__hero {
  background-color: #eeeee5;
  padding: 8px;
  margin-top: 30px;

  img {
    display: block;
    width: 100%;
  }

  @include media(">=medium") {
    padding: 20px;
  }
}

.post__body {
  @include post-body;
}

.post__external-info {
  margin-top: $post-vertical-rythm * 2;
  text-align: center;
}

.post__external-cta-wrapper {
  text-align: center;

  a {
    text-decoration: none;
  }
}
