/* Animation Classes - Elements are visible by default, animations enhance the experience */

/* Base animation setup - elements start visible */
.animate-on-scroll {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

/* Before animation triggers - subtle starting state */
.animate-on-scroll.animate-ready {
    opacity: 0;
    transform: translateY(30px);
}

.animate-on-scroll.animate-ready.from-left {
    opacity: 0;
    transform: translateX(-40px);
}

.animate-on-scroll.animate-ready.from-right {
    opacity: 0;
    transform: translateX(40px);
}

.animate-on-scroll.animate-ready.scale-in {
    opacity: 0;
    transform: scale(0.95);
}

/* Animated state - triggered when in viewport */
.animate-on-scroll.animated {
    opacity: 1;
    transform: translateY(0) translateX(0) scale(1);
}

/* Stagger delays for grid items */
.stagger-1 { transition-delay: 0.1s; }
.stagger-2 { transition-delay: 0.15s; }
.stagger-3 { transition-delay: 0.2s; }
.stagger-4 { transition-delay: 0.25s; }
.stagger-5 { transition-delay: 0.3s; }
.stagger-6 { transition-delay: 0.35s; }

/* Hero section animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

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

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

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

/* Hero animations - play immediately on page load */
.hero-animate {
    animation: fadeInUp 0.8s ease-out forwards;
}

.hero-animate-delay-1 {
    animation: fadeInUp 0.8s ease-out 0.2s forwards;
    opacity: 0;
}

.hero-animate-delay-2 {
    animation: fadeInUp 0.8s ease-out 0.4s forwards;
    opacity: 0;
}

.hero-animate-delay-3 {
    animation: fadeInUp 0.8s ease-out 0.6s forwards;
    opacity: 0;
}

/* Card hover effects */
.card-hover {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

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

/* Image zoom on hover */
.img-zoom {
    transition: transform 0.4s ease;
}

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

/* Button pulse effect */
@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.4);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(220, 38, 38, 0);
    }
}

.btn-pulse:hover {
    animation: pulse 1.5s infinite;
}

/* Floating animation for decorative elements */
@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

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

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

.text-shimmer {
    background: linear-gradient(90deg, #dc2626, #ff6b6b, #dc2626);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: shimmer 3s linear infinite;
}

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

.stat-animate {
    animation: countUp 0.6s ease-out forwards;
}

/* Underline animation for links */
.link-underline {
    position: relative;
}

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

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

/* Icon bounce on hover */
.icon-bounce:hover {
    animation: bounce 0.5s ease;
}

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

/* Reveal animation for sections */
.reveal-section {
    position: relative;
    overflow: hidden;
}

.reveal-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #f5f7f8;
    transform: translateX(-101%);
    transition: transform 0.6s ease;
    z-index: 1;
}

.reveal-section.revealed::before {
    transform: translateX(101%);
}

/* Prevent white flash during page transitions - match preloader */
html, body {
    background: #001a33 !important;
}

/* Page Preloader with Circuit Animation */
.page-preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #001a33 0%, #003366 50%, #002244 100%);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    visibility: visible;
    transition: opacity 1s ease-out;
}

.page-preloader.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 1s ease-out, visibility 0s linear 1s;
}

