.teco-back-to-top {
  --teco-green: #a6b013;
  --teco-gray: #333333;
  --teco-gold: #b9935a;
  --teco-white: #ffffff;
  position: fixed;
  right: calc(24px + env(safe-area-inset-right, 0px));
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  z-index: 100;
  display: grid;
  place-items: center;
  box-sizing: border-box;
  width: 48px;
  height: 48px;
  margin: 0;
  padding: 4px;
  border: 1px solid var(--teco-gold);
  border-radius: 50%;
  appearance: none;
  color: var(--teco-gray);
  background: var(--teco-white);
  box-shadow: 0 2px 6px rgb(51 51 51 / 12%);
  cursor: pointer;
  touch-action: manipulation;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 160ms ease,
    visibility 0s linear 160ms;
}

.teco-back-to-top[hidden] {
  display: none;
}

.teco-back-to-top.is-visible {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transition-delay: 0s;
}

/* An approaching collision can fade out; actual overlap must stop painting now. */
.teco-back-to-top.is-obstructed {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: none;
}

.teco-back-to-top img {
  display: block;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  object-fit: contain;
  pointer-events: none;
}

.teco-back-to-top:focus-visible {
  outline: 2px solid var(--teco-gray);
  outline-offset: 3px;
  box-shadow: 0 0 0 5px var(--teco-white);
}

@media (hover: hover) and (pointer: fine) {
  .teco-back-to-top:hover {
    border-color: var(--teco-green);
  }
}

/* Visibility also removes the control from keyboard/AT navigation. */
body.teco-mobile-v12-open .teco-back-to-top,
body:has(.teco-pdf-v61.is-open) .teco-back-to-top {
  --teco-back-to-top-blocked: 1;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: none;
}

@media (max-width: 767px) {
  .teco-back-to-top {
    right: calc(16px + env(safe-area-inset-right, 0px));
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    width: 44px;
    height: 44px;
  }
}

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