/* ============================================================
   Cloud Institute — animations
   Scroll reveals, keyframes, ambient motion, reduced-motion
   ============================================================ */

/* ---------- Scroll reveal ---------- */
[data-reveal] {
  opacity: 0;
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
  will-change: opacity, transform;
}
[data-reveal="up"]    { transform: translateY(34px); }
[data-reveal="left"]  { transform: translateX(-40px); }
[data-reveal="right"] { transform: translateX(40px); }
[data-reveal="zoom"]  { transform: scale(0.92); }

[data-reveal].is-visible {
  opacity: 1;
  transform: none;
}

/* ---------- Page transition ---------- */
body {
  animation: pageIn 0.5s var(--ease) both;
}

/* ---------- Keyframes ---------- */
@keyframes pageIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: none; }
}

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

@keyframes floatSlow {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%      { transform: translate(24px, -30px) scale(1.06); }
}

@keyframes caret {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0; }
}

@keyframes ripple {
  to { transform: scale(2.6); opacity: 0; }
}

@keyframes loading {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(320%); }
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(28px); }
  to   { opacity: 1; transform: none; }
}

@keyframes toastOut {
  to { opacity: 0; transform: translateX(28px); }
}

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

@keyframes dash {
  to { stroke-dashoffset: -240; }
}

@keyframes pulseRing {
  0%   { transform: scale(0.9); opacity: 0.7; }
  70%  { transform: scale(1.5); opacity: 0; }
  100% { transform: scale(1.5); opacity: 0; }
}

/* ---------- Ambient motion ---------- */
.blob--1 { animation: floatSlow 16s ease-in-out infinite; }
.blob--2 { animation: floatSlow 20s ease-in-out infinite reverse; }

.hero__chip--a { animation: float 5.5s ease-in-out infinite; }
.hero__chip--b { animation: float 6.8s ease-in-out infinite 0.6s; }

.hero__net .link { stroke-dasharray: 6 10; animation: dash 9s linear infinite; }
.hero__net .node { animation: float 7s ease-in-out infinite; transform-origin: center; }
.hero__net .node:nth-child(even) { animation-duration: 9s; }

.animate-gradient {
  background-size: 220% 220%;
  animation: gradientShift 9s ease infinite;
}

.hover-lift { transition: transform var(--t), box-shadow var(--t); }
.hover-lift:hover { transform: translateY(-6px) scale(1.01); box-shadow: var(--shadow-md); }

.live-dot { position: relative; }
.live-dot::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--primary);
  animation: pulseRing 2s ease-out infinite;
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  [data-reveal] { opacity: 1; transform: none; }
}
