/* =================================================================
   ANANTA MOTORS — ANIMATIONS & MICRO-INTERACTIONS
   Awwwards-quality scroll reveals, transitions, and effects
   ================================================================= */

/* ─── Scroll Reveal ──────────────────────────────────────────────── */
/* IntersectionObserver adds .is-visible; CSS handles the transition */

[data-animate] {
    opacity: 0;
    transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-animate="fade-up"]    { transform: translateY(40px); }
[data-animate="fade-down"]  { transform: translateY(-40px); }
[data-animate="fade-left"]  { transform: translateX(-40px); }
[data-animate="fade-right"] { transform: translateX(40px); }
[data-animate="scale-in"]   { transform: scale(0.9); }
[data-animate="stagger-up"] { transform: translateY(20px); }

[data-animate].is-visible {
    opacity: 1;
    transform: none;
}

/* Stagger children */
[data-animate="stagger-up"].is-visible > * {
    opacity: 0;
    transform: translateY(30px);
    animation: stagger-fade-up 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

[data-animate="stagger-up"].is-visible > *:nth-child(1)  { animation-delay: 0.05s; }
[data-animate="stagger-up"].is-visible > *:nth-child(2)  { animation-delay: 0.1s; }
[data-animate="stagger-up"].is-visible > *:nth-child(3)  { animation-delay: 0.15s; }
[data-animate="stagger-up"].is-visible > *:nth-child(4)  { animation-delay: 0.2s; }
[data-animate="stagger-up"].is-visible > *:nth-child(5)  { animation-delay: 0.25s; }
[data-animate="stagger-up"].is-visible > *:nth-child(6)  { animation-delay: 0.3s; }
[data-animate="stagger-up"].is-visible > *:nth-child(7)  { animation-delay: 0.35s; }
[data-animate="stagger-up"].is-visible > *:nth-child(8)  { animation-delay: 0.4s; }
[data-animate="stagger-up"].is-visible > *:nth-child(9)  { animation-delay: 0.45s; }
[data-animate="stagger-up"].is-visible > *:nth-child(10) { animation-delay: 0.5s; }
[data-animate="stagger-up"].is-visible > *:nth-child(n+11) { animation-delay: 0.55s; }

@keyframes stagger-fade-up {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ─── Text Reveal (split lines) ──────────────────────────────────── */

.ananta-text-reveal {
    overflow: hidden;
}

.ananta-text-reveal__inner {
    display: block;
    transform: translateY(110%);
    transition: transform 0.9s cubic-bezier(0.16, 1, 0.3, 1);
}

.ananta-text-reveal.is-visible .ananta-text-reveal__inner {
    transform: translateY(0);
}

/* ─── Image Reveal (mask wipe) ───────────────────────────────────── */

.ananta-img-reveal {
    position: relative;
    overflow: hidden;
}

.ananta-img-reveal::after {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--am-green-600);
    transform-origin: right;
    transition: transform 1s cubic-bezier(0.77, 0, 0.175, 1);
}

.ananta-img-reveal.is-visible::after {
    transform: scaleX(0);
}

.ananta-img-reveal img {
    transform: scale(1.2);
    transition: transform 1.2s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* ─── Magnetic Button Effect ─────────────────────────────────────── */

.ananta-magnetic {
    transition: transform 0.3s var(--am-ease);
}

/* ─── Parallax Layer ─────────────────────────────────────────────── */

.ananta-parallax {
    will-change: transform;
}

/* ─── Counter Animation ──────────────────────────────────────────── */

.ananta-counter {
    font-variant-numeric: tabular-nums;
}

/* ─── Gradient Border Animation ──────────────────────────────────── */

.ananta-glow-border {
    position: relative;
}

.ananta-glow-border::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    background: conic-gradient(
        from 0deg,
        var(--am-green-500),
        var(--am-green-300),
        var(--am-green-700),
        var(--am-green-500)
    );
    z-index: -1;
    animation: rotate-glow 4s linear infinite;
    opacity: 0;
    transition: opacity 0.3s var(--am-ease);
}

.ananta-glow-border:hover::before {
    opacity: 1;
}

@keyframes rotate-glow {
    to { transform: rotate(360deg); }
}

/* ─── Marquee Text ───────────────────────────────────────────────── */

.ananta-marquee {
    overflow: hidden;
    white-space: nowrap;
    background: var(--am-bg-alt);
    padding: var(--am-space-xl) 0;
}

.ananta-marquee__inner {
    display: inline-flex;
    animation: marquee 30s linear infinite;
}

.ananta-marquee__inner span {
    padding: 0 var(--am-space-2xl);
    font-family: var(--am-font-heading);
    font-size: clamp(3rem, 8vw, 8rem);
    font-weight: 700;
    color: transparent;
    -webkit-text-stroke: 1px var(--am-grey-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

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

/* ─── Smooth Line Separator ──────────────────────────────────────── */

.ananta-line {
    height: 1px;
    background: var(--am-grey-200);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 1s cubic-bezier(0.16, 1, 0.3, 1);
}

.ananta-line.is-visible {
    transform: scaleX(1);
}

/* ─── Card Tilt on Hover (3D) ────────────────────────────────────── */

.ananta-tilt {
    transition: transform 0.4s var(--am-ease);
    transform-style: preserve-3d;
    perspective: 1000px;
}

/* ─── Loading Skeleton ───────────────────────────────────────────── */

.ananta-skeleton {
    background: linear-gradient(90deg,
        var(--am-grey-100) 25%,
        var(--am-grey-200) 50%,
        var(--am-grey-100) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: var(--am-radius-sm);
}

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

/* ─── Noise Texture Overlay ──────────────────────────────────────── */

.ananta-noise::after {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 1;
}

/* ─── Reduce Motion ──────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    [data-animate] {
        opacity: 1 !important;
        transform: none !important;
    }
}
