/* 
 * Animation Component Styles
 * Atelier Flint & Associates Architects Website
 * 
 * Custom animations and AOS integration styles
 * for smooth, purposeful user interface interactions.
 */

/* ==========================================================================
   AOS (Animate On Scroll) CUSTOMIZATION
   ========================================================================== */

/* Custom AOS animations */
[data-aos="fade-up-custom"] {
    transform: translate3d(0, 40px, 0);
    opacity: 0;
}

[data-aos="fade-up-custom"].aos-animate {
    transform: translate3d(0, 0, 0);
    opacity: 1;
}

[data-aos="fade-down-custom"] {
    transform: translate3d(0, -40px, 0);
    opacity: 0;
}

[data-aos="fade-down-custom"].aos-animate {
    transform: translate3d(0, 0, 0);
    opacity: 1;
}

[data-aos="fade-left-custom"] {
    transform: translate3d(-40px, 0, 0);
    opacity: 0;
}

[data-aos="fade-left-custom"].aos-animate {
    transform: translate3d(0, 0, 0);
    opacity: 1;
}

[data-aos="fade-right-custom"] {
    transform: translate3d(40px, 0, 0);
    opacity: 0;
}

[data-aos="fade-right-custom"].aos-animate {
    transform: translate3d(0, 0, 0);
    opacity: 1;
}

/* Scale animations */
[data-aos="scale-up"] {
    transform: scale(0.8);
    opacity: 0;
}

[data-aos="scale-up"].aos-animate {
    transform: scale(1);
    opacity: 1;
}

[data-aos="scale-down"] {
    transform: scale(1.2);
    opacity: 0;
}

[data-aos="scale-down"].aos-animate {
    transform: scale(1);
    opacity: 1;
}

/* Rotate animations */
[data-aos="rotate-in"] {
    transform: rotate(-45deg);
    opacity: 0;
}

[data-aos="rotate-in"].aos-animate {
    transform: rotate(0);
    opacity: 1;
}

/* ==========================================================================
   CUSTOM KEYFRAME ANIMATIONS
   ========================================================================== */

/* Fade animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translate3d(0, 30px, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translate3d(0, -30px, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translate3d(-30px, 0, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translate3d(30px, 0, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

/* Scale animations */
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes scaleOut {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.8);
    }
}

/* Bounce animations */
@keyframes bounceIn {
    0%, 20%, 40%, 60%, 80% {
        animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
    }
    0% {
        opacity: 0;
        transform: scale3d(0.3, 0.3, 0.3);
    }
    20% {
        transform: scale3d(1.1, 1.1, 1.1);
    }
    40% {
        transform: scale3d(0.9, 0.9, 0.9);
    }
    60% {
        opacity: 1;
        transform: scale3d(1.03, 1.03, 1.03);
    }
    80% {
        transform: scale3d(0.97, 0.97, 0.97);
    }
    100% {
        opacity: 1;
        transform: scale3d(1, 1, 1);
    }
}

/* Slide animations */
@keyframes slideInUp {
    from {
        transform: translate3d(0, 100%, 0);
        visibility: visible;
    }
    to {
        transform: translate3d(0, 0, 0);
    }
}

@keyframes slideInDown {
    from {
        transform: translate3d(0, -100%, 0);
        visibility: visible;
    }
    to {
        transform: translate3d(0, 0, 0);
    }
}

@keyframes slideOutUp {
    from {
        transform: translate3d(0, 0, 0);
    }
    to {
        visibility: hidden;
        transform: translate3d(0, -100%, 0);
    }
}

@keyframes slideOutDown {
    from {
        transform: translate3d(0, 0, 0);
    }
    to {
        visibility: hidden;
        transform: translate3d(0, 100%, 0);
    }
}

/* Rotate animations */
@keyframes rotateIn {
    from {
        transform-origin: center;
        transform: rotate3d(0, 0, 1, -200deg);
        opacity: 0;
    }
    to {
        transform-origin: center;
        transform: translate3d(0, 0, 0);
        opacity: 1;
    }
}

/* Pulse animation */
@keyframes pulse {
    0% {
        transform: scale3d(1, 1, 1);
    }
    50% {
        transform: scale3d(1.05, 1.05, 1.05);
    }
    100% {
        transform: scale3d(1, 1, 1);
    }
}

