/* =================================
   SISTEMA DE HOJAS ANIMADAS CON SCROLL
   ================================= */

/* Contenedor principal de hojas */
.leaves-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

/* Hojas del lado izquierdo */
.leaves-left {
    position: absolute;
    left: -50px;
    top: 0;
    width: 150px;
    height: 100vh;
}

/* Hojas del lado derecho */
.leaves-right {
    position: absolute;
    right: -50px;
    top: 0;
    width: 150px;
    height: 100vh;
}

/* =================================
   DISEÑOS DE HOJAS REALISTAS
   ================================= */

/* Hoja básica */
.leaf {
    position: absolute;
    opacity: 0;
    transform: translateY(50px) rotate(0deg) scale(0.5);
    transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    transform-origin: bottom center;
}

/* Hoja visible */
.leaf.visible {
    opacity: 1;
    transform: translateY(0) rotate(var(--rotation, 0deg)) scale(1);
}

/* Hoja eucalipto */
.leaf-eucalyptus {
    width: 25px;
    height: 60px;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 50%, #15803d 100%);
    border-radius: 50% 50% 50% 50% / 80% 80% 20% 20%;
    position: relative;
}

.leaf-eucalyptus::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 1px;
    height: 70%;
    background: rgba(0, 0, 0, 0.2);
    transform: translate(-50%, -50%);
}

.leaf-eucalyptus::after {
    content: '';
    position: absolute;
    top: 10%;
    left: 50%;
    width: 80%;
    height: 1px;
    background: rgba(255, 255, 255, 0.3);
    transform: translateX(-50%);
    border-radius: 50%;
}

/* Hoja redonda */
.leaf-round {
    width: 35px;
    height: 35px;
    background: radial-gradient(circle at 30% 30%, #4ade80, #22c55e, #16a34a);
    border-radius: 0 80% 0 80%;
    position: relative;
    transform-origin: bottom left;
}

.leaf-round::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 40px;
    height: 2px;
    background: #15803d;
    transform: rotate(-45deg);
    transform-origin: left center;
}

/* Hoja serrada */
.leaf-serrated {
    width: 30px;
    height: 50px;
    background: linear-gradient(45deg, #34d399 0%, #10b981 50%, #059669 100%);
    clip-path: polygon(
        50% 0%, 
        60% 10%, 
        70% 8%, 
        80% 18%, 
        90% 15%, 
        95% 25%, 
        90% 35%, 
        95% 45%, 
        90% 55%, 
        95% 65%, 
        85% 75%, 
        90% 85%, 
        80% 95%, 
        50% 100%, 
        20% 95%, 
        10% 85%, 
        15% 75%, 
        5% 65%, 
        10% 55%, 
        5% 45%, 
        10% 35%, 
        5% 25%, 
        10% 15%, 
        20% 18%, 
        30% 8%, 
        40% 10%
    );
    position: relative;
}

.leaf-serrated::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 1px;
    height: 80%;
    background: rgba(0, 0, 0, 0.2);
    transform: translate(-50%, -50%);
}

/* Hoja de arce pequeña */
.leaf-maple {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    clip-path: polygon(
        50% 0%, 
        65% 15%, 
        85% 10%, 
        90% 30%, 
        75% 40%, 
        95% 50%, 
        85% 65%, 
        70% 60%, 
        60% 80%, 
        50% 90%, 
        40% 80%, 
        30% 60%, 
        15% 65%, 
        5% 50%, 
        25% 40%, 
        10% 30%, 
        15% 10%, 
        35% 15%
    );
    position: relative;
}

/* Hoja alargada */
.leaf-elongated {
    width: 20px;
    height: 70px;
    background: linear-gradient(180deg, #4ade80 0%, #22c55e 50%, #16a34a 100%);
    border-radius: 50% 50% 50% 50% / 20% 20% 80% 80%;
    position: relative;
}

.leaf-elongated::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 1px;
    height: 90%;
    background: rgba(0, 0, 0, 0.15);
    transform: translate(-50%, -50%);
}

/* =================================
   POSICIONAMIENTO Y ANIMACIONES
   ================================= */

/* Hojas lado izquierdo */
.leaf-left-1 { top: 10%; left: 20px; --rotation: -15deg; }
.leaf-left-2 { top: 20%; left: 40px; --rotation: 10deg; }
.leaf-left-3 { top: 35%; left: 15px; --rotation: -25deg; }
.leaf-left-4 { top: 50%; left: 35px; --rotation: 5deg; }
.leaf-left-5 { top: 65%; left: 25px; --rotation: -10deg; }
.leaf-left-6 { top: 80%; left: 45px; --rotation: 20deg; }
.leaf-left-7 { top: 90%; left: 20px; --rotation: -5deg; }

