/**
 * SubZero Theme - Animations & Effects
 * Ice/Frost inspired animations for enhanced UI/UX
 *
 * @package SubZero
 */

/* ==========================================================================
   Reduced Motion Support
   ========================================================================== */
@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;
    }

    .animate-on-scroll,
    .frost-hover,
    .ice-glow {
        opacity: 1 !important;
        transform: none !important;
    }

    /* GSAP-animated elements - ensure visible state */
    .hero__badge, .hero__title, .hero__description, .hero__actions,
    .section-intro__label, .section-intro__title, .section-intro__description,
    .service-card, .project-card,
    .cta-block, .cta-block__title, .cta-block__text, .cta-block__actions,
    .footer-cta, .footer-main, .footer-bottom,
    .project-gallery__item img, .project-details__section, .project-sidebar__card {
        opacity: 1 !important;
        transform: none !important;
        visibility: visible !important;
    }

    /* Reset will-change to avoid any residual effects */
    [style*="will-change"] {
        will-change: auto !important;
    }
}

/* ==========================================================================
   Keyframe Animations
   ========================================================================== */

/* Frost Shimmer - Subtle ice sparkle effect */
@keyframes frost-shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* Ice Particle Float - Floating ice crystals */
@keyframes ice-particle-float {
    0% {
        transform: translateY(100vh) translateX(0) rotate(0deg) scale(0);
        opacity: 0;
    }
    10% {
        opacity: 0.8;
        transform: translateY(80vh) translateX(10px) rotate(45deg) scale(1);
    }
    50% {
        opacity: 1;
        transform: translateY(40vh) translateX(-10px) rotate(180deg) scale(1.2);
    }
    90% {
        opacity: 0.6;
        transform: translateY(5vh) translateX(5px) rotate(315deg) scale(0.8);
    }
    100% {
        transform: translateY(-10vh) translateX(0) rotate(360deg) scale(0);
        opacity: 0;
    }
}

/* Frost Breathe - Pulsing frost glow effect */
@keyframes frost-breathe {
    0%, 100% {
        box-shadow:
            0 0 5px rgba(0, 153, 191, 0.2),
            0 0 10px rgba(0, 153, 191, 0.1),
            0 0 20px rgba(102, 196, 217, 0.05);
        filter: brightness(1);
    }
    50% {
        box-shadow:
            0 0 10px rgba(0, 153, 191, 0.4),
            0 0 20px rgba(0, 153, 191, 0.2),
            0 0 40px rgba(102, 196, 217, 0.1);
        filter: brightness(1.05);
    }
}

