/* =============================================================================
   SiemaszkoLab - Animations
   Cyberpunk / terminal motion design system
   ============================================================================= */

/* -----------------------------------------------------------------------------
   1. Keyframe Definitions
   ----------------------------------------------------------------------------- */

/* Neon pulse glow animation */
@keyframes neonPulse {
  0%, 100% {
    text-shadow:
      0 0 4px rgba(0, 255, 136, 0.4),
      0 0 11px rgba(0, 255, 136, 0.3),
      0 0 19px rgba(0, 255, 136, 0.2),
      0 0 40px rgba(0, 255, 136, 0.1);
  }
  50% {
    text-shadow:
      0 0 4px rgba(0, 255, 136, 0.6),
      0 0 14px rgba(0, 255, 136, 0.5),
      0 0 28px rgba(0, 255, 136, 0.35),
      0 0 60px rgba(0, 255, 136, 0.2),
      0 0 80px rgba(0, 255, 136, 0.1);
  }
}

/* Neon pulse for box shadows (borders, cards) */
@keyframes neonBorderPulse {
  0%, 100% {
    box-shadow:
      0 0 5px rgba(0, 255, 136, 0.1),
      0 0 10px rgba(0, 255, 136, 0.05);
  }
  50% {
    box-shadow:
      0 0 8px rgba(0, 255, 136, 0.2),
      0 0 20px rgba(0, 255, 136, 0.1),
      0 0 40px rgba(0, 255, 136, 0.05);
  }
}

/* Cyan neon pulse variant */
@keyframes cyanPulse {
  0%, 100% {
    text-shadow:
      0 0 4px rgba(0, 212, 255, 0.4),
      0 0 11px rgba(0, 212, 255, 0.3),
      0 0 19px rgba(0, 212, 255, 0.2);
  }
  50% {
    text-shadow:
      0 0 4px rgba(0, 212, 255, 0.6),
      0 0 14px rgba(0, 212, 255, 0.5),
      0 0 28px rgba(0, 212, 255, 0.35),
      0 0 60px rgba(0, 212, 255, 0.15);
  }
}

/* Scanline moving effect */
@keyframes scanline {
  0% {
    transform: translateY(-100%);
  }
  100% {
    transform: translateY(100vh);
  }
}

/* Horizontal scanline */
@keyframes scanlineHorizontal {
  0% {
    transform: translateY(-100%);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    transform: translateY(100%);
    opacity: 0;
  }
}

/* Fade in */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Fade in from below */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Fade in from above */
@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Slide in from left */
@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Slide in from right */
@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Generic slide in (used as default = from bottom) */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Scale up */
@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Terminal typing effect */
@keyframes typing {
  from {
    width: 0;
  }
  to {
    width: 100%;
  }
}

/* Blinking cursor */
@keyframes blink {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}

/* Flicker (CRT-like) */
@keyframes flicker {
  0%, 100% {
    opacity: 1;
  }
  92% {
    opacity: 1;
  }
  93% {
    opacity: 0.8;
  }
  94% {
    opacity: 1;
  }
  96% {
    opacity: 0.9;
  }
  97% {
    opacity: 1;
  }
}

/* Glitch effect */
@keyframes glitch {
  0%, 100% {
    transform: translate(0);
  }
  20% {
    transform: translate(-2px, 2px);
  }
  40% {
    transform: translate(-2px, -2px);
  }
  60% {
    transform: translate(2px, 2px);
  }
  80% {
    transform: translate(2px, -2px);
  }
}

/* Subtle float */
@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}

/* Spin */
@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Progress bar indeterminate */
@keyframes progressIndeterminate {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(300%);
  }
}

/* Dot pulse (loading indicator) */
@keyframes dotPulse {
  0%, 80%, 100% {
    transform: scale(0.6);
    opacity: 0.4;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}


/* -----------------------------------------------------------------------------
   2. Utility Classes - Text Effects
   ----------------------------------------------------------------------------- */

/* Neon glowing text */
.neon-text {
  color: var(--color-accent);
  animation: neonPulse 3s ease-in-out infinite;
}

.neon-text--cyan {
  color: var(--color-secondary);
  animation: cyanPulse 3s ease-in-out infinite;
}

.neon-text--static {
  color: var(--color-accent);
  text-shadow:
    0 0 4px rgba(0, 255, 136, 0.4),
    0 0 11px rgba(0, 255, 136, 0.3),
    0 0 19px rgba(0, 255, 136, 0.2),
    0 0 40px rgba(0, 255, 136, 0.1);
}

/* CRT flicker */
.flicker {
  animation: flicker 4s linear infinite;
}

/* Glitch text */
.glitch-text {
  position: relative;
}

.glitch-text:hover {
  animation: glitch 0.3s ease infinite;
}


/* -----------------------------------------------------------------------------
   3. Scanline Overlay
   ----------------------------------------------------------------------------- */

.scanline-overlay {
  position: relative;
  overflow: hidden;
}

.scanline-overlay::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 255, 136, 0.012) 2px,
    rgba(0, 255, 136, 0.012) 4px
  );
  pointer-events: none;
  z-index: 10;
}

