/* ================================
   FP1.ch - Animation Helpers
   GSAP ScrollTrigger animations
   ================================ */

/* --------------------------------
   Initial States for GSAP
   Elements start invisible/offset
   -------------------------------- */

/* Fade Up Animation */
[data-animate="fade-up"] {
  opacity: 0;
  transform: translateY(40px);
}

/* Fade In Animation */
[data-animate="fade-in"] {
  opacity: 0;
}

/* Fade Left Animation */
[data-animate="fade-left"] {
  opacity: 0;
  transform: translateX(-40px);
}

/* Fade Right Animation */
[data-animate="fade-right"] {
  opacity: 0;
  transform: translateX(40px);
}

/* Scale Up Animation */
[data-animate="scale-up"] {
  opacity: 0;
  transform: scale(0.9);
}

/* Stagger Children - for lists/grids */
[data-animate="stagger"] > * {
  opacity: 0;
  transform: translateY(30px);
}

/* Counter Animation */
[data-animate="counter"] {
  opacity: 0;
}

/* Word Reveal Animation */
.word-reveal {
  overflow: hidden;
  display: inline-block;
}

.word-reveal .word {
  display: inline-block;
  transform: translateY(100%);
  opacity: 0;
}

/* Line Reveal Animation */
.line-reveal {
  overflow: hidden;
}

.line-reveal .line {
  display: block;
  transform: translateY(100%);
}

/* --------------------------------
   Animated States (after GSAP runs)
   -------------------------------- */
.animated {
  opacity: 1 !important;
  transform: none !important;
}

/* --------------------------------
   Gradient Orb Animations
   -------------------------------- */
.orb {
  animation: float 20s ease-in-out infinite;
}

.orb-1 {
  animation-delay: 0s;
}

.orb-2 {
  animation-delay: -7s;
}

.orb-3 {
  animation-delay: -14s;
}

@keyframes float {
  0%, 100% {
    transform: translate(0, 0) scale(1);
  }
  25% {
    transform: translate(30px, -30px) scale(1.05);
  }
  50% {
    transform: translate(-20px, 20px) scale(0.95);
  }
  75% {
    transform: translate(-30px, -20px) scale(1.02);
  }
}

/* --------------------------------
   Mobile: Disable all animations
   Show content immediately
   -------------------------------- */
@media (max-width: 768px) {
  /* Hide orbs completely */
  .orb {
    display: none !important;
  }

  /* Hide page loader on mobile */
  .page-loader {
    display: none !important;
  }

  /* Show header elements immediately */
  .logo,
  .nav > a,
  .nav-cta {
    opacity: 1 !important;
    transform: none !important;
  }

  /* Show hero content immediately */
  .hero-content,
  .hero-content h1,
  .hero-content p,
  .hero-buttons,
  .hero-stats {
    opacity: 1 !important;
    transform: none !important;
  }

  /* Show all animated elements immediately */
  [data-animate="fade-up"],
  [data-animate="fade-in"],
  [data-animate="fade-left"],
  [data-animate="fade-right"],
  [data-animate="scale-up"],
  [data-animate="counter"] {
    opacity: 1 !important;
    transform: none !important;
  }

  [data-animate="stagger"] > * {
    opacity: 1 !important;
    transform: none !important;
  }
}

/* --------------------------------
   Loading Animation
   -------------------------------- */
.page-loader {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--color-dark);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.page-loader.loaded {
  opacity: 0;
  visibility: hidden;
}

.loader-logo {
  width: 80px;
  height: 80px;
  animation: pulse 1.5s ease-in-out infinite;
}

/* Faster loader on mobile */
@media (max-width: 768px) {
  .page-loader {
    transition: opacity 0.2s ease, visibility 0.2s ease;
  }

  .loader-logo {
    width: 60px;
    height: 60px;
    animation: none;
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.7;
    transform: scale(0.95);
  }
}

/* --------------------------------
   Button Hover Effects
   -------------------------------- */
.btn {
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.6s ease, height 0.6s ease;
}

