/**
 * skin style
 *
 * @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
 * @version 0.2.1.2, Sep 9, 2019
*/

@import 'variables';
@import '../../../scss/basic';

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

body {
  font-size: 14px;
  color: $text-color;
  background-color: #fff;
  letter-spacing: 0.01rem;
  line-height: 1.4;
  text-rendering: geometricPrecision;
  transition: $transition;
}

a {
  transition: $transition;
}

// function
.fn-bottom {
  padding-bottom: 50px;
  margin-bottom: 50px;
  border-bottom: 1px dotted $border-color;
}

.fn-absolute {
  position: absolute;
}

.fn-padding68 {
  padding-left: 68px;
}

.fn-padding30 {
  padding-left: 30px;
  padding-right: 30px;
}

.fn-two {
  & > a,
  & > div {
    float: left;
    width: 48%;
    &:first-child {
      margin-right: 4%;
    }
  }
  &--next {
    text-align: right;
  }
}

.fn-three {
  & > div,
  & > a {
    width: 30%;
    float: left;
  }
  &--mid {
    margin: 0 5%;
  }
}

.ft-orange {
  color: $theme-accent !important;
}

// avatar
.avatar {
  height: 58px;
  width: 58px;
  border-radius: 50%;
  display: inline-block;
  z-index: 10;
  box-shadow: rgba(0, 0, 0, 0.05) 0px 1px 7px;
  @include image-bg('../../../images/image-bg.svg');

  &--space {
    margin-right: 20px;
  }
}

// module
.module {
  &__header {
    line-height: 24px;
    margin-bottom: 20px;
    color: $fade;
  }

  &__list {
    li {
      list-style: none;
      margin-bottom: 10px;
      padding-bottom: 10px;
      position: relative;

      .fn-padding68 {
        padding-left: 48px;
      }

      .avatar {
        height: 38px;
        width: 38px;
      }
    }

    &-title {
      color: $text-color;
      word-break: break-all;
      &:hover {
        color: $text-hover-color;
        text-decoration: none;
      }
    }
  }
}

// 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;

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

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

.content {
  margin: 50px auto;
}

.body--side {
  padding-right: 340px;

  .header__tool {
    position: fixed;
    width: 339px;
    box-shadow: rgba(0, 0, 0, 0.05) 0px 1px 7px;
  }

  .side {
    right: 0;
  }

  .sidebar__icon:hover .sidebar__icon-line:first-child,
  .sidebar__icon-line:first-child {
    width: 100%;
    transform: rotateZ(-45deg);
    top: 6px;
    background-color: $theme-accent;
  }

  .sidebar__icon:hover .sidebar__icon-line--middle,
  .sidebar__icon-line--middle {
    opacity: 0
  }

  .sidebar__icon:hover .sidebar__icon-line:last-child,
  .sidebar__icon-line:last-child {
    width: 100%;
    transform: rotateZ(45deg);
    top: -6px;
    background-color: $theme-accent;
  }
}

