/* Mi idea del reloj de arena son 2 triangulos y una simulacion de flujo, simeplemente pongo 2 triangulos y creo un marco bordeado para dar efecto y lo que hago es hacer uno grande y otro pequeño, mientras eso pasa el flujo de arena es una simulacion de unas bolitas que van cayendo hacia abajo y les meto una opacidad para que desaparezcan al terminar la animacion, giro el reloj y vuelta a empezar  */
/* Clip-path viene de aqui https://bennettfeely.com/clippy/ */
body {
    background-color: #6D28D9;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
}

.titulo {
    font-family: 'Arial', sans-serif;
    font-size: 2rem;
    color: #ecc47a;
    margin-bottom: 20px;
    text-align: center;
    text-shadow: 2px 2px #4b1a8a;
}

.reloj_de_arena {
    position: relative;
    width: 200px;
    height: 300px;
    border-top: 25px solid rgb(155, 79, 17);
    border-bottom: 25px solid rgb(155, 79, 17);
    border-radius: 40px;
    overflow: hidden;
    animation: rotarReloj 10s linear infinite;
}

.parte_arriba, .parte_abajo {
    position: absolute;
    width: 100%;
    height: 50%;
    background-color: #ecc47a;
}

.parte_arriba {
    clip-path: polygon(0 0, 50% 100%, 100% 0);
    top: 0;
    animation: vaciarArriba 5s linear infinite alternate;
}

.parte_abajo {
    clip-path: polygon(50% 100%, 50% 100%, 50% 100%);
    bottom: 0;
    animation: llenarAbajo 5s linear infinite alternate;
}

.arena_cayendo {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translateX(-50%);
    width: 15px;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
    opacity: 1;
    animation: flujoArena 5s linear infinite alternate;
}

.arena_cayendo::before, .arena_cayendo::after {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 12px;
    height: 12px;
    background-color: #ecc47a;
    border-radius: 50%;
    animation: caerParticulas 0.5s linear infinite;
}

.arena_cayendo::after {
    animation-delay: 0.25s;
}

@keyframes caerParticulas {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(150px) scale(0.5);
    }
}

@keyframes flujoArena {
    0%, 45%, 55%, 100% {
        opacity: 1; 
    }
    50% {
        opacity: 0; 
    }
}


@keyframes vaciarArriba {
    0% {
        clip-path: polygon(0 0, 50% 100%, 100% 0);
    }
    50% {
        clip-path: polygon(50% 0, 50% 0, 50% 0);
    }
    100% {
        clip-path: polygon(50% 0, 50% 0, 50% 0);
    }
}

@keyframes llenarAbajo {
    0% {
        clip-path: polygon(50% 100%, 50% 100%, 50% 100%);
    }
    50% {
        clip-path: polygon(0 100%, 50% 0, 100% 100%);
    }
    100% {
        clip-path: polygon(0 100%, 50% 0, 100% 100%);
    }
}

@keyframes rotarReloj {
    0%, 50% {
        transform: rotate(0deg);
    }
    75% {
        transform: rotate(90deg);
    }
    100% {
        transform: rotate(180deg);
    }
}

.parte_arriba {
    animation: vaciarArriba 10s linear infinite;
}

.parte_abajo {
    animation: llenarAbajo 10s linear infinite;
}

.reloj_de_arena {
    animation: rotarReloj 10s linear infinite;
}


