.dark .vp-code span {
  color: var(--shiki-dark, rgba(235, 235, 245, 0.6));
}

html:not(.dark) .vp-code span {
  color: var(--shiki-light, rgba(60, 60, 67, 0.78));
}

.plume-content {
  pre {
    padding: 1.3rem 1.5rem;
    margin: 0 0 0.85rem;
    overflow: auto;
    font-size: 14px;
    border-radius: 6px;

    scrollbar-color: var(--vp-c-brand-1) var(--vp-c-border);
    scrollbar-width: thin;

    code {
      padding: 0;
      color: #fff;
      overflow-wrap: unset;
      background-color: transparent;
      border-radius: 0;

      -webkit-font-smoothing: auto;
      -moz-osx-font-smoothing: auto;
    }
  }

  .line-number {
    font-family: var(--vp-font-family-mono);
  }

  .code-tabs {
    .div[class*="language-"] {
      border-top-left-radius: 0;
      border-top-right-radius: 0;
    }
  }
}

div[class*="language-"] {
  position: relative;
  background-color: var(--vp-code-block-bg);
  border-radius: 6px;

  &::before {
    position: absolute;
    top: 0.8em;
    right: 1em;
    z-index: 3;
    font-size: 0.75rem;
    color: var(--vp-code-line-number-color);
    content: attr(data-ext);
  }

  code {
    display: inline-block;
    min-width: 100%;
  }

  pre {
    position: relative;
    z-index: 1;

    // force override the background color to be compatible with shiki
    background: transparent !important;
  }

  .highlight-lines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding-top: 1.3rem;
    line-height: 1.5;
    user-select: none;

    .highlight-line {
      background-color: var(--vp-c-default-soft);
    }
  }

  &:not(.line-numbers-mode) {
    .line-numbers {
      display: none;
    }
  }

  &.line-numbers-mode {
    .highlight-lines .highlight-line {
      position: relative;

      &::before {
        position: absolute;
        top: 0;
        left: 0;
        z-index: 2;
        display: block;
        height: 100%;
        content: " ";
      }
    }

    pre {
      padding-left: 1rem;
      margin-left: 2rem;
      vertical-align: middle;
    }

    .line-numbers {
      position: absolute;
      top: 0;
      left: 0;
      z-index: 1;
      width: 2rem;
      height: 100%;
      padding-top: 1.25rem;
      line-height: var(--vp-code-line-height);
      color: var(--vp-code-line-number-color);
      text-align: center;
      counter-reset: line-number;
      border-right: var(--vp-code-block-divider-color) 1px solid;

      .line-number {
        position: relative;
        z-index: 3;
        height: 1.5rem;
        user-select: none;

        &::before {
          font-size: 0.85em;
          content: counter(line-number);
          counter-increment: line-number;
        }
      }
    }
  }
}

.plume-content [class*="language-"] code .highlighted {
  z-index: 2;
  display: inline-block;
  width: calc(100% + 2 * 24px);
  padding: 0 24px;
  margin: 0 -24px;
  background-color: var(--vp-code-line-highlight-color);
  transition: background-color 0.5s;

  &.error {
    background-color: var(--vp-code-line-error-color);
  }

  &.warning {
    background-color: var(--vp-code-line-warning-color);
  }
}

.plume-content [class*="language-"] code .diff {
  display: inline-block;
  width: calc(100% + 2 * 24px);
  padding: 0 24px;
  margin: 0 -24px;
  transition: background-color 0.5s;

  &::before {
    position: absolute;
    left: 10px;
  }

  &.remove {
    background-color: var(--vp-code-line-diff-remove-color);
    opacity: 0.7;
  }

  &.remove::before {
    color: var(--vp-code-line-diff-remove-symbol-color);
    content: "-";
    transform: translateX(-6px);
  }

  &.add {
    background-color: var(--vp-code-line-diff-add-color);
  }

  &.add::before {
    color: var(--vp-code-line-diff-add-symbol-color);
    content: "+";
    transform: translateX(-6px);
  }
}

.plume-content [class*="language-"] .has-focused-lines .line:not(.has-focus) {
  filter: blur(0.095rem);
  opacity: 0.7;
  transition:
    filter 0.35s,
    opacity 0.35s;
}

.plume-content [class*="language-"]:hover .has-focused-lines .line:not(.has-focus) {
  filter: blur(0);
  opacity: 1;
}

// narrow mobile
@media (max-width: 419px) {
  .plume-content {
    div[class*="language-"] {
      margin: 0.85rem -1.5rem;
      border-radius: 0;
    }
  }
}
