/**
 * ANIMACIONES INTERACTIVAS - PORTAFOLIO JORGE ACUÑA
 * Archivo: animations.css
 * Descripción: Animaciones personalizadas para interacciones y efectos visuales
 */

/* ============================================
   1. CURSOR PERSONALIZADO
   ============================================ */

.custom-cursor {
    position: fixed;
    top: 0;
    left: 0;
    width: 10px;
    height: 10px;
    background-color: #FF2E63;
    border-radius: 50%;
    pointer-events: none;
    z-index: 99999;
    transform: translate(-50%, -50%);
    transition: transform 0.15s ease-out, background-color 0.3s ease;
    mix-blend-mode: difference;
}

.cursor-follower {
    position: fixed;
    top: 0;
    left: 0;
    width: 40px;
    height: 40px;
    border: 2px solid #FF2E63;
    border-radius: 50%;
    pointer-events: none;
    z-index: 99998;
    transform: translate(-50%, -50%);
    transition: transform 0.3s ease-out, width 0.3s ease, height 0.3s ease, border-color 0.3s ease;
    opacity: 0.6;
}

/* Estados del cursor */
.custom-cursor.hover {
    transform: translate(-50%, -50%) scale(1.5);
    background-color: #08D9D6;
}

.cursor-follower.hover {
    width: 60px;
    height: 60px;
    border-color: #08D9D6;
    opacity: 0.8;
}

.custom-cursor.clicking {
    transform: translate(-50%, -50%) scale(0.8);
}

.cursor-follower.clicking {
    transform: translate(-50%, -50%) scale(0.9);
}

/* Cursor para elementos interactivos */
.custom-cursor.dark-theme {
    mix-blend-mode: difference;
    background-color: #FFA630;
}

.cursor-follower.dark-theme {
    border-color: #FFA630;
}

/* ============================================
   2. PARTÍCULAS ANIMADAS
   ============================================ */

.particles-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.particle {
    position: absolute;
    background: radial-gradient(circle, rgba(255, 46, 99, 0.6) 0%, rgba(255, 46, 99, 0) 70%);
    border-radius: 50%;
    pointer-events: none;
    animation: float-particle linear infinite;
}

.particle.turquesa {
    background: radial-gradient(circle, rgba(8, 217, 214, 0.6) 0%, rgba(8, 217, 214, 0) 70%);
}

.particle.naranja {
    background: radial-gradient(circle, rgba(255, 166, 48, 0.6) 0%, rgba(255, 166, 48, 0) 70%);
}

@keyframes float-particle {
    0% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-100px) rotate(720deg);
        opacity: 0;
    }
}

/* Partículas interactivas */
.particle-interactive {
    position: absolute;
    width: 6px;
    height: 6px;
    background: #FF2E63;
    border-radius: 50%;
    pointer-events: none;
    animation: particle-explode 0.8s ease-out forwards;
}

.particle-interactive.turquesa {
    background: #08D9D6;
}

.particle-interactive.naranja {
    background: #FFA630;
}

@keyframes particle-explode {
    0% {
        transform: scale(1) translate(0, 0);
        opacity: 1;
    }
    100% {
        transform: scale(0) translate(var(--tx), var(--ty));
        opacity: 0;
    }
}

/* ============================================
   3. EFECTOS RIPPLE
   ============================================ */

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

.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 46, 99, 0.3);
    transform: scale(0);
    animation: ripple-animation 0.6s ease-out;
    pointer-events: none;
}

.ripple.turquesa {
    background: rgba(8, 217, 214, 0.3);
}

.ripple.naranja {
    background: rgba(255, 166, 48, 0.3);
}

@keyframes ripple-animation {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(4);
        opacity: 0;
    }
}

/* ============================================
   4. BARRA DE PROGRESO DE SCROLL
   ============================================ */

.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 4px;
    background: linear-gradient(90deg, #FF2E63 0%, #08D9D6 50%, #FFA630 100%);
    z-index: 10000;
    transition: width 0.1s ease-out;
    box-shadow: 0 2px 10px rgba(255, 46, 99, 0.5);
}

.scroll-progress.alt {
    bottom: 0;
    top: auto;
    height: 6px;
}

/* ============================================
   5. ANIMACIONES DE TEXTO
   ============================================ */