/* Slide Up Fade - Scroll reveal animation */
@keyframes slide-up-fade {
    0% {
        opacity: 0;
        transform: translateY(40px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Slide In Left */
@keyframes slide-in-left {
    0% {
        opacity: 0;
        transform: translateX(-40px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Slide In Right */
@keyframes slide-in-right {
    0% {
        opacity: 0;
        transform: translateX(40px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Scale Fade In */
@keyframes scale-fade-in {
    0% {
        opacity: 0;
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Text Freeze - Text ice-over effect */
@keyframes text-freeze {
    0% {
        background-position: 100% 50%;
        filter: blur(0px);
    }
    50% {
        filter: blur(1px);
    }
    100% {
        background-position: 0% 50%;
        filter: blur(0px);
    }
}

/* Button Frost - Button hover frost spread */
@keyframes button-frost {
    0% {
        background-size: 0% 100%;
        background-position: left center;
    }
    100% {
        background-size: 100% 100%;
        background-position: left center;
    }
}

/* Ice Crystal Spin */
@keyframes ice-crystal-spin {
    0% {
        transform: rotate(0deg) scale(1);
    }
    25% {
        transform: rotate(90deg) scale(1.1);
    }
    50% {
        transform: rotate(180deg) scale(1);
    }
    75% {
        transform: rotate(270deg) scale(1.1);
    }
    100% {
        transform: rotate(360deg) scale(1);
    }
}

/* Frost Wave */
@keyframes frost-wave {
    0%, 100% {
        transform: translateX(-100%);
        opacity: 0;
    }
    50% {
        transform: translateX(100%);
        opacity: 0.5;
    }
}

/* Snow Fall */
@keyframes snow-fall {
    0% {
        transform: translateY(-10px) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* Glow Pulse */
@keyframes glow-pulse {
    0%, 100% {
        text-shadow:
            0 0 4px rgba(102, 196, 217, 0.5),
            0 0 8px rgba(102, 196, 217, 0.3);
    }
    50% {
        text-shadow:
            0 0 8px rgba(102, 196, 217, 0.8),
            0 0 16px rgba(102, 196, 217, 0.5),
            0 0 24px rgba(102, 196, 217, 0.3);
    }
}

/* Counter Number Animation */
@keyframes count-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Ripple Effect */
@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(4);
        opacity: 0;
    }
}

/* ==========================================================================
   Scroll Indicator Pulse Animation (Apple-style)
   ========================================================================== */
@keyframes scroll-indicator-pulse {
    0%, 100% {
        opacity: 0.6;
        transform: translateY(0) scale(1);
    }
    50% {
        opacity: 1;
        transform: translateY(4px) scale(1.05);
    }
}

.hero__scroll-indicator {
    animation: scroll-indicator-pulse 2s ease-in-out infinite;
    will-change: transform, opacity;
}

/* Pause animation on hover - user is paying attention */
.hero__scroll-indicator:hover {
    animation-play-state: paused;
    opacity: 1;
}

/* ==========================================================================
   Utility Animation Classes
   ========================================================================== */

/* Animate on Scroll - Base class */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
    will-change: opacity, transform;
}

/* Trust bar - always visible immediately (no delay after hero) */
.trust-bar.animate-on-scroll {
    opacity: 1;
    transform: none;
    transition: none;
}

.animate-on-scroll.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Animation Variants */
.animate-on-scroll--fade {
    transform: none;
}

.animate-on-scroll--slide-left {
    transform: translateX(-40px);
}

.animate-on-scroll--slide-left.is-visible {
    transform: translateX(0);
}

.animate-on-scroll--slide-right {
    transform: translateX(40px);
}

.animate-on-scroll--slide-right.is-visible {
    transform: translateX(0);
}

.animate-on-scroll--scale {
    transform: scale(0.9);
}

.animate-on-scroll--scale.is-visible {
    transform: scale(1);
}

.animate-on-scroll--zoom {
    transform: scale(0.8);
}

.animate-on-scroll--zoom.is-visible {
    transform: scale(1);
}

/* Animation Delays for Staggered Effects */
.animate-delay-1 { transition-delay: 0.1s; }
.animate-delay-2 { transition-delay: 0.2s; }
.animate-delay-3 { transition-delay: 0.3s; }
.animate-delay-4 { transition-delay: 0.4s; }
.animate-delay-5 { transition-delay: 0.5s; }
.animate-delay-6 { transition-delay: 0.6s; }

/* Stagger children animation */
.stagger-children > * {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.4s ease-out, transform 0.4s ease-out;
}

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

.stagger-children.is-visible > * {
    opacity: 1;
    transform: translateY(0);
}

/* ==========================================================================
   Frost Hover Effect
   ========================================================================== */
.frost-hover {
    position: relative;
    overflow: hidden;
    transition: box-shadow 0.3s ease;
}

.frost-hover::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.1) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    transform: translateX(-100%);
    transition: transform 0.5s ease;
    pointer-events: none;
    z-index: 1;
}

.frost-hover:hover::before {
    transform: translateX(100%);
}

.frost-hover:hover {
    box-shadow:
        0 0 20px rgba(0, 153, 191, 0.15),
        0 8px 32px rgba(0, 153, 191, 0.2);
}

/* Ensure all direct children of frost-hover appear above the ::before overlay */
.frost-hover > * {
    position: relative;
    z-index: 2;
}

/* ==========================================================================
   Ice Glow Effect
   ========================================================================== */
.ice-glow {
    position: relative;
    transition: box-shadow 0.3s ease;
}

.ice-glow::after {
    content: '';
    position: absolute;
    inset: -2px;
    background: linear-gradient(
        45deg,
        rgba(0, 153, 191, 0.3),
        rgba(102, 196, 217, 0.3),
        rgba(0, 153, 191, 0.3)
    );
    border-radius: inherit;
    opacity: 0;
    z-index: -1;
    transition: opacity 0.3s ease;
    filter: blur(8px);
}

.ice-glow:hover::after,
.ice-glow:focus::after {
    opacity: 1;
}

/* Ice Glow Animation Active State */
.ice-glow--active::after {
    opacity: 1;
    animation: frost-breathe 2s ease-in-out infinite;
}

/* ==========================================================================
   Frost Glass Effect (Enhanced)
   ========================================================================== */
.frost-glass {
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 32px rgba(0, 153, 191, 0.1);
}

.frost-glass--dark {
    background: rgba(48, 48, 48, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.frost-glass--subtle {
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* ==========================================================================
   Ice Shimmer Loading Effect
   ========================================================================== */
.loading-shimmer {
    position: relative;
    overflow: hidden;
}

.loading-shimmer::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.4) 50%,
        transparent 100%
    );
    animation: frost-shimmer 1.5s infinite;
    pointer-events: none;
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--color-secondary-pale) 25%,
        rgba(255, 255, 255, 0.5) 50%,
        var(--color-secondary-pale) 75%
    );
    background-size: 200% 100%;
    animation: frost-shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-md);
}

.skeleton--text {
    height: 1em;
    margin-bottom: 0.5em;
}

.skeleton--title {
    height: 1.5em;
    width: 60%;
    margin-bottom: 1em;
}

.skeleton--image {
    aspect-ratio: 16/9;
}

/* ==========================================================================
   Ice Particle Styles (Subtle - blends with dark hero)
   ========================================================================== */
.ice-particle {
    position: absolute;
    background: radial-gradient(
        circle,
        rgba(102, 196, 217, 0.5) 0%,
        rgba(102, 196, 217, 0.2) 50%,
        transparent 100%
    );
    border-radius: 50%;
    pointer-events: none;
    animation: ice-particle-float 15s infinite linear;
    opacity: 0;
    box-shadow:
        0 0 4px rgba(102, 196, 217, 0.3),
        0 0 8px rgba(102, 196, 217, 0.2);
}

/* Crystal-shaped particles */
.ice-particle--crystal {
    border-radius: 0;
    -webkit-clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
    clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
    background: linear-gradient(
        135deg,
        rgba(102, 196, 217, 0.5),
        rgba(102, 196, 217, 0.3)
    );
}

/* Snow flake particles - subtle cyan instead of bright white */
.ice-particle--snow {
    background: rgba(102, 196, 217, 0.4);
    box-shadow: 0 0 4px rgba(102, 196, 217, 0.3);
    animation: snow-fall 10s infinite linear;
}

/* ==========================================================================
   Button Frost Effects
   ========================================================================== */
.btn-frost {
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    z-index: 1;
}

.btn-frost::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 100%;
    background: linear-gradient(
        90deg,
        rgba(102, 196, 217, 0.3),
        rgba(255, 255, 255, 0.2)
    );
    transition: width 0.3s ease;
    z-index: -1;
}

.btn-frost:hover::before {
    width: 100%;
}

.btn-frost:hover {
    box-shadow:
        0 0 20px rgba(0, 153, 191, 0.3),
        0 0 40px rgba(0, 153, 191, 0.1);
    transform: translateY(-2px);
}

/* Ripple effect on click */
.btn-frost::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    background: rgba(255, 255, 255, 0.5);
    opacity: 0;
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(1);
    pointer-events: none;
}

.btn-frost:active::after {
    animation: ripple 0.6s ease-out;
}

/* ==========================================================================
   CTA Button Enhanced Hover
   ========================================================================== */

/* CTA button pulse/glow animation */
@keyframes cta-button-pulse {
    0%, 100% {
        box-shadow:
            0 4px 15px rgba(0, 153, 191, 0.3),
            0 0 20px rgba(0, 153, 191, 0.1);
    }
    50% {
        box-shadow:
            0 6px 25px rgba(0, 153, 191, 0.5),
            0 0 40px rgba(0, 153, 191, 0.2),
            0 0 60px rgba(102, 196, 217, 0.1);
    }
}

/* Enhanced CTA button hover - the most inviting interactive element */
.cta-block .btn--primary,
.btn-cta-enhanced {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.cta-block .btn--primary:hover,
.btn-cta-enhanced:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow:
        0 8px 30px rgba(0, 153, 191, 0.4),
        0 0 30px rgba(0, 153, 191, 0.2);
    animation: cta-button-pulse 2s ease-in-out infinite;
}

/* Reduced motion override */
@media (prefers-reduced-motion: reduce) {
    .cta-block .btn--primary:hover,
    .btn-cta-enhanced:hover {
        animation: none;
        transform: none;
    }
}

/* ==========================================================================
   Service Card Hover Enhancement (Apple iOS-style)
   ========================================================================== */
.service-card {
    transition:
        transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
        box-shadow 0.3s ease;
    will-change: transform;
}

.service-card:hover {
    transform: scale(1.02) translateY(-4px);
    box-shadow:
        0 12px 24px rgba(0, 0, 0, 0.1),
        0 24px 48px rgba(0, 0, 0, 0.08),
        0 0 0 1px rgba(0, 153, 191, 0.1);
}

/* Icon subtle bounce on card hover */
.service-card:hover .service-card__icon {
    transform: scale(1.1);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Link arrow slide on card hover */
.service-card:hover .service-card__link svg {
    transform: translateX(4px);
    transition: transform 0.2s ease;
}

/* ==========================================================================
   Card Lift Effect (Apple-style subtle hover)
   ========================================================================== */
.card-lift {
    transition:
        transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
        box-shadow 0.3s ease;
    will-change: transform;
}

.card-lift:hover {
    transform: scale(1.02) translateY(-6px);
    box-shadow:
        0 16px 32px rgba(0, 0, 0, 0.12),
        0 32px 64px rgba(0, 0, 0, 0.08),
        0 0 20px rgba(0, 153, 191, 0.1);
}

/* Card with frost border */
.card-frost-border {
    position: relative;
    transition: box-shadow 0.3s ease;
}

.card-frost-border::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 2px;
    background: linear-gradient(
        135deg,
        rgba(0, 153, 191, 0),
        rgba(102, 196, 217, 0),
        rgba(0, 153, 191, 0)
    );
    -webkit-mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    transition: background 0.3s ease;
}

.card-frost-border:hover::before {
    background: linear-gradient(
        135deg,
        rgba(0, 153, 191, 0.5),
        rgba(102, 196, 217, 0.5),
        rgba(0, 153, 191, 0.5)
    );
}

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

.image-reveal img {
    transition: transform 0.6s ease, filter 0.6s ease;
}

.image-reveal::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        135deg,
        var(--color-primary-dark),
        var(--color-primary)
    );
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

.image-reveal.is-revealed::after {
    transform: translateX(100%);
}

.image-reveal:hover img {
    transform: scale(1.05);
}

/* Frost overlay on images */
.image-frost-overlay {
    position: relative;
}

.image-frost-overlay::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        transparent 0%,
        transparent 50%,
        rgba(0, 153, 191, 0.1) 100%
    );
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 1;
}

