/* ============================================
   ONBOARDING V2 — Progressive Annotated Walkthrough
   Premium camera-app aesthetic: VSCO / Halide / Lightroom first-run feel
   Scrim + spotlight cutout + handwritten annotations
   Tap anywhere to advance.
   ============================================ */

/* ─── Competing UI suppression ──────────────────────────────────
   Force-hide distracting elements during onboarding.
   Uses body class for CSS specificity, !important to override JS. */
body.onboarding-active .soft-upsell-banner,
body.onboarding-active #softUpsellBanner,
body.onboarding-active .rate-limit-banner,
body.onboarding-active #rateLimitBanner,
body.onboarding-active .free-edit-timer,
body.onboarding-active .editor-timer-banner,
body.onboarding-active .weekly-free-banner,
body.onboarding-active .ad-banner-bottom,
body.onboarding-active .bottom-banner {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* ─── Full-screen click blocker ─────────────────────────────────
   Prevents all interaction with underlying UI during onboarding.
   Sits below the highlight but above all app UI. */
.onboarding-blocker {
  position: fixed;
  inset: 0;
  z-index: 9989;
  pointer-events: auto;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* ─── Highlight / Scrim ────────────────────────────────────────
   Deep cinematic scrim — app UI nearly vanishes.
   Only the spotlight cutout remains visible. */
.onboarding-highlight {
  position: fixed;
  z-index: 9990;
  pointer-events: none;
  border-radius: 14px;
  box-shadow:
    0 0 0 9999px rgba(0, 0, 0, 0.84),
    0 0 40px 8px rgba(139, 124, 246, 0.25),
    inset 0 0 20px 4px rgba(139, 124, 246, 0.08);
  transition:
    top 0.5s cubic-bezier(0.34, 1.56, 0.64, 1),
    left 0.5s cubic-bezier(0.34, 1.56, 0.64, 1),
    width 0.5s cubic-bezier(0.34, 1.56, 0.64, 1),
    height 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  animation: onb-highlight-enter 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes onb-highlight-enter {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Pulsing violet glow ring around spotlight */
.onboarding-highlight::after {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 20px;
  border: 2.5px solid rgba(139, 124, 246, 0.6);
  box-shadow:
    0 0 16px 4px rgba(139, 124, 246, 0.3),
    inset 0 0 16px 4px rgba(139, 124, 246, 0.1);
  animation: onb-ring-pulse 2.2s ease-in-out infinite;
  pointer-events: none;
}

@keyframes onb-ring-pulse {
  0%, 100% {
    opacity: 0.5;
    transform: scale(1);
    box-shadow:
      0 0 16px 4px rgba(139, 124, 246, 0.2),
      inset 0 0 16px 4px rgba(139, 124, 246, 0.05);
  }
  50% {
    opacity: 1;
    transform: scale(1.03);
    box-shadow:
      0 0 24px 8px rgba(139, 124, 246, 0.4),
      inset 0 0 20px 6px rgba(139, 124, 246, 0.15);
  }
}

/* Dark mode: even deeper scrim */
.pro-mode .onboarding-highlight {
  box-shadow:
    0 0 0 9999px rgba(0, 0, 0, 0.92),
    0 0 50px 12px rgba(139, 124, 246, 0.3),
    inset 0 0 24px 6px rgba(139, 124, 246, 0.1);
}

/* ─── Annotation container ─────────────────────────────────────
   Spring-physics entrance: overshoots then settles. */
.onboarding-annotation {
  position: fixed;
  z-index: 9992;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  animation: onb-annotation-in 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes onb-annotation-in {
  0% {
    opacity: 0;
    transform: translateY(18px) scale(0.85);
  }
  60% {
    opacity: 1;
    transform: translateY(-3px) scale(1.02);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ─── Handwritten annotation text ──────────────────────────────
   Bold, warm, impossible to miss. Violet-tinged glassmorphism. */
.onboarding-text {
  font-family: 'Caveat', cursive;
  font-size: 1.85rem;
  font-weight: 700;
  line-height: 1.25;
  color: #fff;
  transform: rotate(-1.5deg);
  white-space: nowrap;
  max-width: 340px;
  text-align: center;
  background: rgba(20, 10, 40, 0.75);
  padding: 10px 24px;
  border-radius: 24px;
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid rgba(139, 124, 246, 0.3);
  box-shadow:
    0 4px 24px rgba(0, 0, 0, 0.4),
    0 0 20px rgba(139, 124, 246, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  text-shadow: 0 1px 8px rgba(139, 124, 246, 0.4);
  letter-spacing: 0.01em;
}

/* ─── "Tap to continue" hint ───────────────────────────────────
   Gentle bounce — alive, not just fading. */
.onboarding-tap-hint {
  font-family: 'Caveat', cursive;
  font-size: 1.05rem;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.7);
  text-align: center;
  pointer-events: none;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.4);
  animation: onb-hint-bounce 2.4s ease-in-out infinite;
  animation-delay: 1.2s;
  opacity: 0;
}

@keyframes onb-hint-bounce {
  0% { opacity: 0.65; transform: translateY(0); }
  15% { opacity: 0.9; transform: translateY(-4px); }
  30% { opacity: 0.65; transform: translateY(0); }
  45% { opacity: 0.9; transform: translateY(-3px); }
  60%, 100% { opacity: 0.65; transform: translateY(0); }
}

/* ─── SVG arrow ────────────────────────────────────────────────
   Thick, glowing, undeniable. */
.onboarding-arrow {
  position: absolute;
  z-index: 9991;
  pointer-events: none;
  overflow: visible;
}

.onboarding-arrow path {
  fill: none;
  stroke: #fff;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter:
    drop-shadow(0 0 6px rgba(139, 124, 246, 0.5))
    drop-shadow(0 2px 8px rgba(0, 0, 0, 0.5));
}

/* Draw-in animation — smooth reveal */
.onboarding-arrow path.onb-draw-in {
  stroke-dasharray: var(--path-length);
  stroke-dashoffset: var(--path-length);
  animation: onb-draw 0.7s cubic-bezier(0.4, 0, 0.2, 1) 0.15s forwards;
}

@keyframes onb-draw {
  to { stroke-dashoffset: 0; }
}

/* Arrowhead — pops in with scale after line draws */
.onboarding-arrow polygon {
  fill: #fff;
  opacity: 0;
  transform-origin: center;
  filter:
    drop-shadow(0 0 6px rgba(139, 124, 246, 0.5))
    drop-shadow(0 2px 8px rgba(0, 0, 0, 0.5));
  animation: onb-arrowhead-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) 0.7s forwards;
}

@keyframes onb-arrowhead-in {
  from {
    opacity: 0;
    transform: scale(0.5);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* ─── Skip button ──────────────────────────────────────────────
   Subtle glassmorphic pill — present but not competing. */
.onboarding-skip {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 9995;
  padding: 8px 20px;
  font-family: 'Caveat', cursive;
  font-size: 1.1rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.8);
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50px;
  cursor: pointer;
  pointer-events: auto;
  transition: all 0.2s ease;
  animation: onb-annotation-in 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  -webkit-tap-highlight-color: transparent;
}

.onboarding-skip:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border-color: rgba(139, 124, 246, 0.4);
  box-shadow: 0 0 16px rgba(139, 124, 246, 0.2);
}

.onboarding-skip:active {
  transform: scale(0.94);
}

/* ─── Step counter ─────────────────────────────────────────────
   Understated — information, not decoration. */
.onboarding-counter {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9995;
  font-family: 'Caveat', cursive;
  font-size: 1.1rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.65);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  animation: onb-annotation-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  letter-spacing: 0.05em;
}

/* ─── Responsive (mobile) ──────────────────────────────────────
   Mobile is the primary viewport — keep text bold and readable. */
@media (max-width: 768px) {
  .onboarding-text {
    font-size: 1.65rem;
    max-width: 280px;
    padding: 8px 20px;
  }
  .onboarding-tap-hint {
    font-size: 0.95rem;
  }
  .onboarding-skip {
    top: 10px;
    right: 10px;
    padding: 6px 16px;
    font-size: 1rem;
  }
  .onboarding-counter {
    top: 12px;
    font-size: 1rem;
  }
}

/* ─── Large screens ────────────────────────────────────────────
   Scale up for desktop — annotation should still command attention. */
@media (min-width: 1024px) {
  .onboarding-text {
    font-size: 2.1rem;
    max-width: 400px;
    padding: 12px 28px;
  }
  .onboarding-tap-hint {
    font-size: 1.15rem;
  }
}
