/* Draggable floating back-to-top control. */
.landing-back-to-top {
  position: fixed;
  right: max(24px, env(safe-area-inset-right));
  bottom: max(108px, calc(env(safe-area-inset-bottom) + 18px));
  z-index: 1200;
  width: auto;
  min-width: 132px;
  height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 16px;
  border: 1px solid rgba(103, 86, 232, 0.5);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  color: #28324a;
  font: inherit;
  font-size: 13px;
  font-weight: 820;
  line-height: 1;
  cursor: grab;
  touch-action: none;
  user-select: none;
  box-shadow: 0 14px 36px rgba(28, 35, 58, 0.2);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(14px) scale(0.96);
  transition:
    opacity 180ms ease,
    visibility 180ms ease,
    transform 180ms ease,
    border-color 180ms ease,
    background-color 180ms ease,
    color 180ms ease,
    box-shadow 180ms ease;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

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

.landing-back-to-top.is-positioned {
  right: auto;
  bottom: auto;
}

.landing-back-to-top.is-dragging {
  cursor: grabbing;
  border-color: #6756e8;
  box-shadow: 0 20px 46px rgba(74, 58, 196, 0.3);
  transform: scale(1.025);
  transition: none;
}

.landing-back-to-top svg {
  width: 23px;
  height: 23px;
  flex: 0 0 23px;
  fill: none;
  stroke: #6756e8;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 180ms ease, stroke 180ms ease;
}

.landing-back-to-top:hover:not(.is-dragging) {
  border-color: #6756e8;
  background: #6756e8;
  color: #fff;
  box-shadow: 0 18px 42px rgba(74, 58, 196, 0.34);
  transform: translateY(-3px) scale(1);
}

.landing-back-to-top:hover:not(.is-dragging) svg {
  stroke: #fff;
  transform: translateY(-2px);
}

.landing-back-to-top:active:not(.is-dragging) {
  transform: translateY(0) scale(0.98);
}

.landing-back-to-top:focus-visible {
  outline: 3px solid #65d6b4;
  outline-offset: 4px;
}

@media (max-width: 720px) {
  .landing-back-to-top {
    right: max(16px, env(safe-area-inset-right));
    bottom: max(86px, calc(env(safe-area-inset-bottom) + 14px));
    min-width: 0;
    width: 52px;
    height: 52px;
    padding: 0;
  }

  .landing-back-to-top span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .landing-back-to-top svg {
    width: 25px;
    height: 25px;
    flex-basis: 25px;
  }
}

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