/* 
 * Clear Enterprise Website - Animations
 * Dynamic animations for hexagons and page elements
 */

/* ====================
   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(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

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

/* Hexagon Pulse */
@keyframes hexagonPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(63, 136, 197, 0.7);
    }
    70% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(63, 136, 197, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(63, 136, 197, 0);
    }
}

/* Hexagon Rotate */
@keyframes hexRotate {
    0% {
        transform: rotate(0deg);
    }
    25% {
        transform: rotate(2deg);
    }
    75% {
        transform: rotate(-2deg);
    }
    100% {
        transform: rotate(0deg);
    }
}

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

/* Wave Animation for Connecting Lines */
@keyframes wave {
    0% {
        opacity: 0.2;
    }
    50% {
        opacity: 0.5;
    }
    100% {
        opacity: 0.2;
    }
}

/* Connection Line Animation */
@keyframes drawLine {
    0% {
        width: 0;
        opacity: 0;
    }
    100% {
        width: 100%;
        opacity: 0.5;
    }
}

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

/* ====================
   Applied Animations
   ==================== */

/* General Page Elements */
.hero-content h1 {
    animation: fadeInDown 1s ease-out forwards;
}

.hero-content p {
    animation: fadeInUp 1s ease-out 0.3s forwards;
    opacity: 0;
    animation-fill-mode: forwards;
}

.hero-content .cta-button {
    animation: fadeIn 1s ease-out 0.6s forwards;
    opacity: 0;
    animation-fill-mode: forwards;
}

/* Hexagon Grid Animations */
.hexagon-menu-section h2 {
    animation: fadeInDown 1s ease-out forwards;
}

/* Staggered animation for hexagons */
.hexagon-wrapper {
    opacity: 0;
    animation: fadeIn 0.8s ease-out forwards;
    animation-fill-mode: forwards;
}

.hexagon-wrapper:nth-child(1) {
    animation-delay: 0.2s;
}

.hexagon-wrapper:nth-child(2) {
    animation-delay: 0.4s;
}

.hexagon-wrapper:nth-child(3) {
    animation-delay: 0.6s;
}

.hexagon-wrapper:nth-child(4) {
    animation-delay: 0.8s;
}

.hexagon-wrapper:nth-child(5) {
    animation-delay: 1.0s;
}

.hexagon-wrapper:nth-child(6) {
    animation-delay: 1.2s;
}

.hexagon-wrapper:nth-child(7) {
    animation-delay: 1.4s;
}

/* Connecting Lines Animation */
.hexagon-container::before {
    animation: drawLine 1.5s ease-out 1.5s forwards, wave 3s ease-in-out 3s infinite;
    width: 0;
    opacity: 0;
}

.hexagon-container::after {
    animation: drawLine 1.5s ease-out 1.5s forwards, wave 3s ease-in-out 3s infinite;
    height: 0;
    opacity: 0;
}

/* Hover Animation Enhancements */
.hexagon-wrapper:hover .hexagon {
    animation: hexagonPulse 1.5s infinite;
}

.hexagon-wrapper:hover .hexagon-content i {
    animation: rotateIcon 2s ease infinite;
}

/* Main Hexagons Special Animations */
.hexagon-wrapper:nth-child(1) .hexagon,
.hexagon-wrapper:nth-child(2) .hexagon,
.hexagon-wrapper:nth-child(3) .hexagon {
    animation: float 6s ease-in-out infinite;
    animation-delay: calc(var(--animation-order) * 0.2s);
}

.hexagon-wrapper:nth-child(1) {
    --animation-order: 1;
}

.hexagon-wrapper:nth-child(2) {
    --animation-order: 2;
}

.hexagon-wrapper:nth-child(3) {
    --animation-order: 3;
}

/* Reference Cards Animation */
.reference-card {
    opacity: 0;
    animation: fadeInUp 0.8s ease-out forwards;
    animation-fill-mode: forwards;
}

.reference-card:nth-child(1) {
    animation-delay: 0.2s;
}

.reference-card:nth-child(2) {
    animation-delay: 0.4s;
}

.reference-card:nth-child(3) {
    animation-delay: 0.6s;
}

/* Team Member Animation */
.team-member {
    opacity: 0;
    animation: fadeInUp 0.8s ease-out forwards;
    animation-fill-mode: forwards;
}

.team-member:nth-child(1) {
    animation-delay: 0.3s;
}

.team-member:nth-child(2) {
    animation-delay: 0.6s;
}

/* Contact Form Animation */
.contact-info, .contact-form {
    opacity: 0;
    animation: fadeInUp 0.8s ease-out forwards;
    animation-fill-mode: forwards;
}

.contact-info {
    animation-delay: 0.3s;
}

.contact-form {
    animation-delay: 0.6s;
}

/* ====================
   Scroll-Triggered Animations
   ==================== */

/* Classes to be added via JS for scroll animations */
.animate-on-scroll {
    opacity: 0;
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.animate-fade-in.in-view {
    animation: fadeIn 1s ease-out forwards;
}

.animate-fade-up.in-view {
    animation: fadeInUp 1s ease-out forwards;
}

.animate-fade-down.in-view {
    animation: fadeInDown 1s ease-out forwards;
}

.animate-fade-left.in-view {
    animation: fadeInLeft 1s ease-out forwards;
}

.animate-fade-right.in-view {
    animation: fadeInRight 1s ease-out forwards;
}

.animate-zoom-in.in-view {
    animation: zoomIn 1s ease-out forwards;
}

/* ====================
   Page Transition Effects
   ==================== */

/* Page transition overlay */
.page-transition {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--trust-blue);
    z-index: 9999;
    transform: translateX(-100%);
    transition: transform 0.5s ease-in-out;
}

.page-transition.active {
    transform: translateX(0);
}

.page-transition.exit {
    transform: translateX(100%);
}

/* Loading spinner animation */
@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--pure-white);
    animation: spin 1s ease-in-out infinite;
    position: absolute;
    top: 50%;
    left: 50%;
    margin-top: -25px;
    margin-left: -25px;
}