﻿/* ============================================================
   ANIMATIONS.CSS — Keyframes, GSAP helper classes, transitions
   ============================================================ */

/* ————— Reveal Animation Base States ————— */
.reveal {
    opacity: 0;
    transform: translateY(60px);
    will-change: transform, opacity;
}

.reveal-left {
    opacity: 0;
    transform: translateX(-80px);
    will-change: transform, opacity;
}

.reveal-right {
    opacity: 0;
    transform: translateX(80px);
    will-change: transform, opacity;
}

.reveal-scale {
    opacity: 0;
    transform: scale(0.9);
    will-change: transform, opacity;
}

.reveal-stagger > * {
    opacity: 0;
    transform: translateY(40px);
}

/* Active state — set by GSAP */
.is-revealed {
    opacity: 1;
    transform: translate(0) scale(1);
}


/* ============================================================
   KEYFRAME ANIMATIONS
   ============================================================ */

/* Floating animation */
@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50%      { transform: translateY(-20px); }
}

.animate-float {
    animation: float 6s ease-in-out infinite;
}

.animate-float-slow {
    animation: float 8s ease-in-out infinite;
}

.animate-float-delay {
    animation: float 6s ease-in-out 2s infinite;
}

/* Pulse glow */
@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 20px rgba(255,77,0,0.2); }
    50%      { box-shadow: 0 0 40px rgba(255,77,0,0.4), 0 0 80px rgba(255,122,46,0.2); }
}

.animate-pulse-glow {
    animation: pulse-glow 3s ease-in-out infinite;
}

/* Gradient shift */
@keyframes gradient-shift {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.animate-gradient {
    background-size: 200% 200%;
    animation: gradient-shift 8s ease infinite;
}

/* Rotate */
@keyframes rotate {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

.animate-rotate {
    animation: rotate 20s linear infinite;
}

.animate-rotate-slow {
    animation: rotate 40s linear infinite;
}

/* Scale pulse */
@keyframes scale-pulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.05); }
}

/* Slide in from left for mobile menu */
@keyframes slide-in-left {
    from { transform: translateX(-100%); }
    to   { transform: translateX(0); }
}

/* Fade up for page load */
@keyframes fade-up {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Draw line (for timeline) */
@keyframes draw-line {
    from { height: 0; }
    to   { height: 100%; }
}

/* Shimmer effect for loading */
@keyframes shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.animate-shimmer {
    background: linear-gradient(
        90deg,
        rgba(255,255,255,0) 0%,
        rgba(255,255,255,0.05) 50%,
        rgba(255,255,255,0) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 2s ease-in-out infinite;
}

/* Blob morph for hero background */
@keyframes morph {
    0%, 100% {
        border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
        transform: rotate(0deg) scale(1);
    }
    25% {
        border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%;
    }
    50% {
        border-radius: 50% 60% 30% 60% / 30% 50% 70% 60%;
        transform: rotate(180deg) scale(1.05);
    }
    75% {
        border-radius: 60% 30% 50% 40% / 60% 40% 60% 30%;
    }
}

.animate-morph {
    animation: morph 12s ease-in-out infinite;
}

/* Dot grid pulse */
@keyframes dot-pulse {
    0%, 100% { opacity: 0.3; }
    50%      { opacity: 0.6; }
}

/* Text reveal clip */
@keyframes text-reveal {
    from { clip-path: inset(0 100% 0 0); }
    to   { clip-path: inset(0 0 0 0); }
}

/* Counter number animation helper */
@keyframes count-up {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}


/* ============================================================
   HERO-SPECIFIC ANIMATIONS
   ============================================================ */

/* Hero gradient orbs animation */
.hero-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    pointer-events: none;
    z-index: 0;
}

.hero-orb--1 {
    width: 700px;
    height: 700px;
    background: rgba(255,77,0,0.2);
    top: -300px;
    right: -200px;
    animation: morph 15s ease-in-out infinite, float 10s ease-in-out infinite;
}

.hero-orb--2 {
    width: 500px;
    height: 500px;
    background: rgba(255,122,46,0.15);
    bottom: -200px;
    left: -150px;
    animation: morph 12s ease-in-out 3s infinite, float 8s ease-in-out 2s infinite;
}

.hero-orb--3 {
    width: 400px;
    height: 400px;
    background: rgba(255,170,92,0.1);
    top: 30%;
    left: 40%;
    animation: morph 10s ease-in-out 5s infinite, float 12s ease-in-out 4s infinite;
}

.hero-orb--4 {
    width: 300px;
    height: 300px;
    background: rgba(6,182,212,0.1);
    bottom: 10%;
    right: 20%;
    animation: morph 14s ease-in-out 2s infinite, float 9s ease-in-out infinite;
}


/* ============================================================
   TIMELINE ANIMATIONS
   ============================================================ */
.timeline-line {
    position: absolute;
    left: 50%;
    top: 0;
    width: 2px;
    height: 100%;
    background: var(--color-border);
    transform: translateX(-50%);
}

.timeline-line-fill {
    position: absolute;
    left: 50%;
    top: 0;
    width: 2px;
    height: 0;
    background: var(--gradient-accent);
    transform: translateX(-50%);
    transition: height 0.1s linear;
}

@media (max-width: 767px) {
    .timeline-line,
    .timeline-line-fill {
        left: 20px;
    }
}


/* ============================================================
   CARD HOVER EFFECTS
   ============================================================ */

/* Gradient border rotation on hover */
.card-glow {
    position: relative;
}

.card-glow::after {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    background: conic-gradient(
        from var(--rotation, 0deg),
        transparent,
        var(--color-accent-1),
        var(--color-accent-2),
        var(--color-accent-3),
        transparent
    );
    z-index: -1;
    opacity: 0;
    transition: opacity var(--transition-slow);
}

.card-glow:hover::after {
    opacity: 1;
}

/* Tilt effect class — controlled by JS */
.tilt-card {
    transform-style: preserve-3d;
    perspective: 1000px;
}


/* ============================================================
   ACCORDION ANIMATIONS
   ============================================================ */
.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s var(--ease-out-expo);
}

