/* ============================================================
   RDO Animations — Complete Animation System
   ============================================================ */

/* ── Keyframes ───────────────────────────────────────────── */

@keyframes spin {
  to { transform: rotate(360deg); }
}

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

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

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(20px); }
}

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

@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-24px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-48px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(48px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 20px rgba(59, 130, 246, 0.15); }
  50%       { box-shadow: 0 0 45px rgba(59, 130, 246, 0.45); }
}

@keyframes pulse-glow-green {
  0%, 100% { box-shadow: 0 0 8px rgba(34, 197, 94, 0.2); }
  50%       { box-shadow: 0 0 20px rgba(34, 197, 94, 0.6); }
}

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

@keyframes floatSlow {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  33%       { transform: translateY(-8px) rotate(1deg); }
  66%       { transform: translateY(-4px) rotate(-1deg); }
}

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

@keyframes orbPulse {
  0%, 100% { transform: scale(1) translate(0, 0); opacity: 0.55; }
  33%       { transform: scale(1.18) translate(22px, -35px); opacity: 0.75; }
  66%       { transform: scale(0.88) translate(-18px, 22px); opacity: 0.45; }
}

@keyframes borderPulse {
  0%, 100% { border-color: rgba(59, 130, 246, 0.12); }
  50%       { border-color: rgba(59, 130, 246, 0.38); }
}

@keyframes textGlow {
  0%, 100% { text-shadow: 0 0 24px rgba(59, 130, 246, 0.2); }
  50%       { text-shadow: 0 0 48px rgba(59, 130, 246, 0.55); }
}

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

@keyframes drawLine {
  from { stroke-dashoffset: 600; }
  to   { stroke-dashoffset: 0; }
}

@keyframes countUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes checkSuccess {
  0%   { transform: scale(0) rotate(-45deg); opacity: 0; }
  60%  { transform: scale(1.2) rotate(5deg); }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

@keyframes errorShake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-8px); }
  40%       { transform: translateX(8px); }
  60%       { transform: translateX(-4px); }
  80%       { transform: translateX(4px); }
}

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

@keyframes blink {
  50% { opacity: 0; }
}

@keyframes scanline {
  0%   { transform: translateY(-100%); }
  100% { transform: translateY(100vh); }
}

@keyframes dotPulse {
  0%, 100% { transform: scale(0.6); opacity: 0.4; }
  40%       { transform: scale(1.1); opacity: 1; }
}

@keyframes progressFill {
  from { width: 0%; }
  to   { width: var(--pct, 100%); }
}

@keyframes rotate3d {
  from { transform: rotate3d(1, 1, 0, 0deg); }
  to   { transform: rotate3d(1, 1, 0, 360deg); }
}

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

@keyframes gridAppear {
  from { opacity: 0; background-size: 0px 0px; }
  to   { opacity: 1; background-size: 40px 40px; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes typewriter {
  from { width: 0; }
  to   { width: 100%; }
}

/* ── Animated Background Orbs ──────────────────────────── */
.animated-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  animation: orbPulse 14s ease-in-out infinite;
  will-change: transform, opacity;
}

.orb-1 {
  width: 650px; height: 650px;
  top: -20%; left: -10%;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.28) 0%, transparent 70%);
  animation-delay: 0s;
}
.orb-2 {
  width: 500px; height: 500px;
  top: 50%; right: -15%;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.22) 0%, transparent 70%);
  animation-delay: -5s;
}
.orb-3 {
  width: 420px; height: 420px;
  bottom: -12%; left: 28%;
  background: radial-gradient(circle, rgba(6, 182, 212, 0.12) 0%, transparent 70%);
  animation-delay: -10s;
}

/* Subtle animated grid overlay */
.grid-overlay {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(59,130,246,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(59,130,246,0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  animation: fadeIn 2s ease forwards;
  opacity: 0;
}

/* Scanline flash (one-time on page load) */
.scanline-flash::after {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(59,130,246,0.5), transparent);
  z-index: 999;
  animation: scanline 1.6s ease forwards;
  pointer-events: none;
}

/* ── Particle Canvas ── */
#particles-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: 0.4;
}

/* ── Scroll Reveal ──────────────────────────────────────── */
.reveal {
  opacity: 0;
  transition: opacity 0.7s cubic-bezier(.22,1,.36,1), transform 0.7s cubic-bezier(.22,1,.36,1);
}
.reveal.reveal-up    { transform: translateY(40px); }
.reveal.reveal-down  { transform: translateY(-40px); }
.reveal.reveal-left  { transform: translateX(-50px); }
.reveal.reveal-right { transform: translateX(50px); }
.reveal.reveal-scale { transform: scale(0.90); }

.reveal.visible {
  opacity: 1;
  transform: none;
}

