/*
 * sp-effects.css — Animations, reveal, cursor, theme transitions
 */

/* ============================================================
   SCROLL REVEAL
   ============================================================ */
.sp-reveal {
  opacity: 0;
  transform: translateY(24px);
  transition:
    opacity 0.7s var(--sp-ease),
    transform 0.7s var(--sp-ease);
}

.sp-reveal.in {
  opacity: 1;
  transform: none;
}

/* Stagger delays for sibling reveals */
.sp-reveal:nth-child(1) { transition-delay: 0ms; }
.sp-reveal:nth-child(2) { transition-delay: 80ms; }
.sp-reveal:nth-child(3) { transition-delay: 160ms; }
.sp-reveal:nth-child(4) { transition-delay: 240ms; }
.sp-reveal:nth-child(5) { transition-delay: 320ms; }
.sp-reveal:nth-child(6) { transition-delay: 400ms; }

/* Reveal from left */
.sp-reveal-left {
  opacity: 0;
  transform: translateX(-24px);
  transition: opacity 0.7s var(--sp-ease), transform 0.7s var(--sp-ease);
}

.sp-reveal-left.in {
  opacity: 1;
  transform: none;
}

/* ============================================================
   MAGNETIC BUTTON STYLE
   ============================================================ */
.sp-magnetic {
  transition: transform 0.25s cubic-bezier(0.2, 0.7, 0.3, 1);
}

/* ============================================================
   CURSOR BLOB — custom follower
   ============================================================ */
#sp-cursor {
  position: fixed;
  width: 20px;
  height: 20px;
  border-radius: var(--sp-r-full);
  background: rgba(124, 92, 255, 0.5);
  pointer-events: none;
  z-index: 9998;
  transform: translate(-50%, -50%);
  transition: width 0.25s var(--sp-ease), height 0.25s var(--sp-ease), background 0.25s, opacity 0.25s;
  mix-blend-mode: screen;
  will-change: left, top;
  opacity: 0;
}

#sp-cursor.visible {
  opacity: 1;
}

#sp-cursor.hover {
  width: 44px;
  height: 44px;
  background: rgba(124, 92, 255, 0.3);
}

/* Only show cursor on hoverable devices */
@media (hover: none) {
  #sp-cursor {
    display: none !important;
  }
}

/* ============================================================
   STICKY CTA BAR
   ============================================================ */
#sp-sticky-cta {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 400;
  background: var(--sp-bg-2);
  border-top: 1px solid var(--sp-line);
  padding: 12px var(--sp-3);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  transform: translateY(100%);
  transition: transform 0.4s var(--sp-ease);
  backdrop-filter: blur(12px);
}

#sp-sticky-cta.visible {
  transform: translateY(0);
}

.sp-sticky-cta-msg {
  font-size: var(--sp-t-sm);
  font-weight: 500;
  color: var(--sp-fg-2);
  flex: 1;
}

.sp-sticky-cta-msg a {
  color: var(--sp-accent);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.sp-sticky-cta-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: var(--sp-r-sm);
  background: transparent;
  border: 1px solid var(--sp-line-2);
  color: var(--sp-mute);
  cursor: pointer;
  font-size: 16px;
  flex-shrink: 0;
  transition: all 0.15s;
}

.sp-sticky-cta-close:hover {
  color: var(--sp-fg);
  border-color: var(--sp-fg-2);
}

@media (max-width: 480px) {
  #sp-sticky-cta {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 12px var(--sp-2);
  }

  .sp-sticky-cta-close {
    position: absolute;
    top: 10px;
    right: 10px;
  }
}

/* ============================================================
   TOAST (Konami + notifications)
   ============================================================ */
#sp-toast {
  position: fixed;
  bottom: var(--sp-4);
  right: var(--sp-4);
  z-index: 9000;
  background: var(--sp-bg-2);
  border: 1px solid var(--sp-line);
  border-radius: var(--sp-r-md);
  padding: var(--sp-2) var(--sp-3);
  max-width: 300px;
  box-shadow: var(--sp-shadow-lg);
  transform: translateY(20px);
  opacity: 0;
  transition: transform 0.4s var(--sp-ease), opacity 0.4s;
  pointer-events: none;
}

#sp-toast.show {
  transform: none;
  opacity: 1;
  pointer-events: auto;
}

.sp-toast-title {
  font-size: var(--sp-t-sm);
  font-weight: 700;
  color: var(--sp-fg);
  margin-bottom: 4px;
}

.sp-toast-sub {
  font-size: var(--sp-t-xs);
  color: var(--sp-mute);
}

.sp-toast-sub a {
  color: var(--sp-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ============================================================
   THEME TRANSITION — smooth crossfade
   ============================================================ */
html {
  transition: background-color 0.2s var(--sp-ease);
}

/* ============================================================
   HOVER SPOTLIGHT ON CARDS (JS-driven via CSS custom props)
   ============================================================ */
.sp-spotlight {
  position: relative;
  overflow: hidden;
}

.sp-spotlight::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(
    300px circle at var(--mx, -100%) var(--my, -100%),
    rgba(124, 92, 255, 0.1),
    transparent 70%
  );
  opacity: 0;
  transition: opacity 0.3s;
  z-index: 0;
  pointer-events: none;
}

.sp-spotlight:hover::before {
  opacity: 1;
}

/* ============================================================
   FOCUS STYLES (a11y)
   ============================================================ */
:focus-visible {
  outline: 2px solid var(--sp-accent);
  outline-offset: 3px;
  border-radius: 3px;
}

/* ============================================================
   REDUCE MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .sp-reveal,
  .sp-reveal-left {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .sp-magnetic {
    transition: none;
  }

  #sp-cursor {
    display: none;
  }
}
