/**
 * Animations - Kadley Portfolio
 * Glow flicker, scroll reveal, hover pulses, and decorative animations.
 */

/* ==========================================================================
   GLOW FLICKER - Subtle neon pulse on borders
   ========================================================================== */

@keyframes glowPulse {

    0%,
    100% {
        box-shadow: var(--glow-blue);
        border-color: var(--border-glow);
    }

    50% {
        box-shadow: var(--glow-blue-strong);
        border-color: var(--neon-blue);
    }
}

.animate-glow-pulse {
    animation: glowPulse 4s ease-in-out infinite;
}

/* ==========================================================================
   TEXT GLOW FLICKER - Victorian neon sign effect
   ========================================================================== */

@keyframes textGlowFlicker {

    0%,
    19%,
    21%,
    23%,
    25%,
    54%,
    56%,
    100% {
        text-shadow: var(--text-glow-blue);
        opacity: 1;
    }

    20%,
    24%,
    55% {
        text-shadow: none;
        opacity: 0.85;
    }
}

.animate-text-flicker {
    animation: textGlowFlicker 6s linear infinite;
}

/* ==========================================================================
   GOLD SHIMMER - For Victorian ornaments
   ========================================================================== */

@keyframes goldShimmer {

    0%,
    100% {
        opacity: 0.5;
        text-shadow: var(--text-glow-gold);
    }

    50% {
        opacity: 0.8;
        text-shadow: var(--text-glow-gold), 0 0 12px rgba(201, 168, 76, 0.25);
    }
}

.animate-gold-shimmer {
    animation: goldShimmer 5s ease-in-out infinite;
}

/* ==========================================================================
   FADE IN UP - Scroll reveal
   ========================================================================== */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in-up {
    animation: fadeInUp 0.7s ease forwards;
}

/* ==========================================================================
   FADE IN - Simple opacity
   ========================================================================== */

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.animate-fade-in {
    animation: fadeIn 0.6s ease forwards;
}

/* ==========================================================================
   SCALE IN - For lightbox images
   ========================================================================== */

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

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.animate-scale-in {
    animation: scaleIn 0.35s ease forwards;
}

/* ==========================================================================
   BORDER DRAW - Victorian frame reveal
   ========================================================================== */

@keyframes borderDraw {
    0% {
        clip-path: polygon(0 0, 0 0, 0 0, 0 0);
    }

    25% {
        clip-path: polygon(0 0, 100% 0, 100% 0, 0 0);
    }

    50% {
        clip-path: polygon(0 0, 100% 0, 100% 100%, 100% 100%);
    }

    75% {
        clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
    }

    100% {
        clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
    }
}

/* ==========================================================================
   FLOAT - Subtle floating for decorative elements
   ========================================================================== */

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-8px);
    }
}

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

/* ==========================================================================
   STAGGER CHILDREN - For lists and grids
   ========================================================================== */

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

.stagger-children--visible>*:nth-child(1) {
    animation: fadeInUp 0.5s ease 0.05s forwards;
}

.stagger-children--visible>*:nth-child(2) {
    animation: fadeInUp 0.5s ease 0.12s forwards;
}

.stagger-children--visible>*:nth-child(3) {
    animation: fadeInUp 0.5s ease 0.19s forwards;
}

.stagger-children--visible>*:nth-child(4) {
    animation: fadeInUp 0.5s ease 0.26s forwards;
}

.stagger-children--visible>*:nth-child(5) {
    animation: fadeInUp 0.5s ease 0.33s forwards;
}

.stagger-children--visible>*:nth-child(6) {
    animation: fadeInUp 0.5s ease 0.40s forwards;
}

.stagger-children--visible>*:nth-child(7) {
    animation: fadeInUp 0.5s ease 0.47s forwards;
}

.stagger-children--visible>*:nth-child(8) {
    animation: fadeInUp 0.5s ease 0.54s forwards;
}

.stagger-children--visible>*:nth-child(9) {
    animation: fadeInUp 0.5s ease 0.61s forwards;
}

.stagger-children--visible>*:nth-child(10) {
    animation: fadeInUp 0.5s ease 0.68s forwards;
}

.stagger-children--visible>*:nth-child(11) {
    animation: fadeInUp 0.5s ease 0.75s forwards;
}

.stagger-children--visible>*:nth-child(12) {
    animation: fadeInUp 0.5s ease 0.82s forwards;
}

/* ==========================================================================
   HERO ENTRY ANIMATIONS - Staggered entrance on page load
   ========================================================================== */

/* -- Fade + Rise for hero elements -- */
@keyframes heroFadeRise {
    from {
        opacity: 0;
        transform: translateY(25px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* -- Avatar entrance glow burst -- */
@keyframes avatarGlowBurst {
    0% {
        opacity: 0;
        transform: scale(0.8);
        box-shadow: 0 0 0 rgba(41, 171, 226, 0);
    }

    50% {
        opacity: 1;
        transform: scale(1.05);
        box-shadow: 0 0 40px rgba(41, 171, 226, 0.6),
            0 0 80px rgba(41, 171, 226, 0.3);
    }

    100% {
        opacity: 1;
        transform: scale(1);
        box-shadow: var(--glow-blue-strong);
    }
}

/* -- Ornament diamond reveal -- */
@keyframes ornamentReveal {
    from {
        opacity: 0;
        transform: scale(0) rotate(180deg);
    }

    to {
        opacity: 0.8;
        transform: scale(1) rotate(0deg);
    }
}

/* -- Slide in from right for showcase -- */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(60px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Hero element initial hidden state — JS sets this inline */
/* Animations are driven by JS to avoid CSS specificity conflicts */

/* -- Particles canvas -- */
#hero-particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

/* ==========================================================================
   REDUCED MOTION - Accessibility
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .reveal {
        opacity: 1;
        transform: none;
    }

    .stagger-children>* {
        opacity: 1;
        transform: none;
    }

    .hero-entry {
        opacity: 1 !important;
        transform: none !important;
    }
}