/* Section: Back to top (base) */

.back-to-top {
  --back-to-top-width: 100px;
  --back-to-top-height: 84px;
  --back-to-top-gap: 14px;

  width: var(--back-to-top-width);
  height: var(--back-to-top-height);
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;

  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(8px);
  transition:
    opacity 0.3s ease,
    visibility 0.3s ease,
    transform 0.3s ease;
}

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

.back-to-top__arc {
  position: absolute;
  bottom: 48px;
  left: 0;
  width: 100%;
  height: 34px;
  margin-bottom: -10px;
}

.back-to-top:not(.back-to-top--recipe) .back-to-top__arc {
  bottom: 38px;
}

.back-to-top__svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}

.back-to-top__svg--circle {
  display: none;
}

.back-to-top__text {
  fill: var(--dark);
  font-family: var(--font-base);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.back-to-top__text-path {
  animation: back-to-top-arc-marquee 14s linear infinite;
}

@keyframes back-to-top-arc-marquee {
  from {
    start-offset: 0%;
  }

  to {
    start-offset: 100%;
  }
}

.back-to-top__icon-wrap {
  position: relative;
  z-index: 1;

  display: flex;
  align-items: center;
  justify-content: center;

  width: 54px;
  height: 54px;
  margin-bottom: 0;
}

.back-to-top__icon {
  width: 42px;
  height: 42px;
  display: block;
  object-fit: contain;
}

.back-to-top:hover .back-to-top__icon {
  transform: scale(1.06);
  transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

.back-to-top--recipe {
  --back-to-top-width: 118px;
}

.back-to-top--recipe .back-to-top__arc {
  bottom: 38px;
  margin-bottom: -10px;
}

.back-to-top--recipe .back-to-top__text {
  font-size: 9px;
  letter-spacing: 0.08em;
}

.back-to-top--recipe .back-to-top__icon {
  width: 46px;
  height: 46px;
}

@media (max-width: 768px) {
  .back-to-top {
    --back-to-top-gap: 10px;
    --back-to-top-size: 60px;

    position: relative;
    box-sizing: border-box;
    width: var(--back-to-top-size);
    height: var(--back-to-top-size);
    min-width: var(--back-to-top-size);
    min-height: var(--back-to-top-size);
    aspect-ratio: 1;

    background: var(--white);
    border-radius: 50%;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.1);

    display: block;
    overflow: visible;
  }

  .back-to-top--recipe {
    --back-to-top-size: 60px;
  }

  .back-to-top__arc {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
  }

  .back-to-top__svg--arc {
    display: none;
  }

  .back-to-top__svg--circle {
    display: block;
  }

  .back-to-top__text-path {
    animation: none;
  }

  .back-to-top__text-path--circle {
    animation: back-to-top-circle-marquee 16s linear infinite;
  }

  @keyframes back-to-top-circle-marquee {
    from {
      start-offset: 0%;
    }

    to {
      start-offset: 100%;
    }
  }

  .back-to-top:not(.back-to-top--recipe) .back-to-top__arc,
  .back-to-top--recipe .back-to-top__arc {
    bottom: auto;
  }

  .back-to-top__text--circle {
    font-size: 8px;
    letter-spacing: 0.02em;
  }

  .back-to-top--recipe .back-to-top__text--circle {
    font-size: 8px;
    letter-spacing: 0;
  }

  .back-to-top__icon-wrap {
    position: absolute;
    inset: 0;
    z-index: 1;

    display: flex;
    align-items: center;
    justify-content: center;

    width: auto;
    height: auto;
    margin: 0;
  }

  .back-to-top__icon {
    width: 22px;
    height: 22px;
  }

  .back-to-top--recipe .back-to-top__icon {
    width: 22px;
    height: 22px;
  }
}

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

  .back-to-top__text-path,
  .back-to-top__text-path--circle {
    animation: none;
  }

  .back-to-top:hover .back-to-top__icon {
    transform: none;
    transition: none;
  }
}