/* Hojas lado derecho */
.leaf-right-1 { top: 15%; right: 25px; --rotation: 15deg; }
.leaf-right-2 { top: 25%; right: 40px; --rotation: -10deg; }
.leaf-right-3 { top: 40%; right: 20px; --rotation: 25deg; }
.leaf-right-4 { top: 55%; right: 35px; --rotation: -5deg; }
.leaf-right-5 { top: 70%; right: 50px; --rotation: 10deg; }
.leaf-right-6 { top: 85%; right: 30px; --rotation: -20deg; }
.leaf-right-7 { top: 95%; right: 45px; --rotation: 5deg; }

/* =================================
   EFECTOS ADICIONALES
   ================================= */

/* Animación de balanceo suave */
@keyframes gentle-sway {
    0%, 100% { transform: translateY(0) rotate(var(--rotation)) scale(1); }
    50% { transform: translateY(-3px) rotate(calc(var(--rotation) + 2deg)) scale(1.02); }
}

.leaf.swaying {
    animation: gentle-sway 4s ease-in-out infinite;
    animation-delay: var(--delay, 0s);
}

/* Efecto de brillo */
.leaf-glow {
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.3);
}

/* Variaciones de delays para animación natural */
.leaf-left-1, .leaf-right-1 { --delay: 0s; }
.leaf-left-2, .leaf-right-2 { --delay: 0.5s; }
.leaf-left-3, .leaf-right-3 { --delay: 1s; }
.leaf-left-4, .leaf-right-4 { --delay: 1.5s; }
.leaf-left-5, .leaf-right-5 { --delay: 2s; }
.leaf-left-6, .leaf-right-6 { --delay: 2.5s; }
.leaf-left-7, .leaf-right-7 { --delay: 3s; }

/* =================================
   EFECTOS DE PARTÍCULAS
   ================================= */

/* Pequeñas hojas flotantes */
.floating-particles {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.particle {
    position: absolute;
    width: 8px;
    height: 8px;
    background: #22c55e;
    border-radius: 50% 0;
    opacity: 0;
    animation: float-particle 8s ease-in-out infinite;
}

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

.particle:nth-child(1) { left: 10%; animation-delay: 0s; }
.particle:nth-child(2) { left: 20%; animation-delay: 2s; }
.particle:nth-child(3) { right: 10%; animation-delay: 4s; }
.particle:nth-child(4) { right: 20%; animation-delay: 6s; }

/* =================================
   RESPONSIVE DESIGN
   ================================= */

@media (max-width: 1024px) {
    .leaves-left,
    .leaves-right {
        width: 100px;
    }
    
    .leaf {
        transform: scale(0.8);
    }
}

@media (max-width: 768px) {
    .leaves-left {
        left: -30px;
        width: 80px;
    }
    
    .leaves-right {
        right: -30px;
        width: 80px;
    }
    
    .leaf {
        transform: scale(0.6);
    }
    
    .leaf.swaying {
        animation: none; /* Desactivar animaciones complejas en móvil */
    }
}

@media (max-width: 480px) {
    .leaves-container {
        display: none; /* Ocultar en pantallas muy pequeñas */
    }
}

/* =================================
   MODO OSCURO (OPCIONAL)
   ================================= */

@media (prefers-color-scheme: dark) {
    .leaf-eucalyptus {
        background: linear-gradient(135deg, #16a34a 0%, #15803d 50%, #14532d 100%);
    }
    
    .leaf-round {
        background: radial-gradient(circle at 30% 30%, #22c55e, #16a34a, #15803d);
    }
    
    .leaf-serrated {
        background: linear-gradient(45deg, #16a34a 0%, #15803d 50%, #14532d 100%);
    }
}

/* =================================
   CLASES DE UTILIDAD
   ================================= */

/* Para activar desde JavaScript */
.leaves-active .leaf {
    transition-delay: calc(var(--index, 0) * 0.1s);
}

/* Estados especiales */
.leaf.fade-in {
    animation: leafFadeIn 1s ease-out forwards;
}

@keyframes leafFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px) rotate(0deg) scale(0.5);
    }
    to {
        opacity: 1;
        transform: translateY(0) rotate(var(--rotation)) scale(1);
    }
}

/* Efecto hover para interactividad */
.leaf:hover {
    transform: translateY(-5px) rotate(calc(var(--rotation) + 5deg)) scale(1.1);
    transition: all 0.3s ease;
}