@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@200;300;400;500;600;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Poppins", sans-serif;
}

body {
    height: 100vh;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #f2f2f2;
}

nav {
    width: 600px;
    height: 60px;
    border-radius: 5px;
    background: #fff;
    display: flex;
    text-align: center;
    position: relative;
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.25);
}

nav label {
    width: 100%;
    height: 100%;
    line-height: 60px;
    font-size: 18px;
    font-weight: 400;
    border-radius: 5px;
    margin: 0 5px;
    color: #8e44ad;
    z-index: 1;
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

nav label:hover {
    background: rgba(142, 68, 175, 0.3);
}

nav label i {
    margin-right: 4px;
}

.slider {
    position: absolute;
    height: 100%;
    width: 20%;
    background: #8e44ad;
    left: 0;
    top: 0;
    border-radius: 5px;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

#home:checked~nav label.home,
#blog:checked~nav label.blog,
#code:checked~nav label.code,
#help:checked~nav label.help,
#user:checked~nav label.user {
    color: #fff;
}

#blog:checked~nav .slider {
    left: 20%;
}

#code:checked~nav .slider {
    left: 40%;
}

#help:checked~nav .slider {
    left: 60%;
}

#user:checked~nav .slider {
    left: 80%;
}

input[type="radio"] {
    display: none;
}

/* responsiveness */

@media (max-width: 650px) {

    nav {
        width: 530px;
        height: 60px;
    }
}

@media (max-width: 550px) {

    nav {
        width: 430px;
    }

    nav label {
        font-size: 16px;
    }
}

@media (max-width: 450px) {

    nav {
        width: 330px;
    }

    nav span {
        display: none;
    }

    nav label {
        font-size: 18px;
    }
}

@media (max-width: 350px) {

    nav {
        width: 290px;
    }
}