/* animations.css
   مجموعه انیمیشن‌ها — drop-in ready
   نکته: کلاس پایه "anim" رو حتما بذار کنار هر کلاس انیمیشن.
*/

/* متغیرها */
:root {
    --anim-default-duration: 400ms;
    --anim-default-ease: cubic-bezier(.22, .9, .37, 1);
    --anim-default-fill: both;
}

/* احترام به ترجیحات کاهش حرکت */
@media (prefers-reduced-motion: reduce) {
    .anim {
        animation: none !important;
        transition: none !important;
    }
}

/* کلاس پایه */
.anim {
    will-change: transform, opacity;
    animation-duration: var(--anim-default-duration);
    animation-timing-function: var(--anim-default-ease);
    animation-fill-mode: var(--anim-default-fill);
    animation-iteration-count: 1;
}

/* utility: durations */
.duration-100 {
    animation-duration: 100ms;
}

.duration-200 {
    animation-duration: 200ms;
}

.duration-300 {
    animation-duration: 300ms;
}

.duration-400 {
    animation-duration: 400ms;
}

.duration-500 {
    animation-duration: 500ms;
}

.duration-700 {
    animation-duration: 700ms;
}

.duration-1000 {
    animation-duration: 1s;
}

/* utility: delays */
.delay-0 {
    animation-delay: 0ms;
}

.delay-100 {
    animation-delay: 100ms;
}

.delay-200 {
    animation-delay: 200ms;
}

.delay-300 {
    animation-delay: 300ms;
}

.delay-500 {
    animation-delay: 500ms;
}

/* utility: iteration / infinite */
.infinite {
    animation-iteration-count: infinite;
}

.once {
    animation-iteration-count: 1;
}

/* utility: ease overrides */
.ease-linear {
    animation-timing-function: linear;
}

.ease-ease-in {
    animation-timing-function: ease-in;
}

.ease-ease-out {
    animation-timing-function: ease-out;
}

/* -------------------------
   Fade in (directions)
   ------------------------- */
@keyframes fadeInUp {
    0% {
        opacity: 0;
        transform: translateY(14px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    0% {
        opacity: 0;
        transform: translateY(-14px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    0% {
        opacity: 0;
        transform: translateX(-18px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    0% {
        opacity: 0;
        transform: translateX(18px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

.fade-in-up {
    animation-name: fadeInUp;
}

.fade-in-down {
    animation-name: fadeInDown;
}

.fade-in-left {
    animation-name: fadeInLeft;
}

.fade-in-right {
    animation-name: fadeInRight;
}

/* subtle variant (slower & softer) */
.fade-in-subtle {
    animation-name: fadeInUp;
    animation-duration: 700ms;
    animation-timing-function: cubic-bezier(.16, .84, .43, 1);
}

/* -------------------------
   Zoom
   ------------------------- */
@keyframes zoomIn {
    0% {
        opacity: 0;
        transform: scale(.85);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes zoomOut {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(.9);
    }
}

.zoom-in {
    animation-name: zoomIn;
}

.zoom-out {
    animation-name: zoomOut;
}

/* -------------------------
   Slide (off-canvas feel)
   ------------------------- */
@keyframes slideInFromLeft {
    0% {
        transform: translateX(-110%);
    }
    100% {
        transform: translateX(0);
    }
}

@keyframes slideInFromRight {
    0% {
        transform: translateX(110%);
    }
    100% {
        transform: translateX(0);
    }
}

.slide-in-left {
    animation-name: slideInFromLeft;
}

.slide-in-right {
    animation-name: slideInFromRight;
}

/* -------------------------
   Bounce / Elastic
   ------------------------- */
@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(.95);
    }
    100% {
        transform: scale(1);
    }
}

.bounce-in {
    animation-name: bounceIn;
    animation-duration: 600ms;
}

/* -------------------------
   Pulse / heartbeat
   ------------------------- */
@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: .9;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.pulse {
    animation-name: pulse;
    animation-duration: 1s;
}

/* -------------------------
   Shake (attention)
   ------------------------- */
@keyframes shakeX {
    0% {
        transform: translateX(0);
    }
    15% {
        transform: translateX(-8px);
    }
    30% {
        transform: translateX(8px);
    }
    45% {
        transform: translateX(-6px);
    }
    60% {
        transform: translateX(6px);
    }
    75% {
        transform: translateX(-3px);
    }
    100% {
        transform: translateX(0);
    }
}

.shake {
    animation-name: shakeX;
    animation-duration: 600ms;
}

/* -------------------------
   Rotate / Flip
   ------------------------- */
@keyframes rotateIn {
    0% {
        transform: rotate(-18deg) scale(.9);
        opacity: 0;
    }
    60% {
        transform: rotate(8deg) scale(1.02);
        opacity: 1;
    }
    100% {
        transform: rotate(0deg) scale(1);
        opacity: 1;
    }
}

.rotate-in {
    animation-name: rotateIn;
}

@keyframes flipInY {
    0% {
        transform: perspective(400px) rotateY(90deg);
        opacity: 0;
    }
    40% {
        transform: perspective(400px) rotateY(-10deg);
        opacity: 1;
    }
    100% {
        transform: perspective(400px) rotateY(0deg);
        opacity: 1;
    }
}

.flip-in-y {
    animation-name: flipInY;
}

/* -------------------------
   Hinge (dramatic exit)
   ------------------------- */
@keyframes hinge {
    0% {
        transform-origin: top left;
        animation-timing-function: ease-in-out;
    }
    20% {
        transform: rotate(15deg);
    }
    40% {
        transform: rotate(0deg);
    }
    60% {
        transform: rotate(15deg);
    }
    80% {
        transform: rotate(80deg);
        opacity: 1;
    }
    100% {
        transform: translateY(700px);
        opacity: 0;
    }
}

.hinge {
    animation-name: hinge;
    animation-duration: 1s;
}

/* -------------------------
   Fade & blur (nice for modals)
   ------------------------- */
@keyframes blurIn {
    0% {
        opacity: 0;
        transform: translateY(8px);
        filter: blur(6px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
        filter: blur(0);
    }
}

.blur-in {
    animation-name: blurIn;
}

/* -------------------------
   Utilities for quick toggles
   ------------------------- */
/* start paused (useful for JS toggling) */
.anim-paused {
    animation-play-state: paused;
}

.anim-running {
    animation-play-state: running;
}

/* handy visibility helper: element invisible until animation runs */
.anim-hide {
    opacity: 0;
}

/* -------------------------
   Example combos (convenience)
   ------------------------- */
.fade-up-slow {
    animation-name: fadeInUp;
    animation-duration: 900ms;
}

.pop {
    animation-name: zoomIn;
    animation-duration: 320ms;
}

/* End of file */