/* Shake animation */
@keyframes shake {
    0%, 100% {
        transform: translate3d(0, 0, 0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translate3d(-10px, 0, 0);
    }
    20%, 40%, 60%, 80% {
        transform: translate3d(10px, 0, 0);
    }
}

/* Wobble animation */
@keyframes wobble {
    0% {
        transform: translate3d(0, 0, 0);
    }
    15% {
        transform: translate3d(-25%, 0, 0) rotate3d(0, 0, 1, -5deg);
    }
    30% {
        transform: translate3d(20%, 0, 0) rotate3d(0, 0, 1, 3deg);
    }
    45% {
        transform: translate3d(-15%, 0, 0) rotate3d(0, 0, 1, -3deg);
    }
    60% {
        transform: translate3d(10%, 0, 0) rotate3d(0, 0, 1, 2deg);
    }
    75% {
        transform: translate3d(-5%, 0, 0) rotate3d(0, 0, 1, -1deg);
    }
    100% {
        transform: translate3d(0, 0, 0);
    }
}

/* ==========================================================================
   ANIMATION UTILITY CLASSES
   ========================================================================== */

/* Animation classes */
.animate-fade-in-up {
    animation: fadeInUp var(--animation-duration-normal) ease-out;
}

.animate-fade-in-down {
    animation: fadeInDown var(--animation-duration-normal) ease-out;
}

.animate-fade-in-left {
    animation: fadeInLeft var(--animation-duration-normal) ease-out;
}

.animate-fade-in-right {
    animation: fadeInRight var(--animation-duration-normal) ease-out;
}

.animate-scale-in {
    animation: scaleIn var(--animation-duration-normal) ease-out;
}

.animate-bounce-in {
    animation: bounceIn var(--animation-duration-slow) cubic-bezier(0.215, 0.610, 0.355, 1.000);
}

.animate-slide-in-up {
    animation: slideInUp var(--animation-duration-normal) ease-out;
}

.animate-slide-in-down {
    animation: slideInDown var(--animation-duration-normal) ease-out;
}

.animate-rotate-in {
    animation: rotateIn var(--animation-duration-normal) ease-out;
}

.animate-pulse {
    animation: pulse 2s infinite;
}

.animate-shake {
    animation: shake var(--animation-duration-slow) ease-in-out;
}

.animate-wobble {
    animation: wobble 1s ease-in-out;
}

/* Animation delay utilities */
.animate-delay-100 { animation-delay: 100ms; }
.animate-delay-200 { animation-delay: 200ms; }
.animate-delay-300 { animation-delay: 300ms; }
.animate-delay-400 { animation-delay: 400ms; }
.animate-delay-500 { animation-delay: 500ms; }
.animate-delay-600 { animation-delay: 600ms; }
.animate-delay-700 { animation-delay: 700ms; }
.animate-delay-800 { animation-delay: 800ms; }
.animate-delay-900 { animation-delay: 900ms; }
.animate-delay-1000 { animation-delay: 1000ms; }

/* Animation duration utilities */
.animate-duration-fast { animation-duration: var(--animation-duration-fast); }
.animate-duration-normal { animation-duration: var(--animation-duration-normal); }
.animate-duration-slow { animation-duration: var(--animation-duration-slow); }

/* ==========================================================================
   HOVER ANIMATIONS
   ========================================================================== */

.hover-lift {
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.hover-lift:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
}

.hover-scale {
    transition: transform var(--transition-normal);
}

.hover-scale:hover {
    transform: scale(1.05);
}

.hover-rotate {
    transition: transform var(--transition-normal);
}

.hover-rotate:hover {
    transform: rotate(5deg);
}

.hover-glow {
    position: relative;
    transition: all var(--transition-normal);
}

.hover-glow::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, var(--color-secondary), var(--color-accent-orange));
    border-radius: inherit;
    z-index: -1;
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.hover-glow:hover::before {
    opacity: 1;
}

/* ==========================================================================
   STAGGER ANIMATIONS
   ========================================================================== */

.stagger-children > *:nth-child(1) { animation-delay: 0.1s; }
.stagger-children > *:nth-child(2) { animation-delay: 0.2s; }
.stagger-children > *:nth-child(3) { animation-delay: 0.3s; }
.stagger-children > *:nth-child(4) { animation-delay: 0.4s; }
.stagger-children > *:nth-child(5) { animation-delay: 0.5s; }
.stagger-children > *:nth-child(6) { animation-delay: 0.6s; }
.stagger-children > *:nth-child(7) { animation-delay: 0.7s; }
.stagger-children > *:nth-child(8) { animation-delay: 0.8s; }
.stagger-children > *:nth-child(9) { animation-delay: 0.9s; }
.stagger-children > *:nth-child(10) { animation-delay: 1.0s; }

/* ==========================================================================
   LOADING ANIMATIONS
   ========================================================================== */

.loading-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid var(--color-border);
    border-top: 4px solid var(--color-secondary);
    border-radius: var(--border-radius-full);
    animation: spin 1s linear infinite;
}

.loading-dots {
    display: inline-flex;
    gap: 4px;
}

.loading-dots::after {
    content: '';
    width: 8px;
    height: 8px;
    background-color: var(--color-secondary);
    border-radius: var(--border-radius-full);
    animation: loadingDots 1.4s ease-in-out infinite both;
}

.loading-dots::before {
    content: '';
    width: 8px;
    height: 8px;
    background-color: var(--color-secondary);
    border-radius: var(--border-radius-full);
    animation: loadingDots 1.4s ease-in-out infinite both;
    animation-delay: -0.16s;
}

@keyframes loadingDots {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

/* Spin animation */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ==========================================================================
   TEXT ANIMATIONS
   ========================================================================== */

.text-reveal {
    overflow: hidden;
}

.text-reveal .char {
    display: inline-block;
    transform: translateY(100%);
    animation: textReveal var(--animation-duration-normal) ease-out forwards;
}

@keyframes textReveal {
    to {
        transform: translateY(0);
    }
}

.typing-effect::after {
    content: '|';
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* ==========================================================================
   PERFORMANCE OPTIMIZATIONS
   ========================================================================== */

/* GPU acceleration for smooth animations */
.gpu-accelerated {
    transform: translate3d(0, 0, 0);
    backface-visibility: hidden;
    perspective: 1000px;
}

/* ==========================================================================
   ACCESSIBILITY CONSIDERATIONS
   ========================================================================== */

/* Respect user's motion preferences */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .hover-lift:hover,
    .hover-scale:hover,
    .hover-rotate:hover {
        transform: none;
    }
}

/* High contrast mode adjustments */
@media (prefers-contrast: high) {
    .hover-glow::before {
        opacity: 0.8;
    }
    
    .loading-spinner {
        border-width: 6px;
    }
}
