/**
 * Premium Landing Page Animation Styles
 * Subtle, performant animations that respect accessibility
 */

/* 3D Tilt Effects */
.hero-screenshot,
.feature-screenshot {
    transition: transform 300ms cubic-bezier(0.2, 0.7, 0.2, 1);
    transform-style: preserve-3d;
    will-change: transform;
}

/* Scroll Reveal Animations */
.reveal {
    opacity: 0;
    transform: translateY(24px);
    filter: blur(6px);
    transition: all 420ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.reveal.in {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
}

/* Staggered reveal delays for feature blocks */
.reveal:nth-child(1) { transition-delay: 0ms; }
.reveal:nth-child(2) { transition-delay: 100ms; }
.reveal:nth-child(3) { transition-delay: 200ms; }
.reveal:nth-child(4) { transition-delay: 300ms; }

/* Headline Shimmer Effect */
.headline-shimmer {
    background: linear-gradient(
        90deg,
        #a78bfa 0%,
        #f472b6 25%,
        #60a5fa 50%,
        #a78bfa 75%,
        #f472b6 100%
    );
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    background-size: 200% 100%;
    animation: shimmer 6s ease-in-out infinite;
}

@keyframes shimmer {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Spotlight Effect */
.spotlight {
    position: relative;
    overflow: hidden;
}

.spotlight::after {
    content: '';
    position: absolute;
    inset: -200%;
    background: radial-gradient(
        600px 600px at var(--mx, 50%) var(--my, 50%),
        rgba(255, 255, 255, 0.12) 0%,
        rgba(255, 255, 255, 0.06) 30%,
        transparent 60%
    );
    transition: opacity 0.3s ease;
    opacity: 0;
    pointer-events: none;
}

.spotlight:hover::after {
    opacity: 1;
}

/* Enhanced CTA Button Effects */
.cta-enhanced {
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.cta-enhanced::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );
    transition: left 0.5s;
}

.cta-enhanced:hover::before {
    left: 100%;
}

.cta-enhanced:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

/* Pulse Effect for CTAs */
.cta-pulse {
    transition: all 0.3s ease;
}

.cta-pulse.pulse-active {
    animation: subtle-pulse 1.5s ease-in-out infinite;
}

@keyframes subtle-pulse {
    0%, 100% { 
        box-shadow: 0 0 0 0 rgba(168, 85, 247, 0.4);
        transform: scale(1);
    }
    50% { 
        box-shadow: 0 0 0 8px rgba(168, 85, 247, 0);
        transform: scale(1.02);
    }
}

/* Parallax Background Elements */
.parallax-bg {
    will-change: transform;
    transition: transform 0.1s ease-out;
}

/* Glass Card Hover Enhancement */
.glass-enhanced {
    transition: all 0.3s cubic-bezier(0.2, 0.7, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.125);
}

.glass-enhanced:hover {
    transform: translateY(-4px);
    border-color: rgba(168, 85, 247, 0.3);
    box-shadow: 
        0 20px 25px -5px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(168, 85, 247, 0.1);
}

/* Floating Animation Enhancement */
.float-enhanced {
    animation: enhanced-float 6s ease-in-out infinite;
}

@keyframes enhanced-float {
    0%, 100% { 
        transform: translateY(0px) rotate(0deg); 
        opacity: 0.6; 
    }
    25% { 
        transform: translateY(-10px) rotate(2deg); 
        opacity: 0.8; 
    }
    50% { 
        transform: translateY(-20px) rotate(0deg); 
        opacity: 1; 
    }
    75% { 
        transform: translateY(-10px) rotate(-2deg); 
        opacity: 0.8; 
    }
}

/* Image Loading States */
.screenshot-loading {
    background: linear-gradient(90deg, #374151 25%, #4b5563 50%, #374151 75%);
    background-size: 200% 100%;
    animation: loading-shimmer 1.5s infinite;
    min-height: 300px;
}

@keyframes loading-shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* Reduce motion preferences support */
@media (prefers-reduced-motion: reduce) {
    .hero-screenshot,
    .feature-screenshot,
    .reveal,
    .cta-enhanced,
    .glass-enhanced,
    .parallax-bg {
        transition: none !important;
        animation: none !important;
        transform: none !important;
    }
    
    .headline-shimmer {
        background: linear-gradient(90deg, #a78bfa, #f472b6, #60a5fa);
        -webkit-background-clip: text;
        background-clip: text;
        color: transparent;
        animation: none;
    }
}

/* Performance optimizations */
.reveal,
.hero-screenshot,
.feature-screenshot,
.parallax-bg {
    backface-visibility: hidden;
    perspective: 1000px;
}

/* Focus states for accessibility */
.cta-enhanced:focus-visible {
    outline: 2px solid #a78bfa;
    outline-offset: 2px;
}

/* Gap fix utility for features when Tailwind gap utilities are missing */
/* Only takes effect where the class is applied (features grid on landing page) */
.gap-fix {
    row-gap: 3rem; /* 48px vertical gap on small screens where grid stacks */
}

@media (min-width: 1024px) { /* lg breakpoint */
    .gap-fix {
        row-gap: 0;           /* no vertical gap when in 2 columns */
        column-gap: 3rem;     /* 48px horizontal gap between columns */
    }
}

/* Features stack vertical spacing (between rows) */
/* Ensures consistent vertical rhythm even if Tailwind 'space-y-*' utilities are missing */
.features-stack-space > * + * {
    margin-top: 4rem; /* 64px on small screens */
}

@media (min-width: 1024px) { /* lg breakpoint */
.features-stack-space > * + * {
    margin-top: 6rem; /* 96px between feature rows on desktop */
}
}

/* Feature focus effect: softly dim non-focused rows, pop the active one */
.features-stack-space.dim-active .feature-row {
    opacity: 0.55;
    transform: scale(0.995);
    transition: opacity 300ms ease, transform 300ms ease, filter 300ms ease, box-shadow 300ms ease, background-color 300ms ease, border-color 300ms ease, border-radius 300ms ease;
    border-radius: 1rem; /* rounded-xl */
    overflow: hidden;
    border: 1px solid transparent;
}

.features-stack-space.dim-active .feature-row.is-focused {
    opacity: 1;
    transform: translateY(0) scale(1.01);
    box-shadow: 0 20px 40px rgba(0,0,0,0.35);
    border-radius: 1.25rem; /* rounded-2xl */
    background: rgba(255,255,255,0.04);
    border-color: rgba(255,255,255,0.08);
}

/* Respect reduced motion: disable emphasis effect */
@media (prefers-reduced-motion: reduce) {
    .features-stack-space.dim-active .feature-row,
    .features-stack-space.dim-active .feature-row.is-focused {
        opacity: 1 !important;
        transform: none !important;
        box-shadow: none !important;
    }
}

/* --------------------------------------
   Stats strip: premium gradient cards
-------------------------------------- */
.stat-card {
    position: relative;
    overflow: hidden;
    border-radius: 1rem;           /* rounded-2xl */
    padding: 1.5rem;               /* p-6 */
    color: #fff;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(17,25,40,0.5); /* glassy backdrop */
    transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}

.stat-card::before {
    content: '';
    position: absolute;
    inset: -1px;
    z-index: 0;
    opacity: .28;                   /* subtle color wash */
    pointer-events: none;
}

.stat-card .content { position: relative; z-index: 1; }
.stat-card .icon {
    width: 2.75rem; height: 2.75rem; /* ~44px */
    border-radius: .75rem;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,0.14);
    margin: 0 auto .5rem;
}
.stat-card .value { font-weight: 800; letter-spacing: -0.01em; }
.stat-card .label { color: rgba(229,231,235,.9); font-size: .875rem; }

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 16px 30px rgba(0,0,0,0.28);
    border-color: rgba(255,255,255,0.22);
}

/* Variant gradients */
.stat-questions::before { background: linear-gradient(135deg, #8b5cf6, #ec4899); }  /* purple -> pink */
.stat-categories::before { background: linear-gradient(135deg, #60a5fa, #22d3ee); } /* blue -> cyan */
.stat-images::before { background: linear-gradient(135deg, #f59e0b, #ef4444); }     /* amber -> red */
.stat-games::before { background: linear-gradient(135deg, #f43f5e, #f59e0b); }      /* rose -> amber */
.stat-videos::before { background: linear-gradient(135deg, #10b981, #3b82f6); }     /* green -> blue */

/* Stats strip top spacing (to separate from hero) */
.stats-strip { margin-top: 2.5rem; }
@media (min-width: 1024px) {
  .stats-strip { margin-top: 3rem; }
}

/* --------------------------------------
   Learning slideshow styles
-------------------------------------- */
.learning-slideshow {
    position: relative;
    overflow: hidden;
    background: transparent; /* no background so smaller images don't show a tint */
    min-height: 320px;
    box-shadow: none !important; /* override any utility shadows like shadow-2xl */
    border-radius: 1rem; /* match rounded-2xl on container for consistent clipping */
}

.learning-slideshow .slide {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transform: scale(1.01);
    transition: opacity 600ms ease, transform 600ms ease;
    border-radius: inherit; /* ensure corners are clipped even during transitions */
}

.learning-slideshow img.slide {
    object-fit: contain;
    background: transparent;
    border-radius: inherit; /* prevent sharp image edges inside rounded container */
}

.learning-slideshow .slide.active {
    opacity: 1;
    transform: scale(1);
}

/* Disable spotlight overlay on the slideshow to avoid any tint */
.learning-slideshow.spotlight::after { display: none !important; }

@media (prefers-reduced-motion: reduce) {
    .learning-slideshow .slide { transition: none !important; }
}

/* --------------------------------------
   Feature text padding utility
-------------------------------------- */
.feature-text-padding { padding-top: 1.25rem; padding-bottom: 1.25rem; }
@media (min-width: 768px) { /* md */
  .feature-text-padding { padding-top: 1.75rem; padding-bottom: 1.75rem; }
}
@media (min-width: 1024px) { /* lg */
  .feature-text-padding { padding-top: 2.25rem; padding-bottom: 2.25rem; }
}
