/* 🧭 Scroll Shuttle - Global Floating Component */

.scroll-shuttle {
  appearance: none;
  position: fixed !important;
  left: 50% !important;
  bottom: max(1.15rem, env(safe-area-inset-bottom)) !important;
  z-index: 9999 !important;
  display: inline-grid !important;
  place-items: center !important;
  width: 2.68rem !important;
  height: 2.68rem !important;
  margin: 0 !important;
  padding: 0 !important;
  transform: translateX(-50%);
  border-radius: 999px;
  cursor: pointer;
  outline: none;
  
  /* Glass/Neon Theme */
  color: rgba(226, 242, 255, 0.92);
  border: 1px solid rgba(var(--scene-accent-rgb, 34, 211, 238), 0.20);
  background: rgba(15, 23, 42, 0.6) !important;
  backdrop-filter: blur(var(--blur-mid)) saturate(var(--sat-shuttle));
  -webkit-backdrop-filter: blur(var(--blur-mid)) saturate(var(--sat-shuttle));
  box-shadow:
    0 12px 30px rgba(0, 0, 0, 0.35),
    0 0 16px rgba(var(--scene-accent-rgb, 34, 211, 238), 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  
  transition:
    transform 280ms cubic-bezier(0.2, 0.8, 0.2, 1),
    opacity 280ms ease,
    background-color 280ms ease,
    border-color 280ms ease,
    box-shadow 280ms ease;
}

.scroll-shuttle:hover {
  transform: translateX(-50%) translateY(-1px);
  border-color: rgba(var(--scene-accent-rgb, 34, 211, 238), 0.38);
  background-color: rgba(15, 23, 42, 0.8) !important;
  box-shadow:
    0 12px 30px rgba(0, 0, 0, 0.4),
    0 0 20px rgba(var(--scene-accent-rgb, 34, 211, 238), 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

/* 🙈 Hidden State (e.g. while in Command Bridge) */
.scroll-shuttle--hidden {
  opacity: 0 !important;
  pointer-events: none !important;
  transform: translateX(-50%) translateY(1rem) !important;
}

.scroll-shuttle__icon {
  display: inline-grid;
  place-items: center;
  font-size: 1.3rem;
  line-height: 1;
  --icon-rotation: 0deg;
  --icon-scale: 1;
  transform: rotate(var(--icon-rotation)) scale(var(--icon-scale));
  transform-origin: 50% 50%;
  transition:
    transform 380ms cubic-bezier(0.22, 1, 0.36, 1),
    color 280ms ease,
    filter 280ms ease;
  color: rgba(226, 242, 255, 0.92);
}

/* Icon-specific Hover enhancement */
.scroll-shuttle:hover .scroll-shuttle__icon {
  --icon-scale: 1.06;
  filter: brightness(1.04) drop-shadow(0 0 6px rgba(34, 211, 238, 0.16));
}

/* 🚀 Attention State: Pulsing CTA */
.scroll-shuttle--attention {
  animation: attentionGlow 2.5s infinite ease-in-out;
}

.scroll-shuttle--attention .scroll-shuttle__icon {
  animation: attentionIconPulse 2.5s infinite ease-in-out !important;
}

@keyframes attentionGlow {
  0%, 100% { border-color: rgba(34, 211, 238, 0.20); box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35), 0 0 16px rgba(34, 211, 238, 0.08); }
  50% { border-color: rgba(34, 211, 238, 0.38); box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45), 0 0 24px rgba(34, 211, 238, 0.16); }
}

@keyframes attentionIconPulse {
  0%, 100% { transform: rotate(var(--icon-rotation)) scale(1); opacity: 0.82; }
  50% { transform: rotate(var(--icon-rotation)) scale(1.11); opacity: 1; filter: brightness(1.08) drop-shadow(0 0 6px rgba(34, 211, 238, 0.22)); }
}

/* State: Return to Top */
html.scroll-shuttle--return .scroll-shuttle__icon,
[data-scroll-shuttle][aria-expanded="true"] .scroll-shuttle__icon {
  --icon-rotation: 180deg;
  animation-direction: reverse; /* Re-apply animation direction here */
  color: rgba(34, 211, 238, 0.9); /* Cyan color for return state */
  filter: drop-shadow(0 0 4px rgba(34, 211, 238, 0.22));
}

@keyframes shuttlePulse {
  0%, 100% { opacity: 0.82; }
  50% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .scroll-shuttle, .scroll-shuttle__icon {
    transition: none !important;
    animation: none !important;
  }
}