/* ==========================================================================
   Auswandern nach Dänemark – Animations & Transitions
   ========================================================================== */

/* ==========================================================================
   1. Keyframe Definitions
   ========================================================================== */

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

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

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

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

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

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

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

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

@keyframes expandWidth {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

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

@keyframes bounceDown {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(8px);
  }
}

@keyframes float {
  0%, 100% {
    transform: translateY(0) rotate(0deg);
  }
  33% {
    transform: translateY(-10px) rotate(2deg);
  }
  66% {
    transform: translateY(5px) rotate(-1deg);
  }
}

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

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

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

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

@keyframes typing {
  from { width: 0; }
  to { width: 100%; }
}

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

@keyframes wiggle {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-3deg); }
  75% { transform: rotate(3deg); }
}

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

@keyframes progressBar {
  from { width: 0%; }
  to { width: var(--progress, 100%); }
}

@keyframes dotPulse {
  0%, 80%, 100% {
    transform: scale(0);
    opacity: 0;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}


/* ==========================================================================
   2. Scroll-triggered Animations (Intersection Observer)
   ========================================================================== */

/* Elements with these classes start hidden and animate in when visible */

.animate-on-scroll {
  opacity: 0;
  transition: opacity 0.6s var(--ease-default, cubic-bezier(0.4, 0, 0.2, 1)),
              transform 0.6s var(--ease-default, cubic-bezier(0.4, 0, 0.2, 1));
}

.animate-on-scroll.is-visible {
  opacity: 1;
}

/* Fade in up (default) */
.animate-fade-up {
  transform: translateY(30px);
}

.animate-fade-up.is-visible {
  transform: translateY(0);
}

/* Fade in down */
.animate-fade-down {
  transform: translateY(-30px);
}

.animate-fade-down.is-visible {
  transform: translateY(0);
}

/* Fade in left */
.animate-fade-left {
  transform: translateX(-30px);
}

.animate-fade-left.is-visible {
  transform: translateX(0);
}

/* Fade in right */
.animate-fade-right {
  transform: translateX(30px);
}

.animate-fade-right.is-visible {
  transform: translateX(0);
}

/* Scale in */
.animate-scale {
  transform: scale(0.92);
}

.animate-scale.is-visible {
  transform: scale(1);
}

/* Stagger delays for children */
.stagger-children > .animate-on-scroll:nth-child(1) { transition-delay: 0.05s; }
.stagger-children > .animate-on-scroll:nth-child(2) { transition-delay: 0.1s; }
.stagger-children > .animate-on-scroll:nth-child(3) { transition-delay: 0.15s; }
.stagger-children > .animate-on-scroll:nth-child(4) { transition-delay: 0.2s; }
.stagger-children > .animate-on-scroll:nth-child(5) { transition-delay: 0.25s; }
.stagger-children > .animate-on-scroll:nth-child(6) { transition-delay: 0.3s; }
.stagger-children > .animate-on-scroll:nth-child(7) { transition-delay: 0.35s; }
.stagger-children > .animate-on-scroll:nth-child(8) { transition-delay: 0.4s; }

/* Respect prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  .animate-on-scroll {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
    animation: none !important;
  }

  .hero-title .highlight::after,
  .scroll-indicator svg,
  .hero-float-flag,
  .checklist-checkbox .checkmark::after {
    animation: none !important;
  }

  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}


/* ==========================================================================
   3. Button & Interactive Hover Transitions
   ========================================================================== */

/* Ripple effect for buttons */
.btn-ripple {
  position: relative;
  overflow: hidden;
}

.btn-ripple::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 5px;
  height: 5px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0);
  opacity: 0;
}

.btn-ripple:active::after {
  animation: ripple 0.6s ease-out;
}

