/* =============================================================
   SICCURA REGULA — ANIMATIONS.CSS
   Scroll-triggered reveal system, transitions, micro-animations
   ============================================================= */

/* ─── SCROLL REVEAL ──────────────────────────────────────────── */
[data-reveal] {
  opacity: 0;
  transform: translateY(24px);
  transition:
    opacity 600ms cubic-bezier(0.4, 0, 0.2, 1),
    transform 600ms cubic-bezier(0.4, 0, 0.2, 1);
}

[data-reveal="fade"] {
  transform: none;
}

[data-reveal="slide-left"] {
  transform: translateX(-32px);
}

[data-reveal="slide-right"] {
  transform: translateX(32px);
}

[data-reveal="scale"] {
  transform: translateY(16px) scale(0.97);
}

[data-reveal].is-visible {
  opacity: 1;
  transform: none;
}

/* Staggered children */
[data-stagger] > * {
  opacity: 0;
  transform: translateY(20px);
  transition:
    opacity 500ms cubic-bezier(0.4, 0, 0.2, 1),
    transform 500ms cubic-bezier(0.4, 0, 0.2, 1);
}

[data-stagger].is-visible > *:nth-child(1) { transition-delay: 0ms; }
[data-stagger].is-visible > *:nth-child(2) { transition-delay: 80ms; }
[data-stagger].is-visible > *:nth-child(3) { transition-delay: 160ms; }
[data-stagger].is-visible > *:nth-child(4) { transition-delay: 240ms; }
[data-stagger].is-visible > *:nth-child(5) { transition-delay: 320ms; }
[data-stagger].is-visible > *:nth-child(6) { transition-delay: 400ms; }
[data-stagger].is-visible > *:nth-child(7) { transition-delay: 480ms; }
[data-stagger].is-visible > *:nth-child(8) { transition-delay: 560ms; }

[data-stagger].is-visible > * {
  opacity: 1;
  transform: none;
}

/* ─── HERO ANIMATIONS ────────────────────────────────────────── */
@keyframes heroFadeUp {
  from {
    opacity: 0;
    transform: translateY(32px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes heroLineExpand {
  from { width: 0; opacity: 0; }
  to   { width: 48px; opacity: 1; }
}

@keyframes heroPulse {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50%       { opacity: 0.7; transform: scale(1.05); }
}

@keyframes floatSlow {
  0%, 100% { transform: translateY(0px); }
  50%       { transform: translateY(-10px); }
}

@keyframes subtleRotate {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

@keyframes gradientShift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.hero-animate-1 { animation: heroFadeUp 800ms cubic-bezier(0.4,0,0.2,1) 100ms both; }
.hero-animate-2 { animation: heroFadeUp 800ms cubic-bezier(0.4,0,0.2,1) 250ms both; }
.hero-animate-3 { animation: heroFadeUp 800ms cubic-bezier(0.4,0,0.2,1) 400ms both; }
.hero-animate-4 { animation: heroFadeUp 800ms cubic-bezier(0.4,0,0.2,1) 550ms both; }
.hero-animate-5 { animation: heroFadeUp 800ms cubic-bezier(0.4,0,0.2,1) 700ms both; }

/* ─── HOVER MICRO-ANIMATIONS ─────────────────────────────────── */
.hover-lift {
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}
.hover-lift:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
}

.hover-glow {
  transition: box-shadow var(--transition-base);
}
.hover-glow:hover {
  box-shadow: 0 0 0 3px rgba(26,127,142,0.15), var(--shadow-lg);
}

/* ─── PILLAR CARD ────────────────────────────────────────────── */
@keyframes pillarsReveal {
  from { opacity: 0; transform: translateY(30px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}

/* ─── GRADIENT ANIMATED BG ───────────────────────────────────── */
.animated-gradient {
  background: linear-gradient(135deg, #0D1B2A 0%, #1E3A5F 50%, #0D1B2A 100%);
  background-size: 200% 200%;
  animation: gradientShift 12s ease infinite;
}

/* ─── FLOATING NODE (hero decoration) ────────────────────────── */
.float-node {
  animation: floatSlow 6s ease-in-out infinite;
}
.float-node:nth-child(2) { animation-delay: 2s; }
.float-node:nth-child(3) { animation-delay: 4s; }

/* ─── COUNTER ANIMATION ──────────────────────────────────────── */
@keyframes countUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

/* ─── NAV SCROLL STATES ──────────────────────────────────────── */
.nav-scrolled {
  transition: background var(--transition-base), box-shadow var(--transition-base);
}

/* ─── PAGE TRANSITION ────────────────────────────────────────── */
@keyframes pageIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.page-enter {
  animation: pageIn 400ms ease both;
}

/* ─── SPINNER (loading state) ────────────────────────────────── */
@keyframes spin {
  to { transform: rotate(360deg); }
}
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-teal);
  border-radius: 50%;
  animation: spin 600ms linear infinite;
}

/* ─── HORIZONTAL SCROLL MARQUEE ──────────────────────────────── */
@keyframes marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
.marquee-track {
  animation: marquee 30s linear infinite;
}
.marquee-track:hover {
  animation-play-state: paused;
}

/* Reduce motion preference */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  [data-reveal], [data-stagger] > * {
    opacity: 1;
    transform: none;
  }
}
