/* ===================================
   ANIMACIONES Y EFECTOS VISUALES
   Diseño elegante, sutil y artesanal
   =================================== */

/* === FONDO DINÁMICO ANIMADO === */
:root {
    /* Paleta de colores elegantes y sofisticados */
    --color-1: #a8e6d8;      /* verde agua suave */
    --color-2: #85dcc7;      /* verde menta delicado */
    --color-3: #f2b8d4;      /* rosado suave elegante */
    --color-4: #f0d5cc;      /* nude/rosado pastel premium */
}

body {
    position: relative;
    background: linear-gradient(
        135deg,
        var(--color-1) 0%,
        var(--color-2) 25%,
        var(--color-3) 50%,
        var(--color-4) 75%,
        var(--color-1) 100%
    );
    background-size: 400% 400%;
    animation: gradientShift 28s ease-in-out infinite;
    min-height: 100vh;
}

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

/* Pseudo-elemento para mejorar el efecto */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(ellipse at 20% 50%, rgba(255, 255, 255, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(168, 230, 216, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 40% 80%, rgba(242, 184, 212, 0.05) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
    animation: shimmer 22s ease-in-out infinite;
}

@keyframes shimmer {
    0%, 100% {
        opacity: 0.6;
        filter: blur(0px);
    }
    50% {
        opacity: 0.8;
        filter: blur(1.5px);
    }
}

/* === ANIMACIONES DE SCROLL (FADE-IN, SLIDE-UP, SCALE) === */

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

/* Slide up */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Slide down */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Slide left */
@keyframes slideLeft {
    from {
        opacity: 0;
        transform: translateX(-40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Slide right */
@keyframes slideRight {
    from {
        opacity: 0;
        transform: translateX(40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Scale subtle */
@keyframes scaleUp {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* === CLASES DE ANIMACIÓN === */

/* Elementos visibles por defecto (sin scroll observer) */
.animate-fade-in {
    animation: fadeIn 0.8s ease-out forwards;
}

.animate-slide-up {
    animation: slideUp 0.8s ease-out forwards;
}

.animate-slide-down {
    animation: slideDown 0.8s ease-out forwards;
}

.animate-slide-left {
    animation: slideLeft 0.8s ease-out forwards;
}

.animate-slide-right {
    animation: slideRight 0.8s ease-out forwards;
}

.animate-scale-up {
    animation: scaleUp 0.8s ease-out forwards;
}

/* Estados iniciales para elementos con scroll observer */
.scroll-animate {
    opacity: 0;
}

.scroll-animate.fade-in {
    animation: fadeIn 0.8s ease-out forwards;
}

.scroll-animate.slide-up {
    opacity: 0;
    transform: translateY(30px);
    animation: slideUp 0.8s ease-out forwards;
}

.scroll-animate.slide-left {
    opacity: 0;
    transform: translateX(-40px);
    animation: slideLeft 0.8s ease-out forwards;
}

.scroll-animate.slide-right {
    opacity: 0;
    transform: translateX(40px);
    animation: slideRight 0.8s ease-out forwards;
}

.scroll-animate.scale-up {
    opacity: 0;
    transform: scale(0.95);
    animation: scaleUp 0.8s ease-out forwards;
}

/* === ANIMACIONES ESCALONADAS (STAGGER) === */

/* Atrasos en cascada para elementos hermanos */
.stagger-item {
    opacity: 0;
    animation: slideUp 0.8s ease-out forwards;
}

.stagger-item:nth-child(1) {
    animation-delay: 0s;
}

.stagger-item:nth-child(2) {
    animation-delay: 0.1s;
}

.stagger-item:nth-child(3) {
    animation-delay: 0.2s;
}

.stagger-item:nth-child(4) {
    animation-delay: 0.3s;
}

.stagger-item:nth-child(5) {
    animation-delay: 0.4s;
}

.stagger-item:nth-child(n+6) {
    animation-delay: 0.5s;
}

/* Para scroll observer con stagger */
.scroll-stagger {
    opacity: 0;
    transform: translateY(30px);
}

.scroll-stagger.active {
    animation: slideUp 0.8s ease-out forwards;
}

.scroll-stagger:nth-child(1).active {
    animation-delay: 0s;
}

.scroll-stagger:nth-child(2).active {
    animation-delay: 0.1s;
}

.scroll-stagger:nth-child(3).active {
    animation-delay: 0.2s;
}

.scroll-stagger:nth-child(4).active {
    animation-delay: 0.3s;
}

.scroll-stagger:nth-child(5).active {
    animation-delay: 0.4s;
}

.scroll-stagger:nth-child(n+6).active {
    animation-delay: 0.5s;
}

/* === HOVER EFFECTS === */

.hover-lift {
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.hover-lift:hover {
    transform: translateY(-8px);
    filter: drop-shadow(0 15px 30px rgba(0, 0, 0, 0.15));
}

.hover-scale {
    transition: transform 0.3s ease-out;
}

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

.hover-glow {
    transition: box-shadow 0.3s ease-out;
}

.hover-glow:hover {
    box-shadow: 0 0 20px rgba(248, 189, 196, 0.4);
}

/* === PULSE/GLOW SUBTLE === */

@keyframes subtlePulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.85;
    }
}

.pulse-subtle {
    animation: subtlePulse 3s ease-in-out infinite;
}

@keyframes subtleGlow {
    0%, 100% {
        filter: drop-shadow(0 0 0px rgba(248, 189, 196, 0));
    }
    50% {
        filter: drop-shadow(0 0 8px rgba(248, 189, 196, 0.3));
    }
}

.glow-subtle {
    animation: subtleGlow 4s ease-in-out infinite;
}

/* === RESPETO A PREFERENCIAS DE ACCESIBILIDAD === */

@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;
    }
    
    body {
        animation: none;
        background: linear-gradient(135deg, var(--color-1), var(--color-2), var(--color-3), var(--color-4));
        background-size: auto;
    }
    
    body::before {
        animation: none;
    }

    .hover-lift,
    .hover-scale,
    .hover-glow {
        transition: none;
    }

    .pulse-subtle,
    .glow-subtle {
        animation: none;
    }
}

/* === RESPONSIVE ADJUSTMENTS === */

@media (max-width: 768px) {
    /* Animaciones más rápidas en mobile para mejor UX */
    .animate-fade-in,
    .scroll-animate.fade-in,
    .animate-slide-up,
    .scroll-animate.slide-up,
    .animate-slide-left,
    .scroll-animate.slide-left,
    .animate-slide-right,
    .scroll-animate.slide-right,
    .animate-scale-up,
    .scroll-animate.scale-up {
        animation-duration: 0.6s;
    }

    /* Reducir stagger delays en mobile */
    .stagger-item:nth-child(2) {
        animation-delay: 0.05s;
    }

    .stagger-item:nth-child(3) {
        animation-delay: 0.1s;
    }

    .stagger-item:nth-child(4) {
        animation-delay: 0.15s;
    }

    .stagger-item:nth-child(5) {
        animation-delay: 0.2s;
    }

    .stagger-item:nth-child(n+6) {
        animation-delay: 0.25s;
    }
}

/* === LÍNEA DECORATIVA ANIMADA === */

.line-animate::after {
    content: '';
    display: block;
    height: 2px;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(248, 189, 196, 0.6), 
        transparent);
    margin-top: 1rem;
    animation: lineSlide 1.5s ease-in-out;
}

@keyframes lineSlide {
    from {
        width: 0;
        opacity: 0;
    }
    to {
        width: 100%;
        opacity: 1;
    }
}

/* === ENTRADA ELEGANTE PARA TEXTOS === */

.text-reveal {
    position: relative;
    display: inline-block;
    opacity: 0;
    animation: textReveal 0.8s ease-out forwards;
}

@keyframes textReveal {
    0% {
        opacity: 0;
        letter-spacing: -0.5em;
    }
    100% {
        opacity: 1;
        letter-spacing: 0;
    }
}

/* === SMOOTH SCROLL (ya en main.css pero reforzamos) === */

html {
    scroll-behavior: smooth;
}

/* === TRANSICIONES SUAVES POR DEFECTO === */

a,
button,
input,
textarea,
select {
    transition: all 0.3s ease-out;
}

/* ===================================
   ANIMACIONES AVANZADAS PREMIUM
   Microinteracciones sofisticadas
   =================================== */

/* === PARALLAX EFFECT === */

.parallax-image {
    position: relative;
    overflow: hidden;
    transform-style: preserve-3d;
    perspective: 1000px;
}

.parallax-image img {
    transform: translateZ(-100px) scale(1.2);
    transform-style: preserve-3d;
    will-change: transform;
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.parallax-image:hover img {
    transform: translateZ(0) scale(1.1);
}

@supports not (transform-style: preserve-3d) {
    .parallax-image img {
        transform: scale(1.05);
    }
    .parallax-image:hover img {
        transform: scale(1.08);
    }
}

/* === BOTÓN ANIMADO CON UNDERLINE DINÁMICO === */

.btn-animated {
    position: relative;
    overflow: hidden;
    padding: 1rem 2rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-animated::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: -100%;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, transparent, currentColor, transparent);
    transition: left 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-animated:hover::before {
    left: 100%;
}

.btn-animated::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(45deg, 
        var(--color-1), 
        var(--color-2), 
        var(--color-3), 
        var(--color-4));
    background-size: 300% 300%;
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: -1;
    animation: gradientShift 8s ease-in-out paused;
}

.btn-animated:hover::after {
    opacity: 0.15;
    animation-play-state: running;
}

/* === BOTÓN CON FONDO ANIMADO === */

.btn-gradient-shift {
    position: relative;
    background-size: 200% 200%;
    animation: gradientPulse 6s ease-in-out infinite;
    transition: all 0.3s ease;
}

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

.btn-gradient-shift:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(242, 184, 212, 0.3);
    animation-duration: 3s;
}

/* === SCALE + SHADOW PREMIUM === */

.hover-premium {
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.hover-premium:hover {
    transform: scale(1.04) translateY(-6px);
    box-shadow: 
        0 0 30px rgba(168, 230, 216, 0.3),
        0 8px 32px rgba(242, 184, 212, 0.2);
}

/* === BLUR TRANSITION BETWEEN SECTIONS === */

.section-transition {
    position: relative;
    transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.section-transition::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, 
        rgba(168, 230, 216, 0.1), 
        transparent,
        rgba(242, 184, 212, 0.1));
    opacity: 0;
    transition: opacity 0.6s ease;
    pointer-events: none;
}

.section-transition:hover::before {
    opacity: 1;
}

/* === FLOATING ELEMENTS === */

.float-animation {
    animation: float 4s ease-in-out infinite;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px) translateX(0px);
    }
    25% {
        transform: translateY(-12px) translateX(-3px);
    }
    50% {
        transform: translateY(0px) translateX(0px);
    }
    75% {
        transform: translateY(-8px) translateX(3px);
    }
}

/* === DECORATIVE LINE ANIMATION === */

.decorative-line {
    position: relative;
    height: 2px;
    background: linear-gradient(90deg, 
        transparent,
        var(--color-3),
        transparent);
    margin: 2rem 0;
    overflow: hidden;
}

.decorative-line::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
        transparent,
        rgba(255, 255, 255, 0.8),
        transparent);
    animation: shimmerLine 2s infinite;
}

