/* ================================================
   LENS & LIGHT - ADVANCED ANIMATIONS
   ================================================ */

/* ============================================
   Keyframe Animations
   ============================================ */

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

/* Fade In Up */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fade In Down */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fade In Left */
@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Fade In Right */
@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

/* Slide Down */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-100%);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* Rotate In */
@keyframes rotateIn {
    from {
        opacity: 0;
        transform: rotate(-180deg) scale(0);
    }
    to {
        opacity: 1;
        transform: rotate(0) scale(1);
    }
}

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

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

/* Float */
@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-15px);
    }
}

/* Shimmer */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* Gradient Animation */
@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%;
    }
}

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

/* Reveal from Left */
@keyframes revealLeft {
    from {
        clip-path: inset(0 100% 0 0);
    }
    to {
        clip-path: inset(0 0 0 0);
    }
}

/* Reveal from Right */
@keyframes revealRight {
    from {
        clip-path: inset(0 0 0 100%);
    }
    to {
        clip-path: inset(0 0 0 0);
    }
}

/* Reveal from Top */
@keyframes revealTop {
    from {
        clip-path: inset(0 0 100% 0);
    }
    to {
        clip-path: inset(0 0 0 0);
    }
}

/* Reveal from Bottom */
@keyframes revealBottom {
    from {
        clip-path: inset(100% 0 0 0);
    }
    to {
        clip-path: inset(0 0 0 0);
    }
}

/* Glitch Effect */
@keyframes glitch {
    0%, 100% {
        transform: translate(0);
    }
    20% {
        transform: translate(-2px, 2px);
    }
    40% {
        transform: translate(-2px, -2px);
    }
    60% {
        transform: translate(2px, 2px);
    }
    80% {
        transform: translate(2px, -2px);
    }
}

/* Text Reveal */
@keyframes textReveal {
    0% {
        clip-path: polygon(0 0, 0 0, 0 100%, 0% 100%);
    }
    100% {
        clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
    }
}

/* Blur In */
@keyframes blurIn {
    from {
        opacity: 0;
        filter: blur(20px);
    }
    to {
        opacity: 1;
        filter: blur(0);
    }
}

/* Stagger Animation Helper */
[data-aos] {
    opacity: 0;
    transition: all 0.6s ease;
}

[data-aos].aos-animate {
    opacity: 1;
}

[data-aos="fade-up"] {
    transform: translateY(50px);
}

[data-aos="fade-up"].aos-animate {
    transform: translateY(0);
}

[data-aos="fade-down"] {
    transform: translateY(-50px);
}

[data-aos="fade-down"].aos-animate {
    transform: translateY(0);
}

[data-aos="fade-left"] {
    transform: translateX(50px);
}

[data-aos="fade-left"].aos-animate {
    transform: translateX(0);
}

[data-aos="fade-right"] {
    transform: translateX(-50px);
}

[data-aos="fade-right"].aos-animate {
    transform: translateX(0);
}

[data-aos="zoom-in"] {
    transform: scale(0.8);
}

[data-aos="zoom-in"].aos-animate {
    transform: scale(1);
}

/* ============================================
   Hover Animations
   ============================================ */

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

.img-zoom img {
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* Text Underline Animation */
.text-underline {
    position: relative;
    display: inline-block;
}

.text-underline::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: currentColor;
    transition: width 0.3s ease;
}

.text-underline:hover::after {
    width: 100%;
}

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

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

.btn-ripple:hover::after {
    width: 300px;
    height: 300px;
}

/* Card Lift Effect */
.card-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

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

/* Shine Effect */
.shine-effect {
    position: relative;
    overflow: hidden;
}

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

.shine-effect:hover::before {
    left: 125%;
}

/* Border Animation */
.border-animate {
    position: relative;
}

