/* ===========================================
   Animaciones y microinteracciones
   =========================================== */

/* Estado inicial de los elementos animados */
.will-animate {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

/* Clase que se añade cuando el elemento es visible */
.animate-in {
    opacity: 1;
    transform: translateY(0);
}

/* Retraso escalonado para elementos en secuencia */
.story-entry:nth-child(1) { transition-delay: 0.1s; }
.story-entry:nth-child(2) { transition-delay: 0.2s; }
.story-entry:nth-child(3) { transition-delay: 0.3s; }
.story-entry:nth-child(4) { transition-delay: 0.4s; }

.step:nth-child(1) { transition-delay: 0.1s; }
.step:nth-child(2) { transition-delay: 0.2s; }
.step:nth-child(3) { transition-delay: 0.3s; }

/* Animaciones para elementos del hero */
.about-photo.animate-in {
    animation: fadeInRight 0.8s ease-out forwards;
}

.about-sub.animate-in {
    animation: fadeInUp 0.6s ease-out forwards;
}

.pill-list.animate-in li {
    animation: popIn 0.4s ease-out forwards;
    opacity: 0;
}

.pill-list li:nth-child(1) { animation-delay: 0.1s; }
.pill-list li:nth-child(2) { animation-delay: 0.2s; }
.pill-list li:nth-child(3) { animation-delay: 0.3s; }

/* Animaciones de navegación */
.nav-links a {
    position: relative;
    transition: color 0.3s ease;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--primary);
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.3s ease;
}

.nav-links a:hover::after,
.nav-links a.active::after {
    transform: scaleX(1);
    transform-origin: left;
}

.nav-hover {
    color: var(--primary);
}

/* Mejoras en botones */
.btn {
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
}

.btn:active {
    transform: translateY(0);
}

/* Keyframes para animaciones específicas */
@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Animaciones para las tarjetas de servicios */
.service-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    transform-origin: center bottom;
}

.service-card.will-animate {
    opacity: 0;
    transform: translateY(30px);
}

.service-card.animate-in {
    opacity: 1;
    transform: translateY(0);
}

.service-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 24px rgba(37, 99, 235, 0.15);
}

/* Animación del icono del servicio */
.service-icon {
    transition: transform 0.3s ease, background-color 0.3s ease;
}

.service-card:hover .service-icon {
    transform: scale(1.1) rotate(8deg);
    background-color: var(--primary);
    color: white;
}

/* Animación de la lista de características */
.feature-item {
    transition: transform 0.2s ease;
}

.feature-item:hover {
    transform: translateX(5px);
}

.feature-icon {
    transition: transform 0.2s ease;
}

.feature-item:hover .feature-icon {
    transform: scale(1.2);
}

/* Animaciones para FAQ */
.faq-item {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.faq-item.will-animate {
    opacity: 0;
    transform: translateY(20px);
}

.faq-item.animate-in {
    opacity: 1;
    transform: translateY(0);
}

.faq-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.1);
}

/* Retraso escalonado para las tarjetas de servicios */
.service-card:nth-child(1) { transition-delay: 0.1s; }
.service-card:nth-child(2) { transition-delay: 0.2s; }
.service-card:nth-child(3) { transition-delay: 0.3s; }

/* Retraso para las FAQs */
.faq-item:nth-child(1) { transition-delay: 0.1s; }
.faq-item:nth-child(2) { transition-delay: 0.2s; }
.faq-item:nth-child(3) { transition-delay: 0.3s; }

/* Animaciones para el hero de inicio - Estilo servicios */
.hero {
    position: relative;
    overflow: hidden;
}

/* Animación de texto letra por letra */
.animate-text {
    display: inline-block;
    opacity: 0;
    transform: translateY(10px);
    animation: fadeInLetter 0.5s ease-out forwards;
    white-space: pre;  /* Preserva los espacios */
}

/* Aseguramos que los espacios tengan el ancho correcto */
.animate-text.space {
    margin-right: 0.25em;  /* Ajusta este valor para controlar el espacio entre palabras */
}

