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

@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 {
    height: fit-content;
  }
  section {
    margin: 0 5%;
  }
  .section__pic-container {
    width: 275px;
    height: 275px;
    margin: 0 auto 2rem;
    display: flex;
    justify-content: center;
    align-items: center;
  }
  
  #about .section__pic-container {
    margin: 0 auto 2rem;
    display: flex;
    justify-content: center;
    align-items: center;
  }
  
  #about .section-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }
  .about-containers {
    margin-top: 0;
  }
}

/* Tablet and smaller desktop adjustments */
@media screen and (max-width: 768px) {
  /* Ensure desktop nav is hidden on tablets and phones */
  #desktop-nav {
    display: none !important;
  }
  
  /* Ensure hamburger nav is visible on tablets and phones */
  #hamburger-nav {
    display: flex !important;
  }
  
  #web-applications .about-containers {
    flex-direction: column;
    gap: 2rem;
  }
  
  #web-applications .details-container.color-container {
    max-width: 90%;
    min-width: auto;
  }
  
  .project-img,
  video.project-img {
    width: 100%;
    max-width: 100%;
    height: auto;
  }
  
  section {
    margin: 0 3%;
    padding-top: 2vh;
  }
  
  /* Research and Awards sections tablet */
  #research .details-container.color-container,
  #awards .details-container.color-container {
    max-width: 100%;
    width: 100%;
  }
  
  #research .about-containers,
  #awards .about-containers {
    flex-direction: column;
    align-items: stretch;
  }
  
  /* Scrolling sections tablet */
  .spotlight-scroll-content img,
  .images-scroll-content img {
    width: 280px !important;
    height: 280px !important;
    min-width: 280px;
    max-width: 280px;
  }
  
  .videos-scroll-content > div {
    width: 350px !important;
    min-width: 350px;
    max-width: 350px;
  }
  
  .videos-scroll-content video {
    width: 350px !important;
    height: 262px !important;
    min-width: 350px !important;
    max-width: 350px !important;
  }
}

