/*!
* HomePage: https://www.misterma.com
* GithubPage: https://github.com/changbin1997
* ProjectPage: https://github.com/changbin1997/Facile
* author: Mr. Ma
* Licensed under MIT
*/

// 文章头图
@mixin headerImg {
  width: 100%;
  a {
    display: block;
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    background-size: cover;
    background-position: center;
  }
  a:after {
    content: '';
    padding-bottom: 50%;
    display: block;
  }
}

// 通用的文章标题
@mixin postTitle {
  font-size: 28px;
  font-weight: 700;
  a {
    transition: 0.3s;
    &:hover {
      text-decoration: none;
    }
  }
}

//  通用的文章内容样式
@mixin postContent {
  p,li,a {
    font-size: 16px;
  }
  h1,h2,h3,h4,h5,h6 {
    font-weight: 700;
    code {
      padding: 0 4px;
    }
  }
  h1 {
    font-size: 28px;
    * {
      font-size: 28px;
    }
  }
  h2 {
    font-size: 21px;
    * {
      font-size: 21px;
    }
  }
  h3 {
    font-size: 18px;
    * {
      font-size: 18px;
    }
  }
  h4,h5,h6 {
    font-size: 16px;
    * {
      font-size: 16px;
    }
  }
  img:not(.logo) {
    max-width: 100%;
    cursor: zoom-in;
    border-radius: 4px;
    margin-left: auto;
    margin-right: auto;
    display: block;
  }
  figcaption {
    text-align: center;
    color: #757575;
    font-size: 15px;
  }
  p code,li code,td code {
    font-size: 16px;
    padding: 0 4px;
  }
  a {
    font-weight: 700;
    word-wrap: break-word;
    word-break: break-all;
  }
  p {
    margin: 20px 0;
  }
  blockquote {
    border-left: 3px solid #333333;
    margin: 20px 0;
    padding: 0 0 0 20px;
  }
  table {
    td,th {
      min-width: 90px;
    }
  }
  .table-responsive {
    margin-bottom: 20px;
    table {
      margin-bottom: 0;
    }
  }
  pre {
    margin-bottom: 20px;
  }
  video {
    width: 100%;
  }
}


// 代码高亮样式
// stackoverflow-light 样式
.stackoverflow-light {
  pre {
    background: #F6F6F6;
    .line-box {
      background: #F6F6F6;
      div {
        color: #777777;
        border-right: 1px solid #777777;
      }
    }
  }
  @import "stackoverflow-light.min";
}
// vs2015样式
.vs2015 {
  pre {
    background: #1E1E1E;
    .line-box {
      background: #1E1E1E;
      div {
        color: #9B9B9B;
        border-right: 1px solid #9B9B9B;
      }
    }
  }
  @import "vs2015.min";
}
// Sunburst高对比度样式
.sunburst {
  pre {
    background: #000000;
    .line-box {
      background: #000000;
      div {
        color: #AEAEAE;
        border-right: 1px solid #AEAEAE;
      }
    }
  }
  @import "sunburst.min";
}
// 通用的代码高亮样式
.enable-highlight {
  pre {
    position: relative;
    border-radius: 4px;
    &:hover .copy-code-btn {
      display: block;
    }
    .line-box {
      width: 40px;
      position: absolute;
      top: 0;
      left: 0;
      padding-top: 12px;
      div {
        line-height: 24px;
        height: 24px;
        padding-right: 9px;
        font-size: 15px;
        -moz-user-select: none;
        -webkit-user-select: none;
        -ms-user-select: none;
        user-select: none;
      }
    }
  }
  pre > code {
    font-size: 16px !important;
    white-space: pre;
    word-wrap: normal;
    &::-webkit-scrollbar {
      height: 12px;
      background: #F1F1F1;
    }
    &::-webkit-scrollbar-thumb {
      background: #A8A8A8;
    }
  }
}
// 包含行号的样式
.line-num-show {
  pre {
    code {
      padding: 12px 10px 12px 54px !important;
    }
  }
}
// 不包含行号的样式
.line-num-hide {
  pre {
    code {
      padding: 12px 16px !important;
    }
  }
}



* {
  text-transform: none;
}

// 顶部横幅区导航
header {
  input[type="search"]:focus {
    box-shadow: none;
  }
}

// pjax的进度条
#progress-bar {
  width: 100%;
  height: 3px;
  position: fixed;
  top: 0;
  left: 0;
  background: #E0E0E0;
  z-index: 2000;
  #progress {
    height: 100%;
    width: 0;
  }
}

