/* Shared Brclio back-to-top control, adapted from esther-design-system CTA patterns. */
.back-to-top {
  --back-to-top-size: clamp(50px, 4.5vw, 58px);
  appearance: none;
  -webkit-tap-highlight-color: transparent;
  position: fixed;
  right: calc(clamp(16px, 2.4vw, 32px) + env(safe-area-inset-right, 0px));
  bottom: calc(clamp(18px, 3vw, 34px) + env(safe-area-inset-bottom, 0px));
  z-index: 2147482000;
  display: grid;
  grid-template-rows: 1fr auto;
  place-items: center;
  width: var(--back-to-top-size);
  height: var(--back-to-top-size);
  margin: 0;
  padding: 8px 6px 6px;
  overflow: visible;
  border: 2px solid var(--ink, #1a1a2e);
  border-radius: 16px;
  background: var(--yellow, #f4d758);
  color: var(--ink, #1a1a2e);
  box-shadow:
    4px 4px 0 var(--blue, #2b7fd8),
    0 12px 26px rgba(26, 26, 46, 0.16);
  font-family: "Noto Sans SC", -apple-system, "PingFang SC", "Helvetica Neue", sans-serif;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(14px);
  transition:
    opacity 220ms ease-out,
    transform 220ms cubic-bezier(0.16, 1, 0.3, 1),
    visibility 220ms,
    box-shadow 180ms ease-out;
}

.back-to-top::after {
  content: "";
  position: absolute;
  top: 7px;
  right: 7px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--red, #e84a5f);
  box-shadow: 0 0 0 2px var(--yellow, #f4d758);
}

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

.back-to-top__arrow {
  width: 23px;
  height: 23px;
  align-self: end;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.back-to-top__label {
  align-self: start;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-indent: 0.14em;
}

.back-to-top:focus-visible {
  outline: 3px solid var(--red, #e84a5f);
  outline-offset: 5px;
}

.back-to-top:active {
  transform: translate(2px, 2px);
  box-shadow:
    2px 2px 0 var(--blue, #2b7fd8),
    0 7px 18px rgba(26, 26, 46, 0.13);
}

@media (hover: hover) {
  .back-to-top.is-visible:hover {
    transform: translateY(-2px);
    box-shadow:
      4px 6px 0 var(--blue, #2b7fd8),
      0 15px 30px rgba(26, 26, 46, 0.18);
  }

  .back-to-top.is-visible:active {
    transform: translate(2px, 2px);
  }
}

@media (max-width: 600px) {
  .back-to-top {
    --back-to-top-size: 50px;
    border-radius: 14px;
    padding-top: 7px;
  }

  .back-to-top__arrow {
    width: 21px;
    height: 21px;
  }
}

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

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