@media screen and (max-width: 1400px) {
  #profile {
    height: 83vh;
    margin-bottom: 6rem;
  }
  .about-containers {
    flex-wrap: wrap;
  }
  #contact,
  #projects {
    height: fit-content;
  }
}

/* Ensure 2x2 grid for larger screens */
@media screen and (min-width: 900px) {
  #projects .about-containers {
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem 4rem; /* increased horizontal gap for desktop */
    max-width: 1000px;
    padding: 0 2rem;
    margin: 0 auto;
    justify-items: center;
  }
}

@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;
  }
  
  /* Ensure profile picture stays circular */
  #profile .section__pic-container img {
    border-radius: 50%;
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
  
  .about-containers {
    margin-top: 0;
  }
}

/* Switch to single column for medium and small screens */
@media screen and (max-width: 899px) {
  #experience .details-container {
    max-width: 500px;
    padding: 1rem;
  }
  
  #experience .article-container {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    max-width: 480px;
  }
  
  article {
    max-width: 140px;
    gap: 0.6rem;
  }
  
  #projects .about-containers {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding: 0 1rem;
    justify-items: center;
    max-width: 500px;
    margin: 0 auto;
  }
  
  #projects .details-container {
    min-height: 350px;
    width: 100%;
    max-width: 400px;
  }
  
  /* Center project images on medium screens */
  #projects .article-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1rem;
  }
  
  .project-title {
    font-size: 1.3rem;
    line-height: 1.3;
    margin: 0.8rem;
  }
}

@media screen and (max-width: 600px) {
  #contact,
  footer {
    height: 40vh;
  }
  #profile {
    height: 83vh;
    margin-bottom: 0;
  }
  
  #experience .details-container {
    max-width: 380px;
    padding: 0.8rem;
  }
  
  #experience .article-container {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.8rem;
    max-width: 320px;
  }
  
  article {
    font-size: 0.9rem;
    max-width: 140px;
    gap: 0.4rem;
    flex-direction: column;
    text-align: center;
  }
  
  .certification-container {
    max-width: 100%;
    padding: 0 0.5rem;
  }
  
  .certification-article {
    flex-direction: column;
    text-align: center;
    gap: 0.8rem;
    padding: 1.2rem 0.8rem;
  }
  
  .certification-article .icon {
    align-self: center;
  }
  
  .certification-article:hover {
    transform: translateY(-2px);
  }
  
  article .icon {
    margin-bottom: 0.2rem;
  }
  
  footer nav {
    height: fit-content;
    margin-bottom: 2rem;
  }
  .about-containers,
  .contact-info-upper-container,
  .btn-container {
    flex-wrap: wrap;
  }
  
  /* Add spacing between contact options on mobile */
  .contact-info-upper-container {
    gap: 1rem;
    padding: 1rem;
    justify-content: center;
  }
  
  .contact-info-container {
    margin: 0.5rem;
  }
  
  #projects .about-containers {
    gap: 1rem;
    padding: 0 0.5rem;
    max-width: 400px;
  }
  
  #projects .details-container {
    min-height: 320px;
    max-width: 350px;
  }
  
  /* Center project images on mobile */
  #projects .article-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1rem;
  }
  
  .project-img {
    display: block;
    margin: 0 auto;
  }
  
  .project-title {
    font-size: 1.2rem;
    line-height: 1.2;
    margin: 0.5rem;
  }
  
  .contact-info-container {
    margin: 0.5rem 0;
  }
  .contact-info-container p,
  .nav-links li a {
    font-size: 1rem;
  }
  .experience-sub-title {
    font-size: 1.25rem;
  }
  .logo {
    font-size: 1.5rem;
  }
  .nav-links {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
  }
  
  /* Keep footer nav-links horizontal */
  footer .nav-links {
    flex-direction: row;
    gap: 1.5rem;
    justify-content: center;
  }
  .section__pic-container {
    width: 250px;
    height: 250px;
    margin: 0 auto 2rem;
    justify-content: center;
  }
  
  /* Ensure profile picture stays circular on mobile */
  #profile .section__pic-container img {
    border-radius: 50%;
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
  .section__text__p2 {
    font-size: 1.25rem;
  }
  .title {
    font-size: 2rem;
  }
  .text-container {
    text-align: center;
  }
  
  .about-text {
    text-align: center;
    margin: 1rem auto;
    max-width: 100%;
  }
}
