/* =========================================================
   ZAR SMART SCROLL — FUTURISTIC / SCIENTIFIC / LOW-GLOW
========================================================= */

.zar-smart-scroll {
  position: fixed;
  right: clamp(14px, 2vw, 24px);
  bottom: clamp(86px, 10vh, 128px);
  z-index: 9998;

  width: 48px;
  height: 48px;
  border-radius: 999px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  border: 1px solid rgba(120, 145, 255, 0.18);

  color: rgba(234, 240, 255, 0.92);

  background:
    radial-gradient(circle at 32% 24%, rgba(132, 108, 255, 0.16), transparent 30%),
    radial-gradient(circle at 70% 72%, rgba(88, 132, 255, 0.08), transparent 44%),
    linear-gradient(180deg, rgba(19, 28, 50, 0.92), rgba(8, 13, 26, 0.94));

  box-shadow:
    0 10px 26px rgba(0, 0, 0, 0.34),
    0 0 0 1px rgba(86, 118, 255, 0.08),
    0 0 18px rgba(110, 125, 255, 0.10),
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    inset 0 -1px 0 rgba(0, 0, 0, 0.32);

  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);

  cursor: pointer;

  opacity: 0;
  visibility: hidden;
  pointer-events: none;

  transform: translateY(10px) scale(0.94);

  transition:
    opacity 180ms ease,
    visibility 180ms ease,
    transform 180ms ease,
    box-shadow 180ms ease,
    border-color 180ms ease,
    background 180ms ease;
}

.zar-smart-scroll.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.zar-smart-scroll[hidden] {
  display: none !important;
}

/* subtle outer ring */
.zar-smart-scroll::before {
  content: "";
  position: absolute;
  inset: -5px;
  border-radius: inherit;
  border: 1px solid rgba(120, 145, 255, 0.08);
  opacity: 0.9;
  pointer-events: none;
}

/* inner glass ring */
.zar-smart-scroll::after {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: inherit;
  border: 1px solid rgba(170, 190, 255, 0.10);
  pointer-events: none;
}

.zar-smart-scroll:hover {
  border-color: rgba(130, 158, 255, 0.30);

  background:
    radial-gradient(circle at 32% 24%, rgba(132, 108, 255, 0.20), transparent 32%),
    radial-gradient(circle at 70% 72%, rgba(88, 132, 255, 0.10), transparent 46%),
    linear-gradient(180deg, rgba(22, 33, 58, 0.94), rgba(10, 16, 30, 0.96));

  box-shadow:
    0 14px 30px rgba(0, 0, 0, 0.38),
    0 0 0 1px rgba(86, 118, 255, 0.10),
    0 0 22px rgba(110, 125, 255, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    inset 0 -1px 0 rgba(0, 0, 0, 0.34);
}

.zar-smart-scroll:active {
  transform: translateY(0) scale(0.96);
}

.zar-smart-scroll:focus-visible {
  outline: 2px solid rgba(126, 158, 255, 0.42);
  outline-offset: 3px;
}

/* =========================================================
   ICON
========================================================= */

.zar-smart-scroll__icon {
  position: relative;
  z-index: 2;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  font-size: 22px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: 0;

  color: rgba(243, 246, 255, 0.95);
  text-shadow: 0 0 10px rgba(115, 138, 255, 0.10);

  transition:
    transform 180ms ease,
    opacity 180ms ease;
}

.zar-smart-scroll[data-direction="down"] .zar-smart-scroll__icon {
  transform: translateY(1px);
}

.zar-smart-scroll[data-direction="up"] .zar-smart-scroll__icon {
  transform: translateY(-1px);
}

/* =========================================================
   OPTIONAL STATE HELPERS
========================================================= */

.zar-smart-scroll.is-up {
  border-color: rgba(132, 154, 255, 0.22);
}

.zar-smart-scroll.is-down {
  border-color: rgba(120, 145, 255, 0.18);
}

.zar-smart-scroll.has-new-content::before {
  animation: zarSmartScrollPulse 1.1s ease-out;
}

@keyframes zarSmartScrollPulse {
  0% {
    transform: scale(1);
    opacity: 0.75;
  }
  100% {
    transform: scale(1.24);
    opacity: 0;
  }
}

/* =========================================================
   MOBILE
   - smaller
   - softer glow
   - less visual dominance
========================================================= */

@media (max-width: 720px) {
  .zar-smart-scroll {
    width: 44px;
    height: 44px;
    right: 14px;
    bottom: 110px;

    box-shadow:
      0 8px 20px rgba(0, 0, 0, 0.30),
      0 0 0 1px rgba(86, 118, 255, 0.07),
      0 0 14px rgba(110, 125, 255, 0.09),
      inset 0 1px 0 rgba(255, 255, 255, 0.05),
      inset 0 -1px 0 rgba(0, 0, 0, 0.32);
  }

  .zar-smart-scroll__icon {
    font-size: 20px;
  }

  .zar-smart-scroll::before {
    inset: -4px;
    border-color: rgba(120, 145, 255, 0.06);
  }

  .zar-smart-scroll::after {
    inset: 4px;
  }
}

/* =========================================================
   REDUCED MOTION
========================================================= */

@media (prefers-reduced-motion: reduce) {
  .zar-smart-scroll,
  .zar-smart-scroll__icon,
  .zar-smart-scroll::before,
  .zar-smart-scroll::after {
    transition: none;
    animation: none;
  }
}