@keyframes shimmerLine {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* === BLUR ENTRANCE/EXIT === */

.blur-enter {
    animation: blurEnter 0.8s ease-out forwards;
}

@keyframes blurEnter {
    from {
        opacity: 0;
        filter: blur(8px);
    }
    to {
        opacity: 1;
        filter: blur(0px);
    }
}

.blur-exit {
    animation: blurExit 0.8s ease-in forwards;
}

@keyframes blurExit {
    from {
        opacity: 1;
        filter: blur(0px);
    }
    to {
        opacity: 0;
        filter: blur(8px);
    }
}

/* === CARD HOVER WITH DEPTH === */

.card-premium {
    position: relative;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    border-radius: 12px;
    overflow: hidden;
}

.card-premium::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.5), 
        transparent);
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
}

.card-premium:hover {
    transform: translateY(-12px) scale(1.02);
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.12),
        0 0 40px rgba(168, 230, 216, 0.2);
}

.card-premium:hover::before {
    opacity: 1;
}

/* === IMAGE ZOOM ON HOVER === */

.image-zoom {
    overflow: hidden;
    border-radius: 8px;
}

.image-zoom img {
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.image-zoom:hover img {
    transform: scale(1.08) rotate(1deg);
}

/* === TITLE REVEAL WITH UNDERLINE === */

.title-premium {
    position: relative;
    display: inline-block;
}

.title-premium::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--color-3), var(--color-2));
    transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.title-premium:hover::after,