/* Stagger children */
.reveal-stagger > * {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.55s cubic-bezier(.22,1,.36,1), transform 0.55s cubic-bezier(.22,1,.36,1);
}
.reveal-stagger.visible > *:nth-child(1) { opacity:1; transform:none; transition-delay: 0ms; }
.reveal-stagger.visible > *:nth-child(2) { opacity:1; transform:none; transition-delay: 90ms; }
.reveal-stagger.visible > *:nth-child(3) { opacity:1; transform:none; transition-delay: 180ms; }
.reveal-stagger.visible > *:nth-child(4) { opacity:1; transform:none; transition-delay: 270ms; }
.reveal-stagger.visible > *:nth-child(5) { opacity:1; transform:none; transition-delay: 360ms; }
.reveal-stagger.visible > *:nth-child(6) { opacity:1; transform:none; transition-delay: 450ms; }

/* ── Hero Animations (stagger on load) ─────────────────── */
.hero-badge   { animation: fadeDown 0.55s cubic-bezier(.22,1,.36,1) 0.15s both; }
.hero-title   { animation: fadeUp  0.75s cubic-bezier(.22,1,.36,1) 0.3s  both; }
.hero-subtitle{ animation: fadeUp  0.75s cubic-bezier(.22,1,.36,1) 0.48s both; }
.hero-actions { animation: fadeUp  0.75s cubic-bezier(.22,1,.36,1) 0.62s both; }
.hero-stats   { animation: fadeUp  0.75s cubic-bezier(.22,1,.36,1) 0.78s both; }
.hero-visual  { animation: scaleIn 0.9s  cubic-bezier(.22,1,.36,1) 0.4s  both; }

/* ── Float Animations ───────────────────────────────────── */
.float-element   { animation: float     6s ease-in-out infinite; }
.float-element-2 { animation: floatSlow 9s ease-in-out infinite; animation-delay: -3s; }
.float-element-3 { animation: float     7.5s ease-in-out infinite; animation-delay: -5s; }

/* ── Glow Effects ───────────────────────────────────────── */
.glow-pulse       { animation: pulse-glow       3.5s ease-in-out infinite; }
.glow-pulse-green { animation: pulse-glow-green 2.5s ease-in-out infinite; }

/* ── Interactive Hover Lifts ────────────────────────────── */
.card-hover {
  transition: transform 0.28s cubic-bezier(.22,1,.36,1),
              box-shadow 0.28s cubic-bezier(.22,1,.36,1),
              border-color 0.2s ease;
}
.card-hover:hover {
  transform: translateY(-5px) scale(1.005);
  box-shadow: 0 24px 64px rgba(0,0,0,.4), 0 0 0 1px rgba(59,130,246,.12);
}

.icon-hover {
  transition: transform 0.25s cubic-bezier(.22,1,.36,1), color 0.2s ease;
}
.icon-hover:hover {
  transform: scale(1.2) rotate(-5deg);
  color: #3b82f6;
}

/* ── Buttons ────────────────────────────────────────────── */
.btn-primary {
  background-size: 200% 200%;
  animation: gradientShift 5s ease infinite;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 32px rgba(59,130,246,.4);
}
.btn-primary:active { transform: scale(0.97); }

/* Ripple container */
.ripple-container { position: relative; overflow: hidden; }
.ripple-effect {
  position: absolute;
  border-radius: 50%;
  transform: scale(0);
  background: rgba(255,255,255,0.15);
  animation: ripple 0.55s linear;
  pointer-events: none;
}

/* Shimmer loading effect */
.shimmer {
  background: linear-gradient(90deg,
    rgba(255,255,255,0) 0%,
    rgba(255,255,255,0.04) 50%,
    rgba(255,255,255,0) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.6s ease infinite;
}

/* ── Form Elements ──────────────────────────────────────── */
.input-focus-anim {
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}
.input-focus-anim:focus {
  box-shadow: 0 0 0 2px rgba(59,130,246,.2);
  transform: scale(1.002);
}

/* ── Gradient Border (hover) ────────────────────────────── */
.gradient-border { position: relative; }
.gradient-border::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(59,130,246,.35) 0%, rgba(99,102,241,.2) 100%);
  z-index: -1;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.gradient-border:hover::before,
.gradient-border:focus-within::before { opacity: 1; }

/* ── Progress Bar ───────────────────────────────────────── */
.progress-bar-fill {
  animation: progressFill 0.9s cubic-bezier(.22,1,.36,1) forwards;
}

/* ── Step Indicators ────────────────────────────────────── */
.step-active {
  animation: pulse-glow 2.5s ease-in-out infinite;
}

/* ── Loading Dots ───────────────────────────────────────── */
.loading-dots { display: flex; gap: 5px; align-items: center; }
.loading-dots span {
  width: 5px; height: 5px;
  background: currentColor;
  border-radius: 50%;
  animation: dotPulse 1.3s ease infinite;
}
.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

