/* Back-to-top — circle outline + upward arrow (site-wide) */
#topcontrol {
  position: fixed;
  z-index: 900;
  right: max(20px, env(safe-area-inset-right, 0px));
  /* Above yourgood social widget (bottom-right) */
  bottom: calc(max(24px, env(safe-area-inset-bottom, 0px)) + 88px);
  width: 48px;
  height: 48px;
  padding: 0;
  margin: 0;
  border: none;
  border-radius: 50%;
  background: transparent !important;
  background-image: none !important;
  box-shadow: none;
  color: #1a2332;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate3d(0, 14px, 0);
  transition:
    opacity 0.35s ease,
    transform 0.35s cubic-bezier(0.22, 1, 0.36, 1),
    visibility 0.35s,
    background-color 0.25s ease,
    color 0.25s ease,
    box-shadow 0.25s ease;
  -webkit-tap-highlight-color: transparent;
  appearance: none;
  -webkit-appearance: none;
  overflow: visible;
}

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

#topcontrol:hover,
#topcontrol:focus-visible {
  color: #0d1520;
  background-color: rgba(26, 35, 50, 0.06) !important;
  transform: translate3d(0, 0, 0) scale(1.06);
  outline: none;
}

#topcontrol:focus-visible {
  box-shadow: 0 0 0 2px rgba(26, 35, 50, 0.25);
}

#topcontrol:active {
  transform: translate3d(0, 0, 0) scale(0.97);
}

#topcontrol svg {
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
  overflow: visible;
}

#topcontrol .btt-ring {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.25;
  transition: stroke-width 0.25s ease;
}

#topcontrol:hover .btt-ring,
#topcontrol:focus-visible .btt-ring {
  stroke-width: 1.6;
}

#topcontrol .btt-arrow {
  transform-origin: 24px 24px;
  transition: transform 0.25s ease;
}

#topcontrol .btt-arrow path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#topcontrol.is-pulsing .btt-arrow {
  animation: btt-arrow-pulse 0.55s ease;
}

@keyframes btt-arrow-pulse {
  0%,
  100% {
    transform: translateY(0);
  }
  35% {
    transform: translateY(-5px);
  }
  65% {
    transform: translateY(1px);
  }
}

@media (max-width: 767px) {
  #topcontrol {
    width: 44px;
    height: 44px;
    right: max(16px, env(safe-area-inset-right, 0px));
    bottom: calc(max(20px, env(safe-area-inset-bottom, 0px)) + 84px);
  }
}

@media (prefers-reduced-motion: reduce) {
  #topcontrol {
    transition: opacity 0.2s ease, visibility 0.2s;
    transform: none;
  }

  #topcontrol.is-visible,
  #topcontrol:hover,
  #topcontrol:focus-visible,
  #topcontrol:active {
    transform: none;
  }

  #topcontrol.is-pulsing .btt-arrow {
    animation: none;
  }
}
