*,
*::before,
*::after {
    box-sizing: border-box;
}

@media screen and (max-width: 1400px) {
    #profile {
        height: 83vh;
        margin-bottom: 6rem;
    }
    .about-container {
        flex-direction: wrap;
    }
}  

@media screen and (max-width: 1200px) {
    #desktop-nav {
        display:none;
    }
    #hamburger-nav {
        display:flex;
    }
    #experience, .experience-details-container {
        margin-top: 2rem;
    }

    #profile, .section-container {
        display: block;
    }

    .arrow {
        display: none;
    }
    section, .section-container {
        height: fit-content
    }
    section {
        margin: 0 5%;
    }

    .section_pic-container {
        width: 275px;
        height: 275px;
        margin: 0 auto 2rem;
    }
    
    .about-container {
        margin-top: 0;
    }
}  

@media screen and (max-width: 600px) {
    #contact, footer {
        height: 40vh;
    }
    #profile {
        height: 83vh;
        margin-bottom: 0;
        /* Responsive smaller top gap on very small screens */
        margin-top: clamp(7rem, 9vh, 4.5rem) !important; /* Overrides desktop margin-top */
    }
    article {
        font-size: 1rem;
    }
    footer nav {
        height: fit-content;
        margin-bottom: 2rem;
    }
    .about-container, .contact-info-upper-container, .btn-container {
        flex-wrap: wrap;
    }
    .contact-info-container {
        margin: 0;
    }
    .contact-info-containerp, .nav-links li a {
        font-size: 1rem;
    }
    .experience-sub-title {
        font-size: 1.25rem;
    }
    .logo {
        font-size: 1rem;
    }

    .text-container {
        text-align: center !important;
    }


    .nav-links {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
    .section_pic-container {
        width: auto;
        height: 46vw;
        justify-content: center;
        /* Reduced bottom margin to tighten gap below image */
        margin-bottom: 0.5rem;
    }

    
    .section_text {
        display: flex;
        flex-direction: column; 
        align-items: center;
    }

    .section_text_p2 {
        font-size: 1.25rem;
    }
    .title {
        font-size: 2rem;
    }
    .text-container {
        text-align: justify;
    }

}

@media screen and (max-width: 900px) {
    .section-container,
    .experience-containers,
    .experience-details-container {
        flex-direction: column !important;
        gap: 2rem !important;
        align-items: center;
    }
    .details-containers,
    .details-container,
    .color-container {
        width: 100% !important;
        min-width: 0 !important;
        margin: 0 !important;
    }
}

@media screen and (max-width: 600px) {
    section {
        margin: 0 0.5rem !important;
        padding-top: 2vh !important;
        height: auto !important;
        min-height: 0 !important;
    }
    .section-container {
        gap: 1rem !important;
    }

    .section_pic-container,
    .about-pic,
    .project-pic,
    .project-img {
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        margin: 0 auto !important;
        display: block !important;
    }
    .article-container {
        flex-direction: column !important;
        gap: 1rem !important;
        align-items: flex-start !important;
    }
}

@media screen and (max-width: 1200px) {
    #hamburger-nav {
        display: flex !important;
        width: 100vw !important;
        position: fixed;
        top: 0;
        left: 0;
        z-index: 1000;
        background: #fff;
        padding: 1rem 0.5rem;
    }
    .menu-links {
        position: absolute;
        top: 100%;
        right: 0;
        background: #fff;
        width: 100vw;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease-in-out;
        box-shadow: 0 2px 8px rgba(0,0,0,0.05);
        z-index: 999;
        padding: 0;
        margin: 0;
        list-style: none;
    }

    .menu-links.open {
        max-height: 300px;
    }
}

@media screen and (max-width: 600px) {
    #contact, footer {
        height: auto !important;
        padding: 1rem 0 !important;
    }
    /* Tighten spacing between profile image and headings */
    #profile .section_text_p1 { 
        margin-top: 1rem !important; 
        margin-bottom: 0.4rem !important; 
    }
    #profile .title { 
        margin-top: 0.15rem !important; 
        margin-bottom: 0.6rem !important; 
    }
    #profile .section_text_p2 { 
        margin-top: 0.4rem !important; 
    }
    .contact-info-upper-container {
        flex-direction: column !important;
        gap: 1rem !important;
        align-items: center !important;
        width: 100% !important;
        padding: 1rem !important;
        box-sizing: border-box;
    }
    .contact-info-container {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 0.75rem !important;
        width: 100% !important;
        font-size: 1rem;
        text-align: left;
        margin: 0 auto;
    }
    .contact-info-container p, .contact-info-container a {
        font-size: 1rem !important;
        margin: 0;
        text-align: left;
        width: auto;
        word-break: break-all;
    }
    .contact-icon {
        flex-shrink: 0;
        width: 1.5em !important;
        height: 1.5em !important;
        margin: 0;
        display: block;
    }
    .email-icon {
        height: 2rem !important;
        width: 2rem !important;
    }

    .nav-links {
        flex-direction: column !important;
        gap: 0.5rem !important;
    }
    .section_pic-container {
        width: 140px !important;
        height: 140px !important;
        max-width: 60vw !important;
        max-height: 60vw !important;
        margin: 0 auto 0.3rem !important;
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        overflow: hidden;
        border-radius: 30%; /* optional: makes it circular */
    }
    .section_pic-container img,
    .about-pic,
    .profile-pic {
        width: 100% !important;
        height: 100% !important;
        max-width: 140px !important;
        max-height: 140px !important;
        object-fit: cover;
        border-radius: 30%; /* optional: makes it circular */
        display: block;
    }
    .details-containers,
    .details-container,
    .color-container {
        width: 90vw !important;
        min-width: 0 !important;
        height: 220px !important;
        min-height: 120px !important;
        margin: 0 auto 1.5rem auto !important;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-align: center;
    }
}