/* 
 * Sytnaya-Zeleni - Gry planszowe dla seniorów
 * Animations Stylesheet
 * Vaporwave style animations and effects
 */

/* Keyframes Definitions */

/* Neon pulse effect for text elements */
@keyframes neon-pulse {
  from {
    text-shadow: 0 0 5px var(--accent), 
                 0 0 10px var(--accent), 
                 0 0 20px var(--accent), 
                 0 0 40px var(--primary-light);
  }
  to {
    text-shadow: 0 0 5px var(--accent), 
                 0 0 15px var(--accent), 
                 0 0 25px var(--accent), 
                 0 0 50px var(--primary-light);
  }
}

/* Floating animation for hero image */
@keyframes float {
  0% {
    transform: translateY(-50%) translateZ(0);
  }
  50% {
    transform: translateY(-55%) translateZ(0);
  }
  100% {
    transform: translateY(-50%) translateZ(0);
  }
}

/* Grid line scan effect */
@keyframes grid-scan {
  0% {
    background-position: 0% 0%;
  }
  100% {
    background-position: 0% 100%;
  }
}

/* Pulse animation for icons and buttons */
@keyframes pulse {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.05);
    opacity: 0.8;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

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

/* Gradient animation for buttons and highlights */
@keyframes gradient-shift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* Shimmer effect for loading states or highlights */
@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

/* Rotate animation for loading spinners */
@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Typing animation for text */
@keyframes typing {
  from {
    width: 0;
  }
  to {
    width: 100%;
  }
}

/* Blink animation for cursor */
@keyframes blink {
  50% {
    border-color: transparent;
  }
}