.btn:hover::before {
  width: 300px;
  height: 300px;
}

/* Disable hover effects on touch devices */
@media (hover: none) {
  .btn::before {
    display: none;
  }

  .card::before {
    display: none;
  }
}

/* --------------------------------
   Card Hover Effects
   -------------------------------- */
.card {
  position: relative;
}

.card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 2px;
  background: linear-gradient(135deg, transparent, rgba(254, 0, 0, 0.3), transparent);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity var(--transition-base);
}

.card:hover::before {
  opacity: 1;
}

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

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

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

/* --------------------------------
   Image Reveal Animation
   -------------------------------- */
.image-reveal {
  position: relative;
  overflow: hidden;
}

.image-reveal::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--color-dark);
  transform: scaleX(1);
  transform-origin: right;
  transition: transform 0.8s cubic-bezier(0.77, 0, 0.175, 1);
}

.image-reveal.revealed::after {
  transform: scaleX(0);
}

/* --------------------------------
   Text Highlight Animation
   -------------------------------- */
.text-highlight {
  background: linear-gradient(to right, var(--color-red), var(--color-red));
  background-size: 0% 100%;
  background-repeat: no-repeat;
  transition: background-size 0.5s ease;
}

.text-highlight:hover,
.text-highlight.active {
  background-size: 100% 100%;
}

/* --------------------------------
   Parallax Helpers
   -------------------------------- */
.parallax-slow {
  will-change: transform;
}

.parallax-medium {
  will-change: transform;
}

.parallax-fast {
  will-change: transform;
}

/* --------------------------------
   Scroll Progress Indicator
   -------------------------------- */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(to right, var(--color-red), var(--color-purple));
  width: 0%;
  z-index: 9999;
  transition: width 0.1s linear;
}

/* --------------------------------
   Magnetic Button Effect
   -------------------------------- */
.btn-magnetic {
  transition: transform 0.3s cubic-bezier(0.33, 1, 0.68, 1);
}

/* --------------------------------
   Cursor Effects (optional)
   -------------------------------- */
.cursor-dot {
  position: fixed;
  width: 8px;
  height: 8px;
  background: var(--color-red);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  transition: transform 0.1s ease;
}

.cursor-outline {
  position: fixed;
  width: 40px;
  height: 40px;
  border: 2px solid var(--color-red);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9998;
  transform: translate(-50%, -50%);
  transition: transform 0.15s ease, width 0.3s ease, height 0.3s ease;
  opacity: 0.5;
}

.cursor-outline.hover {
  width: 60px;
  height: 60px;
  opacity: 1;
}

/* --------------------------------
   Number Counter Styles
   -------------------------------- */
.counter {
  font-variant-numeric: tabular-nums;
}

/* --------------------------------
   Typing Animation
   -------------------------------- */
.typing-text {
  border-right: 2px solid var(--color-red);
  animation: blink 0.7s step-end infinite;
}

@keyframes blink {
  50% {
    border-color: transparent;
  }
}

/* --------------------------------
   Shake Animation (for errors)
   -------------------------------- */
.shake {
  animation: shake 0.5s ease-in-out;
}

@keyframes shake {
  0%, 100% {
    transform: translateX(0);
  }
  10%, 30%, 50%, 70%, 90% {
    transform: translateX(-5px);
  }
  20%, 40%, 60%, 80% {
    transform: translateX(5px);
  }
}

/* --------------------------------
   Success Animation
   -------------------------------- */
.success-checkmark {
  width: 80px;
  height: 80px;
  margin: 0 auto;
}

.success-checkmark circle {
  stroke-dasharray: 166;
  stroke-dashoffset: 166;
  animation: stroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

.success-checkmark path {
  stroke-dasharray: 48;
  stroke-dashoffset: 48;
  animation: stroke 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.3s forwards;
}

@keyframes stroke {
  100% {
    stroke-dashoffset: 0;
  }
}

/* --------------------------------
   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;
  }

  .orb {
    animation: none;
  }

  [data-animate] {
    opacity: 1 !important;
    transform: none !important;
  }
}
