/* ================================================================
   HELSAN — ANIMATIONS & MICRO-INTERACTIONS
   Motion utilities. All tokens are owned by helsan-tokens.css;
   this file only consumes `--hs-*` (never declares global tokens).
   ================================================================ */

/* ================================================================
   KEYFRAMES
   ================================================================ */

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

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

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

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

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

@keyframes hpScaleIn {
    from {
        opacity: 0;
        transform: scale(0.92);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

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

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

@keyframes hpPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(185, 103, 24, 0.35);
    }
    50% {
        transform: scale(1.02);
        box-shadow: 0 0 0 12px rgba(185, 103, 24, 0);
    }
}

@keyframes hpPulseSoft {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(185, 103, 24, 0.25);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(185, 103, 24, 0);
    }
}

@keyframes hpBounce {
    0%, 100% { transform: translateY(0); }
    25% { transform: translateY(-6px); }
    50% { transform: translateY(0); }
    75% { transform: translateY(-3px); }
}

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

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

@keyframes hpCountdownFlip {
    0% {
        transform: rotateX(0deg);
        opacity: 1;
    }
    50% {
        transform: rotateX(-90deg);
        opacity: 0.5;
    }
    100% {
        transform: rotateX(0deg);
        opacity: 1;
    }
}

@keyframes hpKenBurns {
    0% {
        transform: scale(1) translate(0, 0);
    }
    100% {
        transform: scale(1.08) translate(-1%, -1%);
    }
}

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

@keyframes hpRipple {
    0% {
        transform: scale(0);
        opacity: 0.6;
    }
    100% {
        transform: scale(4);
        opacity: 0;
    }
}

@keyframes hpCheckmark {
    0% {
        stroke-dashoffset: 100;
    }
    100% {
        stroke-dashoffset: 0;
    }
}

@keyframes hpCartBounce {
    0%, 100% { transform: scale(1); }
    30% { transform: scale(1.3); }
    50% { transform: scale(0.95); }
    70% { transform: scale(1.1); }
}

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

/* ================================================================
   PERFORMANCE — GPU acceleration hints
   ================================================================ */

.t1-anim-fade-in,
.t1-anim-fade-in-up,
.t1-anim-fade-in-down,
.t1-anim-fade-in-right,
.t1-anim-fade-in-left,
.t1-anim-scale-in,
.t1-anim-slide-up,
.t1-card-hover,
.t1-btn-lift,
.t1-img-zoom img,
.t1-parallax {
    will-change: transform, opacity;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

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

.t1-anim-fade-in { animation: hpFadeIn var(--hs-dur) var(--hs-ease-out) both; }
.t1-anim-fade-in-up { animation: hpFadeInUp var(--hs-dur) var(--hs-ease-out) both; }
.t1-anim-fade-in-down { animation: hpFadeInDown var(--hs-dur) var(--hs-ease-out) both; }
.t1-anim-fade-in-right { animation: hpFadeInRight var(--hs-dur) var(--hs-ease-out) both; }
.t1-anim-fade-in-left { animation: hpFadeInLeft var(--hs-dur) var(--hs-ease-out) both; }
.t1-anim-scale-in { animation: hpScaleIn var(--hs-dur) var(--hs-ease-spring) both; }
.t1-anim-slide-up { animation: hpSlideUp var(--hs-dur-slow) var(--hs-ease-out) both; }

.t1-anim-delay-1 { animation-delay: 0.05s; }
.t1-anim-delay-2 { animation-delay: 0.10s; }
.t1-anim-delay-3 { animation-delay: 0.15s; }
.t1-anim-delay-4 { animation-delay: 0.20s; }
.t1-anim-delay-5 { animation-delay: 0.25s; }
.t1-anim-delay-6 { animation-delay: 0.30s; }
.t1-anim-delay-7 { animation-delay: 0.35s; }
.t1-anim-delay-8 { animation-delay: 0.40s; }

/* ================================================================
   GLASSMORPHISM
   ================================================================ */

.t1-glass {
    background: var(--hs-glass-bg);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--hs-glass-border);
    box-shadow: var(--hs-glass-shadow);
}

.t1-glass-strong {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(24px) saturate(200%);
    -webkit-backdrop-filter: blur(24px) saturate(200%);
    border: 1px solid rgba(255, 255, 255, 0.7);
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.12);
}

