.hmag-back-to-top__target {
  position: absolute;
  inset-block-start: 0;
  inset-inline-start: 0;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.hmag-back-to-top__target:focus {
  z-index: 1001;
  width: auto;
  height: auto;
  padding: 0.5rem;
  overflow: visible;
  clip: auto;
  clip-path: none;
  background: #fff;
  color: #111;
  outline: 3px solid #111;
  outline-offset: -3px;
  white-space: normal;
}

.hmag-back-to-top {
  position: fixed;
  z-index: 1000;
  inset-block-end: var(
    --hmag-back-to-top-bottom,
    max(1rem, env(safe-area-inset-bottom))
  );
  inset-inline-end: var(
    --hmag-back-to-top-right,
    max(1rem, env(safe-area-inset-right))
  );
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 3rem;
  height: 3rem;
  min-width: 44px;
  min-height: 44px;
  margin: 0;
  padding: 0;
  border: 2px solid #fff;
  border-radius: 2rem;
  background: var(--hmag-back-to-top-background, #a7a5a2);
  box-shadow: 0 2px 8px rgb(0 0 0 / 30%);
  color: #fff;
  font: inherit;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
}

.hmag-back-to-top::before {
  width: 0.75rem;
  height: 0.75rem;
  border-top: 0.1875rem solid currentColor;
  border-left: 0.1875rem solid currentColor;
  content: '';
  transform: translateY(0.125rem) rotate(45deg);
}

.hmag-back-to-top[hidden] {
  display: none;
}

.hmag-back-to-top:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 2px;
  box-shadow: 0 0 0 5px #111;
}

@media (hover: hover) {
  .hmag-back-to-top:hover {
    background: var(--hmag-back-to-top-background-hover, #7d1524);
  }
}

@media (forced-colors: active) {
  .hmag-back-to-top {
    border-color: ButtonText;
  }
}
