/* =============================================================
   DENTAL INSIGHT THEME — CSS Animations & Motion Primitives
   ============================================================= */

/* ── Keyframes ───────────────────────────────────────────── */

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Ambient glow pulse for decorative elements */
@keyframes glowPulse {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50%       { opacity: 0.7; transform: scale(1.05); }
}

/* Scan line effect for medical/data aesthetic */
@keyframes scanLine {
  0%   { transform: translateY(-100%); }
  100% { transform: translateY(100vh); }
}

/* Typing cursor blink */
@keyframes cursorBlink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* Subtle float for decorative blobs */
@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  33%       { transform: translateY(-12px) rotate(1deg); }
  66%       { transform: translateY(8px) rotate(-1deg); }
}

/* Data stream shimmer */
@keyframes shimmer {
  0%   { background-position: -200% center; }
  100% { background-position: 200% center; }
}

/* Line draw for SVG */
@keyframes drawLine {
  from { stroke-dashoffset: 1000; }
  to   { stroke-dashoffset: 0; }
}

/* ── Animation Utility Classes ───────────────────────────── */

.animate-fadeIn     { animation: fadeIn     var(--duration-slow) var(--ease-out) both; }
.animate-fadeInUp   { animation: fadeInUp   var(--duration-slow) var(--ease-out) both; }
.animate-fadeInDown { animation: fadeInDown var(--duration-slow) var(--ease-out) both; }
.animate-scaleIn    { animation: scaleIn    var(--duration-slow) var(--ease-out) both; }
.animate-float      { animation: float 6s var(--ease-inout) infinite; }

/* Stagger delay helpers */
.delay-100  { animation-delay: 100ms; }
.delay-200  { animation-delay: 200ms; }
.delay-300  { animation-delay: 300ms; }
.delay-400  { animation-delay: 400ms; }
.delay-500  { animation-delay: 500ms; }
.delay-600  { animation-delay: 600ms; }
.delay-800  { animation-delay: 800ms; }

/* ── GSAP-Ready State Classes ────────────────────────────── */

/* Elements that start invisible and are animated in by GSAP */
.gsap-hidden {
  opacity: 0;
  visibility: hidden;
}

/* Clip-path reveal (used for curtain reveals) */
.gsap-clip-up {
  clip-path: inset(100% 0 0 0);
}

.gsap-clip-down {
  clip-path: inset(0 0 100% 0);
}

/* Line-by-line text reveal container */
.text-reveal-container {
  overflow: hidden;
}

.text-reveal-line {
  display: block;
  transform: translateY(110%);
  opacity: 0;
}

/* ── Ambient Background Elements ─────────────────────────── */

.ambient-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  z-index: var(--z-base);
  animation: glowPulse 8s var(--ease-inout) infinite;
}

.ambient-blob--primary {
  background: var(--color-primary-glow);
  width: 600px;
  height: 600px;
}

.ambient-blob--accent {
  background: rgba(0, 102, 255, 0.12);
  width: 400px;
  height: 400px;
}

/* ── Gradient Text ───────────────────────────────────────── */
.gradient-text {
  background: linear-gradient(
    135deg,
    var(--color-primary) 0%,
    var(--color-white) 60%,
    var(--color-primary) 100%
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  background-size: 200% 200%;
  animation: shimmer 4s linear infinite;
}

/* ── Scan Line Overlay ───────────────────────────────────── */
.scan-line {
  position: absolute;
  inset-inline: 0;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--color-primary),
    transparent
  );
  opacity: 0.3;
  animation: scanLine 6s linear infinite;
  pointer-events: none;
}

/* ── Noise Texture Overlay ───────────────────────────────── */
.noise-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-size: 128px;
}

/* ── Performance: Respect Reduced Motion ─────────────────── */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .ambient-blob {
    animation: none;
  }

  .gradient-text {
    animation: none;
    background: var(--color-primary);
  }
}
