/* Simplicity / Back to top
   Independent component: does not alter typography, images or motion.js.
   Change --stt-gap or the dimensions below to adjust the button.
*/
.simplicity-back-to-top {
  --stt-gap: 28px;
  --stt-footer-clearance: 0px;
  --stt-viewport-gap: 0px;
  --stt-viewport-right-gap: 0px;
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
  position: fixed;
  z-index: 1000;
  right: 28px;
  bottom: 28px;
  right: calc(var(--stt-gap) + env(safe-area-inset-right, 0px) + var(--stt-viewport-right-gap));
  bottom: max(
    calc(var(--stt-gap) + env(safe-area-inset-bottom, 0px) + var(--stt-viewport-gap)),
    var(--stt-footer-clearance)
  );
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  padding: 0;
  margin: 0;
  border: 1px solid var(--line, #d8d8cf);
  border-radius: 50%;
  background: var(--paper, #f9f8f4);
  color: var(--ink, #292b25);
  box-shadow: 0 3px 16px rgb(41 43 37 / 7%);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(8px);
  transition:
    opacity 240ms ease,
    transform 320ms cubic-bezier(.22, 1, .36, 1),
    visibility 240ms,
    background-color 220ms ease,
    border-color 220ms ease,
    color 220ms ease,
    box-shadow 220ms ease;
}

/* Keep the browser's hidden attribute effective despite display:grid. */
.simplicity-back-to-top[hidden] {
  display: none;
}

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

.simplicity-back-to-top svg {
  display: block;
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.simplicity-back-to-top:focus-visible {
  outline: 2px solid var(--accent, #bd412c);
  outline-offset: 4px;
}

@media (hover: hover) and (pointer: fine) {
  .simplicity-back-to-top.is-visible:hover {
    background: var(--accent, #bd412c);
    border-color: var(--accent, #bd412c);
    color: var(--paper, #f9f8f4);
    box-shadow: 0 5px 18px rgb(41 43 37 / 10%);
    transform: translateY(-3px);
  }
}

.simplicity-back-to-top.is-visible:active {
  transform: translateY(0) scale(.96);
}

@media (max-width: 760px) {
  .simplicity-back-to-top {
    --stt-gap: 20px;
    width: 48px;
    height: 48px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .simplicity-back-to-top,
  .simplicity-back-to-top.is-visible,
  .simplicity-back-to-top.is-visible:hover,
  .simplicity-back-to-top.is-visible:active {
    transition: none;
    transform: none;
  }
}

@media print {
  .simplicity-back-to-top {
    display: none !important;
  }
}
