/* Motion contract: one controller, explicit transitions, and the existing LUNERA palette. */
html {
  overflow-x: clip;
  scroll-behavior: auto !important;
}

html.lenis,
html.lenis body {
  height: auto;
}

html.lenis.lenis-stopped {
  overflow: hidden;
}

#backToTop.scroll-progress {
  position: fixed;
  z-index: 100;
  right: 24px;
  bottom: 24px;
  display: grid;
  width: 68px;
  height: 68px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #24364f;
  background: transparent;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(18px) scale(.88);
  transition: opacity .35s cubic-bezier(.22, 1, .36, 1), visibility .35s, transform .35s cubic-bezier(.22, 1, .36, 1);
}

#backToTop.scroll-progress.is-visible,
#backToTop.scroll-progress.visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: none;
}

#backToTop.scroll-progress:focus-visible {
  outline: 3px solid #7f96b5;
  outline-offset: 4px;
}

#backToTop.scroll-progress .scroll-progress__ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  transform: rotate(-90deg);
}

#backToTop.scroll-progress .scroll-progress__ring circle {
  fill: none;
  stroke-width: 4.5;
  stroke-linecap: round;
}

#backToTop.scroll-progress .scroll-progress__track {
  stroke: rgba(75, 100, 135, .28);
}

#backToTop.scroll-progress .scroll-progress__bar {
  stroke: #4b6487;
  stroke-dasharray: 201.06;
  stroke-dashoffset: 201.06;
  transition: stroke-dashoffset .12s linear;
}

#backToTop.scroll-progress .scroll-progress__disc {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 50%;
  color: #f8fafd;
  background: #24364f;
  box-shadow: 0 12px 24px rgba(21, 36, 58, .22);
  transition: background-color .25s ease, transform .25s ease;
}

#backToTop.scroll-progress .scroll-progress__icon {
  width: 20px;
  height: 20px;
  overflow: visible;
  transform: rotate(180deg);
}

#backToTop.scroll-progress .scroll-progress__icon path {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

#backToTop.scroll-progress:hover .scroll-progress__disc,
#backToTop.scroll-progress:focus-visible .scroll-progress__disc {
  background: #4b6487;
  transform: translateY(-2px);
}

#backToTop.scroll-progress.is-returning .scroll-progress__disc {
  animation: scroll-return .75s cubic-bezier(.22, 1, .36, 1) infinite alternate;
}

@keyframes scroll-return {
  from { transform: translateY(2px); }
  to { transform: translateY(-4px); }
}

#faq .accordion .answer {
  display: block;
  height: 0;
  overflow: hidden;
  transition: height .62s cubic-bezier(.22, 1, .36, 1);
}

#faq .accordion .answer > p {
  min-height: 0;
  margin: 0;
  padding: 20px 22px;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity .38s ease, transform .62s cubic-bezier(.22, 1, .36, 1);
}

#faq .accordion article.open .answer > p {
  opacity: 1;
  transform: translateY(0);
}

#faq .accordion article .answer[aria-hidden="true"] {
  pointer-events: none;
}

html.motion-reduced .reveal,
html.motion-reduced .card-stagger > * {
  opacity: 1 !important;
  transform: none !important;
  clip-path: none !important;
  filter: none !important;
}

html.motion-reduced .ticker-track,
html.motion-reduced .hero-orbit {
  animation: none !important;
}

@media (max-width: 767px) {
  #backToTop.scroll-progress {
    right: 16px;
    bottom: 16px;
    width: 60px;
    height: 60px;
  }

  #backToTop.scroll-progress .scroll-progress__disc {
    width: 42px;
    height: 42px;
  }
}

html.motion-reduced #backToTop.scroll-progress,
html.motion-reduced #backToTop.scroll-progress .scroll-progress__disc,
html.motion-reduced #backToTop.scroll-progress .scroll-progress__bar,
html.motion-reduced #faq .accordion .answer,
html.motion-reduced #faq .accordion .answer > p {
  transition: none !important;
  animation: none !important;
}

/* Keep the return arrow optically centered in the disc in every state. */
#backToTop.scroll-progress > .scroll-progress__disc {
  position: absolute;
  top: 50%;
  left: 50%;
  margin: 0;
  transform: translate(-50%, -50%);
}

#backToTop.scroll-progress {
  color: #fff;
}

/* The generic page SVG rule also matches the nested arrow. Reset it so the
   glyph is centered by the disc grid instead of inheriting ring geometry. */
#backToTop.scroll-progress .scroll-progress__icon {
  position: static !important;
  inset: auto !important;
  display: block;
  width: 20px !important;
  height: 20px !important;
  transform: rotate(180deg) !important;
}

#backToTop.scroll-progress .scroll-progress__icon path {
  stroke: #fff;
}

#backToTop.scroll-progress:hover > .scroll-progress__disc,
#backToTop.scroll-progress:focus-visible > .scroll-progress__disc {
  transform: translate(-50%, -50%) scale(1.04);
}

#backToTop.scroll-progress.is-returning > .scroll-progress__disc {
  animation: scroll-return-centered .75s cubic-bezier(.22, 1, .36, 1) infinite alternate;
}

@keyframes scroll-return-centered {
  from { transform: translate(-50%, -50%) translateY(2px); }
  to { transform: translate(-50%, -50%) translateY(-4px); }
}