/* Magnetic hover (subtle pull toward cursor) */
.magnetic-hover {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Underline animation for text links */
.animated-underline {
  position: relative;
  display: inline;
}

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

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


/* ==========================================================================
   4. Card Hover Transitions
   ========================================================================== */

/* Lift on hover */
.hover-lift {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hover-lift:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(27, 54, 93, 0.12);
}

/* Grow on hover */
.hover-grow {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* Glow effect */
.hover-glow {
  transition: box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hover-glow:hover {
  box-shadow: 0 0 20px rgba(200, 16, 46, 0.15),
              0 8px 24px rgba(27, 54, 93, 0.1);
}

/* Border color transition */
.hover-border {
  border: 2px solid transparent;
  transition: border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hover-border:hover {
  border-color: var(--color-primary, #C8102E);
}

/* Image zoom inside cards */
.card-image-zoom {
  overflow: hidden;
  border-radius: var(--radius-lg, 12px);
}

.card-image-zoom img {
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-image-zoom:hover img {
  transform: scale(1.06);
}


/* ==========================================================================
   5. Loading Skeleton
   ========================================================================== */

.skeleton {
  background: linear-gradient(
    90deg,
    #F3F4F6 25%,
    #E5E7EB 50%,
    #F3F4F6 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-md, 8px);
}

.skeleton-text {
  height: 1em;
  width: 100%;
  margin-bottom: 0.5em;
}

.skeleton-text--short {
  width: 60%;
}

.skeleton-text--medium {
  width: 80%;
}

.skeleton-heading {
  height: 1.5em;
  width: 50%;
  margin-bottom: 1em;
}

.skeleton-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
}

.skeleton-image {
  width: 100%;
  aspect-ratio: 16/10;
}

.skeleton-button {
  width: 160px;
  height: 48px;
  border-radius: var(--radius-lg, 12px);
}


/* ==========================================================================
   6. Chatbot Widget Animations
   ========================================================================== */

/* Chat bubble floating button */
.chatbot-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--color-primary, #C8102E);
  color: white;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(200, 16, 46, 0.35);
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chatbot-toggle:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(200, 16, 46, 0.45);
}

.chatbot-toggle svg {
  width: 28px;
  height: 28px;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chatbot-toggle.is-open svg {
  transform: rotate(90deg);
}

/* Chat window slide up */
.chatbot-window {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 380px;
  max-height: 550px;
  background: white;
  border-radius: var(--radius-xl, 16px);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.15);
  z-index: 399;
  overflow: hidden;
  transform-origin: bottom right;
  animation: chatWindowOpen 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes chatWindowOpen {
  from {
    opacity: 0;
    transform: scale(0.8) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.chatbot-window.is-closing {
  animation: chatWindowClose 0.25s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes chatWindowClose {
  from {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
  to {
    opacity: 0;
    transform: scale(0.8) translateY(20px);
  }
}

/* Typing indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-text-secondary, #6B7280);
  animation: dotPulse 1.4s ease-in-out infinite;
}

.typing-indicator span:nth-child(2) {
  animation-delay: 0.16s;
}

.typing-indicator span:nth-child(3) {
  animation-delay: 0.32s;
}

/* Chat message animations */
.chat-message {
  animation: fadeInUp 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  opacity: 0;
}

.chat-message:nth-child(1) { animation-delay: 0s; }
.chat-message:nth-child(2) { animation-delay: 0.05s; }
.chat-message:nth-child(3) { animation-delay: 0.1s; }

@media (max-width: 768px) {
  .chatbot-window {
    right: 12px;
    left: 12px;
    bottom: 84px;
    width: auto;
    max-height: 70vh;
  }
}


/* ==========================================================================
   7. Counter / Statistic Animations
   ========================================================================== */

.stat-counter {
  font-family: var(--font-heading, 'Plus Jakarta Sans', sans-serif);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.stat-counter.is-visible {
  animation: countUp 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Circular progress */
.circular-progress {
  --progress: 0;
  --size: 80px;
  --stroke: 6px;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  background: conic-gradient(
    var(--color-primary, #C8102E) calc(var(--progress) * 1%),
    var(--color-border-light, #F3F4F6) 0
  );
  display: flex;
  align-items: center;
  justify-content: center;
  transition: --progress 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.circular-progress::after {
  content: '';
  width: calc(var(--size) - var(--stroke) * 2);
  height: calc(var(--size) - var(--stroke) * 2);
  border-radius: 50%;
  background: var(--color-surface, #fff);
}

/* Horizontal progress bar animation */
.progress-bar-animated {
  height: 8px;
  background: var(--color-border-light, #F3F4F6);
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar-animated .progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary, #C8102E), var(--color-accent, #D4A574));
  border-radius: 999px;
  width: 0%;
  transition: width 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-bar-animated.is-visible .progress-fill {
  width: var(--progress, 100%);
}


/* ==========================================================================
   8. Parallax Helpers
   ========================================================================== */

/* Simple CSS parallax for hero background */
.parallax-container {
  position: relative;
  overflow: hidden;
}

.parallax-bg {
  position: absolute;
  inset: -20% 0;
  background-size: cover;
  background-position: center;
  will-change: transform;
}

/* JS-controlled transform – set via scroll handler */
.parallax-bg[data-speed] {
  transition: transform 0.1s linear;
}


/* ==========================================================================
   9. Page Transition Effects
   ========================================================================== */

/* Fade transition for page loads */
.page-transition-fade {
  animation: fadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Content reveal on page load */
.reveal-on-load {
  opacity: 0;
  animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) 0.2s forwards;
}

.reveal-on-load:nth-child(2) { animation-delay: 0.3s; }
.reveal-on-load:nth-child(3) { animation-delay: 0.4s; }
.reveal-on-load:nth-child(4) { animation-delay: 0.5s; }


/* ==========================================================================
   10. Notification / Toast Animations
   ========================================================================== */

.toast {
  animation: slideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.toast.is-leaving {
  animation: fadeIn 0.2s cubic-bezier(0.4, 0, 0.2, 1) reverse forwards;
}

/* Attention wiggle for CTA */
.wiggle-attention {
  animation: wiggle 0.5s ease-in-out;
  animation-delay: 3s;
  animation-iteration-count: 3;
}