/* Scale entrance animation */
@keyframes scaleIn {
  from {
    transform: scale(0.8);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* Slide from side animation */
@keyframes slideInRight {
  from {
    transform: translateX(100px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

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

/* Wobble animation for hover effects */
@keyframes wobble {
  0%, 100% {
    transform: translateX(0%);
    transform-origin: 50% 50%;
  }
  15% {
    transform: translateX(-5px) rotate(-5deg);
  }
  30% {
    transform: translateX(3px) rotate(3deg);
  }
  45% {
    transform: translateX(-3px) rotate(-3deg);
  }
  60% {
    transform: translateX(2px) rotate(2deg);
  }
  75% {
    transform: translateX(-1px) rotate(-1deg);
  }
}

/* Hinge animation for some elements */
@keyframes hinge {
  0% {
    transform: rotate(0);
    transform-origin: top left;
    animation-timing-function: ease-in-out;
  }
  20%, 60% {
    transform: rotate(30deg);
    transform-origin: top left;
    animation-timing-function: ease-in-out;
  }
  40%, 80% {
    transform: rotate(20deg);
    transform-origin: top left;
    animation-timing-function: ease-in-out;
    opacity: 1;
  }
  100% {
    transform: translateY(700px);
    opacity: 0;
  }
}

/* Animation Utility Classes */

/* Page content animation on load */
.page-content {
  opacity: 0;
  animation: fadeIn 1s ease-out forwards;
}

/* For adding floating effect to elements */
.float {
  animation: float 6s ease-in-out infinite;
}

/* For adding pulse effect to elements */
.pulse {
  animation: pulse 2s infinite;
}

/* Gradient background that shifts */
.gradient-shift {
  background: linear-gradient(270deg, var(--primary), var(--primary-light), var(--accent), var(--secondary));
  background-size: 300% 300%;
  animation: gradient-shift 8s ease infinite;
}

/* Entrance animations for sections as they come into view */
.animate-on-scroll {
  opacity: 0;
  transition: opacity 0.8s, transform 0.8s;
}

.animate-on-scroll.fade-in {
  transform: translateY(30px);
}

.animate-on-scroll.slide-in-right {
  transform: translateX(50px);
}

.animate-on-scroll.slide-in-left {
  transform: translateX(-50px);
}

.animate-on-scroll.scale-in {
  transform: scale(0.9);
}

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

/* Apply specific animations to elements */

/* Hero section animations */
.hero, .thank-you {
  animation: fadeIn 1.2s ease-out;
}

.hero h1, .thank-you h1 {
  animation: fadeIn 1.5s ease-out;
}

.hero h2 {
  animation: fadeIn 1.8s ease-out;
}

.hero p, .thank-you p {
  animation: fadeIn 2.1s ease-out;
}

.hero .btn, .thank-you .btn {
  animation: fadeIn 2.4s ease-out;
}

/* Service card hover animations */
.service-card:hover .service-icon img {
  animation: pulse 1.5s infinite;
}

/* Game cards animations */
.game-card {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.game-card:hover {
  animation: pulse 2s infinite;
}

/* Testimonial slider animation */
.testimonial {
  animation: scaleIn 0.5s ease-out;
}

/* Blog cards animations */
.blog-card {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.blog-card:hover .read-more {
  animation: pulse 1.5s infinite;
}

/* Button hover effects */
.neon-btn:hover {
  animation: pulse 1.5s infinite;
}

.outline-btn:hover {
  animation: pulse 1.5s infinite;
}

/* Social icons hover animation */
.social-icons a:hover svg {
  animation: wobble 1s ease;
}

/* Form submit button animation */
.form-container .btn[type="submit"] {
  position: relative;
  overflow: hidden;
}

.form-container .btn[type="submit"]::after {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  bottom: -50%;
  left: -50%;
  background: linear-gradient(to bottom, rgba(229, 172, 142, 0), rgba(255, 255, 255, 0.5) 50%, rgba(229, 172, 142, 0));
  transform: rotateZ(60deg) translate(-5em, 7.5em);
  animation: shimmer 2s infinite;
  background-size: 200% 100%;
  opacity: 0.5;
}

/* Animated underline for links */
.animated-underline {
  position: relative;
}

.animated-underline::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--gradient-neon);
  transition: width 0.3s ease;
}

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

/* Article image hover effect */
.article-image img {
  transition: transform 0.3s ease;
}

.article-image:hover img {
  transform: scale(1.03);
}

/* Modal animations */
.modal {
  transition: opacity 0.3s ease;
  opacity: 0;
  visibility: hidden;
}

.modal.visible {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  transform: scale(0.8);
  transition: transform 0.3s ease;
}

.modal.visible .modal-content {
  transform: scale(1);
}

/* Cookie banner animation */
.cookie-banner {
  transform: translateY(100%);
  transition: transform 0.5s ease-out;
}

.cookie-banner.visible {
  transform: translateY(0);
}

/* Page transition effects */
.page-transition {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--primary-dark);
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.page-transition.active {
  opacity: 1;
}

/* Loading spinner animation */
.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(0, 255, 255, 0.1);
  border-left-color: var(--accent);
  border-radius: 50%;
  animation: rotate 1s linear infinite;
}

/* Typing animation for headings */
.typing-effect {
  display: inline-block;
  white-space: nowrap;
  overflow: hidden;
  border-right: 3px solid var(--accent);
  animation: typing 3.5s steps(40, end), blink 0.75s step-end infinite;
}

/* Grid background animation */
.grid-background {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-size: 100px 100px;
  background-image: 
    linear-gradient(to right, rgba(0, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0, 255, 255, 0.05) 1px, transparent 1px);
  animation: grid-scan 15s linear infinite;
  pointer-events: none;
  z-index: -1;
}

/* Responsive Animations */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  
  .float, .pulse, .gradient-shift, .service-card:hover .service-icon img,
  .game-card:hover, .neon-btn:hover, .outline-btn:hover, 
  .social-icons a:hover svg, .loading-spinner {
    animation: none !important;
  }
  
  .hero-image, .thank-you-icon {
    animation: none !important;
    transform: none !important;
  }
}

@media (max-width: 768px) {
  .hero h1, .hero h2, .hero p, .hero .btn,
  .thank-you h1, .thank-you p, .thank-you .btn {
    animation-delay: 0.3s;
  }
  
  .animate-on-scroll.fade-in {
    transform: translateY(20px);
  }
  
  .animate-on-scroll.slide-in-right,
  .animate-on-scroll.slide-in-left {
    transform: translateX(0);
  }
}
