<div
  class="
    backtotop
    hidden
    md:block
    fixed
    bottom-8
    right-8
    w-12
    h-12
    rounded-full
    shadow-lg
    z-20
    cursor-pointer
    transition-all
    duration-200
  "
  x-data="backtotop()"
  x-init="setup()"
  x-on:scroll.window="scroll()"
  x-bind:class="{
    'opacity-100 visible translate-y-0': scrolled,
    'opacity-0 invisible translate-y-4': !scrolled,
  }"
  x-on:click="scrollTop()"
>
  <svg
    class="stroke-primary-500 stroke-[4px] transition-all duration-200"
    width="100%"
    height="100%"
    viewBox="-1 -1 102 102"
  >
    <path fill="none" d="M50,1 a49,49 0 0,1 0,98 a49,49 0 0,1 0,-98" />
  </svg>

  <svg
    class="
      block
      absolute
      top-1/2
      left-1/2
      -translate-x-1/2 -translate-y-1/2
      w-6
      h-6
      text-primary-500
      cursor-pointer
      z-10
    "
    xmlns="http://www.w3.org/2000/svg"
    width="24"
    height="24"
    viewBox="0 0 24 24"
    fill="none"
    stroke="currentColor"
    stroke-width="2"
    stroke-linecap="round"
    stroke-linejoin="round"
  >
    <line x1="12" y1="19" x2="12" y2="5"></line>
    <polyline points="5 12 12 5 19 12"></polyline>
  </svg>
</div>
