/* ============================================================
   ASHVA Tech — Animations CSS
   Keyframes, scroll-triggered reveals, 3D effects
   ============================================================ */

/* ── Keyframes ──────────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

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

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

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

@keyframes float {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  33%       { transform: translateY(-12px) rotate(1deg); }
  66%       { transform: translateY(-6px) rotate(-1deg); }
}

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

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

@keyframes pulse-blue {
  0%, 100% { box-shadow: 0 0 20px rgba(46,106,200,0.2); }
  50%       { box-shadow: 0 0 40px rgba(46,106,200,0.5), 0 0 80px rgba(46,106,200,0.15); }
}

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

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

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

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

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

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

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

@keyframes scanline {
  0%   { transform: translateY(-100%); }
  100% { transform: translateY(100vh); }
}

@keyframes morph {
  0%, 100% { border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; }
  25%       { border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%; }
  50%       { border-radius: 50% 60% 30% 60% / 40% 30% 60% 50%; }
  75%       { border-radius: 40% 60% 60% 40% / 60% 40% 60% 40%; }
}

@keyframes slideInLeft {
  from { transform: translateX(-100%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

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

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

@keyframes dash {
  to { stroke-dashoffset: 0; }
}

@keyframes lineGrow {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

/* ── Hero Animations ────────────────────────────────────────── */
.hero-badge {
  animation: fadeDown 0.6s ease-out 0.1s both;
}

.hero-title {
  animation: fadeUp 0.8s ease-out 0.2s both;
}

.hero-subtitle {
  animation: fadeUp 0.8s ease-out 0.4s both;
}

.hero-cta {
  animation: fadeUp 0.8s ease-out 0.6s both;
}

.hero-stats {
  animation: fadeUp 0.8s ease-out 0.8s both;
}

.hero-visual {
  animation: float 6s ease-in-out infinite, scaleIn 1s ease-out 0.3s both;
}

/* ── Scroll Reveal — Applied by JS ─────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.reveal-left {
  opacity: 0;
  transform: translateX(-40px);
  transition: opacity 0.7s ease-out, transform 0.7s ease-out;
}

.reveal-left.revealed {
  opacity: 1;
  transform: translateX(0);
}

.reveal-right {
  opacity: 0;
  transform: translateX(40px);
  transition: opacity 0.7s ease-out, transform 0.7s ease-out;
}

.reveal-right.revealed {
  opacity: 1;
  transform: translateX(0);
}

.reveal-scale {
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.7s ease-out, transform 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.reveal-scale.revealed {
  opacity: 1;
  transform: scale(1);
}

/* Stagger children delays */
.stagger-children > *:nth-child(1) { transition-delay: 0ms; }
.stagger-children > *:nth-child(2) { transition-delay: 100ms; }
.stagger-children > *:nth-child(3) { transition-delay: 200ms; }
.stagger-children > *:nth-child(4) { transition-delay: 300ms; }
.stagger-children > *:nth-child(5) { transition-delay: 400ms; }
.stagger-children > *:nth-child(6) { transition-delay: 500ms; }

/* ── Shimmer text effect ─────────────────────────────────────── */
.shimmer-text {
  background: linear-gradient(
    90deg,
    var(--brown-400) 0%,
    var(--gold-300) 25%,
    var(--brown-400) 50%,
    var(--gold-400) 75%,
    var(--brown-400) 100%
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer 4s linear infinite;
}

/* ── Animated gradient border ───────────────────────────────── */
.gradient-border {
  position: relative;
}

.gradient-border::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: linear-gradient(135deg, var(--brown-600), var(--blue-500), var(--gold-500), var(--brown-600));
  background-size: 300% 300%;
  animation: gradientShift 4s ease infinite;
  z-index: -1;
}

/* ── Floating animation classes ─────────────────────────────── */
.float-anim { animation: float 5s ease-in-out infinite; }
.float-slow { animation: floatSlow 7s ease-in-out infinite; }
.float-delay-1 { animation-delay: -1s; }
.float-delay-2 { animation-delay: -2s; }
.float-delay-3 { animation-delay: -3s; }

/* ── Pulse animations ───────────────────────────────────────── */
.pulse-glow { animation: pulse-glow 3s ease-in-out infinite; }
.pulse-blue { animation: pulse-blue 3s ease-in-out infinite; }

/* ── Morph blob ─────────────────────────────────────────────── */
.morph-blob { animation: morph 8s ease-in-out infinite; }

/* ── Stats counter animation ────────────────────────────────── */
.stat-number {
  display: inline-block;
  animation: countUp 0.5s ease-out both;
}

/* ── SVG path animation ─────────────────────────────────────── */
.svg-draw {
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  transition: stroke-dashoffset 1.5s ease-out;
}

.svg-draw.revealed {
  stroke-dashoffset: 0;
}

/* ── Hover 3D tilt ──────────────────────────────────────────── */
.tilt-card {
  transform-style: preserve-3d;
  transition: transform 0.3s ease-out;
}

.tilt-card:hover {
  transform: perspective(1000px) rotateX(var(--rotateX, 0deg)) rotateY(var(--rotateY, 0deg)) translateZ(10px);
}

.tilt-card .card-inner {
  transform-style: preserve-3d;
}

.tilt-card .card-front {
  transform: translateZ(20px);
}

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

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

.loader-ring {
  width: 60px;
  height: 60px;
  border: 3px solid var(--border-subtle);
  border-top-color: var(--brown-500);
  border-right-color: var(--blue-500);
  border-radius: 50%;
  animation: rotate 1s linear infinite;
}

.loader-text {
  margin-top: var(--space-md);
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.1em;
}

/* ── Chart line animation ───────────────────────────────────── */
.chart-line {
  stroke-dasharray: 2000;
  stroke-dashoffset: 2000;
  animation: dash 2s ease-out forwards;
}

/* ── Typing cursor ──────────────────────────────────────────── */
.typing-cursor::after {
  content: '|';
  animation: blink 1s step-end infinite;
  color: var(--brown-400);
}

/* ── Background animated gradient mesh ─────────────────────── */
.animated-bg {
  background: linear-gradient(-45deg, #080604, #1A1510, #0F1E35, #0A1628, #1A1510, #080604);
  background-size: 400% 400%;
  animation: gradientShift 12s ease infinite;
}

/* ── Nav animation ──────────────────────────────────────────── */
.nav-link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--grad-text-brown);
  transition: width var(--transition-base);
  border-radius: 2px;
}

.nav-link:hover::after,
.nav-link.active::after {
  width: 100%;
}

/* ── Ripple effect on click ─────────────────────────────────── */
.ripple-effect {
  position: relative;
  overflow: hidden;
}

.ripple-effect .ripple-circle {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  transform: scale(0);
  animation: ripple 0.6s linear;
  pointer-events: none;
}

/* ── Skeleton loading ───────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--bg-card) 50%, var(--bg-elevated) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}

/* ── Scroll progress bar ────────────────────────────────────── */
#scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, var(--brown-600), var(--gold-500), var(--blue-500));
  z-index: var(--z-toast);
  transition: width 0.1s linear;
}
