#backtotop {
  --btt-size: 3rem;
  --btt-bg: linear-gradient(145deg, var(--primary-blue) 0%, var(--blue-dark) 100%);
  --btt-shadow: 0 10px 24px rgba(0, 85, 136, 0.28);
  appearance: none;
  position: fixed !important;
  right: clamp(0.875rem, 2.5vw, 1.5rem) !important;
  bottom: clamp(0.875rem, 2.5vw, 1.5rem) !important;
  left: auto !important;
  top: auto !important;
  z-index: 900 !important;
  display: none;
  width: var(--btt-size) !important;
  height: var(--btt-size) !important;
  min-width: var(--btt-size);
  padding: 0 !important;
  margin: 0;
  border: 0 !important;
  border-radius: 50% !important;
  background: var(--btt-bg) !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M12 5v14M12 5l-6 6M12 5l6 6' stroke='%23ffffff' stroke-width='2.25' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"), var(--btt-bg) !important;
  background-repeat: no-repeat !important;
  background-position: center !important;
  background-size: 1.25rem 1.25rem, cover !important;
  color: transparent !important;
  font-size: 0 !important;
  line-height: 0 !important;
  text-indent: 0 !important;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
  box-shadow: var(--btt-shadow);
  transition: transform 0.25s ease, box-shadow 0.25s ease, opacity 0.25s ease, background 0.25s ease;
}
#backtotop:hover {
  opacity: 1 !important;
  transform: translateY(-3px);
  box-shadow: 0 14px 28px rgba(0, 85, 136, 0.35);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M12 5v14M12 5l-6 6M12 5l6 6' stroke='%23ffffff' stroke-width='2.25' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"), linear-gradient(145deg, var(--blue-accent) 0%, #004488 100%) !important;
}
#backtotop:focus, #backtotop:focus-visible {
  opacity: 1 !important;
  outline: 0.1875rem solid rgba(0, 119, 192, 0.45) !important;
  outline-offset: 0.2rem;
}
#backtotop:active {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(0, 85, 136, 0.28);
}

nav:has(> #backtotop) {
  position: static;
  margin: 0;
  padding: 0;
}

@media (max-width: 29.999rem) {
  #backtotop {
    --btt-size: 2.75rem;
    right: 0.75rem !important;
    bottom: 0.75rem !important;
  }
}
@media (prefers-reduced-motion: reduce) {
  #backtotop {
    transition: none;
  }
  #backtotop:hover, #backtotop:active {
    transform: none;
  }
}