@keyframes fadeInLetter {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Animación específica para el título principal del hero */
.hero-title-animated {
    overflow: hidden;
}

.hero-title-animated .word {
    display: inline-block;
    opacity: 0;
    transform: translateY(30px);
    animation: slideInWord 0.8s ease-out forwards;
}

/* Aplicar delays escalonados a las palabras */
.hero-title-animated .word:nth-child(1) { animation-delay: 0.1s; }
.hero-title-animated .word:nth-child(3) { animation-delay: 0.3s; }
.hero-title-animated .word:nth-child(5) { animation-delay: 0.5s; }
.hero-title-animated .word:nth-child(7) { animation-delay: 0.7s; }
.hero-title-animated .word:nth-child(9) { animation-delay: 0.9s; }
.hero-title-animated .word:nth-child(11) { animation-delay: 1.1s; }
.hero-title-animated .word:nth-child(13) { animation-delay: 1.3s; }

@keyframes slideInWord {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero-copy p,
.hero-actions,
.points {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s ease-out forwards;
}

.hero-copy p { animation-delay: 1.8s; }
.hero-actions { animation-delay: 2.0s; }
.points { animation-delay: 2.2s; }

/* Animación para la imagen del hero, similar a about-photo */
.hero-image {
    opacity: 0;
    transform: translateX(30px);
    animation: fadeInRight 0.8s ease-out 0.3s forwards;
}

/* Características principales con el estilo de service-card */
.key-feature {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    transform-origin: center bottom;
}

.key-feature.will-animate {
    opacity: 0;
    transform: translateY(30px);
}

.key-feature.animate-in {
    opacity: 1;
    transform: translateY(0);
}

.key-feature:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 24px rgba(37, 99, 235, 0.15);
}

/* Retraso escalonado para características */
.key-feature:nth-child(1) { transition-delay: 0.1s; }
.key-feature:nth-child(2) { transition-delay: 0.2s; }
.key-feature:nth-child(3) { transition-delay: 0.3s; }

/* Preview de servicios similar a service-card */
.service-preview {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    transform-origin: center bottom;
}

.service-preview.will-animate {
    opacity: 0;
    transform: translateY(30px);
}

.service-preview.animate-in {
    opacity: 1;
    transform: translateY(0);
}

.service-preview:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 24px rgba(37, 99, 235, 0.15);
}

/* Retraso para previews de servicios */
.service-preview:nth-child(1) { transition-delay: 0.1s; }
.service-preview:nth-child(2) { transition-delay: 0.2s; }
.service-preview:nth-child(3) { transition-delay: 0.3s; }

/* Animación para la sección hero de servicios */
.services-hero {
    position: relative;
    overflow: hidden;
}

.services-hero h1,
.services-hero p {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s ease-out forwards;
}

.services-hero h1 { animation-delay: 0.2s; }
.services-hero p { animation-delay: 0.4s; }

/* Animación para el CTA flotante */
.floating-cta {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.floating-cta.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Efecto parallax suave para imágenes de fondo */
.parallax-bg {
    transition: transform 0.5s cubic-bezier(0.33, 1, 0.68, 1);
}

/* Animación para el scroll indicator */
@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

/* Otras animaciones existentes */
.story-entry {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.story-entry:hover {
    transform: translateX(10px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.1);
}

/* Smooth scroll behavior */
html {
    scroll-behavior: smooth;
}

/* ===========================================
   Animaciones específicas para página "Sobre mí"
   =========================================== */

/* Animación del título principal de la página sobre-mi */
.about-title-animated {
    overflow: hidden;
}

.about-title-animated .word {
    display: inline-block;
    opacity: 0;
    transform: translateY(30px);
    animation: slideInWord 0.8s ease-out forwards;
}

/* Delays escalonados para el título de sobre-mi */
.about-title-animated .word:nth-child(1) { animation-delay: 0.1s; }
.about-title-animated .word:nth-child(3) { animation-delay: 0.3s; }

/* Animación para el eyebrow (etiqueta superior) */
.intro-eyebrow {
    opacity: 0;
    transform: translateY(-20px);
    animation: slideInDown 0.6s ease-out 0.2s forwards;
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Animación para la descripción principal */
.about-sub {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s ease-out 0.4s forwards;
}

/* Animación para la lista de pills */
.pill-list {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s ease-out 0.6s forwards;
}

.pill-list li {
    opacity: 0;
    transform: scale(0.8);
    animation: popIn 0.4s ease-out forwards;
}

.pill-list li:nth-child(1) { animation-delay: 0.8s; }
.pill-list li:nth-child(2) { animation-delay: 0.9s; }
.pill-list li:nth-child(3) { animation-delay: 1.0s; }

/* Animación para los botones de acción */
.about-actions {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s ease-out 1.2s forwards;
}

/* Animación para la foto del perfil */
.about-photo {
    opacity: 0;
    transform: translateX(30px);
    animation: fadeInRight 0.8s ease-out 0.3s forwards;
}

/* Animación para el timeline de historia */
.story-timeline::before {
    opacity: 0;
    transform: scaleY(0);
    transform-origin: top;
    animation: growLine 1.2s ease-out 0.5s forwards;
}

@keyframes growLine {
    from {
        opacity: 0;
        transform: scaleY(0);
    }
    to {
        opacity: 1;
        transform: scaleY(1);
    }
}

/* Animación para los puntos del timeline */
.story-entry::before {
    opacity: 0;
    transform: scale(0);
    animation: popIn 0.4s ease-out forwards;
}

.story-entry:nth-child(1)::before { animation-delay: 0.8s; }
.story-entry:nth-child(2)::before { animation-delay: 1.0s; }
.story-entry:nth-child(3)::before { animation-delay: 1.2s; }
.story-entry:nth-child(4)::before { animation-delay: 1.4s; }

/* Animación para los pasos del método */
.method .grid3 .step {
    opacity: 0;
    transform: translateY(30px);
    animation: fadeInUp 0.6s ease-out forwards;
}

.method .grid3 .step:nth-child(1) { animation-delay: 0.2s; }
.method .grid3 .step:nth-child(2) { animation-delay: 0.4s; }
.method .grid3 .step:nth-child(3) { animation-delay: 0.6s; }

/* Animación para el disclaimer */
.disclaimer {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s ease-out 0.8s forwards;
}