/* =========================================================
 * サビ管ジョブ：ページトップへ戻るボタン
 * ========================================================= */

.sj-page-top {
  --sj-page-top-base-bottom: 20px;
  --sj-page-top-safe-bottom: env(safe-area-inset-bottom, 0px);
  --sj-page-top-bottom: calc(
    var(--sj-page-top-base-bottom) + var(--sj-page-top-safe-bottom)
  );
  position: fixed;
  z-index: 110;
  right: max(20px, env(safe-area-inset-right));
  bottom: var(--sj-page-top-bottom);
  display: inline-grid;
  width: 46px;
  height: 46px;
  margin: 0;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: #ffffff;
  background: rgba(0, 0, 0, 0.4);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.16);
  opacity: 0;
  pointer-events: none;
  cursor: pointer;
  transform: translateY(8px);
  transition:
    bottom 0.24s ease,
    background-color 0.2s ease,
    opacity 0.2s ease,
    transform 0.2s ease,
    visibility 0s linear 0.2s;
  visibility: hidden;
}

.sj-page-top.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
  transition-delay: 0s;
  visibility: visible;
}

.sj-page-top svg {
  display: block;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

@media (hover: hover) and (pointer: fine) {
  .sj-page-top:hover {
    background: rgba(0, 0, 0, 0.56);
  }
}

.sj-page-top:focus-visible {
  outline: 3px solid rgba(202, 168, 70, 0.62);
  outline-offset: 3px;
  background: rgba(0, 0, 0, 0.56);
}

@media screen and (max-width: 767.9px) {
  .sj-page-top {
    --sj-page-top-base-bottom: 15px;
    right: max(13px, env(safe-area-inset-right));
    width: 42px;
    height: 42px;
  }

  .sj-page-top svg {
    width: 18px;
    height: 18px;
  }
}

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