/* Page Transitions & Smooth Scroll */

/* Lenis recommended styles */
html.lenis {
  height: auto;
}

.lenis.lenis-smooth {
  scroll-behavior: auto !important;
}

.lenis.lenis-smooth [data-lenis-prevent] {
  overscroll-behavior: contain;
}

.lenis.lenis-stopped {
  overflow: hidden;
}

.lenis.lenis-scrolling iframe {
  pointer-events: none;
}

/* Page Transition Overlay */
.transition-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-dark, #0a0a0f);
  z-index: 9999;
  pointer-events: none;
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform 0.6s cubic-bezier(0.87, 0, 0.13, 1);
}

.transition-overlay.is-active {
  transform: scaleY(1);
  transform-origin: bottom;
}

.transition-overlay.is-leaving {
  transform: scaleY(0);
  transform-origin: top;
}

/* Content Fade */
body {
  opacity: 0;
  transition: opacity 0.4s ease-out;
}

body.is-loaded {
  opacity: 1;
}

/* Deep-link highlight when arriving from the index (#effectId) */
.fx-highlight {
  animation: fx-highlight-pulse 2s ease-out;
}

@keyframes fx-highlight-pulse {
  0% { box-shadow: 0 0 0 0 rgba(124, 92, 255, 0.5); }
  30% { box-shadow: 0 0 0 6px rgba(124, 92, 255, 0.25); }
  100% { box-shadow: 0 0 0 0 rgba(124, 92, 255, 0); }
}

.panel.fx-highlight,
.scroll-block.fx-highlight,
.effect-block.fx-highlight,
.cursor-block.fx-highlight,
.layout-block.fx-highlight {
  border-color: rgba(124, 92, 255, 0.6) !important;
}

/* ── Reduced motion ─────────────────────────────────────────
   Loaded on every page. Collapses looping keyframes and long
   transitions to near-instant. JS-driven autoplay loops are
   additionally guarded in a11y.js / the per-page scripts. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    transition-delay: 0ms !important;
  }
  html { scroll-behavior: auto !important; }
  body { transition: none !important; }
  .transition-overlay { transition-duration: 0.001ms !important; }
  .fx-highlight { animation: none !important; }
}

/* ── Touch devices ──────────────────────────────────────────
   Hide the JS custom cursors (they can't track a finger sensibly)
   and restore the native cursor for hybrid touch+mouse devices. */
html.is-touch .cursor-glow,
html.is-touch #mainCursor,
html.is-touch #cursorFollower {
  display: none !important;
}
html.is-touch body { cursor: auto !important; }

/* "Desktop only" note — shown only on touch, above a pointer-only page/effect */
.desktop-note {
  display: none;
  align-items: center;
  gap: 0.55rem;
  width: min(900px, calc(100% - 2rem));
  margin: 0 auto 1.5rem;
  padding: 0.7rem 1rem;
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary, #b5b5bd);
  font-size: 0.82rem;
  line-height: 1.4;
}
.desktop-note svg { flex-shrink: 0; color: var(--text-muted, #7c7c86); }
html.is-touch .desktop-note { display: flex; }
