/**
 * Custom CSS - Additional animations and effects
 * @package Zenyth
 */

/* ==========================================================================
   Advanced Animations
   ========================================================================== */

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

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

/* Glow Pulse */
@keyframes glowPulse {
  0%, 100% {
    box-shadow: 0 0 20px hsla(var(--primary), 0.3);
  }
  50% {
    box-shadow: 0 0 40px hsla(var(--primary), 0.5);
  }
}

.glow-pulse {
  animation: glowPulse 3s ease-in-out infinite;
}

/* Shimmer Effect */
@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

.shimmer {
  background: linear-gradient(
    90deg,
    hsl(var(--card)) 0%,
    hsla(var(--primary), 0.1) 50%,
    hsl(var(--card)) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 3s infinite;
}

/* Typewriter Effect */
@keyframes typewriter {
  from {
    width: 0;
  }
  to {
    width: 100%;
  }
}

@keyframes blink {
  0%, 100% {
    border-color: transparent;
  }
  50% {
    border-color: hsl(var(--primary));
  }
}

.typewriter {
  overflow: hidden;
  border-right: 2px solid;
  white-space: nowrap;
  animation: 
    typewriter 3s steps(40) 1s 1 normal both,
    blink 0.75s step-end infinite;
}

/* Gradient Border */
.gradient-border {
  position: relative;
  background: hsl(var(--card));
  border-radius: var(--radius);
}

.gradient-border::before {
  content: '';
  position: absolute;
  inset: -1px;
  background: linear-gradient(
    135deg,
    hsl(var(--primary)),
    transparent 50%,
    hsl(var(--primary))
  );
  border-radius: inherit;
  z-index: -1;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.gradient-border:hover::before {
  opacity: 1;
}

/* ==========================================================================
   Particle Effects
   ========================================================================== */

.particles-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.particle {
  position: absolute;
  width: 4px;
  height: 4px;
  background: hsl(var(--primary));
  border-radius: 50%;
  opacity: 0.3;
  animation: particleFloat 15s infinite;
}

@keyframes particleFloat {
  0%, 100% {
    transform: translateY(100vh) rotate(0deg);
    opacity: 0;
  }
  10% {
    opacity: 0.3;
  }
  90% {
    opacity: 0.3;
  }
  100% {
    transform: translateY(-100vh) rotate(720deg);
    opacity: 0;
  }
}

/* ==========================================================================
   Loading States
   ========================================================================== */

.loading {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.skeleton {
  background: linear-gradient(
    90deg,
    hsl(var(--muted)) 0%,
    hsl(var(--accent)) 50%,
    hsl(var(--muted)) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: var(--radius);
}

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

/* ==========================================================================
   Interactive Hover Effects
   ========================================================================== */

/* Tilt on Hover */
.tilt-hover {
  transition: transform 0.3s ease;
  transform-style: preserve-3d;
}

.tilt-hover:hover {
  transform: perspective(1000px) rotateX(5deg) rotateY(5deg);
}

/* Magnetic Button Enhancement */
.magnetic-btn {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.magnetic-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px hsla(var(--primary), 0.3);
}

.magnetic-btn:active {
  transform: translateY(0);
}

/* Link Underline Animation */
.animated-underline {
  position: relative;
  display: inline-block;
}

.animated-underline::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.3s ease;
}

.animated-underline:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

/* ==========================================================================
   Scroll-Triggered Effects
   ========================================================================== */

.parallax {
  transition: transform 0.1s linear;
}

.blur-in {
  filter: blur(10px);
  opacity: 0;
  transition: filter 0.6s ease, opacity 0.6s ease;
}

.blur-in.active {
  filter: blur(0);
  opacity: 1;
}

.scale-reveal {
  transform: scale(0.8);
  opacity: 0;
  transition: transform 0.6s ease, opacity 0.6s ease;
}

.scale-reveal.active {
  transform: scale(1);
  opacity: 1;
}

/* ==========================================================================
   Custom Scrollbar
   ========================================================================== */

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: hsl(var(--background));
}

::-webkit-scrollbar-thumb {
  background: hsl(var(--border));
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: hsl(var(--muted-foreground));
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: hsl(var(--border)) hsl(var(--background));
}

/* ==========================================================================
   Selection Styling
   ========================================================================== */

::selection {
  background: hsla(var(--primary), 0.3);
  color: hsl(var(--foreground));
}

::-moz-selection {
  background: hsla(var(--primary), 0.3);
  color: hsl(var(--foreground));
}

/* ==========================================================================
   Focus States
   ========================================================================== */

*:focus {
  outline: none;
}

*:focus-visible {
  outline: 2px solid hsl(var(--primary));
  outline-offset: 2px;
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
  body {
    background: white;
    color: black;
  }
  
  .site-header,
  .site-footer,
  .scroll-top-btn,
  .loading-screen {
    display: none !important;
  }
  
  .section {
    page-break-inside: avoid;
  }
}

/* ==========================================================================
   Reduced Motion
   ========================================================================== */

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

/* ==========================================================================
   High Contrast Mode
   ========================================================================== */

@media (prefers-contrast: high) {
  :root {
    --border: 0 0% 50%;
    --muted-foreground: 0 0% 80%;
  }
  
  .spotlight-card,
  .glass-card {
    border-width: 2px;
  }
}
