/* Back-to-top — fades in past 600px scroll, fixed bottom-right.
   Hidden via the [hidden] attribute initially; the JS toggle adds/
   removes it so the CSS transitions on opacity/transform without
   any layout flash. The [hidden] override below means [hidden]
   keeps display:flex so the transition works — the JS still drives
   visibility but via opacity, not display. */
.cg-back-to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(135deg, #7c6dfa 0%, #6b48ff 100%);
  box-shadow: 0 8px 24px rgba(124, 109, 250, 0.35);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 90;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 240ms ease, transform 240ms ease,
              background 120ms ease, box-shadow 120ms ease;
  pointer-events: none;
}
.cg-back-to-top[hidden] { display: flex; }
.cg-back-to-top:not([hidden]) {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.cg-back-to-top:hover {
  box-shadow: 0 12px 32px rgba(107, 72, 255, 0.5);
  transform: translateY(-2px);
}
.cg-back-to-top:focus-visible {
  outline: 2px solid #f0f2ff;
  outline-offset: 3px;
}
.cg-back-to-top:active { transform: translateY(0) scale(0.95); }
@media (max-width: 640px) {
  .cg-back-to-top { right: 16px; bottom: 16px; width: 44px; height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  .cg-back-to-top { transition: opacity 0ms; }
}