.t1-glass-dark {
    background: rgba(20, 25, 35, 0.85);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* ================================================================
   SKELETON LOADERS
   ================================================================ */

.t1-skeleton {
    background: linear-gradient(
        90deg,
        #f0f0f0 25%,
        #e0e0e0 50%,
        #f0f0f0 75%
    );
    background-size: 200% 100%;
    animation: hpSkeletonLoading 1.5s ease-in-out infinite;
    border-radius: 8px;
    color: transparent;
    pointer-events: none;
    user-select: none;
}

.t1-skeleton-card {
    background: linear-gradient(
        90deg,
        #f0f0f0 25%,
        #e8e8e8 50%,
        #f0f0f0 75%
    );
    background-size: 200% 100%;
    animation: hpSkeletonLoading 1.5s ease-in-out infinite;
    border-radius: 16px;
    overflow: hidden;
}

.t1-skeleton-text {
    height: 1em;
    margin-bottom: 0.5em;
    border-radius: 4px;
}

.t1-skeleton-image {
    aspect-ratio: 1;
    border-radius: 12px;
}

/* ================================================================
   BUTTON MICRO-INTERACTIONS
   ================================================================ */

.t1-btn {
    position: relative;
    overflow: hidden;
    transition: all var(--hs-dur) var(--hs-ease-out);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.t1-btn::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    background: radial-gradient(circle, rgba(255,255,255,0.4) 0%, transparent 70%);
    border-radius: 50%;
    transition: transform var(--hs-dur-slow) var(--hs-ease-out), opacity var(--hs-dur-slow) var(--hs-ease-out);
    opacity: 0;
    pointer-events: none;
}

.t1-btn:active::after {
    transform: translate(-50%, -50%) scale(3);
    opacity: 1;
    transition: 0s;
}

.t1-btn-lift {
    transition: transform var(--hs-dur) var(--hs-ease-spring),
                box-shadow var(--hs-dur) var(--hs-ease-out);
}

.t1-btn-lift:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

.t1-btn-lift:active {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Button loading state */
.t1-btn-loading {
    pointer-events: none;
    opacity: 0.8;
}

.t1-btn-loading::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: hpSpin 0.8s linear infinite;
    top: 50%;
    left: 50%;
    margin: -10px 0 0 -10px;
}

/* Button success state */
.t1-btn-success {
    background: linear-gradient(135deg, #00c853, #00a344) !important;
    border-color: transparent !important;
}

/* ================================================================
   CARD MICRO-INTERACTIONS
   ================================================================ */

.t1-card-hover {
    transition: transform var(--hs-dur) var(--hs-ease-spring),
                box-shadow var(--hs-dur) var(--hs-ease-out),
                border-color var(--hs-dur) ease;
}

.t1-card-hover:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.12);
}

.t1-card-tilt {
    transform-style: preserve-3d;
    transition: transform var(--hs-dur-fast) var(--hs-ease-out);
}

/* ================================================================
   IMAGE ZOOM & PARALLAX
   ================================================================ */

.t1-img-zoom {
    overflow: hidden;
    border-radius: inherit;
}

.t1-img-zoom img {
    transition: transform var(--hs-dur-slow) var(--hs-ease-out);
}

.t1-img-zoom:hover img {
    transform: scale(1.05);
}

.t1-parallax {
    will-change: transform;
}

/* ================================================================
   SCROLL REVEAL (IntersectionObserver driven)
   ================================================================ */

.t1-reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity var(--hs-dur-slow) var(--hs-ease-out),
                transform var(--hs-dur-slow) var(--hs-ease-out);
}

.t1-reveal.t1-revealed {
    opacity: 1;
    transform: translateY(0);
}

.t1-reveal-stagger > * {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity var(--hs-dur-slow) var(--hs-ease-out),
                transform var(--hs-dur-slow) var(--hs-ease-out);
}

.t1-reveal-stagger.t1-revealed > *:nth-child(1) { opacity: 1; transform: translateY(0); transition-delay: 0.00s; }
.t1-reveal-stagger.t1-revealed > *:nth-child(2) { opacity: 1; transform: translateY(0); transition-delay: 0.08s; }
.t1-reveal-stagger.t1-revealed > *:nth-child(3) { opacity: 1; transform: translateY(0); transition-delay: 0.16s; }
.t1-reveal-stagger.t1-revealed > *:nth-child(4) { opacity: 1; transform: translateY(0); transition-delay: 0.24s; }
.t1-reveal-stagger.t1-revealed > *:nth-child(5) { opacity: 1; transform: translateY(0); transition-delay: 0.32s; }
.t1-reveal-stagger.t1-revealed > *:nth-child(6) { opacity: 1; transform: translateY(0); transition-delay: 0.40s; }
.t1-reveal-stagger.t1-revealed > *:nth-child(7) { opacity: 1; transform: translateY(0); transition-delay: 0.48s; }
.t1-reveal-stagger.t1-revealed > *:nth-child(8) { opacity: 1; transform: translateY(0); transition-delay: 0.56s; }

/* ================================================================
   BADGE & PULSE ANIMATIONS
   ================================================================ */

.t1-badge-pulse {
    animation: hpPulse 2s ease-in-out infinite;
}

.t1-badge-bounce {
    animation: hpBounce 0.6s var(--hs-ease-spring);
}

/* ================================================================
   GRADIENT ANIMATIONS
   ================================================================ */

.t1-gradient-animated {
    background-size: 200% 200%;
    animation: hpGradientShift 6s ease infinite;
}

/* ================================================================
   COUNTDOWN FLIP
   ================================================================ */

.t1-countdown-flip {
    display: inline-block;
    animation: hpCountdownFlip 0.6s var(--hs-ease-out);
}

/* ================================================================
   KEN BURNS EFFECT
   ================================================================ */

.t1-ken-burns {
    animation: hpKenBurns 12s ease-out both;
}

/* ================================================================
   PAGE TRANSITIONS
   ================================================================ */

.t1-page-enter {
    animation: hpFadeInUp 0.5s var(--hs-ease-out) both;
}

.t1-page-exit {
    animation: hpFadeIn 0.3s var(--hs-ease-out) reverse both;
}

/* ================================================================
   TOAST NOTIFICATIONS
   ================================================================ */

.t1-toast {
    animation: hpToastSlideIn 0.4s var(--hs-ease-spring) both;
}

/* ================================================================
   CART ICON BOUNCE
   ================================================================ */

.t1-cart-bounce {
    animation: hpCartBounce 0.6s var(--hs-ease-spring);
}

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

    .t1-reveal,
    .t1-reveal-stagger > * {
        opacity: 1;
        transform: none;
    }
}
