/* ============================================
   Andrew Baldry - Visual Artist
   Animations Stylesheet
   ============================================ */

/* ============================================
   Scroll Reveal Animations
   ============================================ */
.animate-in {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1),
                transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.animate-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Staggered delays for hero elements */
.hero .animate-in:nth-child(1) { transition-delay: 0.1s; }
.hero .animate-in:nth-child(2) { transition-delay: 0.2s; }
.hero .animate-in:nth-child(3) { transition-delay: 0.3s; }
.hero .animate-in:nth-child(4) { transition-delay: 0.4s; }

/* Fade up animation */
.fade-up {
    opacity: 0;
    transform: translateY(40px);
}

.fade-up.visible {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.6s var(--ease-out),
                transform 0.6s var(--ease-out);
}

/* Fade in animation */
.fade-in {
    opacity: 0;
}

.fade-in.visible {
    opacity: 1;
    transition: opacity 0.8s var(--ease-out);
}

/* Scale in animation */
.scale-in {
    opacity: 0;
    transform: scale(0.95);
}

.scale-in.visible {
    opacity: 1;
    transform: scale(1);
    transition: opacity 0.6s var(--ease-out),
                transform 0.6s var(--ease-out);
}

/* Slide in from left */
.slide-left {
    opacity: 0;
    transform: translateX(-50px);
}

.slide-left.visible {
    opacity: 1;
    transform: translateX(0);
    transition: opacity 0.6s var(--ease-out),
                transform 0.6s var(--ease-out);
}

/* Slide in from right */
.slide-right {
    opacity: 0;
    transform: translateX(50px);
}

.slide-right.visible {
    opacity: 1;
    transform: translateX(0);
    transition: opacity 0.6s var(--ease-out),
                transform 0.6s var(--ease-out);
}

/* Stagger children */
.stagger-children > * {
    opacity: 0;
    transform: translateY(30px);
}

.stagger-children.visible > * {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.5s var(--ease-out),
                transform 0.5s var(--ease-out);
}

.stagger-children.visible > *:nth-child(1) { transition-delay: 0.05s; }
.stagger-children.visible > *:nth-child(2) { transition-delay: 0.1s; }
.stagger-children.visible > *:nth-child(3) { transition-delay: 0.15s; }
.stagger-children.visible > *:nth-child(4) { transition-delay: 0.2s; }
.stagger-children.visible > *:nth-child(5) { transition-delay: 0.25s; }
.stagger-children.visible > *:nth-child(6) { transition-delay: 0.3s; }
.stagger-children.visible > *:nth-child(7) { transition-delay: 0.35s; }
.stagger-children.visible > *:nth-child(8) { transition-delay: 0.4s; }
.stagger-children.visible > *:nth-child(9) { transition-delay: 0.45s; }
.stagger-children.visible > *:nth-child(10) { transition-delay: 0.5s; }
.stagger-children.visible > *:nth-child(11) { transition-delay: 0.55s; }
.stagger-children.visible > *:nth-child(12) { transition-delay: 0.6s; }

/* ============================================
   Parallax Effects
   ============================================ */
.parallax {
    will-change: transform;
}

.parallax-slow {
    transform: translateY(var(--parallax-y, 0));
    transition: transform 0.1s linear;
}

.parallax-medium {
    transform: translateY(calc(var(--parallax-y, 0) * 0.5));
    transition: transform 0.1s linear;
}

.parallax-fast {
    transform: translateY(calc(var(--parallax-y, 0) * 0.25));
    transition: transform 0.1s linear;
}

/* ============================================
   Text Animations
   ============================================ */
/* Split text animation */
.split-text .char {
    display: inline-block;
    opacity: 0;
    transform: translateY(100%);
    transition: opacity 0.5s var(--ease-out),
                transform 0.5s var(--ease-out);
}

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

/* Letter stagger */
.split-text.visible .char:nth-child(1) { transition-delay: 0.02s; }
.split-text.visible .char:nth-child(2) { transition-delay: 0.04s; }
.split-text.visible .char:nth-child(3) { transition-delay: 0.06s; }
.split-text.visible .char:nth-child(4) { transition-delay: 0.08s; }
.split-text.visible .char:nth-child(5) { transition-delay: 0.1s; }
.split-text.visible .char:nth-child(6) { transition-delay: 0.12s; }
.split-text.visible .char:nth-child(7) { transition-delay: 0.14s; }
.split-text.visible .char:nth-child(8) { transition-delay: 0.16s; }
.split-text.visible .char:nth-child(9) { transition-delay: 0.18s; }
.split-text.visible .char:nth-child(10) { transition-delay: 0.2s; }
.split-text.visible .char:nth-child(11) { transition-delay: 0.22s; }
.split-text.visible .char:nth-child(12) { transition-delay: 0.24s; }
.split-text.visible .char:nth-child(13) { transition-delay: 0.26s; }
.split-text.visible .char:nth-child(14) { transition-delay: 0.28s; }
.split-text.visible .char:nth-child(15) { transition-delay: 0.3s; }