.image-frost-overlay:hover::before {
    opacity: 1;
}

/* ==========================================================================
   Text Gradient Animation
   ========================================================================== */
.text-gradient-animate {
    background: linear-gradient(
        90deg,
        var(--color-primary),
        var(--color-primary-light),
        var(--color-primary)
    );
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: text-freeze 3s ease infinite;
}

/* Ice text effect */
.text-ice {
    color: var(--color-white);
    text-shadow:
        0 0 4px rgba(102, 196, 217, 0.8),
        0 0 8px rgba(102, 196, 217, 0.6),
        0 0 12px rgba(0, 153, 191, 0.4);
}

.text-ice-pulse {
    animation: glow-pulse 2s ease-in-out infinite;
}

/* ==========================================================================
   Focus States with Ice Effect
   ========================================================================== */
.ice-focus:focus {
    outline: none;
    box-shadow:
        0 0 0 2px var(--color-white),
        0 0 0 4px var(--color-primary),
        0 0 20px rgba(0, 153, 191, 0.3);
}

.ice-focus:focus-visible {
    outline: none;
    box-shadow:
        0 0 0 2px var(--color-white),
        0 0 0 4px var(--color-primary),
        0 0 20px rgba(0, 153, 191, 0.3);
}

/* ==========================================================================
   Counter Animation Styles
   ========================================================================== */
