/* Premium Visual Effects & Transitions */

/* ========================================
   1. ANIMATED COSMIC BACKGROUND
   ======================================== */

/* Animated stars/particles */
@keyframes float-particles {

    0%,
    100% {
        transform: translateY(0) translateX(0);
        opacity: 0.3;
    }

    50% {
        transform: translateY(-20px) translateX(10px);
        opacity: 0.8;
    }
}

@keyframes twinkle {

    0%,
    100% {
        opacity: 0.3;
    }

    50% {
        opacity: 1;
    }
}

/* Create cosmic particle effect */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    background-image:
        radial-gradient(2px 2px at 20% 30%, rgba(139, 92, 246, 0.4), transparent),
        radial-gradient(2px 2px at 60% 70%, rgba(34, 211, 238, 0.4), transparent),
        radial-gradient(1px 1px at 50% 50%, rgba(96, 165, 250, 0.3), transparent),
        radial-gradient(1px 1px at 80% 10%, rgba(168, 85, 247, 0.3), transparent),
        radial-gradient(2px 2px at 90% 60%, rgba(59, 130, 246, 0.4), transparent),
        radial-gradient(1px 1px at 33% 80%, rgba(34, 211, 238, 0.3), transparent);
    background-size: 200% 200%;
    background-position: 0% 0%;
    animation: float-particles 20s ease-in-out infinite;
}

/* Animated gradient overlay */
@keyframes gradient-shift {

    0%,
    100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }
}

body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    background: linear-gradient(45deg,
            rgba(139, 92, 246, 0.03),
            rgba(34, 211, 238, 0.03),
            rgba(59, 130, 246, 0.03),
            rgba(168, 85, 247, 0.03));
    background-size: 400% 400%;
    animation: gradient-shift 15s ease infinite;
}

/* Ensure content is above background effects */
#root {
    position: relative;
    z-index: 2;
}

/* ========================================
   2. SCROLL-TRIGGERED ANIMATIONS
   ======================================== */

/* Fade in from bottom */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fade in from left */
@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Fade in from right */
@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Scale in */
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Apply to cards and sections */
.bento-card,
.learn-card,
.tool-card,
[data-tool-card],
[data-learn-card] {
    animation: fadeInUp 0.6s ease-out backwards;
}

/* Stagger animation delays */
.bento-card:nth-child(1),
.learn-card:nth-child(1) {
    animation-delay: 0.1s;
}

.bento-card:nth-child(2),
.learn-card:nth-child(2) {
    animation-delay: 0.2s;
}

.bento-card:nth-child(3),
.learn-card:nth-child(3) {
    animation-delay: 0.3s;
}

.bento-card:nth-child(4),
.learn-card:nth-child(4) {
    animation-delay: 0.4s;
}

.bento-card:nth-child(5),
.learn-card:nth-child(5) {
    animation-delay: 0.5s;
}

.bento-card:nth-child(6),
.learn-card:nth-child(6) {
    animation-delay: 0.6s;
}

/* ========================================
   3. INTERACTIVE CURSOR EFFECTS
   ======================================== */

/* Cursor glow effect */
@keyframes cursor-glow {

    0%,
    100% {
        opacity: 0.5;
        transform: scale(1);
    }

    50% {
        opacity: 0.8;
        transform: scale(1.2);
    }
}

/* Custom cursor trail (will be added via JS) */
.cursor-glow {
    position: fixed;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(34, 211, 238, 0.6), transparent);
    pointer-events: none;
    z-index: 9999;
    mix-blend-mode: screen;
    animation: cursor-glow 2s ease-in-out infinite;
    transition: transform 0.15s ease-out;
}

/* Enhanced hover states */
a,
button,
.clickable {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

a:hover,
button:hover {
    transform: translateY(-2px);
}

/* ========================================
   4. SMOOTH PAGE TRANSITIONS
   ======================================== */

/* Page fade-in */
@keyframes pageLoad {
    from {
        opacity: 0;
        filter: blur(10px);
    }

    to {
        opacity: 1;
        filter: blur(0);
    }
}

body {
    animation: pageLoad 0.5s ease-out;
}

/* Section transitions */
section,
main>div {
    animation: fadeInUp 0.8s ease-out backwards;
}

/* ========================================
   5. LOADING ANIMATIONS
   ======================================== */

/* Skeleton loading effect */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }

    100% {
        background-position: 1000px 0;
    }
}

.skeleton {
    background: linear-gradient(90deg,
            rgba(255, 255, 255, 0.05) 0%,
            rgba(255, 255, 255, 0.1) 50%,
            rgba(255, 255, 255, 0.05) 100%);
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
}

/* Pulse loading */
@keyframes pulse-glow {

    0%,
    100% {
        opacity: 1;
        box-shadow: 0 0 20px rgba(34, 211, 238, 0.3);
    }

    50% {
        opacity: 0.7;
        box-shadow: 0 0 40px rgba(34, 211, 238, 0.6);
    }
}

.loading {
    animation: pulse-glow 2s ease-in-out infinite;
}

/* ========================================
   6. PARALLAX EFFECTS
   ======================================== */

