@mixin skipLink() {
  position: fixed;
  z-index: 9999;
  top: 5%;
  left: 40%;

  margin: 0;
  padding: 0.5rem 1rem;

  white-space: nowrap;

  font-size: var(--font-size-basis);
  color: var(--skip-link-color);
  text-decoration: none;
  text-align: center;

  user-select: none;

  /* stylelint-disable-next-line */
  -webkit-user-select: none; // Safari / Touch fix

  outline: none;

  background-color: transparent;
  border-radius: 0;
  border: none;
  box-shadow: none;

  &::after {
    content: '';
    position: absolute;
    z-index: -2;
    left: -200vw;
    top: -200vh;
    width: 150vw;
    height: 150vh;

    background-color: rgba(255 255 255 / 85%);

    // we use box-shadow to avoid a horizontal scrollbar
    box-shadow: 150vw 150vh 0 0 rgba(255 255 255 / 85%);
  }

  &::before {
    content: '';
    position: absolute;
    z-index: -1;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    border-radius: 1.5rem; // same as anchor

    background-color: var(--skip-link-background);

    @include focusRing('mouse');
  }

  &:hover::before {
    background-color: var(--skip-link-background--hover);
  }
  &:active::before {
    background-color: var(--skip-link-background--active);
  }

  // focus
  &:focus:not(:active)::before {
    @include focusRing();
  }

  // focus
  &:focus {
    opacity: 1;
  }

  &:hover {
    color: var(--skip-link-color--hover);
    background-color: transparent;
    box-shadow: none;
  }

  &:focus:not(:hover):not(:active) {
    color: var(--skip-link-color);
    background-color: transparent;
    box-shadow: none;
  }
  // stylelint-disable-next-line
  &:active {
    color: var(--skip-link-color--active);
    background-color: transparent;
  }
}

// How to use the "skip-link"
// 1. Have this on the top of your app: <a class="dnb-skip-link dnb-button" href="#dnb-app-content">Skip to content</a>
// 2. Place this id="dnb-app-content" on your main content container
.dnb-skip-link {
  position: absolute;
  z-index: 0;
  top: -100vh;
  opacity: 0.3;
  transition: opacity 0.3s ease-out;
}
.dnb-skip-link--active,
.dnb-skip-link:focus {
  @include skipLink();
}
html[data-whatintent='touch'] .dnb-skip-link {
  display: none;
}
