/* Festival Shop — premium scroll-to-top (.fst-totop) */

.fst-totop {
  --fst-totop-pink: #c41a5b;
  --fst-totop-pink-hot: #d82e6b;
  --fst-totop-size: 48px;
  /* Low corner, left of Chaty FAB (~55–60px) — not stacked above it */
  --fst-totop-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  --fst-totop-right: calc(88px + env(safe-area-inset-right, 0px));

  position: fixed;
  right: var(--fst-totop-right);
  bottom: var(--fst-totop-bottom);
  z-index: 99990;
  box-sizing: border-box;
  width: var(--fst-totop-size);
  height: var(--fst-totop-size);
  min-width: 44px;
  min-height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(160deg, var(--fst-totop-pink-hot) 0%, var(--fst-totop-pink) 100%);
  box-shadow:
    0 8px 22px rgba(196, 26, 91, 0.28),
    0 2px 6px rgba(31, 16, 24, 0.12);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate3d(0, 10px, 0) scale(0.96);
  transition:
    opacity 0.28s ease,
    transform 0.28s cubic-bezier(0.22, 1, 0.36, 1),
    visibility 0.28s ease,
    box-shadow 0.2s ease,
    background 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  appearance: none;
}

.fst-totop.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translate3d(0, 0, 0) scale(1);
}

.fst-totop__icon {
  display: block;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.fst-totop:hover {
  background: linear-gradient(160deg, #e03a78 0%, var(--fst-totop-pink) 100%);
  box-shadow:
    0 12px 28px rgba(196, 26, 91, 0.34),
    0 3px 8px rgba(31, 16, 24, 0.14);
  transform: translate3d(0, -2px, 0) scale(1);
}

.fst-totop:focus {
  outline: none;
}

.fst-totop:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
  box-shadow:
    0 0 0 5px rgba(196, 26, 91, 0.35),
    0 12px 28px rgba(196, 26, 91, 0.34);
  transform: translate3d(0, -2px, 0) scale(1);
}

.fst-totop:active {
  transform: translate3d(0, 0, 0) scale(0.98);
  box-shadow:
    0 4px 12px rgba(196, 26, 91, 0.26),
    0 1px 3px rgba(31, 16, 24, 0.1);
}

/* Mobile: same low band, clear Chaty click target */
@media (max-width: 767px) {
  .fst-totop {
    --fst-totop-size: 44px;
    --fst-totop-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    --fst-totop-right: calc(80px + env(safe-area-inset-right, 0px));
  }

  .fst-totop__icon {
    width: 16px;
    height: 16px;
  }
}

@media (min-width: 768px) {
  .fst-totop {
    --fst-totop-bottom: calc(22px + env(safe-area-inset-bottom, 0px));
    --fst-totop-right: calc(92px + env(safe-area-inset-right, 0px));
  }
}

/* Lead / quiz modals already hide floating chrome */
body.fs-modal-open .fst-totop {
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

@media (prefers-reduced-motion: reduce) {
  .fst-totop {
    transition: opacity 0.15s ease, visibility 0.15s ease;
    transform: none;
  }

  .fst-totop.is-visible,
  .fst-totop:hover,
  .fst-totop:focus-visible,
  .fst-totop:active {
    transform: none;
  }
}