.title-premium.in-view::after {
    width: 100%;
}

/* === ICON PULSE === */

.icon-pulse {
    animation: iconPulse 2s ease-in-out infinite;
}

@keyframes iconPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.12);
        opacity: 0.8;
    }
}

/* === BUTTON RIPPLE EFFECT === */

.btn-ripple {
    position: relative;
    overflow: hidden;
}

.btn-ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.btn-ripple:active::after {
    animation: ripple 0.6s ease-out;
}

@keyframes ripple {
    0% {
        width: 0;
        height: 0;
        opacity: 1;
    }
    100% {
        width: 300px;
        height: 300px;
        opacity: 0;
    }
}

/* === SECTION FADE WITH TRANSLATE === */

.section-fade-enter {
    animation: sectionFadeEnter 1s ease-out forwards;
}

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

/* === NUMBER COUNTER ANIMATION === */

.counter {
    font-weight: 700;
    font-size: 2.5rem;
    background: linear-gradient(135deg, var(--color-2), var(--color-3));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

.counter.active {
    animation: countUp 0.8s ease-out forwards;
}

/* === SMOOTH SECTION DIVIDER === */

.section-divider {
    position: relative;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 2rem 0;
}

.section-divider::before,
.section-divider::after {
    content: '';
    position: absolute;
    width: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(242, 184, 212, 0.5), transparent);
    top: 50%;
}

