/* ------------------------------------------------------------
   "To top" button (totop.js): outlined arrow bottom right inside
   the frame, like the download arrow; fills in on hover.
   ------------------------------------------------------------ */

.to-top {
  position: fixed;
  z-index: 4;
  /* Distance from the frame lines and size, in design pixels */
  right: calc(var(--margin) + 68 * var(--u));
  bottom: calc(var(--margin) + 84 * var(--u));
  width: max(30px, calc(64 * var(--u)));
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0s 0.4s;
}

.to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.4s ease, visibility 0s;
}

/* Not over the imprint / privacy or project pop-ups */
.legal-open .to-top,
.popup-open .to-top {
  opacity: 0;
  visibility: hidden;
}

.to-top svg {
  display: block;
  width: 100%;
  overflow: visible;
  /* White inside, so content scrolling underneath doesn't show through */
  fill: var(--bg);
  stroke: currentColor;
  stroke-width: var(--stroke);
  transition: fill 0.3s ease;
}

.to-top svg * {
  vector-effect: non-scaling-stroke;
}

.to-top:hover svg,
.to-top:focus-visible svg {
  fill: currentColor;
}

.to-top:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 6px;
}

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