﻿/* ============================================
   CSS Animations — 40+ Effects
   Pure CSS, no dependencies
   ============================================ */

:root {
  --bg: #0b0f19;
  --surface: #131a2b;
  --surface-hover: #1a2340;
  --accent: #6366f1;
  --accent-2: #8b5cf6;
  --accent-3: #ec4899;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --radius: 16px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* Hero */
.hero {
  text-align: center;
  padding: 4rem 1rem 2rem;
}
.hero__title {
  font-size: clamp(2rem, 6vw, 3.5rem);
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.5rem;
}
.hero__subtitle {
  color: var(--text-muted);
  font-size: 1.1rem;
}

/* Grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.25rem;
  padding: 2rem;
  max-width: 1400px;
  margin: 0 auto;
}

/* Card */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  box-shadow: var(--shadow);
  transition: transform 0.2s, background 0.2s;
  border: 1px solid rgba(255,255,255,0.04);
  cursor: pointer;
}
.card:hover { background: var(--surface-hover); }
.card h3 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 1rem;
  letter-spacing: 0.02em;
}
.demo {
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Base box */
.box {
  width: 64px;
  height: 64px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  position: relative;
  overflow: hidden;
}

/* ============================================
   KEYFRAMES
   ============================================ */

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(40px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-40px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes slideLeft {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes slideRight {
  from { opacity: 0; transform: translateX(-40px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes zoomIn {
  from { opacity: 0; transform: scale(0.3); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes zoomOut {
  from { opacity: 0; transform: scale(1.5); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes blurIn {
  from { opacity: 0; filter: blur(12px); }
  to { opacity: 1; filter: blur(0); }
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-20px); }
  60% { transform: translateY(-10px); }
}
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-6px); }
  20%, 40%, 60%, 80% { transform: translateX(6px); }
}
@keyframes wobble {
  0% { transform: translateX(0); }
  15% { transform: translateX(-15px) rotate(-5deg); }
  30% { transform: translateX(12px) rotate(3deg); }
  45% { transform: translateX(-9px) rotate(-3deg); }
  60% { transform: translateX(6px) rotate(2deg); }
  75% { transform: translateX(-3px) rotate(-1deg); }
  100% { transform: translateX(0); }
}
@keyframes jello {
  0%, 100% { transform: scale3d(1,1,1); }
  30% { transform: scale3d(1.25,0.75,1); }
  40% { transform: scale3d(0.75,1.25,1); }
  50% { transform: scale3d(1.15,0.85,1); }
  65% { transform: scale3d(0.95,1.05,1); }
  75% { transform: scale3d(1.05,0.95,1); }
}
@keyframes rubberBand {
  0%, 100% { transform: scale3d(1,1,1); }
  30% { transform: scale3d(1.25,0.75,1); }
  40% { transform: scale3d(0.75,1.25,1); }
  50% { transform: scale3d(1.15,0.85,1); }
  65% { transform: scale3d(0.95,1.05,1); }
  75% { transform: scale3d(1.05,0.95,1); }
}
@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  14% { transform: scale(1.15); }
  28% { transform: scale(1); }
  42% { transform: scale(1.15); }
  70% { transform: scale(1); }
}
@keyframes swing {
  20% { transform: rotate(15deg); }
  40% { transform: rotate(-10deg); }
  60% { transform: rotate(5deg); }
  80% { transform: rotate(-5deg); }
  100% { transform: rotate(0); }
}
@keyframes tada {
  0% { transform: scale(1); }
  10%, 20% { transform: scale(0.9) rotate(-3deg); }
  30%, 50%, 70%, 90% { transform: scale(1.1) rotate(3deg); }
  40%, 60%, 80% { transform: scale(1.1) rotate(-3deg); }
  100% { transform: scale(1) rotate(0); }
}

@keyframes flip {
  0% { transform: perspective(400px) rotateY(0); }
  100% { transform: perspective(400px) rotateY(360deg); }
}
@keyframes flipX {
  0% { transform: perspective(400px) rotateX(0); }
  100% { transform: perspective(400px) rotateX(360deg); }
}
@keyframes rotate {
  from { transform: rotate(0); }
  to { transform: rotate(360deg); }
}
@keyframes rotateScale {
  0% { transform: rotate(0) scale(1); }
  50% { transform: rotate(180deg) scale(1.2); }
  100% { transform: rotate(360deg) scale(1); }
}

@keyframes glow {
  0%, 100% { box-shadow: 0 0 10px var(--accent), 0 0 20px var(--accent-2); }
  50% { box-shadow: 0 0 25px var(--accent), 0 0 50px var(--accent-2), 0 0 75px var(--accent-3); }
}
@keyframes shadowPop {
  0%, 100% { box-shadow: 0 2px 8px rgba(0,0,0,0.3); }
  50% { box-shadow: 0 12px 40px rgba(99,102,241,0.4); }
}
@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
@keyframes neonFlicker {
  0%, 19%, 21%, 23%, 25%, 54%, 56%, 100% {
    box-shadow: 0 0 5px var(--accent), 0 0 10px var(--accent), 0 0 20px var(--accent-2), 0 0 40px var(--accent-2);
  }
  20%, 24%, 55% { box-shadow: none; }
}

@keyframes textReveal {
  0% { clip-path: inset(0 100% 0 0); }
  100% { clip-path: inset(0 0 0 0); }
}
@keyframes typewriter {
  from { width: 0; }
  to { width: 100%; }
}
@keyframes glitch {
  0% { transform: translate(0); }
  20% { transform: translate(-3px, 3px); }
  40% { transform: translate(-3px, -3px); }
  60% { transform: translate(3px, 3px); }
  80% { transform: translate(3px, -3px); }
  100% { transform: translate(0); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes loadingDots {
  0%, 80%, 100% { transform: scale(0); opacity: 0.5; }
  40% { transform: scale(1); opacity: 1; }
}
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes morph {
  0%, 100% { border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; }
  50% { border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%; }
}
@keyframes staggerFade {
  0%, 100% { opacity: 0.2; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1); }
}

/* ============================================
   ANIMATION CLASSES
   ============================================ */

.anim-fade-in      { animation: fadeIn 1.2s ease infinite alternate; }
.anim-slide-up     { animation: slideUp 1s ease infinite alternate; }
.anim-slide-down   { animation: slideDown 1s ease infinite alternate; }
.anim-slide-left   { animation: slideLeft 1s ease infinite alternate; }
.anim-slide-right  { animation: slideRight 1s ease infinite alternate; }
.anim-zoom-in      { animation: zoomIn 1s ease infinite alternate; }
.anim-zoom-out     { animation: zoomOut 1s ease infinite alternate; }
.anim-blur-in      { animation: blurIn 1.5s ease infinite alternate; }

.anim-bounce       { animation: bounce 1.5s infinite; }
.anim-pulse        { animation: pulse 1.2s ease-in-out infinite; }
.anim-shake        { animation: shake 0.8s ease infinite; }
.anim-wobble       { animation: wobble 1s ease infinite; }
.anim-jello        { animation: jello 1.2s ease infinite; }
.anim-rubber-band  { animation: rubberBand 1.2s ease infinite; }
.anim-heartbeat    { animation: heartbeat 1.3s ease-in-out infinite; }
.anim-swing        { animation: swing 1s ease infinite; }
.anim-tada         { animation: tada 1.2s ease infinite; }

.anim-flip         { animation: flip 1.5s linear infinite; }
.anim-flip-x       { animation: flipX 1.5s linear infinite; }
.anim-rotate       { animation: rotate 2s linear infinite; }
.anim-rotate-scale { animation: rotateScale 2s ease-in-out infinite; }

.anim-glow          { animation: glow 2s ease-in-out infinite; }
.anim-shadow-pop    { animation: shadowPop 2s ease-in-out infinite; }
.anim-gradient-shift{
  background: linear-gradient(270deg, var(--accent), var(--accent-2), var(--accent-3), var(--accent));
  background-size: 400% 400%;
  animation: gradientShift 3s ease infinite;
}
.anim-neon-flicker  { animation: neonFlicker 2s infinite; }

.anim-text-reveal span {
  display: inline-block;
  animation: textReveal 1.5s ease infinite alternate;
}
.anim-typewriter span {
  display: inline-block;
  overflow: hidden;
  white-space: nowrap;
  animation: typewriter 2s steps(10) infinite alternate;
  border-right: 2px solid var(--accent);
}
.anim-underline-expand span {
  position: relative;
}
.anim-underline-expand span::after {
  content: '';
  position: absolute;
  bottom: -2px; left: 50%;
  width: 0; height: 2px;
  background: var(--accent-3);
  transition: all 0.3s ease;
}
.anim-underline-expand:hover span::after {
  left: 0; width: 100%;
}
.anim-glitch span {
  display: inline-block;
  animation: glitch 0.3s linear infinite;
  text-shadow: 2px 0 var(--accent-3), -2px 0 var(--accent);
}

/* Hover effects */
.hover-lift {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  cursor: pointer;
}
.hover-lift:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 30px rgba(99,102,241,0.3);
}
.hover-glow {
  transition: box-shadow 0.3s ease;
  cursor: pointer;
}
.hover-glow:hover {
  box-shadow: 0 0 30px var(--accent), 0 0 60px var(--accent-2);
}
.hover-scale {
  transition: transform 0.3s ease;
  cursor: pointer;
}
.hover-scale:hover { transform: scale(1.15); }
.hover-rotate {
  transition: transform 0.4s ease;
  cursor: pointer;
}
.hover-rotate:hover { transform: rotate(15deg) scale(1.1); }

.card-3d-tilt {
  transition: transform 0.4s ease;
  transform-style: preserve-3d;
  cursor: pointer;
}
.card-3d-tilt:hover {
  transform: perspective(500px) rotateX(10deg) rotateY(-10deg) scale(1.05);
  box-shadow: 0 20px 40px rgba(0,0,0,0.4);
}

.magnetic-button {
  transition: transform 0.2s ease;
  cursor: pointer;
}
.magnetic-button:hover { transform: scale(1.1); }

.ripple {
  position: relative;
  overflow: hidden;
  cursor: pointer;
}
.ripple::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 0; height: 0;
  background: rgba(255,255,255,0.3);
  border-radius: 50%;
  transform: translate(-50%,-50%);
  transition: width 0.5s ease, height 0.5s ease;
}
.ripple:hover::after {
  width: 150px; height: 150px;
}

.border-draw {
  position: relative;
  background: transparent;
  border: 2px solid transparent;
  cursor: pointer;
}
.border-draw::before, .border-draw::after {
  content: '';
  position: absolute;
  width: 0; height: 0;
  border: 2px solid transparent;
  transition: all 0.4s ease;
}
.border-draw::before {
  top: 0; left: 0;
  border-top-color: var(--accent);
  border-right-color: var(--accent);
}
.border-draw::after {
  bottom: 0; right: 0;
  border-bottom-color: var(--accent-2);
  border-left-color: var(--accent-2);
}
.border-draw:hover::before, .border-draw:hover::after {
  width: 100%; height: 100%;
}

/* Loaders */
.anim-loading-spinner {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 3px solid rgba(99,102,241,0.2);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
  background: transparent;
}
.anim-loading-dots {
  background: transparent;
  display: flex;
  gap: 6px;
  align-items: center;
}
.anim-loading-dots span {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
  animation: loadingDots 1.4s ease-in-out infinite;
}
.anim-loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.anim-loading-dots span:nth-child(3) { animation-delay: 0.4s; }

.anim-skeleton-shimmer {
  background: linear-gradient(90deg, #1e293b 25%, #334155 50%, #1e293b 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

/* Special */
.anim-morphing-blob {
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
  animation: morph 4s ease-in-out infinite;
}

.anim-parallax-layer {
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  transition: transform 0.1s ease-out;
}
.anim-parallax-layer::after {
  content: attr(data-text);
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  font-size: 0.7rem;
  white-space: nowrap;
}
.hover-demo:hover .anim-parallax-layer {
  transform: translateY(-5px) scale(1.05);
}

.anim-stagger-fade {
  background: transparent;
  display: flex;
  gap: 6px;
  align-items: center;
}
.anim-stagger-fade span {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--accent);
  animation: staggerFade 1.2s ease-in-out infinite;
}
.anim-stagger-fade span:nth-child(2) { animation-delay: 0.15s; background: var(--accent-2); }
.anim-stagger-fade span:nth-child(3) { animation-delay: 0.3s; background: var(--accent-3); }
.anim-stagger-fade span:nth-child(4) { animation-delay: 0.45s; background: #f472b6; }

/* ============================================
   MODAL
   ============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  padding: 1rem;
}
.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}
.modal {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 24px 80px rgba(0,0,0,0.6);
  max-width: 640px;
  width: 100%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.9) translateY(20px);
  transition: transform 0.3s ease;
}
.modal-overlay.active .modal {
  transform: scale(1) translateY(0);
}
.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.modal__title {
  font-size: 1.1rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.modal__close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
}
.modal__close:hover {
  background: rgba(255,255,255,0.06);
  color: var(--text);
}
.modal__body {
  padding: 1.5rem;
  overflow-y: auto;
}
.code-block {
  background: #0d1117;
  border-radius: 12px;
  padding: 1.25rem;
  overflow-x: auto;
  font-family: 'Fira Code', 'Cascadia Code', 'SF Mono', Monaco, monospace;
  font-size: 0.8rem;
  line-height: 1.7;
  border: 1px solid rgba(255,255,255,0.05);
}
.code-block pre { margin: 0; white-space: pre; }
/* Simple syntax highlighting */
.code-block .kw { color: #ff7b72; }
.code-block .sel { color: #d2a8ff; }
.code-block .prop { color: #7ee787; }
.code-block .val { color: #79c0ff; }
.code-block .num { color: #fca5a5; }
.code-block .punc { color: #8b949e; }
.code-block .str { color: #a5d6ff; }

.modal__hint {
  margin-top: 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
}

/* Footer */
.footer {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #334155; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #475569; }