// 面包屑导航
.breadcrumb-nav {
  .breadcrumb {
    background: none;
  }
}

// 文章列表
.post-list {
  .post {
    // 文章头图
    .header-img {
      @include headerImg;
    }
    // 文章标题
    .post-title {
      @include postTitle;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    // 小头图
    .mini-header-image a {
      display: block;
      width: 100%;
      height: 100%;
      position: relative;
      overflow: hidden;
      background-size: cover;
      background-position: center;
      &:after {
        content: '';
        padding-bottom: 75%;
        display: block;
      }
    }
    // 文章信息区域
    .post-info {
      display: flex;
      justify-content: flex-start;
      span {
        display: flex;
        align-items: center;
      }
    }
    // 查看全文和查看评论区域
    .more-link-wrapper {
      height: 28px;
      display: flex;
      align-items: center;
      justify-content: space-between;
    }
  }
  .post-content[data-header-image-type="mini"] {
    .content-box {
      display: flex;
      flex-direction: column;
      flex: 1 auto;
      .summary-box p {
        max-height: 80px;
        overflow-y: hidden;
      }
      .summary-box {
        display: flex;
        justify-content: flex-start;
        flex: 1;
      }
      .more-link-wrapper {
        display: flex;
        justify-content: space-between;
      }
    }
  }
  // 全文显示区域
  .fullText {
    @include postContent;
  }
}

// 返回顶部按钮
#to-top-btn {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 40px;
  height: 40px;
  font-size: 16px;
  opacity: 0.7;
}

// 侧边栏
.sidebar {
  position: relative;
  // 通用的侧边栏样式
  section {
    h2 {
      font-size: 12px;
      font-weight: 700;
    }
    ul {
      list-style: none;
      padding: 0;
      li {
        margin-bottom: 12px;;
        a {
          font-size: 12px;
        }
      }
    }
  }
  // 最新评论
  .latest-comment {
    img {
      width: 42px;
      height: 42px;
      margin-right: 10px;
      border-radius: 50%;
    }
    .media-body {
      overflow: hidden;
      p {
        font-size: 12px;
        width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
    }
  }
  // 目录
  .directory {
    overflow-y: auto;
    &::-webkit-scrollbar {
      width: 6px;
      background: #F1F1F1;
    }
    &::-webkit-scrollbar-thumb {
      background: #A8A8A8;
    }
    > .article-directory {
      width: 100%;
      .article-directory {
        margin-left: 16px;
      }
    }
  }
  // 博客信息
  .blog-info {
    .blog-user-info {
      display: flex;
      justify-content: flex-start;
      align-items: center;
      // 头像
      .avatar {
        border-radius: 50%;
        width: 56px;
        height: 56px;
        flex: none;
      }
      .pingback {
        font-size: 20px;
        line-height: 56px;
      }
    }
    // 统计数据区域
    .statistics {
      p {
        font-size: 16px;
        margin: 0;
        color: #333333;
        display: flex;
        align-items: center;
      }
    }
  }
  // 自定义HTML
  .customize-html {
    word-break: break-all;
    img {
      max-width: 100%;
    }
  }
  // 归档
  .archive {
    ul {
      li {
        width: 120px;
      }
    }
  }
}

// 分类页的页头区域
.archive-title {
  h1 {
    font-size: 16px;
    font-weight: 700;
  }
}

// 文章页
.post-page {
  // 文章头图
  .header-img {
    @include headerImg;
  }
  // 文章标题
  .post-title {
    @include postTitle;
  }
  // 文章信息区域
  .post-info {
    display: flex;
    justify-content: flex-start;
    span {
      display: flex;
      align-items: center;
    }
  }
  // 文章内容
  article {
    .post-content {
      @include postContent;
      // 待加载的图片
      .load-img {
        width: 100%;
        height: 380px;
        display: block;
        background-color: #E0E0E0;
      }
    }
  }
  // 文章的分类和标签区域
  .category-tag {
    .post-category {
      display: flex;
      align-items: center;
      a {
        margin-right: 6px;
      }
    }
    .post-tag {
      display: flex;
      align-items: center;
      a {
        margin-right: 6px;
      }
      a:last-child {
        margin-right: 0;
      }
    }
  }
  // 分享链接和二维码区域
  #qr-link {
    .link-box {
      margin: 0 auto;
      width: 96px;
      display: flex;
      justify-content: space-between;
      a {
        font-size: 20px;
        &:hover {
          text-decoration: none;
        }
      }
    }
  }
  // 文章密码输入区域
  .protected {
    text-align: center;
  }
  // 打赏二维码区域
  #reward-qr .qr {
    img {
      max-width: 100%;
    }
  }
  // 文章底部的交互按钮区域
  .agree-share > div button:last-child {
    margin-right: 0 !important;
  }
}

