/* ============================================
   HUIHANCO - Animations & Effects
   ============================================ */

/* ============================================
   KEYFRAME ANIMATIONS
   ============================================ */

/* Float Animation */
@keyframes float {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    25% {
        transform: translateY(-20px) rotate(5deg);
    }
    50% {
        transform: translateY(-10px) rotate(0deg);
    }
    75% {
        transform: translateY(-25px) rotate(-5deg);
    }
}

/* Pulse Animation */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
}

/* Glow Animation */
@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(0, 102, 255, 0.3);
    }
    50% {
        box-shadow: 0 0 40px rgba(0, 102, 255, 0.6);
    }
}

/* Slide Up Animation */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Slide In Left Animation */
@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Slide In Right Animation */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Fade In Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Scale In Animation */
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Rotate Animation */
@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Bounce Animation */
@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-30px);
    }
    60% {
        transform: translateY(-15px);
    }
}

/* Shake Animation */
@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-10px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(10px);
    }
}

/* Wave Animation */
@keyframes wave {
    0%, 100% {
        transform: rotate(0deg);
    }
    25% {
        transform: rotate(20deg);
    }
    75% {
        transform: rotate(-20deg);
    }
}

/* Gradient Shift */
@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Typing Effect */
@keyframes typing {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

/* Blink Cursor */
@keyframes blink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0;
    }
}

/* Particle Animation */
@keyframes particleFloat {
    0% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-100vh) rotate(720deg);
        opacity: 0;
    }
}

/* Ripple Effect */
@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(4);
        opacity: 0;
    }
}

/* Counter Animation */
@keyframes countUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   ANIMATION CLASSES
   ============================================ */

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

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

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

.animate-bounce {
    animation: bounce 1s ease-in-out infinite;
}

.animate-rotate {
    animation: rotate 2s linear infinite;
}

.animate-wave {
    animation: wave 1s ease-in-out infinite;
}

/* Animation Delays */
.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; }
.delay-6 { animation-delay: 0.6s; }
.delay-7 { animation-delay: 0.7s; }
.delay-8 { animation-delay: 0.8s; }

/* ============================================
   HOVER EFFECTS
   ============================================ */

/* Scale on Hover */
.hover-scale {
    transition: transform 0.3s ease;
}

.hover-scale:hover {
    transform: scale(1.05);
}

/* Lift on Hover */
.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

/* Glow on Hover */
.hover-glow {
    transition: box-shadow 0.3s ease;
}

.hover-glow:hover {
    box-shadow: 0 0 30px rgba(0, 102, 255, 0.5);
}

/* Color Change on Hover */
.hover-color {
    transition: color 0.3s ease;
}

.hover-color:hover {
    color: var(--primary-color);
}

/* Background Change on Hover */
.hover-bg {
    transition: background-color 0.3s ease;
}

.hover-bg:hover {
    background-color: var(--primary-color);
}

/* ============================================
   SCROLL REVEAL ANIMATIONS
   ============================================ */

/* Fade In Up */
.reveal-fade-up {
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.8s ease-out;
}

.reveal-fade-up.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Fade In Down */
.reveal-fade-down {
    opacity: 0;
    transform: translateY(-50px);
    transition: all 0.8s ease-out;
}

.reveal-fade-down.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Fade In Left */
.reveal-fade-left {
    opacity: 0;
    transform: translateX(-50px);
    transition: all 0.8s ease-out;
}

.reveal-fade-left.revealed {
    opacity: 1;
    transform: translateX(0);
}

/* Fade In Right */
.reveal-fade-right {
    opacity: 0;
    transform: translateX(50px);
    transition: all 0.8s ease-out;
}

.reveal-fade-right.revealed {
    opacity: 1;
    transform: translateX(0);
}

/* Scale In */
.reveal-scale {
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.8s ease-out;
}

.reveal-scale.revealed {
    opacity: 1;
    transform: scale(1);
}

/* Zoom In */
.reveal-zoom {
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.8s ease-out;
}

.reveal-zoom.revealed {
    opacity: 1;
    transform: scale(1);
}

/* Flip In */
.reveal-flip {
    opacity: 0;
    transform: perspective(400px) rotateY(-90deg);
    transition: all 0.8s ease-out;
}

.reveal-flip.revealed {
    opacity: 1;
    transform: perspective(400px) rotateY(0);
}

/* ============================================
   PARALLAX EFFECTS
   ============================================ */

.parallax-slow {
    transform: translateY(calc(var(--scroll-y) * 0.2));
}

.parallax-medium {
    transform: translateY(calc(var(--scroll-y) * 0.4));
}

.parallax-fast {
    transform: translateY(calc(var(--scroll-y) * 0.6));
}

/* ============================================
   TEXT ANIMATIONS
   ============================================ */

/* Text Reveal */
.text-reveal {
    overflow: hidden;
}

.text-reveal span {
    display: inline-block;
    transform: translateY(100%);
    transition: transform 0.6s cubic-bezier(0.77, 0, 0.175, 1);
}

