/* ===== Keyframes ===== */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(28px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-28px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideLeft {
    from { opacity: 0; transform: translateX(32px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes slideRight {
    from { opacity: 0; transform: translateX(-32px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes zoomIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes float {
    0%, 100% { transform: translateY(0) translateX(0); }
    50% { transform: translateY(-16px) translateX(6px); }
}

@keyframes floatSlow {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-24px) rotate(4deg); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.04); }
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 20px rgba(245, 180, 0, 0.25), 0 0 0 1px rgba(255, 207, 64, 0.2); }
    50% { box-shadow: 0 0 44px rgba(245, 180, 0, 0.5), 0 0 0 1px rgba(255, 207, 64, 0.35); }
}

@keyframes ripple {
    0% { transform: scale(0); opacity: 0.55; }
    100% { transform: scale(3.2); opacity: 0; }
}

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

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

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

@keyframes marquee {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes bounceSoft {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

@keyframes blob {
    0%, 100% { border-radius: 42% 58% 62% 38% / 45% 40% 60% 55%; }
    50% { border-radius: 58% 42% 38% 62% / 55% 60% 40% 45%; }
}

/* ===== Utility animation classes ===== */

.anim-fade-in { animation: fadeIn var(--dur-slow) var(--ease-out) both; }
.anim-slide-up { animation: slideUp var(--dur-slow) var(--ease-out) both; }
.anim-slide-down { animation: slideDown var(--dur-slow) var(--ease-out) both; }
.anim-slide-left { animation: slideLeft var(--dur-slow) var(--ease-out) both; }
.anim-slide-right { animation: slideRight var(--dur-slow) var(--ease-out) both; }
.anim-zoom-in { animation: zoomIn var(--dur-slow) var(--ease-spring) both; }
.anim-scale-in { animation: scaleIn var(--dur-base) var(--ease-out) both; }
.anim-float { animation: float 6s ease-in-out infinite; }
.anim-float-slow { animation: floatSlow 9s ease-in-out infinite; }
.anim-pulse { animation: pulse 2.4s ease-in-out infinite; }
.anim-glow { animation: glow 3s ease-in-out infinite; }
.anim-spin { animation: spin 1s linear infinite; }

.delay-1 { animation-delay: 0.08s; }
.delay-2 { animation-delay: 0.16s; }
.delay-3 { animation-delay: 0.24s; }
.delay-4 { animation-delay: 0.32s; }
.delay-5 { animation-delay: 0.4s; }
.delay-6 { animation-delay: 0.48s; }

/* Reveal-on-scroll: JS toggles .is-visible */
.reveal {
    opacity: 0;
    transform: translateY(32px);
    transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
}
.reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}
.reveal-scale {
    opacity: 0;
    transform: scale(0.94);
    transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-spring);
}
.reveal-scale.is-visible {
    opacity: 1;
    transform: scale(1);
}

/* Hover lift */
.hover-lift {
    transition: transform var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out), border-color var(--dur-base) var(--ease-out);
}
.hover-lift:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
    border-color: var(--color-border-strong);
}

/* Card tilt (JS sets --tiltX/--tiltY via mousemove) */
.card-tilt {
    --tiltX: 0deg;
    --tiltY: 0deg;
    transform: perspective(900px) rotateX(var(--tiltX)) rotateY(var(--tiltY));
    transition: transform 0.25s var(--ease-out);
    will-change: transform;
}

/* Button bounce */
.btn-bounce {
    transition: transform var(--dur-fast) var(--ease-spring);
}
.btn-bounce:active {
    transform: scale(0.94);
}

/* Animated gradient background/text */
.gradient-animated {
    background: var(--gradient-brand);
    background-size: 200% 200%;
    animation: gradientShift 8s ease infinite;
}
.gradient-text {
    background: var(--gradient-text);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: gradientShift 6s ease infinite;
}

/* Loading skeleton + shimmer */
.skeleton {
    position: relative;
    overflow: hidden;
    background: var(--color-surface-strong);
    border-radius: var(--radius-sm);
}
.skeleton::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
    background-size: 400px 100%;
    animation: shimmer 1.4s ease-in-out infinite;
}

/* Animated borders */
.border-animated {
    position: relative;
    border-radius: inherit;
}
.border-animated::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(90deg, var(--color-primary), var(--color-accent), var(--color-accent-alt), var(--color-primary));
    background-size: 200% 100%;
    animation: borderFlow 4s linear infinite;
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

/* Ripple effect container (JS injects .ripple-dot on click) */
.ripple-surface {
    position: relative;
    overflow: hidden;
}
.ripple-dot {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.35);
    transform: scale(0);
    animation: ripple 0.6s ease-out forwards;
    pointer-events: none;
}

/* Floating blob shapes */
.blob {
    animation: blob 8s ease-in-out infinite, float 10s ease-in-out infinite;
    filter: blur(2px);
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
}
