/* Floating "back to top" button, shared across all public pages
   (not loaded on the login page). The element itself is created by
   assets/js/back-to-top.js; this file only handles its appearance. */

.pcg-back-to-top {
  /* Brand green with a deep-green fallback for pages that do not load
     the home-v2 token set. */
  --pcg-btt-bg: var(--pcg-v2-green, #315f2f);
  --pcg-btt-bg-hover: var(--pcg-v2-green-deep, #18371f);

  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 900;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  width: 48px;
  height: 48px;
  padding: 0;
  border: 0;
  border-radius: 50%;

  color: #ffffff;
  background: var(--pcg-btt-bg);
  box-shadow: 0 10px 26px rgba(20, 32, 20, 0.28);

  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  appearance: none;

  /* Hidden by default; revealed by .is-visible when scrolled down. */
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px) scale(0.9);
  pointer-events: none;

  transition:
    opacity 220ms ease,
    transform 220ms ease,
    visibility 220ms ease,
    background-color 200ms ease,
    box-shadow 200ms ease;
}

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

.pcg-back-to-top:hover {
  background: var(--pcg-btt-bg-hover);
  box-shadow: 0 14px 32px rgba(20, 32, 20, 0.34);
  transform: translateY(-2px) scale(1);
}

.pcg-back-to-top:active {
  transform: translateY(0) scale(0.96);
}

.pcg-back-to-top:focus-visible {
  outline: 2px solid var(--pcg-v2-green-soft, #b5d993);
  outline-offset: 3px;
}

.pcg-back-to-top svg {
  width: 20px;
  height: 20px;
  display: block;
}

/* Comfortable on small touch screens: a touch closer to the edge and a
   slightly smaller footprint so it never crowds content. */
@media (max-width: 767px) {
  .pcg-back-to-top {
    right: 16px;
    bottom: 16px;
    width: 44px;
    height: 44px;
  }

  .pcg-back-to-top svg {
    width: 18px;
    height: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pcg-back-to-top {
    transition: opacity 120ms ease, visibility 120ms ease;
    transform: none;
  }

  .pcg-back-to-top.is-visible {
    transform: none;
  }

  .pcg-back-to-top:hover {
    transform: none;
  }
}
