@mixin clippy {
  .clippy-wrapper {
    position: relative;
    width: 0;
    height: 0;
    top: 8px;
    left: calc(100% - 40px);
    z-index: 1;

    .clippy {
      width: 32px;
      height: 32px;
      border: 1px solid var(--color-border-default);
      border-radius: 4px;

      @include interactive-background;
      .icon {
        width: 100%;
        height: 100%;
        display: block;
        background-image: url('~@primer/octicons-react/build/svg/copy-16.svg?inline');
        background-position: center;
        background-repeat: no-repeat;
        &.success {
          background-image: url('~@primer/octicons-react/build/svg/check-16.svg?inline');
        }
        &.fail {
          background-image: url('~@primer/octicons-react/build/svg/x-16.svg?inline');
        }
      }
    }
  }
}

// TODO: use react to render the button content and set color with CSS variables
@media (prefers-color-scheme: dark) {
  :root[data-color-mode='auto'] .markdown-body .clippy .icon {
    filter: invert(0.7); // hack to make it looks like a normal color :P
  }
}
:root[data-color-mode='dark'] {
  .markdown-body .clippy .icon {
    filter: invert(0.7); // hack to make it looks like a normal color :P
  }
}
