/* ============================================================
   Sonsuza Kadar Evet — Animation Library
   Premium Wedding Invitation Platform
   Accent: #6c63ff (purple-blue)
   ============================================================ */

/* ==========================================================
   KEYFRAME ANIMATIONS
   ========================================================== */

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

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-30px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

@keyframes fadeInRight {
  from { opacity: 0; transform: translateX(30px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}

/* --- Slide --- */
@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

@keyframes slideDown {
  from { transform: translateY(-100%); }
  to   { transform: translateY(0); }
}

@keyframes slideLeft {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}

@keyframes slideRight {
  from { transform: translateX(-100%); }
  to   { transform: translateX(0); }
}

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

@keyframes scaleOut {
  from { opacity: 1; transform: scale(1); }
  to   { opacity: 0; transform: scale(0.9); }
}

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

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.5; }
}

@keyframes glow {
  0%, 100% { box-shadow: 0 0 5px rgba(108,99,255,0.4); }
  50%      { box-shadow: 0 0 20px rgba(108,99,255,0.6), 0 0 40px rgba(108,99,255,0.2); }
}

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

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

/* --- Text / Reveal --- */
@keyframes typewriter {
  from { width: 0; }
  to   { width: 100%; }
}

@keyframes blink {
  0%, 100% { border-color: transparent; }
  50%      { border-color: currentColor; }
}

@keyframes reveal {
  from { clip-path: inset(0 100% 0 0); }
  to   { clip-path: inset(0 0 0 0); }
}

@keyframes revealFromBottom {
  from { clip-path: inset(100% 0 0 0); }
  to   { clip-path: inset(0 0 0 0); }
}