.text-reveal.revealed span {
    transform: translateY(0);
}

/* Gradient Text Animation */
.gradient-text {
    background: linear-gradient(
        90deg,
        var(--primary-color),
        var(--accent-purple),
        var(--secondary-color),
        var(--primary-color)
    );
    background-size: 300% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 5s linear infinite;
}

/* Typewriter Effect */
.typewriter {
    overflow: hidden;
    border-right: 2px solid var(--primary-color);
    white-space: nowrap;
    animation: typing 3s steps(40) forwards, blink 0.7s step-end infinite;
}

/* ============================================
   PARTICLE BACKGROUND
   ============================================ */

.particles {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.particle {
    position: absolute;
    width: 10px;
    height: 10px;
    background: rgba(0, 102, 255, 0.3);
    border-radius: 50%;
    animation: particleFloat 15s linear infinite;
}

.particle:nth-child(2n) {
    width: 6px;
    height: 6px;
    background: rgba(0, 212, 170, 0.3);
    animation-duration: 20s;
}

.particle:nth-child(3n) {
    width: 8px;
    height: 8px;
    background: rgba(139, 92, 246, 0.3);
    animation-duration: 18s;
}

.particle:nth-child(4n) {
    width: 4px;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    animation-duration: 25s;
}

/* ============================================
   LOADING ANIMATIONS
   ============================================ */

.loader {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(0, 102, 255, 0.1);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: rotate 1s linear infinite;
}

.loader-dots {
    display: flex;
    gap: 5px;
}

.loader-dot {
    width: 10px;
    height: 10px;
    background: var(--primary-color);
    border-radius: 50%;
    animation: bounce 1.4s ease-in-out infinite both;
}

.loader-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.loader-dot:nth-child(2) {
    animation-delay: -0.16s;
}

/* ============================================
   CARD ANIMATIONS
   ============================================ */

.card-flip {
    perspective: 1000px;
}

.card-flip-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.8s;
    transform-style: preserve-3d;
}

.card-flip:hover .card-flip-inner {
    transform: rotateY(180deg);
}

.card-flip-front,
.card-flip-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
}

.card-flip-back {
    transform: rotateY(180deg);
}

/* ============================================
   BUTTON ANIMATIONS
   ============================================ */

/* Ripple Button Effect */
.btn-ripple {
    position: relative;
    overflow: hidden;
}

.btn-ripple::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transition: transform 0.5s ease;
}

.btn-ripple:active::after {
    transform: translate(-50%, -50%) scale(2);
    transition: transform 0s;
}

/* Slide Arrow Button */
.btn-slide-arrow {
    position: relative;
    overflow: hidden;
}

.btn-slide-arrow svg {
    transition: transform 0.3s ease;
}

.btn-slide-arrow:hover svg {
    transform: translateX(5px);
}

/* ============================================
   IMAGE ANIMATIONS
   ============================================ */

/* Image Zoom on Hover */
.img-zoom {
    overflow: hidden;
}

.img-zoom img {
    transition: transform 0.5s ease;
}

.img-zoom:hover img {
    transform: scale(1.1);
}

/* Image Reveal */
.img-reveal {
    position: relative;
    overflow: hidden;
}

.img-reveal::after {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--primary-color);
    transform: translateX(-101%);
    transition: transform 0.5s ease;
}

.img-reveal.revealed::after {
    transform: translateX(0);
}

.img-reveal img {
    transform: translateX(0);
    transition: transform 0.5s ease;
}

.img-reveal.revealed img {
    transform: translateX(100%);
}

/* ============================================
   LINE ANIMATIONS
   ============================================ */

.line-draw {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    animation: drawLine 3s ease forwards;
}

@keyframes drawLine {
    to {
        stroke-dashoffset: 0;
    }
}

/* ============================================
   COUNTER ANIMATION
   ============================================ */

.counter {
    display: inline-block;
}

.counter.animating {
    animation: countUp 0.5s ease forwards;
}

/* ============================================
   STAGGER ANIMATIONS
   ============================================ */

.stagger-item {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s ease;
}

.stagger-item.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger Children */
.stagger-children > * {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s ease;
}

.stagger-children.revealed > *:nth-child(1) { transition-delay: 0.1s; }
.stagger-children.revealed > *:nth-child(2) { transition-delay: 0.2s; }
.stagger-children.revealed > *:nth-child(3) { transition-delay: 0.3s; }
.stagger-children.revealed > *:nth-child(4) { transition-delay: 0.4s; }
.stagger-children.revealed > *:nth-child(5) { transition-delay: 0.5s; }
.stagger-children.revealed > *:nth-child(6) { transition-delay: 0.6s; }
.stagger-children.revealed > *:nth-child(7) { transition-delay: 0.7s; }
.stagger-children.revealed > *:nth-child(8) { transition-delay: 0.8s; }

.stagger-children.revealed > * {
    opacity: 1;
    transform: translateY(0);
}