/* ============================================================
   FOTATEK — Animations
   Keyframes + scroll reveals + ambient motion
   ============================================================ */

/* ---------- Keyframes ----------------------------------------- */

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%      { opacity: 0.4; transform: scale(1.6); }
}

@keyframes float-ring {
    0%   { transform: scale(1);   opacity: 0.6; }
    100% { transform: scale(1.8); opacity: 0;   }
}

@keyframes orb-drift-1 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33%      { transform: translate(80px, 40px) scale(1.1); }
    66%      { transform: translate(-30px, 80px) scale(0.95); }
}
@keyframes orb-drift-2 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50%      { transform: translate(-60px, -50px) scale(1.15); }
}
@keyframes orb-drift-3 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33%      { transform: translate(-50px, -30px) scale(0.9); }
    66%      { transform: translate(60px, -60px) scale(1.05); }
}

@keyframes grad-flow {
    0%, 100% { background-position: 0% 50%; }
    50%      { background-position: 100% 50%; }
}

@keyframes scroll-line {
    0%   { background-position: 0% -100%; }
    100% { background-position: 0% 100%; }
}

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

@keyframes count-up-fade {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

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

@keyframes floaty {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-8px); }
}

@keyframes title-shine {
    0%   { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}

@keyframes badge-glow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(92, 200, 245, 0.0); }
    50%      { box-shadow: 0 0 0 6px rgba(92, 200, 245, 0.18); }
}

