/* Medium screens */
@media screen and (max-width: 992px) {
    body {
        margin: 0;
    }

    nav {
        margin: 0;
    }

    .menu-toggle {
        display: flex;
    }

    nav ul {
        display: none;
        position: fixed;
        top: 80px;
        left: 0;
        width: 100%;
        background-color: black;
        flex-direction: column;
        align-items: center;
        padding: 20px 0;
        z-index: 1000;
    }

    nav ul.active {
        display: flex;
    }

    nav ul li {
        margin: 15px 0;
        text-align: center;
        width: 100%;
    }

    #home,
    #skills,
    #education,
    #projects,
    #contact_me,
    #about_me {
        width: 100%;
        max-width: 900px;
        margin: 50px auto;
        text-align: center;
        box-sizing: border-box;
    }

    #home {
        display: flex;
        flex-direction: column;
        text-align: center;
        box-sizing: border-box;
        padding: 0 15px;
    }
    #home>div {
        width: 100%;
    
    }

    #infotxt{
        text-align: center;
        width:100%;
        max-width:90vw;;
        

    }

    
   

    #about_me {
        display: flex;
        flex-direction: column-reverse;
        text-align: center;
        box-sizing: border-box;
        padding: 0 15px;
    }

    .green {
        font-size: 4rem;
        max-width: 1000px;
        width: 100%;
    }
    h3{
        padding: 20px;
        font-size: 1.3rem;
    }

    .skills-grid,
    .education-grid,
    .project-grid {
        grid-template-columns: repeat(auto-fit, 1fr);
        gap: 30px;
        width: 100%;
        max-width: 800px;
        margin: 0 auto;
        justify-items: center;
    }

    #education {
        align-items: center;
    }
    
    .leftsection {
        font-size: 1.4rem;  /* Adjust size for mobile */
        margin: 0 auto;
        width: 100%;
        text-align: center;
        box-sizing: border-box;
        padding-top: 100px;  /* Remove the big top padding */
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .about,
    .about_heading {
        margin: 0 auto;
        width: 100%;
        text-align: center;
        box-sizing: border-box;
        padding: 0 10px;
    }
    .leftsection2nd img
    {
        padding-top: 50px;
        width: 100%;
        max-width: 600px;
        align-self: center; 
        margin-left: 15px;       
    }

    
    .rightsection img {
        width: 80%;
        max-width: 400px;
        margin: 20px auto;
        display: block;
    }
    .rightsection image-rendering{
        width: 90%;

    };
}

/* Small screens */
@media screen and (max-width: 768px) {
    body {
        margin: 0 auto;
    }

    nav {
        padding: 0 20px;
        margin: 0;
    }

    .menu-toggle {
        display: flex;
    }

    nav ul {
        display: none;
        position: fixed;
        top: 80px;
        left: 0;
        width: 100%;
        background-color: black;
        flex-direction: column;
        align-items: center;
        padding: 20px 0;
        z-index: 1000;
    }

    nav ul.active {
        display: flex;
    }

    nav ul li {
        margin: 15px 0;
        text-align: center;
        width: 100%;
    }

    #home,
    #skills,
    #education,
    #projects,
    #contact_me,
    #about_me {
        width: 100%;
        max-width: 600px;
        margin: 30px auto;
        text-align: center;
    }

    

    .skills-grid,
    .education-grid,
    .project-grid {
        grid-template-columns: 1fr;
        gap: 20px;
        width: 100%;
        max-width: 500px;
        margin: 0 auto;
        padding: 0;
    }

    .skill-box,
    .education-box,
    .project-box {
        width: 100%;
        max-width: 400px;
        margin: 0 auto;
        text-align: center;
    }

    #infotxt {
        width: 100%;
        max-width: 500px;
        margin: 20px auto;
        text-align: center;
        line-height: 1.6;
    }
    .about_info
    {
        width: 100%;
        max-width: 500px;
        margin: 20px auto;
        text-align: center;
        line-height: 1.6;
    }

    .green,
    #element,
    .about_heading {
        text-align: center;
        width: 100%;
        margin: 0 auto;
    }

    .green {
        font-size: 3rem;
    }

    #element,
    .about_heading {
        font-size: 2rem;
    }

    .contact-form {
        width: 100%;
        max-width: 600px;
        margin: 0 auto;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .contact-form input,
    .contact-form textarea,
    .contact-form button {
        width: 100%;
        margin: 10px auto;
    }
}

/* Extra small screens */
@media screen and (max-width: 480px) {

    nav {
        margin: 0;
    }

    #home,
    #about_me,
    #skills,
    #education,
    #projects,
    #contact_me {
        width: 100%;
        max-width: 450px;
        margin: 40px auto;
        text-align: center;
        box-sizing: border-box;
    }

    .left{
        font-size: 1.5rem;
    }
    

    .skills-grid,
    .education-grid,
    .project-grid {
        width: 100%;
        padding: 10px 0;
    }

    .skill-box,
    .education-box,
    .project-box {
        width: 100%;
        max-width: 350px;
        margin: 0 auto;
    }

    .green,
    #element,
    .about_heading,
    #infotxt {
        text-align: center;
        width: 100%;
        margin: 0 auto;
    }

    .green {
        font-size: 2.5rem;
        line-height: 1.2;
    }

    #element {
        font-size: 1.8rem;
        line-height: 1.2;
    }

    .about_heading {
        font-size: 1.8rem;
        line-height: 1.3;
    }

    #infotxt {
        font-size: 0.8rem;
        width: 100%;
        /* margin: 20px auto; */
        padding: 0 10px;
        line-height: 1.6;
        text-align: center;
    }

    .project-box {
        min-height: 350px;
    }

    
    .skill-box,
    .education-box {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 15px;
    }

    .about {
        width: 100%;
        padding: 0 10px;
        text-align: center;
        margin: 0 auto;
    }
}

/* Animation for dropdown menu */
@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

nav ul.active {
    animation: slideDown 0.3s ease-in-out;
}

/* Menu toggle animations */
.menu-toggle.active .bar:nth-child(1) {
    transform: rotate(-45deg) translate(-5px, 6px);
}

.menu-toggle.active .bar:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active .bar:nth-child(3) {
    transform: rotate(45deg) translate(-5px, -6px);
}