/***** Article *****/
.article {
  /*
  * The article grid is defined this way to optimize readability:
  * Sidebar | Content | Free space
  * 17%     | 66%     | 17%
  */
  @include desktop {
    flex: 1 0 66%;
    max-width: 66%;
    min-width: 640px;
    padding: 0 30px;
  }

  flex: 1 0 auto; //Explicit values needed whith flex-direction: column for IE11

  &-container {
    @include desktop {
      flex-direction: row;
    }

    display: flex;
    flex-direction: column;
  }

  &-header {
    @include tablet {
      flex-direction: row;
      margin-top: 0;
    }

    align-items: flex-start;
    display: flex;
    flex-direction: column;
    flex-wrap: wrap;
    justify-content: space-between;
    margin-bottom: 40px;
    margin-top: 20px;
  }

  &-avatar {
    margin-right: 10px;
  }

  &-author {
    margin-bottom: 10px;
  }

  &-title {
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;

    @include tablet {
      flex-basis: 100%; /* Take entire row */
    }

    .icon-lock {
      position: relative;
      left: -5px;
      vertical-align: baseline;
    }
  }

  [role="button"] {
    @include tablet {
      width: auto;
    }
    flex-shrink: 0; /*Avoid collapsing elements in Safari (https://github.com/philipwalton/flexbugs#1-minimum-content-sizing-of-flex-items-not-honored)*/
    width: 100%;
  }

  &-info {
    max-width: 100%;
  }

  &-meta {
    display: inline-block;
    vertical-align: middle;
  }

  &-body {
    @include content-body;
    > p:last-child {
      margin-bottom: 0;
    }
  }

  &-content {
    line-height: 1.6;
    margin: 40px 0;
    word-wrap: break-word;
  }

  &-footer {
    align-items: center;
    display: flex;
    justify-content: space-between;
    padding-bottom: 20px;
  }

  &-comment-count {
    color: $secondary-text-color;

    &:hover {
      text-decoration: none;
    }

    &-icon {
      vertical-align: middle;
      color: $brand_color;
      width: 18px;
      height: 18px;
    }
  }

  &-sidebar {
    @include desktop {
      border: 0;
      flex: 0 0 17%;
      height: auto;
      max-width: 17%;
    }

    border-bottom: 1px solid $low-contrast-border-color;
    border-top: 1px solid $low-contrast-border-color;
    flex: 1 0 auto; //Explicit values needed whith flex-direction: column for IE11
    margin-bottom: 20px;
    padding: 0;
  }

  &-relatives {
    @include tablet {
      flex-direction: row;
    }

    border-top: 1px solid $low-contrast-border-color;
    display: flex;
    flex-direction: column;
    padding: 20px 0;

    > * {
      flex: 1 0 50%; //Explicit values needed whith flex-direction: column for IE11
      min-width: 50%;
      overflow-wrap: break-word;
      margin-right: 0;

      &:last-child {
        padding: 0;
      }

      @include tablet {
        padding-right: 20px;
      }
    }
  }

  &-votes {
    border-top: 1px solid $low-contrast-border-color;
    padding: 30px 0;
    text-align: center;

    &-question { // Explicit values for rendering h2 like a span for accessibility.
      font-size: $font-size-base;
      font-weight: normal;
      margin-bottom: 0;
    }
  }

  &-vote {
    margin: 10px 5px;
    min-width: 90px;
    width: auto;
  }

  &-more-questions {
    margin: 10px 0 20px;
    text-align: center;
    @include standalone-link;
  }

  &-return-to-top {
    @include desktop {
      display: none;
    }

    border-top: 1px solid $high-contrast-border-color;

    a {
      color: $text_color;
      display: block;
      padding: 20px 0;

      &:hover,
      &:focus {
        text-decoration: none;
      }
    }

    &-icon {
      transform: rotate(0.5turn);
    }
  }

  &-subscribe button {
    @extend .button;
    &[data-selected="true"] {
      @extend .button-primary;
    }
  }

  td > p:first-child,
  th > p:first-child {
    margin-top: 0;
  }

  td > p:last-child,
  th > p:last-child {
    margin-bottom: 0;
  }
}

.sidenav {
  &-title {
    font-size: $font-size-base;
    position: relative;
    font-weight: 600;
  }

  &-item {
    display: block;
    margin-top: 10px;
    margin-bottom: 16px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

.recent-articles,
.related-articles {
  &-title {
    @extend .comment-heading;
  }

  li {
    margin-bottom: 15px;
  }
}
