/* ============================================================
   ANIMATIONS — Mohamed Yousef Theme
   ============================================================ */

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

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

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

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

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

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

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

@keyframes glow-pulse {
  0%, 100% { box-shadow: 0 0 20px rgba(108, 63, 197, 0.3); }
  50%       { box-shadow: 0 0 50px rgba(108, 63, 197, 0.6); }
}

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

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

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

@keyframes slide-in-top {
  from { opacity: 0; transform: translateY(-100%); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes draw-line {
  from { stroke-dashoffset: 1000; }
  to   { stroke-dashoffset: 0; }
}

@keyframes particle-float {
  0%   { transform: translateY(0) translateX(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(-100vh) translateX(50px) rotate(720deg); opacity: 0; }
}

@keyframes number-count {
  from { opacity: 0; transform: scale(0.5); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes border-glow {
  0%, 100% { border-color: rgba(108, 63, 197, 0.2); }
  50%       { border-color: rgba(108, 63, 197, 0.6); }
}

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

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

/* ─── Animation Utility Classes ─────────────────────────────── */
.anim-fade-up        { animation: fade-up 0.6s ease both; }
.anim-fade-down      { animation: fade-down 0.6s ease both; }
.anim-fade-in-left   { animation: fade-in-left 0.6s ease both; }
.anim-fade-in-right  { animation: fade-in-right 0.6s ease both; }
.anim-fade-in        { animation: fade-in 0.6s ease both; }
.anim-scale-up       { animation: scale-up 0.5s ease both; }
.anim-glow           { animation: glow-pulse 3s ease-in-out infinite; }
.anim-bounce         { animation: bounce-subtle 3s ease-in-out infinite; }
.anim-float          { animation: float-y 4s ease-in-out infinite; }
.anim-spin           { animation: spin 10s linear infinite; }

/* Animation delays */
.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; }

/* ─── Scroll-Triggered Animations ───────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

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

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

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

.reveal-scale {
  opacity: 0;
  transform: scale(0.85);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.reveal-scale.is-visible { opacity: 1; transform: scale(1); }

/* ─── Shimmer / Skeleton Loading ────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg,
    var(--bg-card) 25%,
    rgba(108, 63, 197, 0.1) 50%,
    var(--bg-card) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease infinite;
  border-radius: var(--radius-sm);
  color: transparent !important;
}

.skeleton-text  { height: 1em; margin-bottom: 8px; }
.skeleton-title { height: 1.5em; width: 60%; margin-bottom: 12px; }
.skeleton-img   { aspect-ratio: 16/9; }
.skeleton-circle { border-radius: 50%; }

/* ─── Hover Effects ─────────────────────────────────────────── */
.hover-lift {
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}
.hover-lift:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
}

.hover-glow {
  transition: box-shadow var(--transition-base);
}
.hover-glow:hover {
  box-shadow: var(--shadow-glow);
}

.hover-scale {
  transition: transform var(--transition-base);
}
.hover-scale:hover {
  transform: scale(1.03);
}

.hover-bright {
  transition: filter var(--transition-fast);
}
.hover-bright:hover {
  filter: brightness(1.2);
}

/* ─── Molecular Background SVG Elements ─────────────────────── */
.molecular-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.molecule-svg {
  position: absolute;
  opacity: 0.06;
}

.molecule-svg.mol-1 {
  top: 10%;
  right: 5%;
  width: 200px;
  animation: molecule-rotate 30s linear infinite;
}

.molecule-svg.mol-2 {
  bottom: 15%;
  left: 5%;
  width: 150px;
  animation: molecule-rotate 20s linear infinite reverse;
}

.molecule-svg.mol-3 {
  top: 50%;
  right: 30%;
  width: 120px;
  animation: molecule-rotate 25s linear infinite;
  opacity: 0.04;
}

/* ─── Number Counter Animation ──────────────────────────────── */
.counter-number {
  display: inline-block;
  animation: count-up 0.5s ease both;
}

/* ─── Glowing Border ─────────────────────────────────────────── */
.border-glow-animate {
  animation: border-glow 3s ease-in-out infinite;
}

/* ─── Page Transitions ───────────────────────────────────────── */
.page-enter { animation: fade-in 0.4s ease; }
.page-exit  { animation: fade-in 0.4s ease reverse; }

/* ─── Chemical Formula Floating ─────────────────────────────── */
.chem-formula {
  font-family: 'Courier New', monospace;
  font-size: 0.8rem;
  color: var(--color-primary);
  opacity: 0.12;
  position: absolute;
  pointer-events: none;
  animation: particle-float linear infinite;
  white-space: nowrap;
}

/* ─── Success / Error States ─────────────────────────────────── */
@keyframes success-bounce {
  0%   { transform: scale(0); }
  50%  { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.success-checkmark {
  animation: success-bounce 0.5s ease both;
}

/* ─── Pulsing Badge ──────────────────────────────────────────── */
.pulse-badge {
  animation: glow-pulse 2s ease-in-out infinite;
}

/* ─── Stagger Reveal Groups ──────────────────────────────────── */
.stagger-group > * {
  opacity: 0;
  transform: translateY(20px);
}
.stagger-group.visible > *:nth-child(1) { animation: fade-up 0.5s ease 0.0s both; }
.stagger-group.visible > *:nth-child(2) { animation: fade-up 0.5s ease 0.1s both; }
.stagger-group.visible > *:nth-child(3) { animation: fade-up 0.5s ease 0.2s both; }
.stagger-group.visible > *:nth-child(4) { animation: fade-up 0.5s ease 0.3s both; }
.stagger-group.visible > *:nth-child(5) { animation: fade-up 0.5s ease 0.4s both; }
.stagger-group.visible > *:nth-child(6) { animation: fade-up 0.5s ease 0.5s both; }

/* ─── Reduced Motion ─────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
