/* ============================================
   PEACEFUL PAWS - ANIMATIONS
   Premium Motion Design
   ============================================ */

/* ---------- Base Animation States ---------- */
[data-animation] {
    opacity: 0;
}

[data-animation].is-inview {
    opacity: 1;
}

/* ---------- Character Animation States ---------- */
[data-animation="chars"] .char {
    opacity: 0;
    transform: translateY(100%) rotateX(-80deg);
    transform-origin: center top;
    transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-animation="chars"].is-inview .char {
    opacity: 1;
    transform: translateY(0) rotateX(0);
}

/* Stagger delays for characters */
[data-animation="chars"].is-inview .char:nth-child(1) { transition-delay: 0.02s; }
[data-animation="chars"].is-inview .char:nth-child(2) { transition-delay: 0.04s; }
[data-animation="chars"].is-inview .char:nth-child(3) { transition-delay: 0.06s; }
[data-animation="chars"].is-inview .char:nth-child(4) { transition-delay: 0.08s; }
[data-animation="chars"].is-inview .char:nth-child(5) { transition-delay: 0.1s; }
[data-animation="chars"].is-inview .char:nth-child(6) { transition-delay: 0.12s; }
[data-animation="chars"].is-inview .char:nth-child(7) { transition-delay: 0.14s; }
[data-animation="chars"].is-inview .char:nth-child(8) { transition-delay: 0.16s; }
[data-animation="chars"].is-inview .char:nth-child(9) { transition-delay: 0.18s; }
[data-animation="chars"].is-inview .char:nth-child(10) { transition-delay: 0.2s; }
[data-animation="chars"].is-inview .char:nth-child(11) { transition-delay: 0.22s; }
[data-animation="chars"].is-inview .char:nth-child(12) { transition-delay: 0.24s; }
[data-animation="chars"].is-inview .char:nth-child(13) { transition-delay: 0.26s; }
[data-animation="chars"].is-inview .char:nth-child(14) { transition-delay: 0.28s; }
[data-animation="chars"].is-inview .char:nth-child(15) { transition-delay: 0.3s; }
[data-animation="chars"].is-inview .char:nth-child(16) { transition-delay: 0.32s; }
[data-animation="chars"].is-inview .char:nth-child(17) { transition-delay: 0.34s; }
[data-animation="chars"].is-inview .char:nth-child(18) { transition-delay: 0.36s; }
[data-animation="chars"].is-inview .char:nth-child(19) { transition-delay: 0.38s; }
[data-animation="chars"].is-inview .char:nth-child(20) { transition-delay: 0.4s; }
[data-animation="chars"].is-inview .char:nth-child(n+21) { transition-delay: 0.42s; }

/* ---------- Line Animation States ---------- */
[data-animation="lines"] .line {
    opacity: 0;
    transform: translateY(100%);
}

[data-animation="lines"] .line-inner {
    display: block;
    transform: translateY(100%);
    transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-animation="lines"].is-inview .line {
    opacity: 1;
    transform: translateY(0);
}

[data-animation="lines"].is-inview .line-inner {
    transform: translateY(0);
}

/* Line stagger */
[data-animation="lines"].is-inview .line:nth-child(1) .line-inner { transition-delay: 0s; }
[data-animation="lines"].is-inview .line:nth-child(2) .line-inner { transition-delay: 0.1s; }
[data-animation="lines"].is-inview .line:nth-child(3) .line-inner { transition-delay: 0.2s; }
[data-animation="lines"].is-inview .line:nth-child(4) .line-inner { transition-delay: 0.3s; }
[data-animation="lines"].is-inview .line:nth-child(5) .line-inner { transition-delay: 0.4s; }

/* ---------- Fade Animations ---------- */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

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

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

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

/* ---------- Scale Animations ---------- */
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

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

/* ---------- Reveal Animations ---------- */
@keyframes revealRight {
    from {
        transform: scaleX(1);
    }
    to {
        transform: scaleX(0);
    }
}

@keyframes revealLeft {
    from {
        transform: scaleX(1);
        transform-origin: left;
    }
    to {
        transform: scaleX(0);
        transform-origin: left;
    }
}

@keyframes revealUp {
    from {
        transform: scaleY(1);
    }
    to {
        transform: scaleY(0);
    }
}

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

/* ---------- Slide Animations ---------- */
@keyframes slideInUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

@keyframes slideInDown {
    from {
        transform: translateY(-100%);
    }
    to {
        transform: translateY(0);
    }
}

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

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

/* ---------- Float Animations ---------- */
@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-20px);
    }
}

