/* === SCROLL REVEAL ANIMATIONS === */
[data-reveal] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}
[data-reveal].revealed {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger children in grids */
.problem-card[data-reveal]:nth-child(2) { transition-delay: 0.1s; }
.problem-card[data-reveal]:nth-child(3) { transition-delay: 0.2s; }

.outcome-card[data-reveal]:nth-child(2) { transition-delay: 0.08s; }
.outcome-card[data-reveal]:nth-child(3) { transition-delay: 0.16s; }
.outcome-card[data-reveal]:nth-child(4) { transition-delay: 0.24s; }
.outcome-card[data-reveal]:nth-child(5) { transition-delay: 0.32s; }
.outcome-card[data-reveal]:nth-child(6) { transition-delay: 0.40s; }

.why-card[data-reveal]:nth-child(2) { transition-delay: 0.1s; }
.why-card[data-reveal]:nth-child(3) { transition-delay: 0.2s; }

.tyche-feat[data-reveal]:nth-child(2) { transition-delay: 0.1s; }
.tyche-feat[data-reveal]:nth-child(3) { transition-delay: 0.2s; }

/* === GRAIN OVERLAY === */
.grain-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 128px 128px;
}

/* === FLOATING GLOW ORBS === */
.glow-orb {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: -1;
  filter: blur(120px);
  opacity: 0.12;
}
.glow-1 {
  width: 500px; height: 500px;
  background: #6366f1;
  top: -100px; right: -100px;
  animation: glow-drift-1 20s ease-in-out infinite;
}
.glow-2 {
  width: 400px; height: 400px;
  background: #8b5cf6;
  bottom: 20%; left: -80px;
  animation: glow-drift-2 25s ease-in-out infinite;
}
@keyframes glow-drift-1 {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(-60px, 80px); }
  50% { transform: translate(-30px, 40px); }
  75% { transform: translate(40px, -20px); }
}
@keyframes glow-drift-2 {
  0%, 100% { transform: translate(0, 0); }
  33% { transform: translate(80px, -40px); }
  66% { transform: translate(30px, 60px); }
}

/* === DOT GRID BACKGROUND === */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: -2;
  background-image: radial-gradient(circle, rgba(99, 102, 241, 0.08) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
  mask-image: radial-gradient(ellipse 60% 50% at 50% 50%, black, transparent);
  -webkit-mask-image: radial-gradient(ellipse 60% 50% at 50% 50%, black, transparent);
}

/* === ENHANCED CARD HOVER GLOW === */
.problem-card,
.outcome-card,
.why-card {
  position: relative;
  overflow: hidden;
  transition: border-color 0.3s, transform 0.3s, box-shadow 0.3s;
}
.problem-card:hover,
.outcome-card:hover,
.why-card:hover {
  border-color: rgba(99, 102, 241, 0.25);
  transform: translateY(-4px);
  box-shadow: 0 8px 32px rgba(99, 102, 241, 0.08);
}

/* Inner glow on hover */
.problem-card::after,
.outcome-card::after,
.why-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  opacity: 0;
  transition: opacity 0.3s;
  background: radial-gradient(600px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
    rgba(99, 102, 241, 0.06), transparent 40%);
  pointer-events: none;
}
.problem-card:hover::after,
.outcome-card:hover::after,
.why-card:hover::after {
  opacity: 1;
}

/* === ANIMATED COUNTER (outcome metrics) === */
.outcome-metric {
  transition: transform 0.3s;
}
.outcome-card:hover .outcome-metric {
  transform: scale(1.08);
}

/* === ENHANCED STEP NUMBERS === */
.step-num {
  transition: transform 0.3s, box-shadow 0.3s;
}
.step:hover .step-num {
  transform: scale(1.1);
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.4);
}

/* === TYCHE ORB ENHANCEMENT === */
.orb-core {
  transition: box-shadow 0.5s;
}
.tyche-orb:hover .orb-core {
  box-shadow: 0 0 40px rgba(99, 102, 241, 0.3), 0 0 80px rgba(99, 102, 241, 0.1);
}

/* === BUTTON GLOW ON HOVER === */
.btn-primary {
  position: relative;
  transition: all 0.3s;
}
.btn-primary:hover {
  box-shadow: 0 4px 20px rgba(255, 255, 255, 0.15);
}

/* === NAV BORDER GLOW ON SCROLL === */
.nav.scrolled {
  border-bottom-color: rgba(99, 102, 241, 0.12);
}

/* === DEMO PREVIEW CARD ANIMATION === */
.demo-preview {
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.4s;
}
.demo-cta-box:hover .demo-preview {
  transform: translateY(-4px) rotate(-0.5deg);
  box-shadow: 0 16px 48px rgba(99, 102, 241, 0.12);
}

/* === PREVIEW STEPS ENTRANCE === */
.preview-step {
  opacity: 0;
  animation: step-appear 0.5s ease forwards;
}
.preview-step:nth-child(1) { animation-delay: 0.5s; }
.preview-step:nth-child(2) { animation-delay: 1.2s; }
.preview-step:nth-child(3) { animation-delay: 1.9s; }

@keyframes step-appear {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: translateX(0); }
}

/* === CTA BOX GRADIENT SHIMMER === */
.cta-box {
  position: relative;
  overflow: hidden;
}
.cta-box::before {
  content: '';
  position: absolute;
  top: -50%; left: -50%;
  width: 200%; height: 200%;
  background: conic-gradient(
    from 0deg,
    transparent 0%,
    rgba(99, 102, 241, 0.03) 10%,
    transparent 20%
  );
  animation: cta-shimmer 8s linear infinite;
  pointer-events: none;
}
@keyframes cta-shimmer {
  to { transform: rotate(360deg); }
}

/* === SMOOTH SECTION BORDERS === */
section {
  position: relative;
}

/* === STEP LINE PULSE === */
.step-line {
  position: relative;
  overflow: hidden;
}
.step-line::after {
  content: '';
  position: absolute;
  top: 0; left: -100%; bottom: 0;
  width: 60%;
  background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.6), transparent);
  animation: line-pulse 3s ease-in-out infinite;
}
@keyframes line-pulse {
  0% { left: -60%; }
  100% { left: 160%; }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  [data-reveal] {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .glow-orb,
  .grain-overlay,
  body::before {
    display: none;
  }
  .preview-step {
    opacity: 1;
    animation: none;
  }
  .cta-box::before {
    animation: none;
  }
  .step-line::after {
    animation: none;
  }
}