.accordion-item.is-open .accordion-content {
    max-height: 500px;
}

.accordion-icon {
    transition: transform var(--transition-base);
}

.accordion-item.is-open .accordion-icon {
    transform: rotate(45deg);
}


/* ============================================================
   PARALLAX HELPERS
   ============================================================ */
[data-speed] {
    will-change: transform;
}


/* ============================================================
   LOADING & TRANSITION STATES
   ============================================================ */
.page-loader {
    position: fixed;
    inset: 0;
    background: var(--color-bg);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-loader .loader-bar {
    width: 120px;
    height: 2px;
    background: var(--color-surface-3);
    border-radius: var(--radius-full);
    overflow: hidden;
    position: relative;
}

.page-loader .loader-bar::after {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--gradient-accent);
    animation: shimmer 1s ease-in-out infinite;
    background-size: 200% 100%;
}


/* ============================================================
   TEXT SPLIT ANIMATIONS
   ============================================================ */
.split-text .char {
    display: inline-block;
    opacity: 0;
    transform: translateY(40px);
    will-change: transform, opacity;
}

.split-text .word {
    display: inline-block;
    overflow: hidden;
    vertical-align: bottom;
    padding-bottom: 0.05em;
}

.split-text.is-revealed .char {
    opacity: 1;
    transform: none;
}


/* ============================================================
   MARQUEE / HORIZONTAL SCROLL
   ============================================================ */
@keyframes marquee {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

.marquee {
    overflow: hidden;
    white-space: nowrap;
    position: relative;
}

.marquee__track {
    display: inline-flex;
    animation: marquee 30s linear infinite;
    will-change: transform;
}

.marquee:hover .marquee__track {
    animation-play-state: paused;
}

.marquee__item {
    font-family: var(--font-heading);
    font-size: clamp(3rem, 2rem + 5vw, 8rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    padding: 0 var(--space-2xl);
    color: transparent;
    -webkit-text-stroke: 1px var(--color-border-hover);
    transition: all 0.4s ease;
    cursor: default;
    user-select: none;
}

.marquee__item:hover {
    color: var(--color-accent-1);
    -webkit-text-stroke: 1px var(--color-accent-1);
}

.marquee__item .separator {
    display: inline-block;
    width: 16px;
    height: 16px;
    background: var(--color-accent-1);
    border-radius: 50%;
    margin: 0 var(--space-xl);
    vertical-align: middle;
    opacity: 0.5;
}


/* ============================================================
   3D CARD TILT
   ============================================================ */
.tilt-3d {
    transform-style: preserve-3d;
    perspective: 1000px;
    transition: transform 0.1s ease;
}

.tilt-3d-inner {
    transform: translateZ(40px);
}


/* ============================================================
   STAGGER WAVE (for grid items)
   ============================================================ */
.stagger-wave > * {
    opacity: 0;
    transform: translateY(60px) scale(0.95);
    will-change: transform, opacity;
}


/* ============================================================
   LINE DRAW ANIMATION
   ============================================================ */
@keyframes line-draw {
    from { width: 0; }
    to { width: 100%; }
}

.line-draw {
    position: relative;
}

.line-draw::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    height: 2px;
    width: 0;
    background: var(--gradient-accent);
    border-radius: var(--radius-full);
}

.line-draw.is-drawn::after {
    animation: line-draw 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}


/* ============================================================
   IMAGE REVEAL (clip-path)
   ============================================================ */
.clip-reveal {
    clip-path: inset(100% 0 0 0);
    transition: clip-path 1s cubic-bezier(0.16, 1, 0.3, 1);
}

.clip-reveal.is-revealed {
    clip-path: inset(0 0 0 0);
}


/* ============================================================
   REDUCED MOTION OVERRIDES
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    .reveal,
    .reveal-left,
    .reveal-right,
    .reveal-scale,
    .reveal-stagger > *,
    .stagger-wave > *,
    .split-text .char {
        opacity: 1;
        transform: none;
    }

    .animate-float,
    .animate-float-slow,
    .animate-float-delay,
    .animate-morph,
    .animate-rotate,
    .animate-rotate-slow,
    .animate-pulse-glow,
    .animate-gradient,
    .animate-shimmer {
        animation: none;
    }

    .marquee__track {
        animation: none;
    }

    .hero-orb--1,
    .hero-orb--2,
    .hero-orb--3,
    .hero-orb--4 {
        animation: none;
    }

    .cursor, .cursor-dot { display: none !important; }
}
