.amaxa-back-to-top {
  position: fixed;
  right: max(var(--amaxa-page-gutter, 24px), env(safe-area-inset-right));
  bottom: calc(24px + env(safe-area-inset-bottom));
  z-index: 90;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  padding: 0;
  overflow: hidden;
  isolation: isolate;
  border: 1px solid #c7d6e8;
  border-radius: 16px;
  background: #f0f6fd;
  color: #043673;
  box-shadow: 0 4px 18px rgb(4 54 115 / 10%);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(12px);
  transition:
    opacity 0.25s ease,
    visibility 0.25s ease,
    transform 0.25s ease,
    color 0.35s ease,
    border-color 0.35s ease;
}

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

.amaxa-back-to-top::before {
  position: absolute;
  z-index: -1;
  inset: 0;
  background: #043673;
  content: "";
  transform: scaleY(0);
  transform-origin: center bottom;
  transition: transform 0.35s ease;
}

.amaxa-back-to-top svg {
  pointer-events: none;
}

.amaxa-back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.amaxa-back-to-top:focus-visible {
  outline: 3px solid #043673;
  outline-offset: 4px;
}

@media (hover: hover) {
  .amaxa-back-to-top:hover {
    border-color: #043673;
    color: #fff;
  }

  .amaxa-back-to-top:hover::before {
    transform: scaleY(1);
  }
}

.amaxa-back-to-top:active {
  background: #043673;
  color: #fff;
}

.menu-is-open .amaxa-back-to-top {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

@media (max-width: 768px) {
  .amaxa-back-to-top {
    bottom: calc(16px + env(safe-area-inset-bottom));
    width: 44px;
    height: 44px;
    border-radius: 14px;
  }

  .amaxa-back-to-top svg {
    width: 22px;
    height: 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .amaxa-back-to-top,
  .amaxa-back-to-top::before {
    transform: none;
    transition: none;
  }

  .amaxa-back-to-top::before {
    display: none;
  }

  .amaxa-back-to-top:hover {
    background: #043673;
  }
}
