/**
 * skin Medium style
 *
 * @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
 * @version 0.1.1.0, Jan 30, 2018
*/
@import '../../../scss/basic';
@import '../../../scss/github';

// variable
$text-color: rgba(0, 0, 0, .84);
$transition: all .1s;
$green: #03a87c;

// reset
html {
  font-size: 20px;
  line-height: 1.4;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

body {
  color: $text-color;
  background-color: #fff;
  text-rendering: geometricPrecision;
}

.pipe-content__reset {
  pre > code {
    background-image: url(../../../images/code-bg.png);
  }
}

.ft-green {
  color: $green !important;
  transition: $transition;
  &:hover {
    color: #018f69 !important;
  }
}

// tag
.tag {
  background-color: rgba(0, 0, 0, .05);
  color: rgba(0, 0, 0, .68);
  padding: 5px 10px;
  line-height: 22px;
  font-weight: 400;
  border-radius: 3px;
  white-space: nowrap;
  display: inline-block;
  transition: $transition;
  margin: 0 8px 8px 0;
  font-size: 15px;

  &:hover {
    text-decoration: none;
    background: rgba(0, 0, 0, .1);
    color: rgba(0, 0, 0, .68);
  }

  &__level0 {
    line-height: inherit;
    font-size: 12px;
    color: $fade
  }

  &__level1 {
    line-height: inherit;
    font-size: 16px;
    color: $gray
  }

  &__level2 {
    line-height: inherit;
    font-size: 21px;
    color: #6f6f6f
  }

  &__level3 {
    line-height: inherit;
    font-size: 24px;
    color: $black
  }

  &__level4 {
    line-height: inherit;
    font-size: 30px;
    color: #000
  }
}

// module
.module {
  &__title {
    border-bottom: 1px solid rgba(0, 0, 0, .15);
    margin-bottom: 25px;
    line-height: 26px;
    font-size: 22px;
    position: relative;
    height: 46px;

    &--unmargin {
      margin-bottom: 0;
    }

    & > span {
      border-bottom: 1px solid $gray;
      position: absolute;
      padding-bottom: 20px;
      height: 26px;
    }
  }
}

// framework
.wrapper {
  max-width: 1000px;
  margin: 0 auto;
  box-sizing: border-box;
}

.header {
  padding: 0 20px;
  box-sizing: border-box;
  height: 64px;
  text-align: center;
  transition: $transition;
  line-height: 53px;

  h1 {
    display: inline-block;
  }

  &--fixed {
    z-index: 10;
    position: fixed;
    width: 100%;
    top: -64px;
    background-color: #fff;
    box-shadow: 0 2px 2px -2px rgba(0, 0, 0, .15);
  }

  &__logo {
    float: left;
    height: 32px;
    width: 32px;
    margin: 16px 0;
    @include image-bg('../../../images/image-bg.svg');
  }

  &__title {
    font-size: 26px;
    color: $text-color;

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

  &__icon {
    transition: $transition;
    color: $gray;
    text-decoration: none;
    width: 25px;
    margin-left: 10px;
    float: left;
    line-height: normal;
    margin-top: 25px;

    &:hover {
      text-decoration: none;
      color: rgba(0, 0, 0, .68);
    }

    svg {
      height: 16px;
      width: 16px;
    }

    &.avatar {
      @include image-bg('../../../images/image-bg.svg');
      display: inline-block;
      height: 32px;
      width: 32px;
      border-radius: 16px;
      margin-top: 16px;
      margin-left: 14px;
    }
  }

  &__a {
    color: $green;
    font-size: 16px;
    float: left;
    margin: 16px 0 0 16px;
    transition: $transition;
    line-height: 32px;

    &--border {
      border-radius: 4px;
      border: 1px solid $green;
      padding: 0 16px;
    }

    &:hover {
      text-decoration: none;
      color: #018f69;
      border-color: #018f69;
    }
  }

  &__nav {
    height: 50px;
    padding: 0 20px;
    box-sizing: border-box;

    .wrapper {
      overflow: auto;
      word-wrap: normal;
      white-space: nowrap;

      &::-webkit-scrollbar {
        display: none;
      }
    }

    a {
      color: rgba(0, 0, 0, .76);
      font-size: 15px;
      padding: 0 10px;
      line-height: 50px;
      text-decoration: none;

      img {
        height: 16px;
        width: 16px;
        vertical-align: text-top;
      }

      &:first-child {
        padding-left: 0;
      }
    }

    &--fixed {
      z-index: 10;
      position: fixed;
      width: 100%;
      top: 0;
      background-color: #fff;
      box-shadow: 0 2px 2px -2px rgba(0, 0, 0, .15);

      a.header__nav-btn {
        display: block;
      }
    }

    .header__nav-btn {
      background: $green;
      border-color: $green;
      height: 32px;
      line-height: 30px;
      padding: 0 14px;
      border-radius: 4px;
      font-size: 15px;
      color: #fff;
      float: right;
      margin-top: 9px;
      display: none;

      &:hover {
        background: #029e74;
        border-color: #029e74;
      }
    }
  }
}

.main {
  margin: 50px 20px 0;

  .content {
    margin-top: 50px;
  }
}

.board {
  padding: 12px 0;
  text-align: center;
}

.footer {
  margin-top: 50px;
  padding: 10px 20px 25px;
  font-size: 14px;
  border-top: 1px solid rgba(0, 0, 0, .05);
  color: $fade;

  a {
    color: $gray;
  }

  &__tag {
    margin-top: 50px;

    & > div {
      margin-right: 20px;
      &:last-child {
        margin-right: 0;
      }
    }
  }
}

// article
.article {
  &__wrap {
    margin-right: -20px;
  }

  &__item {
    border: 1px solid rgba(0, 0, 0, .1);
    border-radius: 2px;
    margin-bottom: 20px;

    &--wrap {
      width: 33.33333333%;
      padding-right: 20px;
      box-sizing: border-box;
      float: left;
      &-mid {
        width: 50%;
      }
    }

    &--big {
      .article__thumb {
        height: 280px;
        background-image: url("https://img.hacpai.com/bing/20171124.jpg?imageView2/1/w/318/h/280/interlace/1/q/100");;
      }

      .article__main {
        height: 193px;
        overflow: hidden;
        margin-bottom: 10px;
        &--user {
          height: 184px;
        }
      }
    }

    &--small {
      .article__thumb {
        height: 100px;
        background-image: url("https://img.hacpai.com/bing/20171206.jpg?imageView2/1/w/318/h/100/interlace/1/q/100");
      }

      .article__main {
        height: 94px;
        overflow: hidden;
        margin-bottom: 10px;
        &--user {
          height: 84px;
        }
      }
    }

    &--mid {
      .article__thumb {
        float: left;
        width: 40%;
        height: 258px;
        background-image: url("https://img.hacpai.com/bing/20171215.jpg?imageView2/1/w/200/h/258/interlace/1/q/100");
      }

      .article__panel {
        float: left;
        width: 60%;
        box-sizing: border-box;
      }

      .article__main {
        height: 195px;
        overflow: hidden;
        margin-bottom: 10px;
        &--user {
          height: 184px;
        }
      }
    }
  }

  &__thumb {
    @include image-bg('../../../images/image-bg.svg');
    height: 100px;
    width: 100%;
    display: block;
  }

  &__panel {
    padding: 16px;
  }

  &__title {
    overflow: hidden;
    line-height: 24px;
    font-size: 21px;
    font-weight: 600;
    word-break: break-all;
    a {
      color: $text-color;
      &:hover {
        text-decoration: none;
      }
    }
  }

  &__content {
    margin-top: 4px;
    font-size: 16px;
    color: $gray;
    overflow: hidden;
    line-height: 23px;
    word-break: break-all;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    &:hover {
      text-decoration: none;
    }
  }

  &__meta {
    font-size: 15px;
  }

  &__edit {
    color: $gray;
    cursor: pointer;
    &--mid svg {
      margin-top: 15px;
    }
    &:hover {
      color: rgba(0, 0, 0, .68);
    }
  }

  &__author {
    color: $text-color;
    font-size: 15px;
  }

  &__avatar {
    height: 40px;
    width: 40px;
    @include image-bg('../../../images/image-bg.svg');
    display: block;
    border-radius: 20px;
    margin-right: 10px;
  }

  &__next {
    border-left: 1px solid $fade;
    line-height: 14px;
    margin-top: 7px;
    color: $text-color;
    font-size: 16px;
    display: inline-block;
    padding-left: 20px;
    margin-left: 20px;
    float: right;

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

.article__bottom {
  background-color: #fafafa;
  padding: 40px 20px;

  .article__item {
    box-shadow: 0 1px 7px rgba(0,0,0,.05);
    border: 0;
    background-color: #fff;
    border-radius: 4px;
  }

  .article__thumb {
    border-radius: 4px 4px 0 0;
  }

  .article__main--user {
    height: 45px;
    margin-bottom: 15px;
  }

  .article__title {
    font-size: 18px;
  }
}

.article__comment {
  width: 640px;
  margin: 45px auto 0;

  .comment__title {
    font-size: 16px;
    margin-bottom: 15px;
    color: rgba(0,0,0,.68);
  }
}

.article__toolbar {
  box-shadow: 0 0 1px rgba(0,0,0,.54);
  position: fixed;
  bottom: -44px;
  width: 100%;
  background-color: #fff;
  height: 44px;
  font-size: 16px;
  line-height: 44px;
  transition: $transition;
  opacity: 0;

  .wrapper {
    max-width: 740px;
  }

  svg {
    height: 20px;
    width: 20px;
    vertical-align: sub;
  }

  .fn-right {
    position: absolute;
    top: 0;
    right: 20px;
  }

  .article__code {
    position: absolute;
    height: 130px;
    width: 130px;
    left: 50px;
    bottom: 30px;
  }
}

// comment
.pipe-comment {
  &__null {
    box-shadow: 0 1px 4px rgba(0, 0, 0, .03);
    line-height: 78px;
    color: $gray;
    background-color: #fff;
    border: 1px solid rgba(0, 0, 0, .09);
    font-size: 16px;
    border-radius: 3px;
  }

  &__header {
    display: none;
  }

  &__item {
    background-color: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,.04);
    border: 1px solid rgba(0,0,0,.09);
    border-radius: 3px;
    padding: 10px 20px;
    margin: 0 0 20px 0;
  }
  &__body > .fn-clear > .ft-gray:first-child {
    color: $green;
    font-size: 16px;
    transition: $transition;

    &:hover {
      color: #018f69;
      text-decoration: none;
    }
  }

  &__btn {
    display: inline-block;
  }

  &__pagination {
    padding-top: 0;
    margin-top: 0;
    border-top: 0;
  }
}

.pipe-editor {
  font-size: 14px;
}

// post
.post {
  max-width: 740px;
  margin: 50px auto 20px;
  position: relative;

  &__main {
    margin: 20px 0 0 0;
  }

  &__user {
    margin-bottom: 40px;

    .avatar {
      @include image-bg('../../../images/image-bg.svg');
      height: 60px;
      width: 60px;
      margin-right: 15px;
      border-radius: 30px;
    }

    .name {
      color: $green;
      font-size: 21px;
      transition: $transition;
      &:hover {
        color: #018f69;
      }
    }

    .small {
      line-height: 30px;
      color: $gray;
      font-size: 16px;
    }
  }

  &__title {
    font-weight: 700;
    font-size: 36px;
    margin: 0 -20px 10px;
    word-break: break-all;

    svg {
      height: 40px;
      width: 40px;
      float: left;
      margin: 10px 10px 0 0;
    }
  }

  &__tags {
    padding: 4px 0 22px;
    border-bottom: 1px solid rgba(0,0,0,.05);
  }

  &__share {
    border-bottom: 1px solid rgba(0,0,0,.05);
    padding: 20px;
    margin: 0 -20px 20px;
    font-size: 16px;

    &--no {
      border-bottom: 0;
    }

    svg {
      height: 20px;
      width: 20px;
      vertical-align: bottom;
    }

    #articleShare {
      position: relative;
      .article__code {
        position: absolute;
        height: 130px;
        width: 130px;
        left: -2px;
        top: 22px;
      }
    }
  }

  &__view {
    color: $green;
    transition: $transition;
    &:hover {
      color: #018f69;
      text-decoration: none;
    }
  }

  &__side {
    position: fixed;
    top: 50%;
    left: 10%;
    width: 55px;
    text-align: center;
    font-size: 16px;
    margin-top: -105px;
    transition: opacity .1s;
    opacity: 0;

    .article__edit {
      margin-bottom: 5px;
      display: block;
    }

    svg {
      height: 25px;
      width: 25px;
    }

    .ft-green {
      svg {
        height: 45px;
        width: 45px;
        vertical-align: bottom;
        margin-bottom: 10px;
      }
    }

    .article__code {
      position: absolute;
      height: 130px;
      width: 130px;
      left: 45px;
      top: 90px;
    }
  }
}

// pagination
.pagination {
  margin-top: 30px;
  font-size: 16px;
  border-top: 1px solid rgba(0,0,0,0.15);

  &__item {
    text-align: center;
    border-top: 1px solid transparent;
    transition: $transition;
    display: inline-block;
    position: relative;
    top: -1px;
    margin: 0 10px;
    padding: 0 10px;
    line-height: 30px;
    color: $gray;
    &:hover {
      border-top-color: $gray;
      color: $text-color;
      text-decoration: none;
    }

    &--active {
      background: rgba(0,0,0,0.05);
      border-top-color: $gray;
      &:hover {
        color: $gray;
        border-top-color: $gray;
      }
    }

    &:first-child {
      margin-left: 0;
    }

    &:last-child {
      margin-right: 0;
    }
  }

  &__omit {
    top: -5px;
    margin: 0;
    border: 0;
    padding: 0;
    color: #ccc;
  }
}

// page
.page {
  &__item {
    display: block;
    border-bottom: 1px solid rgba(0,0,0,.05);
    padding: 40px 0 35px;

    h3 {
      font-size: 21px;
      line-height: 24px;
      margin-bottom: 4px;
      a {
        color: $text-color;
      }
    }

    &:last-child {
      border-bottom: 0;
    }
  }

  &__desc {
    margin-bottom: 20px;
  }
}

// author
.author {
  margin-right: -20px;

  &__item {
    float: left;
    height: 272px;
    width: 235px;
    border-radius: 4px;
    margin: 0 20px 20px 0;
    display: block;
    text-align: center;
    color: $fade;
    box-shadow: rgba(0,0,0,0.05) 0 1px 7px;
    &:hover {
      text-decoration: none;
      color: $gray;

      & .avatar {
        transform: scale(1.2);
      }
    }
  }

  &__header {
    height: 202px;
    overflow: hidden;
    .avatar {
      @include image-bg('../../../images/image-bg.svg');
      transition: all .4s linear;
      border-radius: 0;
      width: 100%;
      height: 100%;
    }
  }

  &__name {
    font-size: 16px;
    margin: 9px 0 3px;
  }
}

@media (max-width: 768px) {
  .header {
    text-align: left;

    &__logo {
      display: none;
    }

    &__nav {
      &--fixed a.header__nav-btn {
        float: none;
        display: inline-block;
      }
    }

    &__a {
      margin-left: 10px;
      &--border {
        padding: 0 5px;
      }
    }
  }

  .post__side,
  .article__next,
  #articleBottomShare,
  #articleShare {
    display: none;
  }

  .post {
    margin: 50px 20px 20px;

    &__title {
      font-size: 20px;
      margin: 0 0 10px;
    }
  }

  .article {
    &__toolbar {
      padding-left: 20px;
      box-sizing: border-box;
    }

    &__item {
      width: 100%;
      margin-bottom: 20px;
      &--wrap {
        width: 100%;
        padding-right: 0;
      }
    }

    &__wrap {
      margin: 0;
    }

    &__comment {
      width: 100%;
      margin-top: 20px;
    }

    &__thumb,
    &__panel {
      float: none !important;
      width: 100% !important;
      box-sizing: border-box;
    }

    &__thumb {
      height: 100px !important;
    }

    &__main {
      height: auto !important;
      &--user {
        height: auto !important;
      }
    }
  }

  .footer {
    margin-top: 20px;
    .fn-right {
      float: none;
    }

    &__tag {
      display: block;

      & > div:first-child {
        margin: 0 0 20px;
      }
    }
  }

  .pagination {
    &__item {
      margin: 0;
    }
  }

  .author {
    margin-right: 0;
    &__item {
      float: none;
      width: 100%;
    }
  }

  html,
  .page__item h3 {
    font-size: 16px;
  }

  .page__item {
    padding: 20px 0 15px;

    &--li {
      padding: 10px 0;
    }
  }

  .article__title,
  .module__title {
    font-size: 18px;
  }

  .header__title {
    font-size: 22px;
  }

  .pipe-comment__item {
    padding: 10px;
  }
}