/* Fade Up */
.fade-up {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.fade-up.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Fade Down */
.fade-down {
    opacity: 0;
    transform: translateY(-30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.fade-down.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Slide Left */
.slide-left {
    opacity: 0;
    transform: translateX(50px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.slide-left.visible {
    opacity: 1;
    transform: translateX(0);
}

/* Slide Right */
.slide-right {
    opacity: 0;
    transform: translateX(-50px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.slide-right.visible {
    opacity: 1;
    transform: translateX(0);
}

/* Scale In */
.scale-in {
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

.scale-in.visible {
    opacity: 1;
    transform: scale(1);
}

/* Rotate In */
.rotate-in {
    opacity: 0;
    transform: rotate(-10deg) scale(0.9);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.rotate-in.visible {
    opacity: 1;
    transform: rotate(0) scale(1);
}

/* Stagger children */
.stagger-children > * {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.4s ease-out, transform 0.4s ease-out;
}

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

.stagger-children.visible > * {
    opacity: 1;
    transform: translateY(0);
}

/* Text reveal */
.text-reveal {
    position: relative;
    overflow: hidden;
}

.text-reveal::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #1A1A2E;
    transform: translateX(-101%);
    transition: transform 0.6s ease-out;
}

.text-reveal.visible::after {
    transform: translateX(101%);
}

/* Typewriter effect */
.typewriter {
    overflow: hidden;
    border-right: 3px solid #FF2E63;
    white-space: nowrap;
    animation: typing 3.5s steps(40, end), blink-caret 0.75s step-end infinite;
}

@keyframes typing {
    from { width: 0; }
    to { width: 100%; }
}

@keyframes blink-caret {
    from, to { border-color: transparent; }
    50% { border-color: #FF2E63; }
}

/* ============================================
   6. EFECTOS HOVER MAGNÉTICOS
   ============================================ */

.magnetic-hover {
    position: relative;
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.magnetic-hover::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255, 46, 99, 0.2) 0%, transparent 70%);
    transform: translate(-50%, -50%) scale(0);
    transition: transform 0.4s ease;
    z-index: -1;
}

.magnetic-hover:hover::before {
    transform: translate(-50%, -50%) scale(1.5);
}

/* Botón magnético */
.btn-magnetic {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 15px 30px;
    background: linear-gradient(135deg, #FF2E63 0%, #08D9D6 100%);
    color: white;
    border: none;
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 46, 99, 0.3);
}

.btn-magnetic:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(255, 46, 99, 0.5);
}

.btn-magnetic:active {
    transform: translateY(-1px);
}

/* Card con efecto magnético */
.card-magnetic {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
    overflow: hidden;
}

.card-magnetic::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255, 46, 99, 0.1) 0%, rgba(8, 217, 214, 0.1) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.card-magnetic:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 20px 50px rgba(255, 46, 99, 0.2);
}

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

/* Icono con efecto magnético */
.icon-magnetic {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 46, 99, 0.1);
    border-radius: 50%;
    transition: all 0.3s ease;
}

.icon-magnetic:hover {
    background: #FF2E63;
    color: white;
    transform: scale(1.1) rotate(10deg);
}

/* ============================================
   7. TRANSICIONES Y TRANSFORMACIONES SMOOTH
   ============================================ */

/* Smooth scroll */
html {
    scroll-behavior: smooth;
}

/* Transiciones suaves */
.smooth-transition {
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.smooth-transition-slow {
    transition: all 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Transformaciones 3D */
.transform-3d {
    transform-style: preserve-3d;
    perspective: 1000px;
}

.flip-card {
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.flip-card:hover {
    transform: rotateY(180deg);
}

.flip-card-front,
.flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
}

.flip-card-back {
    transform: rotateY(180deg);
}

/* Parallax suave */
.parallax-element {
    transition: transform 0.1s linear;
}

/* Glow effect */
.glow-effect {
    position: relative;
}

.glow-effect::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255, 46, 99, 0.4) 0%, transparent 70%);
    transform: translate(-50%, -50%);
    filter: blur(20px);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
}

.glow-effect:hover::after {
    opacity: 1;
}

/* Shimmer effect */
.shimmer {
    position: relative;
    overflow: hidden;
}

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

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

/* Pulse effect */
.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 46, 99, 0.7);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 20px rgba(255, 46, 99, 0);
    }
}

/* Bounce effect */
.bounce {
    animation: bounce 1s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-20px);
    }
    60% {
        transform: translateY(-10px);
    }
}

/* ============================================
   8. MEDIA QUERIES PARA RESPONSIVE
   ============================================ */

/* Dispositivos extra grandes (1400px y superior) */
@media (min-width: 1400px) {
    .cursor-follower {
        width: 50px;
        height: 50px;
    }

    .card-magnetic {
        padding: 40px;
    }

    .btn-magnetic {
        padding: 18px 40px;
        font-size: 1.1rem;
    }
}

/* Dispositivos grandes (1200px a 1399px) */
@media (max-width: 1399px) {
    .cursor-follower {
        width: 45px;
        height: 45px;
    }
}

/* Dispositivos medianos (992px a 1199px) */
@media (max-width: 1199px) {
    .particle {
        width: 4px !important;
        height: 4px !important;
    }

    .card-magnetic {
        padding: 25px;
    }
}

