/* ============================================
   ANIMATIONS & KEYFRAMES
   ============================================ */

/* === KEYFRAMES === */

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.3); }
}

@keyframes scroll-down {
  0% { top: -100%; }
  100% { top: 200%; }
}

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-20px) rotate(5deg); }
  75% { transform: translateY(10px) rotate(-3deg); }
}

@keyframes pulse-glow {
  0%, 100% { filter: drop-shadow(0 0 0px rgba(16, 185, 129, 0)); transform: scale(1); }
  50% { filter: drop-shadow(0 0 20px rgba(16, 185, 129, 0.5)); transform: scale(1.1); }
}

@keyframes step-pulse {
  0% { transform: scale(1); opacity: 0.6; }
  100% { transform: scale(1.8); opacity: 0; }
}

@keyframes flow-appear {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes flow-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

@keyframes marquee {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

@keyframes demo-step-in {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes demo-result-in {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

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

@keyframes gradient-shift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

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

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

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

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

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

@keyframes typewriter-cursor {
  0%, 100% { border-right-color: var(--primary); }
  50% { border-right-color: transparent; }
}

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

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

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

@keyframes glow-pulse {
  0%, 100% { box-shadow: 0 0 20px rgba(37, 99, 235, 0.1); }
  50% { box-shadow: 0 0 40px rgba(37, 99, 235, 0.3); }
}

/* === ANIMATE ON SCROLL — INITIAL STATE === */

.animate-on-scroll {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.animate-on-scroll.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Staggered delays for grid items */
.animate-on-scroll[data-delay="100"] { transition-delay: 0.1s; }
.animate-on-scroll[data-delay="200"] { transition-delay: 0.2s; }
.animate-on-scroll[data-delay="300"] { transition-delay: 0.3s; }
.animate-on-scroll[data-delay="400"] { transition-delay: 0.4s; }
.animate-on-scroll[data-delay="500"] { transition-delay: 0.5s; }

/* === HERO ENTRANCE ANIMATIONS === */

.animate-fade-up {
  opacity: 0;
  transform: translateY(30px);
  animation: fade-up 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.delay-1 { animation-delay: 0.15s; }
.delay-2 { animation-delay: 0.3s; }
.delay-3 { animation-delay: 0.45s; }
.delay-4 { animation-delay: 0.6s; }

/* === INTERACTIVE HOVER EFFECTS === */

.task-card {
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.task-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
  border-color: var(--border-light);
}

.task-card.automated {
  border-color: var(--success) !important;
  animation: glow-pulse 2s ease-in-out infinite;
}

/* === PAGE CONTENT STYLES === */

.page-single {
  padding: 140px 0 80px;
  min-height: 70vh;
}

.page-header {
  margin-bottom: 48px;
}

.page-header h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}

.page-subtitle {
  font-size: 1.15rem;
  color: var(--text-secondary);
}

.page-content {
  max-width: 800px;
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--text-secondary);
}

.page-content h2 {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
  margin: 48px 0 16px;
}

.page-content h3 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
  margin: 32px 0 12px;
}

.page-content p { margin-bottom: 16px; }

.page-content ul, .page-content ol {
  margin-bottom: 16px;
  padding-left: 24px;
}

.page-content li { margin-bottom: 8px; }

.page-content a {
  color: var(--primary-light);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.page-content a:hover {
  color: var(--accent);
}

/* === LIST PAGE === */

.page-list {
  padding: 140px 0 80px;
  min-height: 70vh;
}

.page-intro {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 48px;
  max-width: 700px;
}

.list-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

.list-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
}

.list-card:hover {
  border-color: var(--primary);
  transform: translateY(-4px);
  box-shadow: var(--shadow-glow);
}

.list-card h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 10px;
}

.list-card p {
  font-size: 0.92rem;
  color: var(--text-secondary);
  flex: 1;
  margin-bottom: 12px;
}

.list-arrow {
  color: var(--primary-light);
  font-size: 1.2rem;
  font-weight: bold;
  transition: transform 0.3s;
}

.list-card:hover .list-arrow {
  transform: translateX(6px);
}

/* === MOBILE CLOSE BUTTON === */

.nav-close {
  display: none;
  background: none;
  border: 1px solid var(--border-light);
  color: var(--text);
  font-size: 1.2rem;
  cursor: pointer;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  margin-top: 32px;
}

@media (max-width: 768px) {
  .nav-close { display: flex; }
}

/* === REDUCED MOTION === */

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

  .animate-on-scroll {
    opacity: 1;
    transform: none;
  }

  .animate-fade-up {
    opacity: 1;
    transform: none;
  }

  .marquee-track {
    animation: none;
  }
}
