.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity var(--transition-slow), transform var(--transition-slow);
  /* Multiple animation layers to guarantee visibility */
  animation: reveal-safety-immediate 0.001s ease forwards 0ms, reveal-safety 0.3s ease forwards 100ms;
}

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

/* Immediate safety: ensures opacity 1 within 50ms as fallback */
@keyframes reveal-safety-immediate {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Primary safety animation with very short delay */
@keyframes reveal-safety {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.reveal-stagger > * {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity var(--transition-slow), transform var(--transition-slow);
  /* Multiple animation layers to guarantee visibility */
  animation: reveal-safety-immediate 0.001s ease forwards 0ms, reveal-safety 0.3s ease forwards 150ms;
}

.reveal-stagger > *.is-visible {
  opacity: 1;
  transform: translateY(0);
  animation: none;
}

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

  .reveal,
  .reveal-stagger > *,
  .stage-node {
    opacity: 1 !important;
    transform: none !important;
  }
}

/* ── Hero diagram: probabilistic node drift ──────────────────────── */
@keyframes nd-drift-a {
  0%, 100% { transform: translate(0, 0); }
  30%       { transform: translate(12px, -16px); }
  70%       { transform: translate(-8px, 11px); }
}
@keyframes nd-drift-b {
  0%, 100% { transform: translate(0, 0); }
  40%       { transform: translate(-14px, 9px); }
  80%       { transform: translate(10px, -13px); }
}
@keyframes nd-drift-c {
  0%, 100% { transform: translate(0, 0); }
  25%       { transform: translate(9px, 18px); }
  60%       { transform: translate(-11px, -7px); }
}
@keyframes nd-drift-d {
  0%, 100% { transform: translate(0, 0); }
  50%       { transform: translate(-16px, -11px); }
}
@keyframes nd-drift-e {
  0%, 100% { transform: translate(0, 0); }
  35%       { transform: translate(7px, -19px); }
  75%       { transform: translate(-13px, 8px); }
}
@keyframes nd-drift-f {
  0%, 100% { transform: translate(0, 0); }
  45%       { transform: translate(15px, 12px); }
}

.nd-a { animation: nd-drift-a  9s   ease-in-out infinite; }
.nd-b { animation: nd-drift-b  7.5s ease-in-out infinite 1.2s; }
.nd-c { animation: nd-drift-c  11s  ease-in-out infinite 0.4s; }
.nd-d { animation: nd-drift-d  8.5s ease-in-out infinite 2.8s; }
.nd-e { animation: nd-drift-e  10s  ease-in-out infinite 1.7s; }
.nd-f { animation: nd-drift-f  7s   ease-in-out infinite 3.5s; }

/* pause chaos on hover: enterprise imposing control */
.hero-abstract:hover .nd { animation-play-state: paused; }

/* ── Hero diagram: deterministic grid pulse (row-by-row ripple) ──── */
@keyframes gn-pulse {
  0%, 100% { opacity: 0.65; transform: scale(1); }
  50%       { opacity: 0.95; transform: scale(1.3); }
}

.gn { animation: gn-pulse 3.8s ease-in-out infinite; }

/* row 1 */ .nodes-grid .gn:nth-child(-n+4)   { animation-delay: 0s; }
/* row 2 */ .nodes-grid .gn:nth-child(n+5):nth-child(-n+8)  { animation-delay: 0.18s; }
/* row 3 */ .nodes-grid .gn:nth-child(n+9):nth-child(-n+12) { animation-delay: 0.36s; }
/* row 4 */ .nodes-grid .gn:nth-child(n+13):nth-child(-n+16){ animation-delay: 0.54s; }
/* row 5 */ .nodes-grid .gn:nth-child(n+17)  { animation-delay: 0.72s; }

/* speed up grid pulse on hover */
.hero-abstract:hover .gn { animation-duration: 1.8s; }

@media (prefers-reduced-motion: reduce) {
  .nd, .gn { animation: none !important; }
}