.counter-animate {
    display: inline-block;
    transition: transform 0.3s ease;
}

.counter-animate.is-counting {
    animation: count-up 0.5s ease-out forwards;
}

/* ==========================================================================
   Parallax Container
   ========================================================================== */
.parallax-container {
    position: relative;
    overflow: hidden;
}

.parallax-layer {
    position: absolute;
    inset: -20%;
    will-change: transform;
    transition: transform 0.1s linear;
}

.parallax-layer--slow {
    inset: -10%;
}

.parallax-layer--fast {
    inset: -30%;
}

/* ==========================================================================
   Section Transitions
   ========================================================================== */
.section-fade-in {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.section-fade-in.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* ==========================================================================
   Hover States for Interactive Elements
   ========================================================================== */

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

.link-frost::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(
        90deg,
        var(--color-primary),
        var(--color-primary-light)
    );
    transition: width 0.3s ease;
}

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

/* Icon hover rotation */
.icon-rotate-hover {
    transition: transform 0.3s ease;
}

.icon-rotate-hover:hover {
    transform: rotate(15deg) scale(1.1);
}

/* ==========================================================================
   Page Transition Effects
   ========================================================================== */
.page-transition-enter {
    animation: slide-up-fade 0.5s ease-out forwards;
}

.page-transition-exit {
    animation: slide-up-fade 0.3s ease-in reverse forwards;
}

/* ==========================================================================
   Performance Optimizations
   ========================================================================== */

/* GPU acceleration for animated elements */
.gpu-accelerate {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}

/* Will-change hints for known animations */
.will-animate-transform {
    will-change: transform;
}

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

.will-animate-all {
    will-change: transform, opacity;
}
