@import './var.less';

:root {
  --rv-index-bar-sidebar-z-index: @index-bar-sidebar-z-index;
  --rv-index-bar-index-font-size: @index-bar-index-font-size;
  --rv-index-bar-index-line-height: @index-bar-index-line-height;
  --rv-index-bar-index-active-color: @index-bar-index-active-color;
  --rv-index-anchor-z-index: @index-anchor-z-index;
  --rv-index-anchor-padding: @index-anchor-padding;
  --rv-index-anchor-text-color: @index-anchor-text-color;
  --rv-index-anchor-font-weight: @index-anchor-font-weight;
  --rv-index-anchor-font-size: @index-anchor-font-size;
  --rv-index-anchor-line-height: @index-anchor-line-height;
  --rv-index-anchor-background-color: @index-anchor-background-color;
  --rv-index-anchor-sticky-text-color: @index-anchor-sticky-text-color;
  --rv-index-anchor-sticky-background-color: @index-anchor-sticky-background-color;
}

.@{rv-prefix}-index-bar {
  &__sidebar {
    position: fixed;
    top: 50%;
    right: 0;
    z-index: var(--rv-index-bar-sidebar-z-index);
    display: flex;
    flex-direction: column;
    text-align: center;
    transform: translateY(-50%);
    cursor: pointer;
    user-select: none;
  }

  &__index {
    padding: 0 var(--rv-padding-xs) 0 var(--rv-padding-md);
    font-weight: var(--rv-font-weight-bold);
    font-size: var(--rv-index-bar-index-font-size);
    line-height: var(--rv-index-bar-index-line-height);

    &--active {
      color: var(--rv-index-bar-index-active-color);
    }
  }
}

.@{rv-prefix}-index-anchor {
  z-index: var(--rv-index-anchor-z-index);
  box-sizing: border-box;
  padding: var(--rv-index-anchor-padding);
  color: var(--rv-index-anchor-text-color);
  font-weight: var(--rv-index-anchor-font-weight);
  font-size: var(--rv-index-anchor-font-size);
  line-height: var(--rv-index-anchor-line-height);
  background-color: var(--rv-index-anchor-background-color);

  &--sticky {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    color: var(--rv-index-anchor-sticky-text-color);
    background-color: var(--rv-index-anchor-sticky-background-color);
  }
}