/* Subtle parallax on scroll */
.parallax-slow {
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Will be controlled by JS */
.parallax-element {
    transition: transform 0.3s ease-out;
}

/* ========================================
   7. ENHANCED MICRO-INTERACTIONS
   ======================================== */

/* Button press effect */
button:active,
.btn:active {
    transform: scale(0.95) translateY(0) !important;
    transition: transform 0.1s ease-out;
}

/* Ripple effect */
@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 0.6;
    }

    100% {
        transform: scale(4);
        opacity: 0;
    }
}

.ripple-effect {
    position: relative;
    overflow: hidden;
}

.ripple-effect::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%) scale(0);
    pointer-events: none;
}

.ripple-effect:active::after {
    animation: ripple 0.6s ease-out;
}

/* Card tilt effect on hover */
@media (hover: hover) and (pointer: fine) {

    .bento-card,
    .learn-card,
    .tool-card {
        transition: transform 0.3s ease-out, box-shadow 0.3s ease-out;
    }

    .bento-card:hover,
    .learn-card:hover,
    .tool-card:hover {
        transform: translateY(-8px) rotateX(2deg);
        transform-style: preserve-3d;
    }
}

/* ========================================
   8. TEXT EFFECTS
   ======================================== */

/* Gradient text animation */
@keyframes gradient-text {

    0%,
    100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }
}

h1,
h2 {
    background-size: 200% auto;
    animation: gradient-text 8s ease infinite;
}

/* Typing effect for headings */
@keyframes typing {
    from {
        width: 0;
    }

    to {
        width: 100%;
    }
}

@keyframes blink {
    50% {
        border-color: transparent;
    }
}

/* Text reveal on scroll */
.text-reveal {
    opacity: 0;
    animation: fadeInUp 0.8s ease-out forwards;
}

/* ========================================
   9. GLOW EFFECTS
   ======================================== */

/* Pulsing glow */
@keyframes glow-pulse {

    0%,
    100% {
        box-shadow:
            0 0 20px rgba(34, 211, 238, 0.3),
            0 0 40px rgba(139, 92, 246, 0.2);
    }

    50% {
        box-shadow:
            0 0 30px rgba(34, 211, 238, 0.5),
            0 0 60px rgba(139, 92, 246, 0.3);
    }
}

.glow-effect {
    animation: glow-pulse 3s ease-in-out infinite;
}

/* Border glow animation */
@keyframes border-glow {

    0%,
    100% {
        border-color: rgba(34, 211, 238, 0.3);
    }

    50% {
        border-color: rgba(34, 211, 238, 0.8);
    }
}

.border-glow {
    animation: border-glow 2s ease-in-out infinite;
}

/* ========================================
   10. FLOATING ANIMATIONS
   ======================================== */

@keyframes float {

    0%,
    100% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-10px);
    }
}

@keyframes float-rotate {

    0%,
    100% {
        transform: translateY(0px) rotate(0deg);
    }

    50% {
        transform: translateY(-10px) rotate(5deg);
    }
}

.float-animation {
    animation: float 3s ease-in-out infinite;
}

.float-rotate-animation {
    animation: float-rotate 4s ease-in-out infinite;
}

/* Apply to icons - Static (No Bounce) */
.learn-card-icon,
[data-tool-card] svg,
.tool-card svg {
    /* animation: float 3s ease-in-out infinite; */
    transition: transform 0.3s ease;
}

/* ========================================
   11. SCROLL PROGRESS INDICATOR
   ======================================== */

.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, #22d3ee, #3b82f6, #a78bfa);
    z-index: 9999;
    transition: width 0.1s ease-out;
    box-shadow: 0 0 10px rgba(34, 211, 238, 0.5);
}

/* ========================================
   12. ENHANCED TRANSITIONS
   ======================================== */

/* Smooth all transitions */
* {
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    body::before,
    body::after {
        animation: none !important;
    }
}

/* ========================================
   13. INTERACTIVE ELEMENTS
   ======================================== */

/* Enhanced focus states */
*:focus-visible {
    outline: 2px solid #22d3ee;
    outline-offset: 4px;
    border-radius: 4px;
}

/* Smooth focus transition */
button:focus-visible,
a:focus-visible,
input:focus-visible {
    box-shadow: 0 0 0 4px rgba(34, 211, 238, 0.2);
    transition: box-shadow 0.2s ease-out;
}

/* ========================================
   14. MOBILE OPTIMIZATIONS
   ======================================== */

@media (max-width: 768px) {

    /* Reduce animation complexity on mobile */
    .bento-card,
    .learn-card,
    .tool-card {
        animation-duration: 0.4s;
    }

    /* Disable parallax on mobile */
    .parallax-slow,
    .parallax-element {
        transform: none !important;
    }

    /* Simplify background effects */
    body::before,
    body::after {
        opacity: 0.5;
    }
}

/* ========================================
   15. UTILITY CLASSES
   ======================================== */

.fade-in {
    animation: fadeInUp 0.6s ease-out;
}

.fade-in-left {
    animation: fadeInLeft 0.6s ease-out;
}

.fade-in-right {
    animation: fadeInRight 0.6s ease-out;
}

.scale-in {
    animation: scaleIn 0.6s ease-out;
}

.delay-1 {
    animation-delay: 0.1s;
}

.delay-2 {
    animation-delay: 0.2s;
}

.delay-3 {
    animation-delay: 0.3s;
}

.delay-4 {
    animation-delay: 0.4s;
}

.delay-5 {
    animation-delay: 0.5s;
}