/* Underline reveal */
.underline-reveal {
    position: relative;
    display: inline-block;
}

.underline-reveal::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--color-accent);
    transition: width 0.6s var(--ease-out);
}

.underline-reveal.visible::after,
.underline-reveal:hover::after {
    width: 100%;
}

/* ============================================
   Image Animations
   ============================================ */
/* Image reveal with mask */
.image-reveal {
    position: relative;
    overflow: hidden;
}

.image-reveal::before {
    content: '';
    position: absolute;
    inset: 0;
    background-color: var(--color-bg);
    z-index: 1;
    transform: scaleX(1);
    transform-origin: right;
    transition: transform 0.8s var(--ease-in-out);
}

.image-reveal.visible::before {
    transform: scaleX(0);
}

.image-reveal img {
    transform: scale(1.2);
    transition: transform 1.2s var(--ease-out);
}

.image-reveal.visible img {
    transform: scale(1);
}

/* Clip reveal */
.clip-reveal {
    clip-path: inset(100% 0 0 0);
    transition: clip-path 0.8s var(--ease-out);
}

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

/* ============================================
   Hover Animations
   ============================================ */
/* Magnetic button effect (handled by JS) */
.magnetic-btn {
    transition: transform 0.3s var(--ease-out);
}

/* Link hover effect */
.link-hover {
    position: relative;
    display: inline-block;
}

.link-hover::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background-color: currentColor;
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.4s var(--ease-out);
}

.link-hover:hover::before {
    transform: scaleX(1);
    transform-origin: left;
}

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

.img-zoom img {
    transition: transform 0.6s var(--ease-out);
}

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

/* Card lift */
.card-lift {
    transition: transform 0.4s var(--ease-out),
                box-shadow 0.4s var(--ease-out);
}

.card-lift:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-lg);
}

/* ============================================
   Loading Animations
   ============================================ */
/* Skeleton loading */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--color-bg-card) 25%,
        var(--color-border) 50%,
        var(--color-bg-card) 75%
    );
    background-size: 200% 100%;
    animation: skeleton 1.5s ease-in-out infinite;
}

@keyframes skeleton {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Pulse animation */
.pulse {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Spin animation */
.spin {
    animation: spin 1s linear infinite;
}

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

/* ============================================
   Page Transitions
   ============================================ */
.page-transition-enter {
    opacity: 0;
}

.page-transition-enter-active {
    opacity: 1;
    transition: opacity 0.4s var(--ease-out);
}

.page-transition-exit {
    opacity: 1;
}

.page-transition-exit-active {
    opacity: 0;
    transition: opacity 0.4s var(--ease-out);
}

/* ============================================
   Micro-interactions
   ============================================ */
/* Button press effect */
.btn:active {
    transform: scale(0.98);
}

/* Checkbox/Radio animation */
.custom-checkbox input:checked + .checkmark {
    animation: checkmark 0.3s var(--ease-out);
}

@keyframes checkmark {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* Ripple effect */
.ripple {
    position: relative;
    overflow: hidden;
}

.ripple::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
    background-image: radial-gradient(circle, var(--color-accent) 10%, transparent 10.01%);
    background-repeat: no-repeat;
    background-position: 50%;
    transform: scale(10);
    opacity: 0;
    transition: transform 0.5s, opacity 0.5s;
}

.ripple:active::after {
    transform: scale(0);
    opacity: 0.3;
    transition: 0s;
}

/* ============================================
   Marquee Animation
   ============================================ */
.marquee {
    overflow: hidden;
    white-space: nowrap;
}

.marquee-content {
    display: inline-block;
    animation: marquee 30s linear infinite;
}

.marquee-content:hover {
    animation-play-state: paused;
}

@keyframes marquee {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* ============================================
   Gradient Animations
   ============================================ */
.gradient-animate {
    background: linear-gradient(
        -45deg,
        var(--color-accent),
        #8b5a2b,
        var(--color-accent-hover),
        #d4a574
    );
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* ============================================
   Attention Seekers
   ============================================ */
/* Bounce */
.bounce {
    animation: bounce 1s ease infinite;
}

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

/* Shake */
.shake {
    animation: shake 0.5s ease;
}

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

/* Glow pulse */
.glow-pulse {
    animation: glowPulse 2s ease-in-out infinite;
}

@keyframes glowPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(201, 169, 98, 0.4); }
    50% { box-shadow: 0 0 20px 10px rgba(201, 169, 98, 0); }
}

/* ============================================
   Performance Optimizations
   ============================================ */
.will-change-transform {
    will-change: transform;
}

.will-change-opacity {
    will-change: opacity;
}

.gpu-accelerated {
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .animate-in,
    .fade-up,
    .fade-in,
    .scale-in,
    .slide-left,
    .slide-right {
        opacity: 1;
        transform: none;
    }
    
    .stagger-children > * {
        opacity: 1;
        transform: none;
    }
}