/* ── State Icons ────────────────────────────────────────── */
.success-icon { animation: checkSuccess 0.5s cubic-bezier(.175,.885,.32,1.275) forwards; }
.error-shake  { animation: errorShake 0.45s ease forwards; }
.counter      { animation: countUp 0.5s ease forwards; }

/* ── Typing cursor ──────────────────────────────────────── */
.typing-cursor::after {
  content: '|';
  animation: blink 1s step-end infinite;
}

/* ── Nav items ──────────────────────────────────────────── */
.nav-link {
  position: relative;
}
.nav-link::after {
  content: '';
  position: absolute;
  bottom: -2px; left: 0;
  width: 0; height: 1px;
  background: #3b82f6;
  transition: width 0.25s ease;
}
.nav-link:hover::after { width: 100%; }

/* ── Flow diagram SVG ───────────────────────────────────── */
.flow-line {
  stroke-dasharray: 600;
  stroke-dashoffset: 600;
  animation: drawLine 1.8s cubic-bezier(.22,1,.36,1) forwards;
}
.flow-node {
  opacity: 0;
  animation: scaleIn 0.5s ease forwards;
}

/* ── Page enter ─────────────────────────────────────────── */
.page-enter { animation: fadeUp 0.45s ease forwards; }

/* ── Timeline ───────────────────────────────────────────── */
.timeline-item {
  opacity: 0;
  transform: translateX(-24px);
  transition: all 0.5s cubic-bezier(.22,1,.36,1);
}
.timeline-item.visible { opacity: 1; transform: translateX(0); }

/* ── Hex/Geometric Visual ───────────────────────────────── */
.geo-spin-slow { animation: hexSpin 30s linear infinite; }
.geo-spin-med  { animation: hexSpin 18s linear infinite reverse; }
.geo-spin-fast { animation: hexSpin 8s linear infinite; }

/* ── Number ticker on hero ──────────────────────────────── */
.stat-number {
  display: inline-block;
  animation: countUp 0.6s cubic-bezier(.22,1,.36,1) 1s both;
}

/* ── Table row enter ────────────────────────────────────── */
.row-enter {
  animation: slideUp 0.3s cubic-bezier(.22,1,.36,1) both;
}

/* ── Microinteractions ──────────────────────────────────── */
a, button {
  transition: opacity 0.15s ease;
}

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

/* ══════════════════════════════════════════════════════════
   RDO Page Loader  (adapted from DVD-bounce pattern)
   - Bounces the "RDO" logotype within a fixed viewport overlay
   - Palette: 5 blue-spectrum tones matching primary #3b82f6
   ══════════════════════════════════════════════════════════ */

#rdo-loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #090909;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: all;
  transition: opacity 0.5s ease;
}

#rdo-loader.fade-out {
  opacity: 0;
  pointer-events: none;
}

#rdo-loader.hidden {
  display: none;
}

/* The bouncing element */
.rdo-loader-mark {
  /* Narrow pill — text only, no background colour needed */
  width: 120px;
  height: 36px;
  border-radius: 4px;
  position: relative;
  animation: rdoBounce 4s cubic-bezier(.36,.07,.19,.97) infinite;
}

/* "RDO" logotype */
.rdo-loader-mark::before {
  content: 'RDO';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Space Grotesk', 'Inter', system-ui, sans-serif;
  font-size: 2rem;           /* 32px — clean, not oversized */
  font-weight: 800;
  font-style: italic;
  letter-spacing: -0.03em;
  animation: rdoColorChange 4s linear infinite;
  /* baseline: primary blue */
  color: #3b82f6;
}

/* Sub-label */
.rdo-loader-mark::after {
  content: 'PROTOCOL';
  position: absolute;
  bottom: -18px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(171, 170, 181, 0.45);   /* --on-surface-variant @ 45% */
  font-size: 0.55rem;
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 700;
  letter-spacing: 0.28em;
  white-space: nowrap;
}

/* ── Bounce keyframes ───────────────────────────────────── */
/*  Confined to ±72px — subtler than the original ±60px
    because the surrounding viewport is dark, not light.     */
@keyframes rdoBounce {
  0%   { transform: translateX(0)    translateY(72px);  }
  25%  { transform: translateX(64px) translateY(0);     }
  50%  { transform: translateX(0)    translateY(-64px); }
  75%  { transform: translateX(-64px) translateY(0);   }
  100% { transform: translateX(0)    translateY(72px);  }
}

/* ── Colour keyframes  ──────────────────────────────────── */
/*  5 stops across the brand blue spectrum:
    deep navy → slate → primary → indigo → cyan            */
@keyframes rdoColorChange {
  0%   { color: #1e3a5f; }   /* deep navy          */
  25%  { color: #3b82f6; }   /* primary blue       */
  50%  { color: #6366f1; }   /* indigo             */
  75%  { color: #06b6d4; }   /* cyan               */
  100% { color: #1e3a5f; }   /* back to deep navy  */
}


