$sidebar-bg-image = hexo-config('sidebar.bg_image');
$sidebar-bg-position = hexo-config('sidebar.bg_position');

// for dark
:root {
  --sidebar-bg-image: url($sidebar-bg-image);
}

// 只在主页显示
#menu-btn {
  display: none;
  position: fixed;
  left: 0.8rem;
  top: 0.6rem;
  line-height: 1;
  z-index: $menu-btn-z-index;
  cursor: pointer;

  +mobile() {
    display: flex;
  }
}

.is-home {
  #menu-btn {
    display: flex;
  }

  .sidebar {
    left: -20rem;
    transform: translateX(0);
    visibility: hidden;
  }

  .sidebar-translate {
    the-transition();
    padding-left: 0;
  }

  .sidebar-open {
    .sidebar {
      transform: translateX(20rem);
      visibility: visible;
    }

    .sidebar-translate {
      padding-left: 20rem;

      +mobile() {
        padding-left: 0;
      }
    }
  }
}

.sidebar {
  position: fixed;
  overflow-y: auto;
  top: 0;
  bottom: 0;
  left: 0;
  width: 20rem;
  background-image: var(--sidebar-bg-image, none);
  background-color: var(--sidebar-bg-color, white);
  background-size: contain;
  background-repeat: no-repeat;
  background-position: convert($sidebar-bg-position);
  text-align: center;
  z-index: $sidebar-z-index;
  the-transition();
  the-box-shadow();

  +mobile() {
    left: -20rem;
    transform: translateX(0);
  }

  &-translate {
    padding-left: 20rem;

    +mobile() {
      padding-left: 0;
    }
  }

  .sidebar-panel {
    padding: 0.5rem;
    display: none;
  }

  .sidebar-panel-active {
    display: block;
  }

  .links {
    display: block;

    &-item {
      display: inline-flex;

      .icon {
        width: 2rem;
        height: 2rem;
      }
    }
  }

  .links-of-author {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;

    .icon {
      width: 1.5rem;
      height: 1.5rem;
    }

    &-item {
      line-height: 1;
      font-size: 0.9rem;
    }
  }
}

.sidebar-open {
  +mobile() {
    .sidebar {
      transform: translateX(20rem);
      visibility: visible;

      &-overlay {
        background-color: rgba(0, 0, 0, 0.3);
        position: fixed;
        width: 100%;
        height: 100vh;
        z-index: $sidebar-z-index - 1;
        transition: 0.4s;
      }
    }
  }
}