@keyframes logo-rotate {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes logo-dot-bounce {
    0%, 100% { transform: scale(1);   opacity: 1; }
    50%      { transform: scale(0.6); opacity: 0.7; }
}

@keyframes reveal-up {
    from { opacity: 0; transform: translateY(40px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes reveal-left {
    from { opacity: 0; transform: translateX(-40px); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes reveal-right {
    from { opacity: 0; transform: translateX(40px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes underline-grow {
    from { width: 0; }
    to   { width: 100%; }
}

@keyframes ken-burns-1 {
    0%   { transform: scale(1.1)  translate(0, 0); }
    100% { transform: scale(1.2)  translate(-2%, -1%); }
}
@keyframes ken-burns-2 {
    0%   { transform: scale(1.15) translate(0, 0); }
    100% { transform: scale(1.25) translate(2%, 1%); }
}
@keyframes ken-burns-3 {
    0%   { transform: scale(1.1)  translate(0, 0); }
    100% { transform: scale(1.22) translate(0, -2%); }
}

@keyframes accent-shine {
    0%, 100% { background-position: 0% 50%; }
    50%      { background-position: 100% 50%; }
}

@keyframes stat-glow-sweep {
    0%, 100% { opacity: 0; }
    50%      { opacity: 1; }
}

/* ---------- Background orbs apply animation ------------------ */
.orb-1 { animation: orb-drift-1 22s ease-in-out infinite; }
.orb-2 { animation: orb-drift-2 28s ease-in-out infinite; }
.orb-3 { animation: orb-drift-3 26s ease-in-out infinite; }

/* ---------- Logo ---------------------------------------------- */
.logo-mark { animation: logo-rotate 18s linear infinite; }
.logo-dot { animation: logo-dot-bounce 2.2s ease-in-out infinite; }
.logo-dot.d2 { animation-delay: 0.2s; }
.logo-dot.d3 { animation-delay: 0.5s; }
.logo-dot.d4 { animation-delay: 0.8s; }
.logo-text {
    background: var(--grad-accent);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: title-shine 6s linear infinite;
}

/* ---------- Floating buttons --------------------------------- */
.float-ring { animation: float-ring 2.4s ease-out infinite; }
.support-float { animation: floaty 3.6s ease-in-out infinite; }

/* ---------- Hero --------------------------------------------- */
.hero-v5-badge {
    animation: badge-glow 3.2s ease-in-out infinite, reveal-up .9s ease both;
}
.hero-v5-badge .dot { animation: pulse 2s infinite; }

.hero-v5-title { animation: reveal-up 1s ease 0.1s both; }
.hero-v5-title .accent {
    background-size: 200% 200%;
    animation: accent-shine 5s ease infinite;
}
.hero-v5-desc { animation: reveal-up 1s ease 0.25s both; }
.hero-v5-btns { animation: reveal-up 1s ease 0.4s both; }

/* slide ken-burns */
.hero-slide.active { animation: ken-burns-1 9s ease-out forwards; }
.hero-slide.active:nth-child(2) { animation-name: ken-burns-2; }
.hero-slide.active:nth-child(3) { animation-name: ken-burns-3; }

.scroll-line { animation: scroll-line 2.2s ease-in-out infinite; }
.hero-scroll-cue { animation: floaty 3s ease-in-out infinite; }

/* ---------- Section subtitle / titles ------------------------ */
.section-subtitle::before,
.section-subtitle::after {
    transform-origin: center;
    animation: shimmer 3s ease-in-out infinite;
}

/* ---------- Service cards ------------------------------------ */
.svc-card {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity .7s ease, transform .7s ease,
                border-color .4s ease, box-shadow .4s ease;
}
.svc-card.in-view {
    opacity: 1;
    transform: translateY(0);
}
.svc-card.in-view:nth-child(1) { transition-delay: 0s;   }
.svc-card.in-view:nth-child(2) { transition-delay: .12s; }
.svc-card.in-view:nth-child(3) { transition-delay: .24s; }
.svc-card.in-view:nth-child(4) { transition-delay: .36s; }
.svc-card.in-view:nth-child(5) { transition-delay: .48s; }
.svc-card.in-view:nth-child(6) { transition-delay: .60s; }

/* hover glow on the icon */
.svc-card-icon::after {
    content: '';
    position: absolute;
    inset: -8px;
    border-radius: 18px;
    background: inherit;
    filter: blur(16px);
    opacity: 0;
    transition: opacity .4s ease;
    z-index: -1;
}
.svc-card-icon { position: relative; }
.svc-card:hover .svc-card-icon::after { opacity: 0.5; }

/* ---------- Tech marquee ------------------------------------- */
.tech-marquee-track { animation: marquee 38s linear infinite; }

/* ---------- Portfolio ---------------------------------------- */
.portfolio-card {
    opacity: 0;
    transform: translateY(40px) scale(.97);
    transition: opacity .7s ease, transform .7s ease,
                border-color .4s ease, box-shadow .4s ease;
}
.portfolio-card.in-view {
    opacity: 1;
    transform: translateY(0) scale(1);
}
.portfolio-card.in-view:nth-child(1) { transition-delay: 0s;   }
.portfolio-card.in-view:nth-child(2) { transition-delay: .08s; }
.portfolio-card.in-view:nth-child(3) { transition-delay: .16s; }
.portfolio-card.in-view:nth-child(4) { transition-delay: .24s; }
.portfolio-card.in-view:nth-child(5) { transition-delay: .32s; }
.portfolio-card.in-view:nth-child(6) { transition-delay: .40s; }
/* Filtered-out cards are removed from the grid flow entirely,
   so the remaining cards reflow with no gaps. */
.portfolio-card.is-hidden {
    display: none !important;
}

/* ---------- Stats -------------------------------------------- */
.stat-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent, rgba(92,200,245,.08), transparent);
    background-size: 200% 200%;
    opacity: 0;
    transition: opacity .4s ease;
}
.stat-card:hover::before {
    opacity: 1;
    animation: grad-flow 3s ease infinite;
}
.stat-icon { transition: transform .4s ease; }
.stat-card:hover .stat-icon { transform: rotate(-8deg) scale(1.08); }

/* ---------- Contact ------------------------------------------ */
.contact-item {
    opacity: 0;
    transform: translateX(-20px);
    transition: opacity .6s ease, transform .6s ease;
}
.reveal-left.in-view .contact-item { opacity: 1; transform: translateX(0); }
.reveal-left.in-view .contact-item:nth-child(1) { transition-delay: .1s; }
.reveal-left.in-view .contact-item:nth-child(2) { transition-delay: .2s; }
.reveal-left.in-view .contact-item:nth-child(3) { transition-delay: .3s; }

/* ---------- Generic scroll reveal helpers ------------------- */
.reveal-up,
.reveal-left,
.reveal-right {
    opacity: 0;
    transition: opacity .9s ease, transform .9s ease;
    will-change: opacity, transform;
}
.reveal-up    { transform: translateY(40px); }
.reveal-left  { transform: translateX(-40px); }
.reveal-right { transform: translateX(40px); }

.reveal-up.in-view,
.reveal-left.in-view,
.reveal-right.in-view {
    opacity: 1;
    transform: translate(0, 0);
}

/* ---------- Tilt card ---------------------------------------- */
.tilt-card {
    transform-style: preserve-3d;
    transition: transform .4s ease;
}

/* ---------- Filter button underline ------------------------- */
.filter-btn { position: relative; overflow: hidden; }
.filter-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(115deg, transparent, rgba(255,255,255,.15), transparent);
    transform: translateX(-100%);
    transition: transform .6s ease;
}
.filter-btn:hover::after { transform: translateX(100%); }

/* ---------- Section transitions on enter ------------------- */
.section-title { position: relative; }

/* underline animation for section titles when revealed */
.section-header.in-view .section-title::after {
    content: '';
    display: block;
    height: 3px;
    margin: 14px auto 0;
    width: 0;
    max-width: 60px;
    background: var(--grad-accent);
    border-radius: 2px;
    animation: underline-grow-fixed .8s ease forwards .3s;
}

@keyframes underline-grow-fixed {
    from { width: 0; }
    to   { width: 60px; }
}

/* ---------- Reduced motion respect ------------------------- */
@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;
    }
}
