/* =============================================
   ANIMATIONS – Theoba Theme
   ============================================= */

/* ── Keyframes ──────────────────────────────── */
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(40px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-30px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInLeft {
    from { opacity: 0; transform: translateX(-40px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes fadeInRight {
    from { opacity: 0; transform: translateX(40px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.8); }
    to   { opacity: 1; transform: scale(1); }
}

@keyframes slideUp {
    from { transform: translateY(100%); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

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

@keyframes glow {
    0%, 100% { box-shadow: 0 0 20px rgba(0,212,255,0.3); }
    50%       { box-shadow: 0 0 40px rgba(0,212,255,0.6), 0 0 80px rgba(0,212,255,0.2); }
}

@keyframes glowText {
    0%, 100% { text-shadow: 0 0 10px rgba(0,212,255,0.3); }
    50%       { text-shadow: 0 0 30px rgba(0,212,255,0.8); }
}

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

@keyframes floatSlow {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50%       { transform: translateY(-30px) rotate(5deg); }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

@keyframes spinSlow {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

@keyframes shimmer {
    0%   { background-position: -1000px 0; }
    100% { background-position: 1000px 0; }
}

@keyframes typewriter {
    from { width: 0; }
    to   { width: 100%; }
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0; }
}

@keyframes progressBar {
    from { width: 0%; }
    to   { width: var(--target-width); }
}

@keyframes countUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes borderGlow {
    0%   { border-color: rgba(0,212,255,0.2); }
    50%  { border-color: rgba(0,212,255,0.8); box-shadow: 0 0 20px rgba(0,212,255,0.4); }
    100% { border-color: rgba(0,212,255,0.2); }
}

@keyframes particleFloat {
    0%   { transform: translateY(100vh) rotate(0deg);    opacity: 0; }
    10%  { opacity: 1; }
    90%  { opacity: 1; }
    100% { transform: translateY(-100px) rotate(720deg); opacity: 0; }
}

@keyframes gradientShift {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes morphBlob {
    0%   { border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; }
    50%  { border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%; }
    100% { border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; }
}

@keyframes ripple {
    0%   { transform: scale(0); opacity: 0.8; }
    100% { transform: scale(4); opacity: 0; }
}

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

@keyframes preloaderPulse {
    0%, 100% { transform: scale(1);   opacity: 1; }
    50%       { transform: scale(0.8); opacity: 0.5; }
}

/* ── Utility Animation Classes ──────────────── */
.animate-fadeIn      { animation: fadeIn 0.6s ease forwards; }
.animate-fadeInUp    { animation: fadeInUp 0.7s ease forwards; }
.animate-fadeInDown  { animation: fadeInDown 0.7s ease forwards; }
.animate-fadeInLeft  { animation: fadeInLeft 0.7s ease forwards; }
.animate-fadeInRight { animation: fadeInRight 0.7s ease forwards; }
.animate-scaleIn     { animation: scaleIn 0.5s ease forwards; }
.animate-float       { animation: float 4s ease-in-out infinite; }
.animate-floatSlow   { animation: floatSlow 6s ease-in-out infinite; }
.animate-pulse       { animation: pulse 2s ease-in-out infinite; }
.animate-glow        { animation: glow 2s ease-in-out infinite; }
.animate-spin        { animation: spin 1s linear infinite; }
.animate-spinSlow    { animation: spinSlow 8s linear infinite; }

/* Delay helpers */
.delay-100  { animation-delay: 0.1s; }
.delay-200  { animation-delay: 0.2s; }
.delay-300  { animation-delay: 0.3s; }
.delay-400  { animation-delay: 0.4s; }
.delay-500  { animation-delay: 0.5s; }
.delay-600  { animation-delay: 0.6s; }
.delay-700  { animation-delay: 0.7s; }
.delay-800  { animation-delay: 0.8s; }
.delay-1000 { animation-delay: 1s; }
.delay-1200 { animation-delay: 1.2s; }

/* AOS (Animate on Scroll) – CSS approach */
[data-aos] {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.7s ease, transform 0.7s ease;
}

[data-aos="fade-up"]   { transform: translateY(40px); }
[data-aos="fade-down"] { transform: translateY(-40px); }
[data-aos="fade-left"] { transform: translateX(40px); }
[data-aos="fade-right"]{ transform: translateX(-40px); }
[data-aos="zoom-in"]   { transform: scale(0.8); }

[data-aos].aos-animate {
    opacity: 1;
    transform: translate(0) scale(1);
}

/* ── Preloader ──────────────────────────────── */
#theoba-preloader {
    position: fixed;
    inset: 0;
    background: var(--bg-deep);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

#theoba-preloader.loaded {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.preloader__logo {
    font-family: var(--font-primary);
    font-size: 2rem;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: preloaderPulse 1.5s ease-in-out infinite;
}

.preloader__spinner {
    width: 50px;
    height: 50px;
    border: 3px solid var(--border-subtle);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: preloaderSpin 0.8s linear infinite;
}

.preloader__bar {
    width: 200px;
    height: 3px;
    background: var(--border-subtle);
    border-radius: 999px;
    overflow: hidden;
}

.preloader__bar-fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: 999px;
    animation: preloaderFill 1.5s ease forwards;
}

@keyframes preloaderFill {
    0%   { width: 0%; }
    50%  { width: 60%; }
    100% { width: 100%; }
}

/* ── Hero Background Effects ────────────────── */
.hero-particles {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.hero-blob {
    position: absolute;
    border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    filter: blur(80px);
    opacity: 0.15;
    animation: morphBlob 8s ease-in-out infinite;
}

.hero-blob--1 {
    width: 500px;
    height: 500px;
    background: var(--color-primary);
    top: -100px;
    right: -100px;
    animation-duration: 10s;
}

.hero-blob--2 {
    width: 400px;
    height: 400px;
    background: var(--color-secondary);
    bottom: -100px;
    left: 10%;
    animation-duration: 12s;
    animation-delay: -4s;
}

.hero-blob--3 {
    width: 300px;
    height: 300px;
    background: var(--color-accent);
    top: 40%;
    left: 50%;
    animation-duration: 14s;
    animation-delay: -6s;
}

/* Grid overlay */
.hero-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(0,212,255,0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0,212,255,0.03) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
}

/* Floating code symbols */
.code-symbol {
    position: absolute;
    font-family: var(--font-mono);
    color: var(--color-primary);
    opacity: 0.08;
    pointer-events: none;
    user-select: none;
    animation: particleFloat var(--duration, 8s) var(--delay, 0s) ease-in-out infinite;
    font-size: var(--size, 1.5rem);
}

/* ── Scroll Reveal ──────────────────────────── */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.7s ease, transform 0.7s ease;
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

.reveal-left  { transform: translateX(-30px); }
.reveal-right { transform: translateX(30px); }
.reveal-scale { transform: scale(0.9); }

.reveal-left.visible,
.reveal-right.visible,
.reveal-scale.visible {
    transform: translateX(0) scale(1);
}

/* ── Number Counter ─────────────────────────── */
.counter-number {
    font-variant-numeric: tabular-nums;
    transition: opacity 0.3s ease;
}

/* ── Typing cursor ──────────────────────────── */
.typing-cursor {
    display: inline-block;
    width: 3px;
    height: 1.1em;
    background: var(--color-primary);
    margin-left: 4px;
    vertical-align: middle;
    animation: blink 0.8s ease-in-out infinite;
}

/* ── Gradient Animation (continuous) ───────── */
.animate-gradient-bg {
    background-size: 300% 300%;
    animation: gradientShift 6s ease infinite;
}