// 点赞的效果样式
#agree-p {
  font-weight: 700;
  font-size: 18px;
  color: red;
  position: absolute;
}

// 代码拷贝按钮
.copy-code-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  display: none;
}

// 移动设备目录按钮开关
#directory-btn {
  position: fixed;
  right: 20px;
  bottom: 80px;
  font-size: 16px;
  opacity: 0.7;
  width: 40px;
  height: 40px;
}
// 移动设备专用的目录
#directory-mobile {
  width: 0;
  position: fixed;
  right: 60px;
  bottom: 80px;
  flex-direction: column;
  display: flex;
  max-height: 70%;
  width: 300px;
  opacity: 0;
  // 目录列表区域
  .directory-list {
    height: 100%;
    overflow-y: auto;
    ul {
      list-style: none;
      padding-left: 0;
      ul {
        padding-left: 15px;
      }
    }
    a {
      font-size: 14px;
    }
  }
  // 目录的标题栏区域
  .title-bar {
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px;
    i {
      font-size: 15px;
    }
  }
}
@media screen and (max-height: 450px) {
  #directory-mobile {
    max-height: 60%;
  }
}

// 图片灯箱
#max-img-box {
  display: none;
  // 遮罩层
  #max-img-bg {
    display: none;
    width: 100%;
    height: 100%;
    position: fixed;
    top: 0;
    left: 0;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 1200;
  }
  // 图片灯箱功能按钮区
  .max-img-features-btn {
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 1203;
    display: none;
    button {
      color: #FFFFFF;
      text-shadow: 0 1px #333333, 1px 0 #333333, -1px 0 #333333, 0 -1px #333333;
      font-size: 15px;
      &:hover {
        color: #F7E6D2;
      }
    }
  }
  // 图片描述
  #img-info {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translate(-50%, 0);
    font-size: 16px;
    text-shadow: 0 1px #333333, 1px 0 #333333, -1px 0 #333333, 0 -1px #333333;
    z-index: 1203;
    display: none;
  }
  // 图片
  #max-img {
    position: absolute;
    cursor: move;
    display: none;
    z-index: 1201;
  }
}

// 禁止滚动
.stop-scrolling {
  height: 100%;
  overflow: hidden;
}

// 评论区文字头像和引用头像
.text-avatar,.pingback {
  width: 42px;
  text-align: center;
  font-size: 14px;
  color: #ffffff;
  font-weight: 700;
  line-height: 42px;
  border-radius: 50%;
  margin-right: 10px;
  -moz-user-select: none;
  -webkit-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

// 评论区引用头像
.pingback {
  background: #488CB8;
}


// 评论区
#comments {
  // 发表评论区
  .comment-off {
    margin-top: 24px;
    h2 {
      font-size: 21px;
      font-weight: 700;
    }
  }
  .comment-input {
    margin-top: 24px;
    h2 {
      font-size: 21px;
      font-weight: 700;
      margin-bottom: 25px;
    }
    .row {
      div {
        margin-bottom: 16px;
        textarea {
          height: 150px;
        }
      }
    }
    a {
      font-weight: 700;
    }
    #emoji-panel {
      width: 400px;
      height: 300px;
      position: absolute;
      z-index: 10;
      display: none;
      // 表情选择区
      #emoji-classification {
        overflow-x: auto;
        button {
          font-size: 16px;
        }
        button:hover {
          background: #D9230F;
        }
        .selected {
          background: #D9230F;
        }
      }
      // 表情列表
      #emoji-list {
        max-height: 222px;
        overflow-y: auto;
        // 表情
        .emoji {
          float: left;
          font-size: 16px;
          margin: 0;
          cursor: pointer;
          &:hover {
            background: #D9230F;
          }
          &:focus {
            background: #D9230F;
          }
        }
      }
    }
  }
  // 评论列表区
  .comments-lists {
    margin-top: 24px;
    h2 {
      font-size: 21px;
      font-weight: 700;
      margin-bottom: 25px;
    }
    ol {
      list-style: none;
      padding: 0;
    }
    .comment-author {
      .avatar {
        float: left;
        margin-right: 10px;
        width: 42px;
        height: 42px;
        border-radius: 50%;
      }
      .comment-info {
        // 评论者
        .author {
          font-size: 14px;
        }
        // 评论时间
        .comment-time {
          display: block;
          font-size: 12px;
        }
      }
      .comment-reply {
        > span {
          display: flex;
          align-items: center;
        }
        a,i {
          font-weight: 700;
          font-size: 14px;
        }
      }
    }
    .comment-content {
      margin-left: 52px;
      @include postContent;
      p {
        margin-top: 0;
        word-wrap: break-word;
        word-break: break-all;
      }
      p,a,li,code,td {
        font-size: 15px;
      }
    }
    //  子评论
    .comment-children {
      margin-left: 52px;
      .comment-children {
        margin-left: 0;
      }
    }
    // 评论回复表单区
    .comment-input {
      margin-bottom: 20px;
    }
  }
}

