/*
 * sas-animations.css
 * Summit Data Audiences — Futuristic Sci-Fi Animation Layer
 * Scroll animations, glassmorphism, glowing timelines, aurora backgrounds
 * Works on ALL SAS pages — desktop + mobile
 */

/* ═══════════════════════════════════════════════════
   ANIMATION KEYFRAMES
═══════════════════════════════════════════════════ */

@keyframes sas-fade-up {
  from { opacity: 0; transform: translateY(32px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes sas-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

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

@keyframes sas-slide-right {
  from { opacity: 0; transform: translateX(-40px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes sas-slide-left {
  from { opacity: 0; transform: translateX(40px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes sas-glow-pulse {
  0%, 100% { box-shadow: 0 0 8px rgba(255,45,120,0.4), 0 0 20px rgba(255,45,120,0.15); }
  50%       { box-shadow: 0 0 16px rgba(255,45,120,0.8), 0 0 48px rgba(255,45,120,0.3); }
}

@keyframes sas-glow-pulse-cyan {
  0%, 100% { box-shadow: 0 0 8px rgba(0,212,255,0.4), 0 0 20px rgba(0,212,255,0.15); }
  50%       { box-shadow: 0 0 16px rgba(0,212,255,0.8), 0 0 48px rgba(0,212,255,0.3); }
}

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

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

@keyframes sas-scan-line {
  0%   { top: -2px; }
  100% { top: 100%; }
}

@keyframes sas-orbit {
  from { transform: rotate(0deg) translateX(60px) rotate(0deg); }
  to   { transform: rotate(360deg) translateX(60px) rotate(-360deg); }
}

@keyframes sas-node-ping {
  0%   { transform: scale(1); opacity: 1; }
  75%  { transform: scale(2.5); opacity: 0; }
  100% { transform: scale(1); opacity: 0; }
}

@keyframes sas-draw-line {
  from { stroke-dashoffset: 1000; }
  to   { stroke-dashoffset: 0; }
}

@keyframes sas-counter-tick {
  0%   { transform: translateY(0); }
  100% { transform: translateY(-100%); }
}

@keyframes sas-border-flow {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes sas-shimmer {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

@keyframes sas-grid-appear {
  from { opacity: 0; }
  to   { opacity: 0.06; }
}

/* ═══════════════════════════════════════════════════
   SCROLL REVEAL — BASE STATES
   JS adds .sas-anim-ready then .sas-anim-visible
═══════════════════════════════════════════════════ */

.sas-anim-fade-up.sas-anim-ready {
  opacity: 0;
  transform: translateY(32px);
  transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
.sas-anim-fade-in.sas-anim-ready {
  opacity: 0;
  transition: opacity 0.7s ease;
}
.sas-anim-scale-in.sas-anim-ready {
  opacity: 0;
  transform: scale(0.92);
  transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.sas-anim-slide-right.sas-anim-ready {
  opacity: 0;
  transform: translateX(-40px);
  transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
.sas-anim-slide-left.sas-anim-ready {
  opacity: 0;
  transform: translateX(40px);
  transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

/* HERO SAFEGUARD — hero content must ALWAYS be visible on page load.
   Never hide above-the-fold content behind scroll animations. */
.hero .sas-anim-fade-up.sas-anim-ready,
.hero .sas-anim-fade-in.sas-anim-ready,
.hero .sas-anim-scale-in.sas-anim-ready,
.hero .sas-anim-slide-right.sas-anim-ready,
.about-hero .sas-anim-fade-up.sas-anim-ready,
.page-hero .sas-anim-fade-up.sas-anim-ready,
.inner-hero .sas-anim-fade-up.sas-anim-ready,
.products-hero .sas-anim-fade-up.sas-anim-ready,
.contact-hero .sas-anim-fade-up.sas-anim-ready {
  opacity: 1 !important;
  transform: none !important;
}

/* VISIBLE STATE — all animation types resolve to this */
.sas-anim-fade-up.sas-anim-visible,
.sas-anim-fade-in.sas-anim-visible,
.sas-anim-scale-in.sas-anim-visible,
.sas-anim-slide-right.sas-anim-visible,
.sas-anim-slide-left.sas-anim-visible {
  opacity: 1;
  transform: none;
}

/* Stagger delays for sibling groups */
.sas-stagger > *:nth-child(1) { transition-delay: 0ms !important; }
.sas-stagger > *:nth-child(2) { transition-delay: 90ms !important; }
.sas-stagger > *:nth-child(3) { transition-delay: 180ms !important; }
.sas-stagger > *:nth-child(4) { transition-delay: 270ms !important; }
.sas-stagger > *:nth-child(5) { transition-delay: 360ms !important; }
.sas-stagger > *:nth-child(6) { transition-delay: 450ms !important; }
.sas-stagger > *:nth-child(7) { transition-delay: 540ms !important; }
.sas-stagger > *:nth-child(8) { transition-delay: 630ms !important; }

/* ═══════════════════════════════════════════════════
   GLASSMORPHISM CARDS
═══════════════════════════════════════════════════ */

.sas-glass {
  background: rgba(255,255,255,0.04) !important;
  backdrop-filter: blur(16px) saturate(1.4) !important;
  -webkit-backdrop-filter: blur(16px) saturate(1.4) !important;
  border: 1px solid rgba(255,255,255,0.10) !important;
  border-radius: 16px !important;
  box-shadow:
    0 8px 32px rgba(0,0,0,0.4),
    0 0 0 1px rgba(255,255,255,0.04) inset !important;
  position: relative;
  overflow: hidden;
}

/* Subtle top-edge shimmer on glass cards */
.sas-glass::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
  pointer-events: none;
}

/* Pink-glow glass variant */
.sas-glass-pink {
  border-color: rgba(255,45,120,0.2) !important;
  box-shadow:
    0 8px 32px rgba(0,0,0,0.4),
    0 0 32px rgba(255,45,120,0.06) inset !important;
}

/* Cyan-glow glass variant */
.sas-glass-cyan {
  border-color: rgba(0,212,255,0.2) !important;
  box-shadow:
    0 8px 32px rgba(0,0,0,0.4),
    0 0 32px rgba(0,212,255,0.06) inset !important;
}

/* Hover glow on glass cards */
.sas-glass:hover {
  border-color: rgba(255,45,120,0.3) !important;
  box-shadow:
    0 16px 48px rgba(0,0,0,0.5),
    0 0 48px rgba(255,45,120,0.08),
    0 0 0 1px rgba(255,45,120,0.15) inset !important;
  transform: translateY(-2px);
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

/* ═══════════════════════════════════════════════════
   NEON EDGE HIGHLIGHTS — button & card accents
═══════════════════════════════════════════════════ */

.sas-neon-edge {
  position: relative;
}
.sas-neon-edge::after {
  content: '';
  position: absolute;
  bottom: 0; left: 10%; right: 10%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,45,120,0.8), rgba(0,212,255,0.8), transparent);
  opacity: 0.5;
  border-radius: 100px;
  pointer-events: none;
}

/* ═══════════════════════════════════════════════════
   GLOW BUTTONS
═══════════════════════════════════════════════════ */

.sas-btn-glow {
  position: relative;
  overflow: hidden;
  transition: all 0.2s ease !important;
}
.sas-btn-glow::before {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
  animation: sas-shimmer 2.5s ease infinite;
  pointer-events: none;
}
.sas-btn-glow:hover {
  box-shadow: 0 0 24px rgba(255,45,120,0.5), 0 4px 20px rgba(0,0,0,0.4) !important;
  transform: translateY(-2px) !important;
}

/* ═══════════════════════════════════════════════════
   AURORA / GRADIENT MESH BACKGROUNDS
═══════════════════════════════════════════════════ */

.sas-aurora-bg {
  position: relative;
}
.sas-aurora-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 40%, rgba(255,45,120,0.08) 0%, transparent 70%),
    radial-gradient(ellipse 70% 50% at 80% 60%, rgba(0,212,255,0.06) 0%, transparent 70%),
    radial-gradient(ellipse 60% 40% at 50% 20%, rgba(127,255,0,0.04) 0%, transparent 70%);
  animation: sas-aurora 12s ease infinite;
  background-size: 200% 200%;
  pointer-events: none;
  z-index: 0;
}
/* z-index only — do NOT set position here. The original `position: relative`
   was overriding position:absolute on hero-orbs/illustrations, making them
   take up layout space and pushing the hero text off-screen. */
.sas-aurora-bg > * { z-index: 1; }

/* Intense aurora for hero sections */
.sas-aurora-hero::before {
  background:
    radial-gradient(ellipse 90% 70% at 10% 30%, rgba(255,45,120,0.12) 0%, transparent 60%),
    radial-gradient(ellipse 80% 60% at 85% 65%, rgba(0,212,255,0.10) 0%, transparent 60%),
    radial-gradient(ellipse 70% 50% at 50% 10%, rgba(199,125,255,0.08) 0%, transparent 60%);
}

/* ═══════════════════════════════════════════════════
   PARTICLE CANVAS OVERLAY
═══════════════════════════════════════════════════ */

#sas-particle-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.35;
}

/* ═══════════════════════════════════════════════════
   CIRCUIT BOARD PATTERN BACKGROUNDS
═══════════════════════════════════════════════════ */

.sas-circuit-bg {
  position: relative;
}
.sas-circuit-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,45,120,0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,45,120,0.06) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
  z-index: 0;
  animation: sas-grid-appear 1s ease forwards;
}
.sas-circuit-bg > * { position: relative; z-index: 1; }

/* Dot-matrix pattern */
.sas-dot-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255,255,255,0.08) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
  z-index: 0;
}
.sas-dot-bg > * { position: relative; z-index: 1; }

/* ═══════════════════════════════════════════════════
   GLOWING TIMELINE
═══════════════════════════════════════════════════ */

.sas-timeline {
  position: relative;
  padding-left: 32px;
}

.sas-timeline::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, transparent, #ff2d78 15%, #00d4ff 50%, #7fff00 85%, transparent);
  border-radius: 2px;
}

.sas-timeline-item {
  position: relative;
  margin-bottom: 40px;
}

.sas-timeline-node {
  position: absolute;
  left: -28px;
  top: 4px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ff2d78;
  box-shadow: 0 0 12px rgba(255,45,120,0.8);
  z-index: 2;
  transition: all 0.4s ease;
}

/* Ping ring around timeline node */
.sas-timeline-node::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid rgba(255,45,120,0.4);
  animation: sas-node-ping 2s ease-out infinite;
}

/* Active node (when scrolled into view) */
.sas-timeline-item.sas-anim-visible .sas-timeline-node {
  animation: sas-glow-pulse 2s ease-in-out infinite;
}

/* Alternate node colors */
.sas-timeline-item:nth-child(2) .sas-timeline-node { background: #00d4ff; box-shadow: 0 0 12px rgba(0,212,255,0.8); }
.sas-timeline-item:nth-child(2) .sas-timeline-node::after { border-color: rgba(0,212,255,0.4); }
.sas-timeline-item:nth-child(3) .sas-timeline-node { background: #7fff00; box-shadow: 0 0 12px rgba(127,255,0,0.8); }
.sas-timeline-item:nth-child(3) .sas-timeline-node::after { border-color: rgba(127,255,0,0.4); }
.sas-timeline-item:nth-child(4) .sas-timeline-node { background: #c77dff; box-shadow: 0 0 12px rgba(199,125,255,0.8); }
.sas-timeline-item:nth-child(4) .sas-timeline-node::after { border-color: rgba(199,125,255,0.4); }

/* ═══════════════════════════════════════════════════
   ANIMATED NUMBER COUNTERS
═══════════════════════════════════════════════════ */

.sas-counter-wrap {
  display: inline-block;
  overflow: hidden;
}

.sas-counter {
  display: inline-block;
  transition: none;
}

/* ═══════════════════════════════════════════════════
   SCANLINE OVERLAY
═══════════════════════════════════════════════════ */

.sas-scanline-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9998;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,0.03) 2px,
    rgba(0,0,0,0.03) 4px
  );
}

/* Moving scan line (optional, subtle) */
.sas-scan-beam {
  position: fixed;
  top: -2px;
  left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(0,212,255,0.15), transparent);
  animation: sas-scan-line 8s linear infinite;
  pointer-events: none;
  z-index: 9997;
}

/* ═══════════════════════════════════════════════════
   GRADIENT SECTION DIVIDERS (smooth transitions)
═══════════════════════════════════════════════════ */

.sas-section-divider {
  position: relative;
  height: 1px;
  margin: 0;
  background: transparent;
  overflow: visible;
}
.sas-section-divider::after {
  content: '';
  position: absolute;
  left: 5%; right: 5%;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg,
    transparent,
    rgba(255,45,120,0.3) 30%,
    rgba(0,212,255,0.3) 70%,
    transparent
  );
}

/* ═══════════════════════════════════════════════════
   NEON BORDER GLOW — for cards and boxes
═══════════════════════════════════════════════════ */

.sas-neon-box {
  position: relative;
  border-radius: 16px;
  padding: 2px;
  background: linear-gradient(135deg, rgba(255,45,120,0.3), rgba(0,212,255,0.3), rgba(127,255,0,0.2));
  background-size: 200% 200%;
  animation: sas-border-flow 4s ease infinite;
}
.sas-neon-box > * {
  background: #000;
  border-radius: 14px;
  position: relative;
  z-index: 1;
}

/* ═══════════════════════════════════════════════════
   FLOATING / PARALLAX ELEMENTS
═══════════════════════════════════════════════════ */

.sas-float {
  animation: sas-float 4s ease-in-out infinite;
}
.sas-float-delay-1 { animation-delay: -1s; }
.sas-float-delay-2 { animation-delay: -2s; }
.sas-float-delay-3 { animation-delay: -3s; }

/* ═══════════════════════════════════════════════════
   TIER BAND GLOW LINES (SAS-specific)
═══════════════════════════════════════════════════ */

.sas-tier-glow {
  position: relative;
  overflow: hidden;
}
.sas-tier-glow::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: inherit;
  filter: brightness(1.5) blur(2px);
  opacity: 0.6;
}
.sas-tier-glow::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2px;
  background: inherit;
  filter: brightness(1.5) blur(2px);
  opacity: 0.6;
}