@keyframes floatRotate {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    25% {
        transform: translateY(-10px) rotate(2deg);
    }
    50% {
        transform: translateY(-20px) rotate(0deg);
    }
    75% {
        transform: translateY(-10px) rotate(-2deg);
    }
}

@keyframes gentleFloat {
    0%, 100% {
        transform: translateY(0) translateX(0);
    }
    25% {
        transform: translateY(-8px) translateX(4px);
    }
    50% {
        transform: translateY(-15px) translateX(0);
    }
    75% {
        transform: translateY(-8px) translateX(-4px);
    }
}

/* ---------- Pulse Animations ---------- */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.9;
    }
}

@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(26, 58, 74, 0.4);
    }
    50% {
        box-shadow: 0 0 0 20px rgba(26, 58, 74, 0);
    }
}

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

/* ---------- Rotate Animations ---------- */
@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

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

/* ---------- Shimmer Animation ---------- */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* ---------- Gradient Shift ---------- */
@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* ---------- Draw Line Animation ---------- */
@keyframes drawLine {
    from {
        stroke-dashoffset: 1000;
    }
    to {
        stroke-dashoffset: 0;
    }
}

/* ---------- Blob Morph Animation ---------- */
@keyframes blobMorph {
    0%, 100% {
        border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    }
    25% {
        border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%;
    }
    50% {
        border-radius: 50% 60% 30% 60% / 30% 60% 70% 40%;
    }
    75% {
        border-radius: 60% 40% 60% 30% / 70% 30% 50% 60%;
    }
}

/* ---------- Magnetic Button Hover ---------- */
.magnetic-btn {
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: transform;
}

.magnetic-btn:hover {
    /* Transform handled by JS */
}

.magnetic-btn::after {
    content: '';
    position: absolute;
    inset: -10px;
    border-radius: inherit;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.magnetic-btn:hover::after {
    opacity: 1;
}

/* ---------- Link Underline Animation ---------- */
.link-animated {
    position: relative;
    display: inline-block;
}

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

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

/* ---------- Card Hover Effects ---------- */
.card-hover {
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow 0.5s ease;
}

.card-hover:hover {
    transform: translateY(-10px);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.15);
}

/* ---------- Image Hover Zoom ---------- */
.image-zoom {
    overflow: hidden;
}

.image-zoom img {
    transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* ---------- Button Ripple Effect ---------- */
.btn-ripple {
    position: relative;
    overflow: hidden;
}

.btn-ripple::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.btn-ripple:active::before {
    width: 300px;
    height: 300px;
}

/* ---------- Stagger Animation Utility Classes ---------- */
.stagger > * {
    opacity: 0;
    transform: translateY(20px);
}

.stagger.is-inview > * {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.stagger.is-inview > *:nth-child(1) { transition-delay: 0s; }
.stagger.is-inview > *:nth-child(2) { transition-delay: 0.1s; }
.stagger.is-inview > *:nth-child(3) { transition-delay: 0.2s; }
.stagger.is-inview > *:nth-child(4) { transition-delay: 0.3s; }
.stagger.is-inview > *:nth-child(5) { transition-delay: 0.4s; }
.stagger.is-inview > *:nth-child(6) { transition-delay: 0.5s; }
.stagger.is-inview > *:nth-child(7) { transition-delay: 0.6s; }
.stagger.is-inview > *:nth-child(8) { transition-delay: 0.7s; }

/* ---------- Page Transition ---------- */
.page-transition {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: var(--ocean-deep);
    transform: scaleY(0);
    transform-origin: bottom;
}

.page-transition.is-active {
    animation: pageTransitionIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.page-transition.is-leaving {
    animation: pageTransitionOut 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes pageTransitionIn {
    from {
        transform: scaleY(0);
        transform-origin: bottom;
    }
    to {
        transform: scaleY(1);
        transform-origin: bottom;
    }
}

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

/* ---------- Loading States ---------- */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--light-gray) 25%,
        var(--cloud-white) 50%,
        var(--light-gray) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

/* ---------- Counter Animation ---------- */
.counter {
    display: inline-block;
    font-variant-numeric: tabular-nums;
}

/* ---------- Parallax Elements ---------- */
.parallax {
    will-change: transform;
}

/* ---------- Scroll Progress ---------- */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: var(--gold-accent);
    transform-origin: left;
    transform: scaleX(0);
    z-index: 9999;
    transition: transform 0.1s linear;
}

/* ---------- Reduced Motion ---------- */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .parallax {
        transform: none !important;
    }

    [data-animation] {
        opacity: 1 !important;
        transform: none !important;
    }

    [data-animation] .char,
    [data-animation] .word,
    [data-animation] .line,
    [data-animation] .line-inner {
        opacity: 1 !important;
        transform: none !important;
    }
}