.scanline-overlay::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 100px;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(0, 255, 136, 0.04) 40%,
    rgba(0, 255, 136, 0.04) 60%,
    transparent 100%
  );
  pointer-events: none;
  z-index: 10;
  animation: scanline 6s linear infinite;
}

/* Lighter variant */
.scanline-overlay--subtle::before {
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 3px,
    rgba(0, 255, 136, 0.006) 3px,
    rgba(0, 255, 136, 0.006) 6px
  );
}

.scanline-overlay--subtle::after {
  opacity: 0.5;
  animation-duration: 10s;
}


/* -----------------------------------------------------------------------------
   4. Fade-In / Slide Utility Classes
   ----------------------------------------------------------------------------- */

.fade-in {
  animation: fadeIn 0.5s ease forwards;
}

.fade-in-up {
  animation: fadeInUp 0.5s ease forwards;
}

.fade-in-down {
  animation: fadeInDown 0.5s ease forwards;
}

.slide-in {
  animation: slideIn 0.4s ease forwards;
}

.slide-in-left {
  animation: slideInLeft 0.4s ease forwards;
}

.slide-in-right {
  animation: slideInRight 0.4s ease forwards;
}

.scale-in {
  animation: scaleIn 0.3s ease forwards;
}

/* Staggered animation delays for lists */
.stagger-1 { animation-delay: 0.05s; }
.stagger-2 { animation-delay: 0.10s; }
.stagger-3 { animation-delay: 0.15s; }
.stagger-4 { animation-delay: 0.20s; }
.stagger-5 { animation-delay: 0.25s; }
.stagger-6 { animation-delay: 0.30s; }
.stagger-7 { animation-delay: 0.35s; }
.stagger-8 { animation-delay: 0.40s; }

/* Initially hidden (for JS-triggered animations) */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.animate-on-scroll.visible {
  opacity: 1;
  transform: translateY(0);
}


/* -----------------------------------------------------------------------------
   5. Hover Effects
   ----------------------------------------------------------------------------- */

/* Neon border glow on hover */
.hover-glow {
  transition:
    border-color var(--transition-base),
    box-shadow var(--transition-base);
}

.hover-glow:hover {
  border-color: var(--color-accent);
  box-shadow:
    0 0 8px rgba(0, 255, 136, 0.15),
    0 0 20px rgba(0, 255, 136, 0.08);
}

/* Cyan variant */
.hover-glow--cyan:hover {
  border-color: var(--color-secondary);
  box-shadow:
    0 0 8px rgba(0, 212, 255, 0.15),
    0 0 20px rgba(0, 212, 255, 0.08);
}

/* Hover lift */
.hover-lift {
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.hover-lift:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

/* Hover scale */
.hover-scale {
  transition: transform var(--transition-fast);
}

.hover-scale:hover {
  transform: scale(1.02);
}

/* Link underline animation */
.hover-underline {
  position: relative;
  text-decoration: none;
}

.hover-underline::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background-color: var(--color-accent);
  box-shadow: 0 0 4px rgba(0, 255, 136, 0.4);
  transition: width var(--transition-base);
}

.hover-underline:hover::after {
  width: 100%;
}

/* Background sweep on hover */
.hover-sweep {
  position: relative;
  overflow: hidden;
  z-index: 0;
}

.hover-sweep::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(0, 255, 136, 0.05),
    transparent
  );
  transform: translateX(-100%);
  transition: transform 0.5s ease;
  z-index: -1;
}

.hover-sweep:hover::before {
  transform: translateX(100%);
}


/* -----------------------------------------------------------------------------
   6. Terminal Effects
   ----------------------------------------------------------------------------- */

/* Terminal typing text */
.terminal-typing {
  font-family: var(--font-mono);
  overflow: hidden;
  white-space: nowrap;
  border-right: 2px solid var(--color-accent);
  animation:
    typing 2.5s steps(40, end) forwards,
    blink 0.75s step-end infinite;
  width: 0;
}