/* ═══════════════════════════════════════════════════
   STAT NUMBERS — neon glow
═══════════════════════════════════════════════════ */

.sas-stat-neon {
  text-shadow:
    0 0 20px rgba(255,45,120,0.6),
    0 0 40px rgba(255,45,120,0.3);
  transition: text-shadow 0.3s ease;
}
.sas-stat-neon:hover {
  text-shadow:
    0 0 30px rgba(255,45,120,0.9),
    0 0 60px rgba(255,45,120,0.5);
}

/* ═══════════════════════════════════════════════════
   SECTION HEADER LABEL — pulsing neon badge
═══════════════════════════════════════════════════ */

.sas-label-pulse {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  position: relative;
}
.sas-label-pulse::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: sas-glow-pulse 1.5s ease-in-out infinite;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════
   HERO ORB ENHANCEMENT
═══════════════════════════════════════════════════ */

.sas-hero-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  animation: sas-float 8s ease-in-out infinite;
}
.sas-hero-orb-pink {
  background: radial-gradient(circle, rgba(255,45,120,0.25) 0%, transparent 70%);
  width: 500px; height: 500px;
  top: -100px; left: -100px;
  animation-delay: 0s;
}
.sas-hero-orb-cyan {
  background: radial-gradient(circle, rgba(0,212,255,0.20) 0%, transparent 70%);
  width: 400px; height: 400px;
  bottom: -80px; right: -80px;
  animation-delay: -3s;
}
.sas-hero-orb-violet {
  background: radial-gradient(circle, rgba(199,125,255,0.15) 0%, transparent 70%);
  width: 350px; height: 350px;
  top: 30%; right: 10%;
  animation-delay: -6s;
}

