/* ============================================================
   JavaLite IDE — Website
   animations.css — keyframes + motion preferences
   Performance note: only transform/opacity are animated.
   ============================================================ */

@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(60px, 40px, 0) scale(1.12); }
}
@keyframes floaty {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-11px); }
}
@keyframes blink {
  0%, 55%  { opacity: 1; }
  56%,100% { opacity: 0; }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.45; }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* page-load fade for above-the-fold */
@keyframes pageIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
body { animation: pageIn .5s ease-out both; }

/* ============================================================
   Ultra-Smooth Typography Entrance & Polish Animations
   ============================================================ */
@keyframes textFadeUp {
  0% {
    opacity: 0;
    transform: translateY(22px);
    filter: blur(4px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

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

/* Silky Hero Typography Stagger */
.hero h1 {
  animation: textFadeUp 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.05s both;
  will-change: transform, opacity, filter;
}
.hero-sub {
  animation: textFadeUp 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.18s both;
  will-change: transform, opacity, filter;
}
.hero-ctas {
  animation: textFadeUp 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.3s both;
  will-change: transform, opacity, filter;
}
.hero-meta {
  animation: textFadeUp 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.42s both;
  will-change: transform, opacity, filter;
}

/* Gradient Text Shimmer */
.grad-text {
  background-size: 200% auto;
  animation: gradientFlow 8s ease infinite;
}

/* Eyebrow text refinement */
.eyebrow {
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), letter-spacing 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.eyebrow:hover {
  letter-spacing: 0.18em;
}

/* spinner for download buttons */
.spinner {
  width: 15px; height: 15px; border-radius: 50%; flex: none;
  border: 2px solid rgba(255,255,255,.35); border-top-color: #fff;
  animation: spin .7s linear infinite; display: none;
}
.dl-loading .spinner { display: inline-block; }
.dl-loading .btn-label { opacity: .85; }

/* theme transition (only while switching) */
html.theme-anim body,
html.theme-anim .ide-mock,
html.theme-anim .f-card,
html.theme-anim .cta-band,
html.theme-anim .footer,
html.theme-anim .dl-card,
html.theme-anim .stats {
  transition: background-color .4s ease, color .4s ease, border-color .4s ease;
}

/* ---------- Interactive Typing Animation & Cursor ---------- */
@keyframes typeBlink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

.type-cursor {
  display: inline-block;
  width: 2px;
  height: 1.15em;
  background: var(--amber);
  margin-left: 2px;
  vertical-align: -2px;
  animation: typeBlink 0.8s steps(1) infinite;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.6);
  flex-shrink: 0;
}

.type-cursor.cyan {
  background: #38bdf8;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.7);
}

.type-cursor.green {
  background: #10b981;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.7);
}

.vm-line.typed-done {
  animation: none;
}

.vm.typing-box {
  position: relative;
}

.replay-typing-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 600;
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: 5px;
  padding: 3px 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}
.replay-typing-btn:hover {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.4);
}
.replay-typing-btn svg {
  width: 9px;
  height: 9px;
  transition: transform 0.4s ease;
}
.replay-typing-btn:hover svg {
  transform: rotate(180deg);
}


/* ---------- Reduced motion: respect the user ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001s !important;
  }
  .blob, .float-card, .hero-badge .rb-dot { animation: none !important; }
  [data-reveal] { opacity: 1 !important; transform: none !important; }
  .ide-mock, .showcase-tilt-frame { transform: none !important; opacity: 1 !important; }
}