/* Dispositivos pequeños (768px a 991px) */
@media (max-width: 991px) {
    /* Desactivar cursor personalizado en tablets */
    .custom-cursor,
    .cursor-follower {
        display: none;
    }

    .particle {
        width: 3px !important;
        height: 3px !important;
    }

    .scroll-progress {
        height: 3px;
    }

    .btn-magnetic {
        padding: 12px 25px;
    }

    .card-magnetic {
        padding: 20px;
    }

    /* Reducir animaciones */
    .fade-up,
    .fade-down,
    .slide-left,
    .slide-right {
        transition-duration: 0.4s;
    }
}

/* Dispositivos móviles (576px a 767px) */
@media (max-width: 767px) {
    .custom-cursor,
    .cursor-follower {
        display: none;
    }

    .particles-container {
        opacity: 0.5;
    }

    .particle {
        width: 2px !important;
        height: 2px !important;
    }

    .scroll-progress {
        height: 3px;
    }

    .btn-magnetic {
        padding: 10px 20px;
        font-size: 0.9rem;
    }

    .card-magnetic {
        padding: 15px;
    }

    .icon-magnetic {
        width: 50px;
        height: 50px;
    }

    /* Reducir transformaciones */
    .card-magnetic:hover {
        transform: translateY(-5px);
    }

    .btn-magnetic:hover {
        transform: translateY(-2px);
    }

    /* Ajustar stagger */
    .stagger-children.visible > *:nth-child(1) { transition-delay: 0.05s; }
    .stagger-children.visible > *:nth-child(2) { transition-delay: 0.1s; }
    .stagger-children.visible > *:nth-child(3) { transition-delay: 0.15s; }
    .stagger-children.visible > *:nth-child(4) { transition-delay: 0.2s; }
    .stagger-children.visible > *:nth-child(5) { transition-delay: 0.25s; }
    .stagger-children.visible > *:nth-child(6) { transition-delay: 0.3s; }
    .stagger-children.visible > *:nth-child(7) { transition-delay: 0.35s; }
    .stagger-children.visible > *:nth-child(8) { transition-delay: 0.4s; }
}

/* Dispositivos muy pequeños (hasta 575px) */
@media (max-width: 575px) {
    .custom-cursor,
    .cursor-follower {
        display: none;
    }

    .particles-container {
        opacity: 0.3;
    }

    /* Simplificar animaciones en móviles pequeños */
    .fade-up,
    .fade-down,
    .slide-left,
    .slide-right,
    .scale-in,
    .rotate-in {
        transition-duration: 0.3s;
    }

    .btn-magnetic {
        width: 100%;
        padding: 12px 20px;
    }

    .icon-magnetic {
        width: 45px;
        height: 45px;
    }

    /* Desactivar efectos complejos */
    .magnetic-hover {
        transform: none !important;
    }

    .flip-card:hover {
        transform: none;
    }
}

/* Preferencia de movimiento reducido */
@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;
    }

    .custom-cursor,
    .cursor-follower {
        display: none;
    }

    .particles-container {
        display: none;
    }

    .shimmer::before,
    .pulse,
    .bounce,
    .typewriter {
        animation: none;
    }
}

/* Pantallas retina */
@media (-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {
    .custom-cursor {
        width: 8px;
        height: 8px;
    }

    .cursor-follower {
        width: 35px;
        height: 35px;
    }
}

/* Orientación landscape en móviles */
@media (max-width: 767px) and (orientation: landscape) {
    .particle {
        width: 2px !important;
        height: 2px !important;
    }

    .card-magnetic {
        padding: 12px;
    }

    .btn-magnetic {
        padding: 8px 16px;
        font-size: 0.85rem;
    }
}

/* Impresión */
@media print {
    .custom-cursor,
    .cursor-follower,
    .particles-container,
    .scroll-progress,
    .ripple {
        display: none !important;
    }

    .fade-up,
    .fade-down,
    .slide-left,
    .slide-right,
    .scale-in,
    .rotate-in {
        opacity: 1;
        transform: none;
    }
}

/* ============================================
   UTILIDADES ADICIONALES
   ============================================ */

/* Ocultar elementos visualmente pero accesibles */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus visible para accesibilidad */
.focus-visible:focus-visible {
    outline: 3px solid #08D9D6;
    outline-offset: 2px;
}

/* Disable animations temporalmente */
.animations-disabled * {
    animation: none !important;
    transition: none !important;
    transform: none !important;
}

/* Loading states */
.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    margin: -15px 0 0 -15px;
    border: 3px solid #FF2E63;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Hover lift effect */
.hover-lift {
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.hover-lift:hover {
    transform: translateY(-5px);
}

/* Gradient text */
.gradient-text {
    background: linear-gradient(135deg, #FF2E63 0%, #08D9D6 50%, #FFA630 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