.border-animate::before,
.border-animate::after {
    content: '';
    position: absolute;
    width: 0;
    height: 0;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.border-animate::before {
    top: 0;
    left: 0;
    border-top-color: var(--primary);
    border-right-color: var(--primary);
}

.border-animate::after {
    bottom: 0;
    right: 0;
    border-bottom-color: var(--primary);
    border-left-color: var(--primary);
}

.border-animate:hover::before,
.border-animate:hover::after {
    width: 100%;
    height: 100%;
}

/* ============================================
   Text Animations
   ============================================ */

/* Split Text Animation */
.split-text .char {
    display: inline-block;
    opacity: 0;
    transform: translateY(50px) rotate(10deg);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.split-text.animate .char {
    opacity: 1;
    transform: translateY(0) rotate(0);
}

/* Gradient Text Animation */
.gradient-text {
    background: linear-gradient(
        90deg,
        var(--primary),
        var(--accent),
        var(--primary)
    );
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradientShift 3s ease infinite;
}

/* Glowing Text */
.glow-text {
    text-shadow: 0 0 10px var(--primary),
                 0 0 20px var(--primary),
                 0 0 30px var(--primary);
    animation: pulse 2s ease infinite;
}

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

/* ============================================
   Scroll Animations
   ============================================ */

/* Reveal on Scroll */
.reveal {
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.8s ease;
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* Parallax Elements */
.parallax-element {
    will-change: transform;
    transition: transform 0.1s linear;
}

/* Counter Animation */
.counter {
    opacity: 0;
}

.counter.animate {
    animation: fadeIn 0.5s ease forwards;
}

/* Progress Bar Animation */
.progress-bar {
    width: 0;
    transition: width 1s ease;
}

.progress-bar.animate {
    width: var(--progress);
}

/* ============================================
   Image Animations
   ============================================ */

/* Reveal Image */
.reveal-img {
    clip-path: inset(0 100% 0 0);
    transition: clip-path 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal-img.revealed {
    clip-path: inset(0 0 0 0);
}

/* Image Overlay Animation */
.img-overlay-animate {
    position: relative;
}

.img-overlay-animate::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--primary);
    transform: translateX(-101%);
    transition: transform 0.4s ease;
}

.img-overlay-animate:hover::before {
    transform: translateX(0);
}

/* Ken Burns Effect */
.ken-burns {
    animation: kenBurns 20s ease infinite alternate;
}

@keyframes kenBurns {
    0% {
        transform: scale(1) translate(0, 0);
    }
    100% {
        transform: scale(1.2) translate(-5%, -5%);
    }
}

/* ============================================
   Loading Animations
   ============================================ */

/* Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Dots Loading */
.dots-loading {
    display: flex;
    gap: 5px;
}

.dots-loading span {
    width: 10px;
    height: 10px;
    background: var(--primary);
    border-radius: 50%;
    animation: dotsBounce 1.4s ease-in-out infinite both;
}

.dots-loading span:nth-child(1) {
    animation-delay: -0.32s;
}

.dots-loading span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes dotsBounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--bg-secondary) 25%,
        var(--bg-tertiary) 50%,
        var(--bg-secondary) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

/* ============================================
   Page Transitions
   ============================================ */

/* Fade Transition */
.page-transition-fade {
    animation: fadeIn 0.5s ease;
}

/* Slide Transition */
.page-transition-slide {
    animation: fadeInUp 0.6s ease;
}

/* ============================================
   Special Effects
   ============================================ */

/* Glassmorphism */
.glass-effect {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Morphing Shape */
.morph-shape {
    animation: morph 8s ease-in-out infinite;
}

@keyframes morph {
    0%, 100% {
        border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    }
    50% {
        border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%;
    }
}

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

/* Pulse Ring */
.pulse-ring {
    position: relative;
}

.pulse-ring::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    border: 2px solid var(--primary);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: pulseRing 2s ease infinite;
}

@keyframes pulseRing {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1.5);
        opacity: 0;
    }
}

/* ============================================
   Particle Effects (CSS Only)
   ============================================ */

.particles {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 5px;
    height: 5px;
    background: var(--primary);
    border-radius: 50%;
    opacity: 0.3;
    animation: particleFloat 15s infinite;
}

@keyframes particleFloat {
    0%, 100% {
        transform: translate(0, 0) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 0.3;
    }
    90% {
        opacity: 0.3;
    }
    100% {
        transform: translate(var(--tx), var(--ty)) rotate(360deg);
        opacity: 0;
    }
}

/* ============================================
   Menu Animations
   ============================================ */

/* Menu Slide */
.menu-slide {
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.menu-slide.active {
    transform: translateX(0);
}

/* Menu Fade */
.menu-fade {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.menu-fade.active {
    opacity: 1;
    visibility: visible;
}

/* Menu Items Stagger */
.menu-item-stagger li {
    opacity: 0;
    transform: translateX(30px);
    transition: all 0.3s ease;
}

.menu-item-stagger.active li {
    opacity: 1;
    transform: translateX(0);
}

.menu-item-stagger.active li:nth-child(1) { transition-delay: 0.1s; }
.menu-item-stagger.active li:nth-child(2) { transition-delay: 0.15s; }
.menu-item-stagger.active li:nth-child(3) { transition-delay: 0.2s; }
.menu-item-stagger.active li:nth-child(4) { transition-delay: 0.25s; }
.menu-item-stagger.active li:nth-child(5) { transition-delay: 0.3s; }
.menu-item-stagger.active li:nth-child(6) { transition-delay: 0.35s; }

/* ============================================
   Form Animations
   ============================================ */

/* Input Focus Animation */
.input-animate {
    position: relative;
}

.input-animate input,
.input-animate textarea {
    border: none;
    border-bottom: 2px solid var(--border);
    background: transparent;
    transition: border-color 0.3s ease;
}

.input-animate input:focus,
.input-animate textarea:focus {
    border-color: var(--primary);
}

.input-animate label {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    transition: all 0.3s ease;
    pointer-events: none;
}

.input-animate input:focus + label,
.input-animate input:valid + label {
    top: -10px;
    font-size: 0.8rem;
    color: var(--primary);
}

/* Success Animation */
.form-success {
    animation: formSuccess 0.5s ease;
}

@keyframes formSuccess {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ============================================
   Utility Animation Classes
   ============================================ */

.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s ease;
}

.animate-on-scroll.animated {
    opacity: 1;
    transform: translateY(0);
}

.delay-100 { transition-delay: 0.1s; }
.delay-200 { transition-delay: 0.2s; }
.delay-300 { transition-delay: 0.3s; }
.delay-400 { transition-delay: 0.4s; }
.delay-500 { transition-delay: 0.5s; }

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