.preloader-content {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* Circuit SVG container */
.circuit-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.circuit-svg svg {
    width: 100%;
    height: 100%;
}

/* Circuit lines animation */
.circuit-line {
    fill: none;
    stroke: rgba(64, 224, 208, 0.4);
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    filter: drop-shadow(0 0 3px rgba(64, 224, 208, 0.5));
}

.circuit-line.active {
    animation: drawLine 1.5s ease-out forwards;
}

.circuit-line-2 { animation-delay: 0.1s; }
.circuit-line-3 { animation-delay: 0.2s; }
.circuit-line-4 { animation-delay: 0.15s; }
.circuit-line-5 { animation-delay: 0.25s; }
.circuit-line-6 { animation-delay: 0.3s; }
.circuit-line-7 { animation-delay: 0.05s; }
.circuit-line-8 { animation-delay: 0.35s; }

/* Red accent line */
.circuit-line-accent {
    stroke: rgba(220, 38, 38, 0.6);
    filter: drop-shadow(0 0 4px rgba(220, 38, 38, 0.6));
    animation-delay: 0.4s;
}

@keyframes drawLine {
    0% {
        stroke-dashoffset: 1000;
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    100% {
        stroke-dashoffset: 0;
        opacity: 1;
    }
}

/* Circuit nodes (glowing dots) */
.circuit-node {
    fill: rgba(64, 224, 208, 0.8);
    filter: drop-shadow(0 0 6px rgba(64, 224, 208, 0.8));
    opacity: 0;
    transform-origin: center;
}

.circuit-node.active {
    animation: nodeGlow 0.4s ease-out forwards, nodePulse 2s ease-in-out 0.4s infinite;
}

.node-1 { animation-delay: 0.3s, 0.7s; }
.node-2 { animation-delay: 0.5s, 0.9s; }
.node-3 { animation-delay: 0.4s, 0.8s; }
.node-4 { animation-delay: 0.6s, 1s; }
.node-5 { animation-delay: 0.35s, 0.75s; }
.node-6 { animation-delay: 0.55s, 0.95s; }
.node-7 { animation-delay: 0.45s, 0.85s; }
.node-8 { animation-delay: 0.65s, 1.05s; }
.node-9 { animation-delay: 0.7s, 1.1s; }
.node-10 { animation-delay: 0.25s, 0.65s; }

/* Large glowing nodes */
.circuit-node-large {
    fill: rgba(64, 224, 208, 0.3);
    filter: drop-shadow(0 0 15px rgba(64, 224, 208, 0.5));
}

.circuit-node-large.active {
    animation: nodeGlowLarge 0.6s ease-out forwards, nodePulseLarge 3s ease-in-out 0.6s infinite;
}

@keyframes nodeGlow {
    0% {
        opacity: 0;
        transform: scale(0);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes nodePulse {
    0%, 100% {
        opacity: 0.8;
        filter: drop-shadow(0 0 6px rgba(64, 224, 208, 0.8));
    }
    50% {
        opacity: 1;
        filter: drop-shadow(0 0 12px rgba(64, 224, 208, 1));
    }
}

@keyframes nodeGlowLarge {
    0% {
        opacity: 0;
        transform: scale(0);
    }
    100% {
        opacity: 0.5;
        transform: scale(1);
    }
}

@keyframes nodePulseLarge {
    0%, 100% {
        opacity: 0.3;
        filter: drop-shadow(0 0 15px rgba(64, 224, 208, 0.5));
    }
    50% {
        opacity: 0.6;
        filter: drop-shadow(0 0 25px rgba(64, 224, 208, 0.8));
    }
}

/* Center logo area */
.preloader-logo {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 10;
}

.preloader-logo img {
    height: 140px;
    margin-bottom: 24px;
    opacity: 0;
    animation: fadeInUp 0.6s ease-out 0.2s forwards;
}

/* Loading progress bar */
.preloader-progress {
    width: 260px;
    height: 2px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    margin: 0 auto;
}

.preloader-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #40E0D0, #dc2626);
    border-radius: 2px;
    box-shadow: 0 0 10px rgba(64, 224, 208, 0.5);
    animation: progressLoad 0.8s ease-out 0.3s forwards;
}

@keyframes progressLoad {
    0% {
        width: 0%;
    }
    100% {
        width: 100%;
    }
}

/* Loading text */
.preloader-text {
    color: rgba(255, 255, 255, 0.6);
    font-size: 13px;
    letter-spacing: 3px;
    text-transform: uppercase;
    margin-top: 15px;
    opacity: 0;
    animation: fadeIn 0.4s ease-out 0.4s forwards;
}

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

/* Data particles floating effect */
.data-particle {
    position: absolute;
    width: 2px;
    height: 2px;
    background: rgba(64, 224, 208, 0.6);
    border-radius: 50%;
    animation: particleFloat 4s ease-in-out infinite;
}

.particle-1 { top: 20%; left: 10%; animation-delay: 0s; }
.particle-2 { top: 60%; left: 85%; animation-delay: 0.5s; }
.particle-3 { top: 80%; left: 20%; animation-delay: 1s; }
.particle-4 { top: 30%; left: 70%; animation-delay: 1.5s; }
.particle-5 { top: 70%; left: 40%; animation-delay: 2s; }
.particle-6 { top: 15%; left: 55%; animation-delay: 0.3s; }
.particle-7 { top: 85%; left: 75%; animation-delay: 0.8s; }
.particle-8 { top: 45%; left: 5%; animation-delay: 1.3s; }

@keyframes particleFloat {
    0%, 100% {
        transform: translateY(0) scale(1);
        opacity: 0.6;
    }
    50% {
        transform: translateY(-20px) scale(1.5);
        opacity: 1;
    }
}

/* Page content transitions - only fade the content, not the preloader */
.page-content {
    opacity: 0;
    transition: opacity 0.6s ease-out;
    background: linear-gradient(135deg, #001a33 0%, #003366 50%, #002244 100%);
}
body.loaded .page-content {
    opacity: 1;
}
body.page-leaving .page-content {
    opacity: 0;
    transition: opacity 0.2s ease-in;
}
