/**
 * Scroll FX
 * =========
 *
 * Page-wide scroll experience layered on top of the browse/guide pages.
 * Provides three things, wired up by js/pages/scroll-fx.js:
 *   1. A fixed, scroll-reactive canvas backdrop (a different signature
 *      effect per page — see data-scrollfx on <body>).
 *   2. A slim top scroll-progress bar.
 *   3. Reveal-on-scroll for content (a different motion per page).
 *
 * The pages keep their solid base color underneath; the canvas only shows
 * through the transparent gaps (behind cards, around sections) and is masked
 * to fade out lower on screen so body copy stays readable.
 */

/* Keep the dark base under the canvas, let body content float over it. */
html {
  background: var(--bg-primary);
}

body[data-scrollfx] {
  background: transparent;
}

/* The page header normally paints its own panel; drop it so the canvas
   shows through (its dot-grid + glow overlays stay). */
body[data-scrollfx] .page-header {
  background: transparent;
}

/* ---- Canvas backdrop ---- */
.scrollfx-bg {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  pointer-events: none;
  opacity: 0.55;
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, rgba(0, 0, 0, 0.55) 44%, transparent 82%);
  mask-image: linear-gradient(to bottom, #000 0%, rgba(0, 0, 0, 0.55) 44%, transparent 82%);
}

/* ---- Scroll progress bar ---- */
.scrollfx-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 100%;
  transform: scaleX(0);
  transform-origin: 0 50%;
  background: var(--accent-primary);
  box-shadow: 0 0 12px color-mix(in srgb, var(--accent-primary) 65%, transparent);
  z-index: 1200;
  will-change: transform;
}

/* ---- Reveal-on-scroll ---- */
[data-reveal] {
  opacity: 0;
  will-change: opacity, transform;
  transition:
    opacity 0.6s ease,
    transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1),
    clip-path 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
  transition-delay: var(--rv-delay, 0s);
}

[data-reveal="up"] { transform: translateY(28px); }
[data-reveal="left"] { transform: translateX(-34px); }
[data-reveal="scale"] { transform: scale(0.93); }
[data-reveal="clip"] {
  transform: translateY(22px);
  clip-path: inset(0 0 14% 0);
}

[data-reveal].is-visible {
  opacity: 1;
  transform: none;
  clip-path: inset(0 0 0 0);
}

/* ---- Respect reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  .scrollfx-bg { display: none; }
  [data-reveal] {
    opacity: 1 !important;
    transform: none !important;
    clip-path: none !important;
    transition: none !important;
  }
}