// header
.header {
  height: 64px;
  border-bottom: 1px solid $border-color;
  line-height: 64px;
  position: relative;
  overflow: hidden;
  box-shadow: rgba(0, 0, 0, 0.05) 0px 1px 7px;

  &__logo {
    position: absolute;
    left: 20px;
    background-color: rgba(255, 255, 255, .68);
    img {
      height: 35px;
      width: 35px;
      flex-shrink: 0;
      margin-top: 15px;
    }

    div {
      text-align: left;
      margin-left: 10px;
    }
  }

  &__icon {
    height: 14px;
    width: 14px;
    display: inline-block;
    margin-top: -3px;
  }
  .wrapper a {
    color: $text-color;
    padding: 0 10px;
    font-size: 16px;

    &:first-child {
      padding: 0;
    }

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

  &__tool {
    position: absolute;
    right: 0;
    top: 0;
    padding-right: 20px;
    z-index: 100;
    background-color: #fff;
    border-bottom: 1px solid $border-color;
    height: 65px;
    box-sizing: border-box;

    a.fn__right {
      padding: 0 20px 0 0;
      box-sizing: border-box;

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

    .avatar {
      margin: 17px 0 0 20px;
      height: 30px;
      width: 30px;
    }
  }
}

// footer
.footer {
  border-top: 1px solid $border-color;
  box-shadow: rgba(0, 0, 0, 0.05) 0 -1px 1px;
  &__side {
    padding: 50px 0 30px;
    .tag {
      margin: 0 10px 10px 0;
    }
  }
  &__info {
    color: $fade;
    border-top: 1px dotted $border-color;
    font-size: 12px;
    padding: 30px 0;

    a {
      color: #8899a6;
    }
  }
}

// side
.side {
  transition: $transition;
  position: fixed;
  width: 340px;
  top: 0;
  right: -340px;
  overflow: auto;
  height: 100%;
  border-left: 1px solid $border-color;
  box-sizing: border-box;
  z-index: 99;
  background-color: #fff;
  padding-top: 65px;

  &__sub-title {
    font-size: 18px;
    padding: 30px 20px 0;
  }

  &__module {
    margin: 20px;

    .module__list {
      margin-bottom: 30px;
    }
  }

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

// side toggle icon
.sidebar__icon {
  position: fixed;
  bottom: 36px;
  width: 16px;
  height: 14px;
  right: 36px;
  border: 3px solid $border-color;
  padding: 10px 9px;
  cursor: pointer;
  border-radius: 50%;
  background-color: #fff;
  z-index: 200;
  box-shadow: rgba(0, 0, 0, 0.05) 0px 1px 7px;

  &-line {
    display: block;
    position: relative;
    vertical-align: top;
    height: 3px;
    width: 100%;
    background: $black;
    margin-top: 3px;
    transition-duration: .2s;
    transition-timing-function: ease-in-out;
    transition-delay: 0s;
    border-radius: 1px;
  }

  &-line:first-child {
    margin-top: 0
  }

  &:hover {
    .sidebar__icon-line:first-child {
      width: 50%;
      transform: rotateZ(-45deg);
      top: 3px
    }

    .sidebar__icon-line-middle {
      width: 90%
    }

    .sidebar__icon-line:last-child {
      width: 50%;
      transform: rotateZ(45deg);
      top: -3px
    }
  }
}

// article
.article {
  &-detail__header {
    .header {
      &__title {
        font-size: 28px;
        font-weight: normal;
        margin-bottom: 20px;

        &--edit {
          margin-right: 72px;
        }

        svg {
          height: 28px;
          width: 28px;
          vertical-align: text-top;
        }
      }
    }
    .article__action {
      position: absolute;
      top: 7px;
      right: 0;
      margin-top: 0;
    }

    .tag {
      margin: 20px 20px 0 0;
    }
  }

  &__header {
    .tag {
      line-height: 14px;
      padding: 2px 8px;
      margin-right: 10px;
    }
  }

  &__item:last-child {
    border-bottom-width: 0;
    margin-bottom: 0;
  }
  &__thumb {
    height: 180px;
    border-radius: 5px;
    margin-bottom: 30px;
    display: block;
    @include image-bg('../../../images/image-bg.svg');
    font-size: 0;

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

  &__title {
    word-break: break-all;
    margin-bottom: 10px;
    svg {
      height: 18px;
      width: 18px;
    }
    a {
      font-size: 22px;
      color: $text-color;
      &:hover {
        color: $text-hover-color;
        text-decoration: none;
      }

      &:visited {
        color: $text-hover-color;
      }
    }
  }

  &__abstract {
    margin-top: 10px;
  }

  &__action {
    margin-top: 20px;

    .action {
      &__btn {
        border-radius: 20px;
        height: 30px;
        display: inline-block;
        border: 1px solid $border-color;
        padding: 0 10px;
        line-height: 28px;
        text-align: center;
        cursor: pointer;
        box-sizing: border-box;
        transition: transform 0.35s ease-in, background .15s ease-in-out;
        color: $black;
        box-shadow: rgba(0, 0, 0, 0.05) 0px 1px 7px;
        svg {
          margin-top: 7px;
          transition: $transition;
        }
        &--active {
          border-color: $theme-accent;
        }
        &:hover {
          color: #fff;
          background-color: $theme-accent;
          border-color: $theme-accent;
          text-decoration: none;
        }

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

        &--wechat {
          border-color: #3caf36;
          transition-delay: 50ms;
          &:hover {
            background-color: #3caf36;
            color: #fff;
            border-color: #3caf36;
          }
        }

        &--weibo {
          border-color: #ff9933;
          transition-delay: 100ms;
          &:hover {
            background-color: #ff9933;
            color: #fff;
            border-color: #ff9933;
          }
        }

        &--twitter {
          border-color: #18a3fa;
          transition-delay: 150ms;
          &:hover {
            background-color: #18a3fa;
            color: #fff;
            border-color: #18a3fa;
          }
        }

        &--google {
          border-color: #dc4A3d;
          transition-delay: 200ms;
          &:hover {
            background-color: #dc4A3d;
            color: #fff;
            border-color: #dc4A3d;
          }
        }
      }

      &__share {
        height: 30px;
        width: 240px;
        overflow: initial;

        &:hover {
          .action__btn--share {
            background-color: $border-color;
            border-color: $border-color;
            color: $fade;
          }

          .action__btns {
            .action__code {
              display: block;
            }
            .action__btn {
              padding: 0 7px;
              opacity: 1;
              visibility: visible;
              transform: translate(0);
            }
          }
        }
        .action__code {
          display: none;
          position: absolute;
          top: 36px;
          left: 0;
          height: 128px;
          width: 128px;
        }
        .action__btns {
          margin-left: 10px;
          position: relative;
          .action__btn {
            opacity: 0;
            transform: translate(20px);
            visibility: hidden;
          }
        }
      }
    }
  }
  // end action

  &__near a {
    color: $black;
    position: relative;
    .near__svg {
      margin: 22px 10px 0 0;
    }
    .avatar {
      margin-right: 10px;
      margin-left: 24px;
    }

    .near__title {
      padding-left: 92px;
      display: block;
      line-height: 29px;
    }

    &.near__next {
      svg {
        right: 0;
        top: 22px;
        margin: 0;
      }

      .avatar {
        margin: 0;
        right: 24px;
      }

      .near__title {
        text-align: right;
        padding: 0 92px 0 0;
      }

      &--single {
        margin-right: 0;
        float: right;
      }
    }

    .near__icon {
      float: left;
      margin: 3px 10px 0 0;
    }

    .near__icon-last {
      float: right;
      margin: 4px 0 0 10px;
    }

    &:hover {
      text-decoration: none;
      color: $text-hover-color;
      svg {
        color: $theme-accent;
      }
    }
  }

  &__relevant {
    background-color: #fafafa;
    padding: 50px;

    .relevant {
      &__panel {
        overflow: auto;
        word-break: keep-all;
        word-wrap: normal;
        white-space: nowrap;
        &::-webkit-scrollbar {
          display: none;
        }
      }
      &__item {
        width: 260px;
        box-shadow: 0 1px 7px rgba(0, 0, 0, .05);
        display: inline-block;
        overflow: hidden;
        background-color: #fff;
        padding: 10px;
        margin-right: 20px;
        border-radius: 5px;

        .avatar {
          height: 38px;
          width: 38px;
        }

        .module__list-title {
          font-size: 18px;
          display: block;
          margin-bottom: 10px;
        }
      }
      &__content {
        padding-left: 48px;
      }
      &__thumbnail {
        height: 90px;
        margin: -10px -10px 0;
        @include image-bg('../../../images/image-bg.svg');
        margin-bottom: 10px;
        display: block;
      }
      &__abstract {
        height: 80px;
        margin-bottom: 10px;
        word-wrap: break-word;
        word-break: break-all;
        overflow: hidden;
        display: block;
        white-space: normal;
        &:hover {
          text-decoration: none;
        }
      }
    }
  }
}

// pagination
.pagination {
  line-height: 24px;
  border-top: 1px dotted $border-color;
  padding-top: 50px;
  text-align: center;
  &__item {
    padding: 1px 10px;
    display: inline-block;
    border-radius: 15px;
    color: $black;
    cursor: pointer;
    margin: 0 10px;

    &:hover,
    &--active {
      text-decoration: none;
      background-color: $theme-accent;
      color: #fff;
      border-color: $theme-accent;
    }
  }

  &__near {
    vertical-align: sub;
    color: $black;
    &:hover {
      text-decoration: none;
      color: $theme-accent;
    }
  }
}

// ToC
.toc {
  margin: 20px 0;
  li.toc__item--active a {
    background-color: #fafafa;
    color: $theme-accent;
    border-left-color: $theme-accent;
  }

  a {
    display: block;
    line-height: 30px;
    color: $gray;
    border-left: 2px solid transparent;
    &:hover {
      text-decoration: none;
      background-color: #fafafa;
      color: $theme-accent;
    }

  }

  @for $i from 1 through 5 {
    .toc__h#{$i} a {
      padding-left: 20px * $i
    }
  }
}

// others pages
.page {
  margin: 50px auto;
  &__title {
    padding-bottom: 30px;
    border-bottom: 1px dotted $border-color;
  }
  &__headline {
    margin-top: 50px;
  }
}

// archives
.archives {
  &__item {
    list-style: none;

    a {
      display: block;
      line-height: 74px;
      border-bottom: 1px dotted $border-color;
      padding: 0 30px;
      color: $black;
      &:hover {
        text-decoration: none;
        color: $theme-accent;
      }
    }

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

// author
.author {
  padding: 0 0 30px 30px;
  &__item {
    float: left;
    height: 265px;
    width: 202px;
    border-radius: 4px;
    background-color: $theme-accent;
    margin: 30px 30px 0 0;
    display: block;
    text-align: center;
    color: #fff;
    box-shadow: rgba(0, 0, 0, 0.05) 0px 1px 7px;
    &:hover {
      text-decoration: none;
      color: $fade;

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

  &__header {
    height: 202px;
    overflow: hidden;
    .avatar {
      transition: all .4s linear;
      border-radius: 0;
      width: 100%;
      height: 100%;
    }
  }

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

// categories
.categories {
  &__item {
    list-style: none;
    border-bottom: 1px dotted $border-color;
    padding: 30px 30px 20px 30px;
    color: $black;

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

    .tag {
      margin: 0 20px 20px 0;
    }
  }

  &__header {
    display: block;
    &:hover {
      text-decoration: none;

      .categories__title {
        color: $theme-accent;
      }
    }
  }

  &__description {
    margin-bottom: 20px;
  }

  &__title {
    color: $black;
    font-size: 20px;
  }
}

// tags
.tags {
  padding: 20px;
  .tag {
    margin: 0 20px 20px 0;
    line-height: 1.6;
  }
  &__level0 {
    font-size: 12px;
    color: $fade
  }

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

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

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

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

@media (max-width: 768px) {
  .wrapper {
    width: auto;
  }

  .side,
  .body--side .header__tool,
  .fn-three > div {
    width: 100%;
  }

  .body--side .sidebar__icon {
    position: fixed;
  }

  .side {
    right: -100%;
  }

  .fn-three > div {
    margin-bottom: 20px;

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

  .fn-three--mid {
    margin-left: 0;
  }

  .editor .emotion__item {
    margin: 5px 5px 5px 0;
  }

  .header {
    &__tool {
      display: none;
    }
    &__logo {
      width: 38px !important;
    }
  }

  .body--side {
    .side {
      right: 1px;
    }

    .header__tool {
      display: block;
    }
  }

  .sidebar__icon {
    top: 12px;
    border-color: transparent;
    left: 5px;
    position: absolute;
    box-shadow: 0 0 0;
  }

  .header > .wrapper {
    text-align: center;
    & > a {
      display: none;
      &:first-child {
        display: block;
        float: left;
        margin-left: 20px;
      }

      &.header__search {
        display: block;
        float: right;
        span {
          display: none;
        }
      }
    }
  }

  .side > .fn__none {
    display: block;
    &.module__list li {
      border-bottom: 1px dotted $border-color;
      a {
        display: block;
        color: $text-color;
      }
    }
  }

  .side__sub-title {
    padding-top: 0;
  }

  .pagination__item {
    margin: 0;
  }

  .footer__info {
    text-align: right;
    padding: 20px 0;
    .fn__right {
      float: none;
    }
  }

  .footer__side {
    padding: 20px 0;
  }

  .fn-padding30 {
    padding-left: 0;
    padding-right: 0;
  }

  .article__relevant {
    padding: 50px 20px;
  }

  .article-detail__header .article__action {
    position: inherit;
  }

  .article__title a,
  .article-detail__header .header__title {
    font-size: 18px;
  }

  .article-detail__header .header__title--edit {
    margin-right: 0;
  }

  .article__action .action__btn.action__btn--share {
    display: none;
  }

  .article__action .action__share {
    width: auto;
  }

  .article__action .action__share .action__btns {
    margin-left: 0;
  }

  .article__action .action__share .action__btns .action__btn {
    opacity: 1;
    transform: translate(0);
    visibility: visible;
    padding: 0 7px;
  }

  .article__responsive-meta {
    display: block;
    margin-top: 10px;
  }

  .archives__item a {
    line-height: 36px;
    padding: 0 10px;
  }

  .page {
    margin: 20px 0;
  }

  .page__title {
    padding-bottom: 20px;
  }

  .categories__item,
  .tags {
    padding: 20px 10px;
  }

  .categories__item .tag,
  .tags .tag {
    margin: 0 10px 10px 0;
  }
}