.section-divider::before {
    left: 0;
    animation: expandLeft 1.2s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    animation-delay: 0.2s;
}

.section-divider::after {
    right: 0;
    animation: expandRight 1.2s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    animation-delay: 0.2s;
}

@keyframes expandLeft {
    to {
        width: calc(50% - 40px);
    }
}

@keyframes expandRight {
    to {
        width: calc(50% - 40px);
    }
}

.section-divider-icon {
    position: relative;
    z-index: 1;
    width: 80px;
    height: 80px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    animation: scaleIcon 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

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

/* === RESPONSIVE ADJUSTMENTS === */

@media (max-width: 768px) {
    .parallax-image img {
        transform: translateZ(-50px) scale(1.15);
    }

    .parallax-image:hover img {
        transform: translateZ(0) scale(1.05);
    }

    .card-premium:hover {
        transform: translateY(-8px) scale(1.01);
    }

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

    .float-animation {
        animation: floatMobile 3s ease-in-out infinite;
    }

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

/* === ACCESIBILIDAD === */

@media (prefers-reduced-motion: reduce) {
    .parallax-image img,
    .btn-animated,
    .btn-gradient-shift,
    .hover-premium,
    .float-animation,
    .image-zoom img,
    .section-divider::before,
    .section-divider::after,
    .section-divider-icon,
    .card-premium {
        animation: none !important;
        transition: none !important;
    }
}