@media screen and (max-width: 600px) {
  /* Ensure desktop nav is hidden on mobile */
  #desktop-nav {
    display: none !important;
  }
  
  /* Ensure hamburger nav is visible on mobile */
  #hamburger-nav {
    display: flex !important;
  }
  
  #contact,
  footer {
    height: 40vh;
  }
  #profile.active {
    height: 83vh;
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
  }
  
  #profile .section__pic-container {
    margin: 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
  }
  
  #profile .section__text {
    text-align: center;
    width: 100%;
  }
  article {
    font-size: 1rem;
  }
  footer nav {
    height: fit-content;
    margin-bottom: 2rem;
  }
  .about-containers,
  .contact-info-upper-container,
  .btn-container {
    flex-wrap: wrap;
  }
  .contact-info-container {
    margin: 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;
  }
  
  /* Improve mobile dropdown menu */
  #hamburger-nav {
    padding: 0 1rem;
    height: 10vh;
    min-height: 60px;
  }
  
  #hamburger-nav .logo {
    font-size: 1.2rem;
  }
  
  .menu-links {
    top: 10vh;
    max-width: 280px;
    width: 85vw;
    box-shadow: -4px 4px 20px rgba(0, 0, 0, 0.2);
  }
  
  .menu-links a {
    padding: 14px 18px;
    font-size: 0.95rem;
  }
  
  .hamburger-icon {
    height: 22px;
    width: 28px;
  }
  .section__pic-container {
    width: auto;
    height: 46vw;
    justify-content: center;
    margin: 0 auto 2rem;
    display: flex;
    align-items: center;
  }
  
  #about .section__pic-container {
    margin: 0 auto 2rem;
    width: 275px;
    height: 275px;
    display: flex;
    justify-content: center;
    align-items: center;
  }
  
  #about .section-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
  }
  .section__text__p2 {
    font-size: 1.25rem;
  }
  .title {
    font-size: 2rem;
  }
  .text-container {
    text-align: justify;
  }
  
  /* Web Applications Section Mobile Fixes */
  #web-applications {
    padding-top: 2vh;
    min-height: auto;
  }
  
  #web-applications .about-containers {
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
  }
  
  #web-applications .details-container.color-container {
    width: 100%;
    max-width: 100%;
    min-width: auto;
    margin: 0;
    padding: 1rem;
  }
  
  #web-applications .article-container {
    width: 100%;
    justify-content: center;
    padding: 0;
    margin: 0;
  }
  
  #web-applications .project-img {
    width: 100%;
    max-width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 1rem;
  }
  
  #web-applications .experience-sub-title {
    font-size: 1.1rem;
    margin-top: 1rem;
    margin-bottom: 0.75rem;
  }
  
  #web-applications .btn-container {
    width: 100%;
    margin-top: 0.5rem;
  }
  
  #web-applications .project-btn {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
  }
  
  /* General container fixes for mobile */
  .details-container.color-container {
    max-width: 100%;
    min-width: auto;
  }
  
  .article-container {
    flex-direction: column;
    align-items: center;
  }
  
  video.project-img {
    width: 100%;
    max-width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: cover;
  }
  
  /* Ensure sections don't overflow on mobile */
  section {
    margin: 0 1rem;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    box-sizing: border-box;
    overflow-x: hidden;
  }
  
  /* Fix any container overflow issues */
  .experience-details-container {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  
  /* Ensure buttons are properly sized */
  .btn {
    white-space: nowrap;
    padding: 0.75rem 1.5rem;
    font-size: 0.9rem;
  }
  
  /* Fix "Click to see details" button text overflow on mobile */
  .btn.project-btn {
    width: auto;
    min-width: fit-content;
    padding: 0.75rem 1rem;
    white-space: normal;
    word-wrap: break-word;
    text-align: center;
    font-size: 0.85rem;
    line-height: 1.3;
  }
  
  .btn-container {
    justify-content: center;
    width: 100%;
  }
  
  /* Research section mobile */
  #research .details-container.color-container {
    max-width: 100%;
    width: 100%;
    padding: 1rem;
  }
  
  #research .about-containers {
    flex-direction: column;
    align-items: stretch;
  }
  
  #research h2 {
    font-size: 1.1rem;
    margin: 1.5rem 0 0.75rem 0;
  }
  
  /* Awards section mobile */
  #awards .details-container.color-container {
    max-width: 100%;
    width: 100%;
    padding: 1rem;
  }
  
  #awards .about-containers {
    flex-direction: column;
    align-items: stretch;
  }
  
  #awards h2 {
    font-size: 1.1rem;
    margin: 1.5rem 0 0.75rem 0;
  }
  
  /* Scrolling sections mobile */
  .spotlight-scroll-content img,
  .images-scroll-content img {
    width: 250px !important;
    height: 250px !important;
    min-width: 250px;
    max-width: 250px;
  }
  
  .videos-scroll-content > div {
    width: 300px !important;
    min-width: 300px;
    max-width: 300px;
  }
  
  .videos-scroll-content video {
    width: 300px !important;
    height: 225px !important;
    min-width: 300px !important;
    max-width: 300px !important;
  }
  
  .spotlight-scroll-content,
  .videos-scroll-content,
  .images-scroll-content {
    gap: 1rem;
    padding: 0 0.5rem;
  }
  
  /* Slower animation on mobile for better viewing */
  .spotlight-scroll-wrapper {
    animation-duration: 50s;
  }
  
  .videos-scroll-wrapper {
    animation-duration: 45s;
  }
  
  .images-scroll-wrapper {
    animation-duration: 40s;
  }
  
  /* Gallery section mobile */
  #gallery h2 {
    font-size: 1.2rem;
    margin: 1.5rem 0 1rem 0;
  }
  
  #gallery .spotlight-scroll-container,
  #gallery .videos-scroll-container,
  #gallery .images-scroll-container {
    margin: 0 -1rem;
    width: calc(100% + 2rem);
  }
  
  /* Music section mobile */
  #music {
    padding-top: 2vh;
  }
  
  #music img {
    max-width: 90%;
  }
  
  /* Ensure all section titles are readable on mobile */
  .title {
    font-size: 1.75rem;
    line-height: 1.2;
  }
  
  .section__text__p1 {
    font-size: 0.9rem;
  }
  
  /* Research and Awards category headers mobile */
  #research h2[style*="font-size: 1.3rem"],
  #awards h2[style*="font-size: 1.3rem"] {
    font-size: 1.1rem !important;
    margin: 1.5rem 0 0.75rem 0 !important;
  }
}
