/* =========================================================================
   Sayed AB - Floating utilities (WhatsApp + Back to top)          v261

   Deliberately plain: two small circles in the bottom-right corner.
   - WhatsApp uses the official brand green and the official glyph.
   - Back-to-top stays hidden until the visitor has scrolled down.
   - Both lift clear of the sticky bottom CTA bar on the pages that have one,
     and clear of the iOS home indicator.
   ========================================================================= */

.sab-float {
  position: fixed;
  right: 14px;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}

.sab-float > * {
  pointer-events: auto;
}

.sab-float-btn {
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(20, 77, 158, 0.14);
  background: #fff;
  box-shadow: 0 6px 18px rgba(12, 38, 84, 0.16);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition:
    transform 0.18s ease,
    opacity 0.2s ease,
    box-shadow 0.18s ease,
    visibility 0.2s ease;
}

.sab-float-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(12, 38, 84, 0.22);
}

.sab-float-btn:active {
  transform: translateY(0) scale(0.96);
}

.sab-float-btn:focus-visible {
  outline: 3px solid rgba(15, 79, 179, 0.45);
  outline-offset: 3px;
}

.sab-float-btn svg {
  display: block;
  width: 24px;
  height: 24px;
}

/* ---- WhatsApp ---------------------------------------------------------- */
.sab-wa {
  background: #25d366;
  border-color: rgba(0, 0, 0, 0.06);
  box-shadow: 0 6px 18px rgba(18, 140, 75, 0.28);
}

.sab-wa:hover {
  background: #1ebe5b;
  box-shadow: 0 10px 24px rgba(18, 140, 75, 0.34);
}

.sab-wa svg {
  width: 26px;
  height: 26px;
  fill: #fff;
}

/* ---- Back to top ------------------------------------------------------- */
.sab-top {
  color: #0f4fb3;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
}

.sab-top.is-on {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.sab-top svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
}

/* ---- Play nicely with the sticky bottom CTA bar ------------------------
   On learn-quran and blog articles the sticky bar already carries a
   WhatsApp button, so the floating one is hidden there on mobile to avoid
   two identical buttons on one screen. Back-to-top simply moves up. */
@media (max-width: 760px) {
  html.has-sticky-cta .sab-float {
    bottom: calc(84px + env(safe-area-inset-bottom, 0px));
  }

  html.has-sticky-cta .sab-wa {
    display: none;
  }
}

@media (max-width: 480px) {
  .sab-float {
    right: 12px;
    gap: 9px;
  }

  .sab-float-btn {
    width: 46px;
    height: 46px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sab-float-btn {
    transition: none;
  }
}

@media print {
  .sab-float {
    display: none !important;
  }
}