// 文章归档页面
.archive-page {
  .archives {
    position: relative;
    &::before {
      width: 2px;
      height: 100%;
      background: #BBBBBB;
      display: block;
      content: "";
      position: absolute;
      top: 0;
      left: 57px;
    }
    .archives-item {
      position: relative;
      h2 {
        font-size: 12px !important;
        background: #FCFCFC;
        width: 84px;
        line-height: 24px;
        text-align: center;
        border-radius: 4px;
        position: relative;
        z-index: 10;
        left: 15px;
        cursor: pointer;
        border: 1px solid #BBBBBB;
      }
      ul {
        padding-left: 0;
        list-style: none;
        li {
          font-size: 14px;
          display: flex;
          align-items: center;
          padding: 6px 0;
          &:hover {
            .timeline {
              background: #FF4242;
            }
          }
          .day {
            display: block;
            width: 36px;
            text-align: center;
            flex: none;
          }
          .timeline {
            width: 8px;
            height: 8px;
            background: #BBBBBB;
            border-radius: 50%;
            margin: 0 10px;
            flex: none;
          }
        }
      }
    }
  }
}

// 友情链接页面
.page-links {
  .logo {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background-color: #F7F7F9;
  }
  .logo-icon {
    width: 42px;
    height: 42px;
    background: #09679B;
    color: #ffffff;
    text-align: center;
    line-height: 42px;
    border-radius: 50%;
    font-size: 22px;
  }
  .link {
    display: flex;
    align-items: center;
  }
}

// 统计数据页面
.statistics-page {
  // 分类占比区域
  #category-chart {
    height: 320px;
    position: relative;
  }
  // 文章和评论动态日历区域
  #post-chart,#comment-chart {
    height: 180px;
    position: relative;
  }
  // 图表加载提示
  .loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
  }
}

// 404页面
.page-404 {
  .text-404 {
    font-size: 120px;
    font-weight: 700;
  }
}

// >= 992 且 <= 1199
@media screen and (min-width: 992px) and (max-width: 1199px) {
  // 小头图的文章列表
  .post-content[data-header-image-type="mini"] {
    .summary-box p {
      max-height: 60px;
      overflow-y: hidden;
    }
  }
}

// >= 768 且 <= 991
@media screen and (min-width: 768px) and (max-width: 991px) {
  // 小头图的文章列表
  .post-content[data-header-image-type="mini"] {
    .summary-box p {
      max-height: 80px;
      overflow-y: hidden;
    }
  }
}

// >= 576 且 <= 767
@media screen and (min-width: 576px) and (max-width: 767px) {
  // 文章列表
  .post-list {
    .post {
      // 文章标题
      .post-title {
        font-size: 18px;
      }
      .post-content[data-header-image-type="mini"] {
        .summary-box p {
          max-height: 80px;
          overflow-y: hidden;
        }
      }
    }
  }
  // 文章页
  .post-page {
    // 文章标题
    .post-title {
      @include postTitle;
      font-size: 18px;
    }
  }
}

// <= 575
@media screen and (max-width: 575px) {
  // 文章列表
  .post-list {
    .post {
      // 文章标题
      .post-title {
        font-size: 18px;
      }
      .post-content[data-header-image-type="mini"] {
        .summary-box p {
          max-height: 60px;
          overflow-y: hidden;
        }
      }
    }
  }
  // 文章页
  .post-page {
    // 文章标题
    .post-title {
      @include postTitle;
      font-size: 18px;
    }
  }
  // 评论区
  #comments {
    // 评论列表区
    .comments-lists {
      // 子评论
      .comment-children {
        margin-left: 21px;
        .comment-children {
          margin-left: 0;
        }
      }
    }
    // Emoji面板
    #emoji-panel {
      width: 93% !important;
    }
  }
  // 待加载的图片
  .load-img {
    height: 200px !important;
  }
}

// 浅色配色
@import "light-color";

// 深色配色
@import "dark-color";