/* Blinking cursor (standalone) */
.terminal-cursor {
  display: inline-block;
  width: 10px;
  height: 1.1em;
  background-color: var(--color-accent);
  vertical-align: text-bottom;
  animation: blink 1s step-end infinite;
  margin-left: 2px;
}

.terminal-cursor--thin {
  width: 2px;
}

.terminal-cursor--underscore {
  width: 10px;
  height: 2px;
  vertical-align: baseline;
}

/* Terminal prompt prefix */
.terminal-prompt {
  font-family: var(--font-mono);
  color: var(--color-accent);
}

.terminal-prompt::before {
  content: '> ';
  color: var(--color-accent);
  opacity: 0.7;
}


/* -----------------------------------------------------------------------------
   7. Loading Indicators
   ----------------------------------------------------------------------------- */

/* Spinner */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.spinner--sm {
  width: 14px;
  height: 14px;
  border-width: 1.5px;
}

.spinner--lg {
  width: 32px;
  height: 32px;
  border-width: 3px;
}

/* Dot loading */
.loading-dots {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.loading-dots__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--color-accent);
  animation: dotPulse 1.4s ease-in-out infinite;
}

.loading-dots__dot:nth-child(1) { animation-delay: 0s; }
.loading-dots__dot:nth-child(2) { animation-delay: 0.2s; }
.loading-dots__dot:nth-child(3) { animation-delay: 0.4s; }

/* Progress bar */
.progress-bar {
  width: 100%;
  height: 4px;
  background-color: var(--color-bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar__fill {
  height: 100%;
  background-color: var(--color-accent);
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
  box-shadow: 0 0 6px rgba(0, 255, 136, 0.4);
}

.progress-bar--indeterminate .progress-bar__fill {
  width: 30% !important;
  animation: progressIndeterminate 1.5s ease-in-out infinite;
}


/* -----------------------------------------------------------------------------
   8. Page / Route Transitions
   ----------------------------------------------------------------------------- */

.page-enter {
  animation: fadeInUp 0.35s ease forwards;
}

.page-exit {
  animation: fadeIn 0.2s ease reverse forwards;
}


/* -----------------------------------------------------------------------------
   9. Floating / Ambient Effects
   ----------------------------------------------------------------------------- */

.float {
  animation: float 4s ease-in-out infinite;
}

/* Pulsing neon border (e.g., active status) */
.pulse-border {
  animation: neonBorderPulse 2.5s ease-in-out infinite;
}

/* Ambient glow behind elements */
.ambient-glow {
  position: relative;
}

.ambient-glow::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 120%;
  height: 120%;
  transform: translate(-50%, -50%);
  background: radial-gradient(
    ellipse at center,
    rgba(0, 255, 136, 0.06) 0%,
    transparent 70%
  );
  pointer-events: none;
  z-index: -1;
}


/* -----------------------------------------------------------------------------
   10. Interactive Transitions
   ----------------------------------------------------------------------------- */

/* Smooth transitions on common interactive elements */
a,
button,
input,
select,
textarea,
.btn,
.card,
.nav__link,
.tag,
.tab-btn,
.pagination__btn {
  transition-property: color, background-color, border-color, box-shadow, opacity, transform;
  transition-duration: 250ms;
  transition-timing-function: ease;
}

/* Modal open/close */
.modal-overlay {
  transition: opacity var(--transition-base);
}

.modal-overlay.open .modal {
  animation: scaleIn 0.25s ease forwards;
}

/* Notification slide-in */
.notification-enter {
  animation: slideInRight 0.3s ease forwards;
}

.notification-exit {
  animation: slideInRight 0.2s ease reverse forwards;
}


/* -----------------------------------------------------------------------------
   11. Reduced Motion Support
   ----------------------------------------------------------------------------- */

@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;
  }

  .neon-text,
  .neon-text--cyan {
    animation: none;
    text-shadow:
      0 0 4px rgba(0, 255, 136, 0.4),
      0 0 11px rgba(0, 255, 136, 0.3);
  }

  .scanline-overlay::after {
    animation: none;
    display: none;
  }

  .terminal-typing {
    animation: none;
    width: auto;
    border-right: 2px solid var(--color-accent);
  }

  .terminal-cursor {
    animation: none;
    opacity: 1;
  }

  .spinner {
    animation-duration: 1s !important;
    animation-iteration-count: infinite !important;
  }

  .float {
    animation: none;
  }

  .hover-lift:hover {
    transform: none;
  }

  .hover-scale:hover {
    transform: none;
  }
}
