/* ============================================================
   BILDWERK – Fotografie
   Animations – Keyframes, Utilities, Scroll Triggers
   ============================================================ */

/* ─── KEYFRAMES ─── */

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

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

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

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

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

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

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

@keyframes scaleInY {
  from { opacity: 0; transform: scaleY(0); transform-origin: top; }
  to   { opacity: 1; transform: scaleY(1); }
}

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

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

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

@keyframes lineGrowY {
  from { height: 0; }
  to   { height: 100%; }
}

@keyframes gridDrift {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
    opacity: 0.45;
  }
  50% {
    transform: translate3d(-1.5%, 1%, 0) scale(1.015);
    opacity: 0.62;
  }
  100% {
    transform: translate3d(1.5%, -1%, 0) scale(1);
    opacity: 0.45;
  }
}

@keyframes ambientGlow {
  0%, 100% {
    opacity: 0.45;
    transform: scale(1);
  }
  50% {
    opacity: 0.72;
    transform: scale(1.04);
  }
}

@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%       { transform: translate(30px, -40px) scale(1.05); }
  66%       { transform: translate(-20px, 25px) scale(0.97); }
}

@keyframes orbFloat2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  40%       { transform: translate(-35px, 30px) scale(1.08); }
  70%       { transform: translate(25px, -20px) scale(0.95); }
}

@keyframes orbFloat3 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%       { transform: translate(20px, 35px) scale(1.03); }
}

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

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

@keyframes shimmer {
  from { background-position: -200% center; }
  to   { background-position: 200% center; }
}

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

@keyframes scrollLine {
  0%   { transform: scaleY(0); transform-origin: top; opacity: 1; }
  50%  { transform: scaleY(1); transform-origin: top; opacity: 1; }
  51%  { transform: scaleY(1); transform-origin: bottom; opacity: 1; }
  100% { transform: scaleY(0); transform-origin: bottom; opacity: 0; }
}

@keyframes preloaderReveal {
  0%   { clip-path: inset(0 0 100% 0); }
  100% { clip-path: inset(0 0 0 0); }
}

@keyframes preloaderHide {
  0%   { clip-path: inset(0 0 0 0); opacity: 1; }
  100% { clip-path: inset(100% 0 0 0); opacity: 0; }
}

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

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

@keyframes surfaceSweep {
  0% {
    transform: translate3d(-110%, 0, 0);
    opacity: 0;
  }
  30% {
    opacity: 0.35;
  }
  100% {
    transform: translate3d(110%, 0, 0);
    opacity: 0;
  }
}

@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50%       { background-position: 100% 50%; }
}

@keyframes borderGlow {
  0%, 100% { box-shadow: 0 0 0 0 var(--clr-gold-glow); }
  50%       { box-shadow: 0 0 24px 8px var(--clr-gold-glow); }
}

@keyframes fieldShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(2px); }
}

@keyframes successBloom {
  0% {
    opacity: 0;
    transform: scale(0.84);
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--clr-gold-mid) 0%, transparent);
  }
  60% {
    opacity: 1;
    transform: scale(1.06);
    box-shadow: 0 0 0 16px color-mix(in srgb, var(--clr-gold-mid) 0%, transparent);
  }
  100% {
    opacity: 1;
    transform: scale(1);
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--clr-gold-mid) 0%, transparent);
  }
}

/* ─── SCROLL ANIMATION STATES ─── */
/* Applied via JS IntersectionObserver */

[data-animate] {
  opacity: 0;
  will-change: opacity, transform;
  transition:
    opacity  var(--dur-enter) var(--ease-out-expo),
    transform var(--dur-enter) var(--ease-out-expo);
}

[data-animate="fade-up"]    { transform: translateY(32px); }
[data-animate="fade-down"]  { transform: translateY(-24px); }
[data-animate="fade-left"]  { transform: translateX(40px); }
[data-animate="fade-right"] { transform: translateX(-40px); }
[data-animate="scale-in"]   { transform: scale(0.94); }
[data-animate="fade-in"]    { transform: none; }

[data-animate="reveal-up"] {
  opacity: 1;
  clip-path: inset(100% 0 0 0);
  transition: clip-path var(--dur-enter) var(--ease-out-expo);
}

[data-animate].is-visible {
  opacity: 1;
  transform: none;
}

[data-animate="reveal-up"].is-visible {
  clip-path: inset(0% 0 0 0);
}

/* ─── STAGGER ─── */

[data-stagger] > * {
  opacity: 0;
  transform: translateY(24px);
  transition:
    opacity  var(--dur-slow) var(--ease-out-expo),
    transform var(--dur-slow) var(--ease-out-expo);
}

[data-stagger].is-visible > *:nth-child(1)  { transition-delay: 0.0s; }
[data-stagger].is-visible > *:nth-child(2)  { transition-delay: 0.08s; }
[data-stagger].is-visible > *:nth-child(3)  { transition-delay: 0.16s; }
[data-stagger].is-visible > *:nth-child(4)  { transition-delay: 0.24s; }
[data-stagger].is-visible > *:nth-child(5)  { transition-delay: 0.32s; }
[data-stagger].is-visible > *:nth-child(6)  { transition-delay: 0.4s; }

/* Reset delay after stagger-in so hover transitions are immediate on all cards */
[data-stagger].is-visible > *:hover        { transition-delay: 0s; }

[data-stagger].is-visible > * {
  opacity: 1;
  transform: none;
}

/* ─── DELAY UTILITIES ─── */

.delay-100 { transition-delay: 0.1s !important; animation-delay: 0.1s !important; }
.delay-200 { transition-delay: 0.2s !important; animation-delay: 0.2s !important; }
.delay-300 { transition-delay: 0.3s !important; animation-delay: 0.3s !important; }
.delay-400 { transition-delay: 0.4s !important; animation-delay: 0.4s !important; }
.delay-500 { transition-delay: 0.5s !important; animation-delay: 0.5s !important; }
.delay-600 { transition-delay: 0.6s !important; animation-delay: 0.6s !important; }
.delay-700 { transition-delay: 0.7s !important; animation-delay: 0.7s !important; }
.delay-800 { transition-delay: 0.8s !important; animation-delay: 0.8s !important; }

/* ─── ANIMATION UTILITY CLASSES ─── */

.animate-fade-up {
  animation: fadeUp var(--dur-enter) var(--ease-out-expo) both;
}

.animate-fade-in {
  animation: fadeIn var(--dur-slow) var(--ease-out-quart) both;
}

.animate-scale-in {
  animation: scaleIn var(--dur-enter) var(--ease-out-quint) both;
}

/* ─── HOVER ANIMATIONS ─── */

.hover-lift {
  transition: transform var(--dur-base) var(--ease-out-quint);
}

.hover-lift:hover {
  transform: translateY(-6px);
}

.hover-glow:hover {
  box-shadow: var(--shadow-gold);
}

.hover-line {
  position: relative;
}

.hover-line::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background: currentColor;
  transition: width var(--dur-base) var(--ease-out-quint);
}

.hover-line:hover::after { width: 100%; }

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

  [data-animate],
  [data-stagger] > * {
    opacity: 1;
    transform: none;
    clip-path: none;
    transition: none;
  }
}