/* --- Slide In / Out (full) --- */
@keyframes slideInFromRight {
  from { transform: translateX(120%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

@keyframes slideOutToRight {
  from { transform: translateX(0);    opacity: 1; }
  to   { transform: translateX(120%); opacity: 0; }
}

/* --- Bounce --- */
@keyframes bounceIn {
  0%   { opacity: 0; transform: scale(0.3); }
  50%  { opacity: 1; transform: scale(1.05); }
  70%  { transform: scale(0.9); }
  100% { transform: scale(1); }
}

/* --- Counter --- */
@keyframes countUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* --- Gradient --- */
@keyframes gradientFlow {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* --- Particle --- */
@keyframes particleFloat {
  0%   { transform: translate(0,0) rotate(0); }
  25%  { transform: translate(10px,-15px) rotate(90deg); }
  50%  { transform: translate(-5px,-25px) rotate(180deg); }
  75%  { transform: translate(-15px,-10px) rotate(270deg); }
  100% { transform: translate(0,0) rotate(360deg); }
}

/* --- Ripple --- */
@keyframes ripple {
  0%   { transform: scale(0); opacity: 0.5; }
  100% { transform: scale(4); opacity: 0; }
}

/* --- Check Mark (SVG) --- */
@keyframes checkMark {
  0%   { stroke-dashoffset: 50; }
  100% { stroke-dashoffset: 0; }
}

/* --- Modal --- */
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes modalOut {
  from { opacity: 1; transform: scale(1) translateY(0); }
  to   { opacity: 0; transform: scale(0.95) translateY(10px); }
}

/* --- Auth Card --- */
@keyframes authCardIn {
  from { opacity: 0; transform: translateY(20px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* --- Flash Messages --- */
@keyframes flashSlideIn {
  from { transform: translateX(-100%); opacity: 0; }
  to   { transform: translateX(0);     opacity: 1; }
}

@keyframes flashSlideOut {
  from { transform: translateX(0);    opacity: 1; }
  to   { transform: translateX(100%); opacity: 0; }
}

/* --- Decorative --- */
@keyframes heartbeat {
  0%  { transform: scale(1); }
  14% { transform: scale(1.1); }
  28% { transform: scale(1); }
  42% { transform: scale(1.1); }
  70% { transform: scale(1); }
}

@keyframes sparkle {
  0%, 100% { opacity: 0; transform: scale(0.5); }
  50%      { opacity: 1; transform: scale(1); }
}

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


/* ==========================================================
   UTILITY CLASSES
   ========================================================== */

/* --- Scroll-triggered Animations --- */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              transform 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  will-change: opacity, transform;
}

.animate-on-scroll.fade-in       { transform: none; }
.animate-on-scroll.fade-in-left  { transform: translateX(-30px); }
.animate-on-scroll.fade-in-right { transform: translateX(30px); }
.animate-on-scroll.scale-in      { transform: scale(0.95); }

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

/* --- Delay Helpers --- */
.animate-delay-1 { transition-delay: 100ms; }
.animate-delay-2 { transition-delay: 200ms; }
.animate-delay-3 { transition-delay: 300ms; }
.animate-delay-4 { transition-delay: 400ms; }
.animate-delay-5 { transition-delay: 500ms; }
.animate-delay-6 { transition-delay: 600ms; }

/* --- Reveal Utilities --- */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-left {
  opacity: 0;
  transform: translateX(-30px);
  transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.reveal-left.visible {
  opacity: 1;
  transform: translateX(0);
}

.reveal-right {
  opacity: 0;
  transform: translateX(30px);
  transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.reveal-right.visible {
  opacity: 1;
  transform: translateX(0);
}

/* --- Page Transitions --- */
.page-transition     { animation: fadeIn 0.4s ease forwards; }
.page-transition-out { animation: fadeOut 0.3s ease forwards; }

/* --- Card Hover --- */
.card-hover {
  transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              box-shadow 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.card-hover:hover {
  transform: translateY(-6px);
  box-shadow: 0 20px 40px rgba(108,99,255,0.12);
}
.card-hover:active {
  transform: translateY(-3px);
  box-shadow: 0 10px 20px rgba(108,99,255,0.08);
}

/* --- Button Hover Scale --- */
.btn-hover-scale {
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.2s ease;
}
.btn-hover-scale:hover  { transform: scale(1.03); }
.btn-hover-scale:active { transform: scale(0.97); }

/* --- Button Ripple --- */
.btn-ripple {
  position: relative;
  overflow: hidden;
}
.btn-ripple::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at var(--ripple-x, 50%) var(--ripple-y, 50%),
    rgba(255, 255, 255, 0.3) 0%,
    transparent 60%
  );
  opacity: 0;
  transition: opacity 0.5s ease;
}
.btn-ripple:active::after {
  opacity: 1;
  transition: opacity 0s;
}

/* --- Accordion --- */
.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              padding 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.accordion-content.open {
  max-height: 500px;
}
.accordion-icon {
  transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.accordion-item.active .accordion-icon {
  transform: rotate(180deg);
}

/* --- Modal --- */
.modal-animate-in          { animation: modalIn 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards; }
.modal-animate-out         { animation: modalOut 0.2s ease forwards; }
.modal-overlay-animate-in  { animation: fadeIn 0.3s ease forwards; }
.modal-overlay-animate-out { animation: fadeOut 0.2s ease forwards; }

/* --- Toast Notifications --- */
.toast-enter { animation: slideInFromRight 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards; }
.toast-exit  { animation: slideOutToRight 0.3s ease forwards; }

/* --- Hero Section --- */
.hero-fade-in {
  animation: fadeIn 1s ease 0.2s forwards;
  opacity: 0;
}
.hero-title-animate {
  animation: fadeInUp 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.3s forwards;
  opacity: 0;
}
.hero-subtitle-animate {
  animation: fadeInUp 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.5s forwards;
  opacity: 0;
}
.hero-cta-animate {
  animation: fadeInUp 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.7s forwards;
  opacity: 0;
}
.hero-note-animate {
  animation: fadeIn 0.8s ease 1s forwards;
  opacity: 0;
}
.hero-gradient-animate {
  background-size: 200% 200%;
  animation: gradientFlow 8s ease infinite;
}

/* --- Auth Card --- */
.auth-card-animate { animation: authCardIn 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards; }

/* --- Counter --- */
.counter-animate { animation: countUp 0.6s ease forwards; }

/* --- Typewriter --- */
.typewriter {
  overflow: hidden;
  white-space: nowrap;
  border-right: 2px solid currentColor;
  animation: typewriter 2s steps(40) forwards,
             blink 0.75s step-end infinite;
}

/* --- Reveal on Scroll (clip-path) --- */
.reveal-on-scroll {
  clip-path: inset(0 0 100% 0);
  transition: clip-path 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.reveal-on-scroll.is-visible {
  clip-path: inset(0 0 0 0);
}

/* --- Float Variants --- */
.float-animation      { animation: float 6s ease-in-out infinite; }
.float-animation-slow { animation: float 8s ease-in-out infinite; }
.float-animation-fast { animation: float 4s ease-in-out infinite; }

/* --- Link Hover Underline --- */
.link-hover {
  position: relative;
}
.link-hover::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: linear-gradient(135deg, #6c63ff, #a78bfa);
  transition: width 0.3s ease;
  border-radius: 1px;
}
.link-hover:hover::after {
  width: 100%;
}

/* --- Number Ticker --- */
.number-ticker {
  display: inline-block;
  transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* --- Pricing Add-on --- */
.pricing-addon-animate {
  transition: all 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.pricing-addon-animate.selected {
  transform: scale(1.02);
}

/* --- Pricing Total --- */
.pricing-total-animate {
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.pricing-total-animate.updated {
  animation: bounceIn 0.4s ease;
}

/* --- Stagger Children --- */
.stagger-children > * {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.stagger-children.is-visible > *:nth-child(1) { transition-delay: 0ms;   opacity: 1; transform: none; }
.stagger-children.is-visible > *:nth-child(2) { transition-delay: 80ms;  opacity: 1; transform: none; }
.stagger-children.is-visible > *:nth-child(3) { transition-delay: 160ms; opacity: 1; transform: none; }
.stagger-children.is-visible > *:nth-child(4) { transition-delay: 240ms; opacity: 1; transform: none; }
.stagger-children.is-visible > *:nth-child(5) { transition-delay: 320ms; opacity: 1; transform: none; }
.stagger-children.is-visible > *:nth-child(6) { transition-delay: 400ms; opacity: 1; transform: none; }
.stagger-children.is-visible > *:nth-child(7) { transition-delay: 480ms; opacity: 1; transform: none; }
.stagger-children.is-visible > *:nth-child(8) { transition-delay: 560ms; opacity: 1; transform: none; }

/* --- Misc Utility Animations --- */
.scroll-indicator      { animation: float 2s ease-in-out infinite; }
.glow-effect           { animation: glow 2s ease-in-out infinite; }
.glow-on-hover:hover   { animation: glow 1.5s ease-in-out infinite; }
.sparkle-animation     { animation: sparkle 2s ease-in-out infinite; }
.heartbeat-animation   { animation: heartbeat 1.4s ease-in-out infinite; }


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

  .animate-on-scroll {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .reveal-on-scroll {
    clip-path: none;
    transition: none;
  }

  .reveal,
  .reveal-left,
  .reveal-right {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .hero-title-animate,
  .hero-subtitle-animate,
  .hero-cta-animate,
  .hero-note-animate,
  .hero-fade-in {
    opacity: 1;
    animation: none;
  }

  .auth-card-animate {
    animation: none;
    opacity: 1;
    transform: none;
  }

  .float-animation,
  .float-animation-slow,
  .float-animation-fast {
    animation: none;
  }

  .stagger-children > * {
    opacity: 1;
    transform: none;
    transition: none;
  }

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

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

  .glow-effect,
  .sparkle-animation,
  .heartbeat-animation {
    animation: none;
  }
}
