/**
 * Mobile back-to-top button (single articles).
 */

.ta-back-top {
  display: none;
}

@media (max-width: 1023px) {
  .ta-back-top {
    position: fixed;
    right: max(12px, env(safe-area-inset-right));
    bottom: max(16px, env(safe-area-inset-bottom));
    z-index: 10050;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 12px;
    background: #0b0e11;
    color: #d6ff3e;
    box-shadow: 0 8px 24px rgba(11, 14, 17, 0.28);
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transform: translateY(8px);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease, bottom 0.2s ease;
  }

  .ta-back-top.is-visible {
    display: inline-flex;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }

  .ta-back-top:focus-visible {
    outline: 2px solid #d6ff3e;
    outline-offset: 2px;
  }

  /* Stay above the sticky YouTube mini-player when present. */
  body.ta-has-yt-sticky .ta-back-top {
    bottom: calc(max(10px, env(safe-area-inset-bottom)) + min(280px, calc(100vw - 20px)) * 0.5625 + 18px);
  }

  [data-theme="dark"] .ta-back-top,
  .ta-dark .ta-back-top {
    background: #d6ff3e;
    color: #0b0e11;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ta-back-top {
    transition: none;
  }
}