/* ═══════════════════════════════════════════════════
   MONOSPACE DATA LABELS
═══════════════════════════════════════════════════ */

.sas-mono {
  font-family: 'Space Grotesk', 'Courier New', monospace !important;
  letter-spacing: 0.08em;
  font-size: 0.85em;
  opacity: 0.7;
}

/* ═══════════════════════════════════════════════════
   MOBILE — reduce motion for performance
═══════════════════════════════════════════════════ */

@media (max-width: 768px) {
  .sas-anim-fade-up.sas-anim-ready,
  .sas-anim-slide-right.sas-anim-ready,
  .sas-anim-slide-left.sas-anim-ready {
    /* Simplified: just fade, no translate on mobile */
    transform: translateY(16px);
  }

  .sas-hero-orb-pink  { width: 280px; height: 280px; }
  .sas-hero-orb-cyan  { width: 220px; height: 220px; }
  .sas-hero-orb-violet { display: none; }

  #sas-particle-canvas { display: none; }

  .sas-aurora-bg::before { opacity: 0.6; }

  .sas-timeline { padding-left: 24px; }
}

/* Respect prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  .sas-anim-fade-up.sas-anim-ready,
  .sas-anim-fade-in.sas-anim-ready,
  .sas-anim-scale-in.sas-anim-ready,
  .sas-anim-slide-right.sas-anim-ready,
  .sas-anim-slide-left.sas-anim-ready {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
  .sas-float,
  .sas-hero-orb,
  .sas-label-pulse::before,
  .sas-timeline-node::after,
  .sas-btn-glow::before,
  .sas-aurora-bg::before {
    animation: none !important;
  }
}
