/* ==========================================
   ANIMATORER ADVANCED EFFECTS COLLECTION
   ========================================== */

/* Базовые свойства для всех анимируемых элементов */
[data-animate] {
  opacity: 0;
  transition-property: opacity, transform, filter, clip-path, border-color, box-shadow;
  transition-duration: 0.75s;
  transition-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ==========================================
   1. СМЕЩЕНИЯ (FADE & MOVE)
   ========================================== */
[data-animate*="fade-up"] {
  transform: translateY(40px);
}

[data-animate*="fade-down"] {
  transform: translateY(-40px);
}

[data-animate*="fade-left"] {
  transform: translateX(-50px);
}

[data-animate*="fade-right"] {
  transform: translateX(50px);
}

/* ==========================================
   2. МАСШТАБ И ЗУМ (ZOOM & SCALE)
   ========================================== */
[data-animate*="zoom-in"] {
  transform: scale(0.88);
}

[data-animate*="zoom-out"] {
  transform: scale(1.12);
}

/* ==========================================
   3. РАЗМЫТИЕ И ЭФФЕКТ СТЁКЛА (BLUR EFFECTS)
   ========================================== */
[data-animate*="blur-in"] {
  filter: blur(12px);
  transform: scale(0.96);
}

[data-animate*="blur-up"] {
  filter: blur(10px);
  transform: translateY(30px);
}

/* ==========================================
   4. ВРАЩЕНИЕ И ТИЛЬТ (ROTATE & TILT)
   ========================================== */
[data-animate*="rotate-up"] {
  transform: translateY(40px) rotate(4deg);
}

[data-animate*="rotate-down"] {
  transform: translateY(-40px) rotate(-4deg);
}

/* ==========================================
   5. 3D ПЕРСПЕКТИВА (3D FLIP & PERSPECTIVE)
   ========================================== */
[data-animate*="flip-up"] {
  transform: perspective(1000px) rotateX(45deg) translateY(30px);
  transform-origin: center bottom;
}

[data-animate*="perspective-left"] {
  transform: perspective(1000px) rotateY(-25deg) translateX(-30px);
  transform-origin: left center;
}

[data-animate*="perspective-right"] {
  transform: perspective(1000px) rotateY(25deg) translateX(30px);
  transform-origin: right center;
}

/* ==========================================
   6. РАСКРЫТИЕ МАСКОЙ (CLIP REVEAL)
   ========================================== */
[data-animate*="reveal-up"] {
  clip-path: inset(100% 0 0 0);
  transform: translateY(20px);
}

[data-animate*="reveal-right"] {
  clip-path: inset(0 100% 0 0);
}

/* ==========================================
   7. НЕСТАНДАРТНЫЕ И ЭЛИТНЫЕ ЭФФЕКТЫ
   ========================================== */
[data-animate*="cube-assembly"] {
  transform: perspective(800px) translate3d(-40px, 60px, -100px) rotateX(25deg) rotateY(-25deg);
  filter: blur(8px);
}

[data-animate*="glitch-reveal"] {
  transform: scale(1.05) skewX(-15deg);
  filter: contrast(150%) brightness(150%) blur(6px);
}

/* ==========================================
   8. ЭФФЕКТЫ ПОДСВЕТКИ ГРАНИЦ (BORDER KEYFRAMES)
   ========================================== */
@keyframes borderPulsePrimary {
  0% {
    border-color: rgba(168, 85, 247, 1) !important;
    box-shadow: 0 0 16px rgba(168, 85, 247, 0.5);
  }
  50% {
    border-color: rgba(168, 85, 247, 0.8) !important;
    box-shadow: 0 0 20px rgba(168, 85, 247, 0.3);
  }
  100% {
    border-color: var(--mode-border-2-color, rgba(255, 255, 255, 0.12));
    box-shadow: none;
  }
}

@keyframes borderPulseDanger {
  0% {
    border-color: rgba(239, 68, 68, 1) !important;
    box-shadow: 0 0 16px rgba(239, 68, 68, 0.5);
  }
  100% {
    border-color: var(--mode-border-2-color, rgba(255, 255, 255, 0.12));
    box-shadow: none;
  }
}

/* Запуск подсветки границы */
[data-animate].anim-border-pulse {
  animation: borderPulsePrimary 1.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

[data-animate].anim-border-danger {
  animation: borderPulseDanger 1.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* ==========================================
   9. АКТИВНОЕ СОСТОЯНИЕ И АВТО-ВОЗВРАТ (STEP 2)
   ========================================== */

/* 1. Исходное видимое состояние (элемент прилетел и встал в сетку) */
[data-animate].is-visible {
  opacity: 1;
  filter: none;
  clip-path: none;
  transform: translate(0, 0) scale(1) rotate(0deg) rotateX(0deg) rotateY(0deg) skewX(0deg);
}

/* Only reveal animations need a clipping mask. Keeping it on every animated
   element crops shadows, tooltips and popovers inside ordinary fade effects. */
[data-animate*="reveal-"].is-visible {
  clip-path: inset(0 0 0 0);
}

/* 2. Keyframes для трансформаций 2-го этапа с автоматическим возвратом в 0 */

/* Поворот влево/вниз с возвратом */
@keyframes tiltResetDown {
  0% {
    transform: translate(0, 0) rotate(0deg);
  }
  35% {
    transform: translateY(6px) rotate(-3.5deg);
  }
  100% {
    transform: translate(0, 0) rotate(0deg);
  }
}

/* Поворот вправо/вверх с возвратом */
@keyframes tiltResetUp {
  0% {
    transform: translate(0, 0) rotate(0deg);
  }
  35% {
    transform: translateY(-6px) rotate(3.5deg);
  }
  100% {
    transform: translate(0, 0) rotate(0deg);
  }
}

/* Зум с возвратом */
@keyframes zoomReset {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

/* Применение анимаций второго шага */
[data-animate].is-step-2.anim-rotate-down {
  animation: tiltResetDown 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

[data-animate].is-step-2.anim-rotate-up {
  animation: tiltResetUp 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

[data-animate].is-step-2.anim-zoom-in {
  animation: zoomReset 0.9s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Restrained entrance effects for the Delvor landing page. */
[data-animate~="rise"]:not(.is-visible) {
  transform: translateY(24px);
}
[data-animate~="soft-focus"]:not(.is-visible) {
  transform: translateY(16px);
  filter: blur(4px);
}
[data-animate~="settle"]:not(.is-visible) {
  transform: translateY(24px) scale(0.97);
}

/* Keep content readable if JavaScript is unavailable; reveal keyboard targets. */
html:not(.animatorer-ready) [data-animate],
[data-animate]:focus-within {
  opacity: 1;
  filter: none;
  clip-path: none;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  [data-animate], [data-animate].is-visible {
    opacity: 1 !important;
    filter: none !important;
    clip-path: none !important;
    transform: none !important;
    transition: none !important;
    animation: none !important;
  }
}
