/* ===================================================
   RESPONSIVE DESIGN & MOBILE OPTIMIZATIONS
   =================================================== */

/* LAPTOP & INTERMEDIATE DESKTOPS (<= 1400px) */
@media screen and (max-width: 1400px) {
  section {
    margin: 0 5rem;
  }
  #profile {
    min-height: 83vh;
    height: auto;
    margin-bottom: 0;
  }
  .about-containers {
    flex-wrap: wrap;
  }
  .arrow {
    right: -2rem;
  }
}

/* TABLET LANDSCAPE & PORTRAIT (<= 1200px) */
@media screen and (max-width: 1200px) {
  #navbar {
    display: none;
  }
  #hamburger-nav {
    display: flex;
    height: 5rem;
    padding: 0 2.5rem;
    justify-content: space-between;
    align-items: center;
  }
  #experience,
  .experience-details-container {
    margin-top: 1rem;
  }
  #profile,
  .section-container {
    display: block;
  }
  .arrow {
    display: none;
  }
  section,
  .section-container {
    height: auto !important;
    min-height: auto !important;
  }
  section {
    margin: 0 5%;
    padding: 3.5rem 0 2rem;
    scroll-margin-top: 5rem;
  }
  #profile {
    height: auto !important;
    min-height: auto !important;
    padding: 2.5rem 0 1.5rem;
    text-align: center;
  }
  .section-pic-container {
    width: 250px !important;
    height: 250px !important;
    max-width: 250px !important;
    max-height: 250px !important;
    aspect-ratio: 1 / 1 !important;
    border-radius: 50% !important;
    overflow: hidden !important;
    margin: 0 auto 2rem !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    flex-shrink: 0 !important;
  }
  .section-pic-container img,
  #profile .section-pic-container img {
    width: 100% !important;
    height: 100% !important;
    aspect-ratio: 1 / 1 !important;
    border-radius: 50% !important;
    object-fit: cover !important;
    display: block !important;
  }
  .about-containers {
    margin-top: 0;
  }
  .cert-grid,
  .cert-more-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .cert-more-grid.open {
    max-height: 2500px;
  }
  .project-card {
    max-width: 500px;
  }
}

/* TABLET PORTRAIT & LARGE PHONES (<= 768px) */
@media screen and (max-width: 768px) {
  #hamburger-nav {
    padding: 0 1.5rem;
    height: 4.5rem;
  }
  .section-pic-container {
    width: 230px !important;
    height: 230px !important;
    max-width: 230px !important;
    max-height: 230px !important;
    aspect-ratio: 1 / 1 !important;
    border-radius: 50% !important;
    overflow: hidden !important;
    margin: 0 auto 1.75rem !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    flex-shrink: 0 !important;
  }
  .section-pic-container img,
  #profile .section-pic-container img {
    width: 100% !important;
    height: 100% !important;
    aspect-ratio: 1 / 1 !important;
    border-radius: 50% !important;
    object-fit: cover !important;
    display: block !important;
  }
  .cert-grid,
  .cert-more-grid {
    grid-template-columns: 1fr;
  }
  .projects-grid {
    gap: 1.5rem;
  }
  .project-card {
    max-width: 100%;
  }
}

/* SMARTPHONES & MOBILE SCREENS (<= 600px) */
@media screen and (max-width: 600px) {
  /* Navigation Bar */
  #hamburger-nav {
    height: 4.25rem;
    padding: 0 1.25rem;
    justify-content: space-between;
  }
  .logo {
    font-size: 1.35rem;
  }
  .hamburger-right {
    gap: 0.75rem;
  }
  .theme-btn {
    width: 2.25rem;
    height: 2.25rem;
  }
  .menu-links {
    min-width: 160px;
  }
  .menu-links a {
    font-size: 1.1rem;
    padding: 0.65rem 1.25rem;
  }

  /* Universal Section Layout & Gap Prevention */
  section {
    margin: 0 1.25rem;
    padding: 2.25rem 0 1.25rem !important;
    height: auto !important;
    min-height: auto !important;
    scroll-margin-top: 4.5rem;
  }
  .title {
    font-size: 1.85rem;
  }
  .section-text-p1 {
    font-size: 0.95rem;
  }
  .section-text-p2 {
    font-size: 1.15rem;
    margin-bottom: 1.25rem;
  }

  /* Hero / Profile */
  #profile {
    height: auto !important;
    min-height: auto !important;
    padding: 1.25rem 0 1.5rem !important;
    margin-bottom: 0;
  }
  .section-pic-container {
    width: 210px !important;
    height: 210px !important;
    max-width: 62vw !important;
    max-height: 62vw !important;
    aspect-ratio: 1 / 1 !important;
    border-radius: 50% !important;
    overflow: hidden !important;
    margin: 0 auto 1.5rem !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    flex-shrink: 0 !important;
    box-sizing: border-box !important;
  }
  #profile .section-pic-container img,
  .section-pic-container img {
    width: 100% !important;
    height: 100% !important;
    aspect-ratio: 1 / 1 !important;
    border-radius: 50% !important;
    object-fit: cover !important;
    display: block !important;
  }
  .btn-container {
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
  }
  .btn {
    width: auto;
    min-width: 7.8rem;
    padding: 0.8rem 1.15rem;
    font-size: 0.9rem;
  }
  .socials-container {
    margin-top: 1.25rem;
    gap: 1.25rem;
  }

  /* About Me */
  #about {
    height: auto !important;
    min-height: auto !important;
    padding: 1.75rem 0 1.25rem !important;
  }
  .about-details-container {
    margin-top: 1rem;
    width: 100%;
  }
  .about-containers {
    flex-direction: column;
    gap: 1.25rem;
    margin: 1.25rem 0 1.5rem;
  }
  .details-container {
    padding: 1.35rem 1.15rem;
    width: 100%;
    box-sizing: border-box;
    border-radius: 1.5rem;
  }
  .duration-text {
    font-size: 0.85rem;
    display: inline-block;
    margin-top: 0.2rem;
  }
  .experience-sub-item {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px dashed rgba(163, 163, 163, 0.4);
  }
  .text-container {
    text-align: center !important;
    margin: 0 auto;
    max-width: 100%;
  }
  .text-container p {
    font-size: 0.95rem !important;
    line-height: 1.65 !important;
    text-align: center !important;
    text-align-last: center !important;
    word-spacing: normal !important;
    text-wrap: pretty;
  }

  /* Skills Section */
  #experience {
    height: auto !important;
    min-height: auto !important;
    padding: 1.75rem 0 1.25rem !important;
    margin-top: 0 !important;
  }
  .experience-sub-title {
    font-size: 1.25rem;
    margin-bottom: 1.25rem;
  }
  .skills-container .details-container {
    padding: 1.35rem 0.85rem;
  }
  .skills-article-container {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem 0.5rem;
    width: 100%;
  }
  article {
    width: auto;
    min-width: 0;
    gap: 0.5rem;
    justify-content: flex-start;
    padding-left: 0.5rem;
    font-size: 0.95rem;
  }
  article h3 {
    font-size: 0.92rem;
  }
  article .icon {
    height: 1.35rem;
    width: 1.35rem;
  }

  /* Projects Section */
  #projects {
    height: auto !important;
    min-height: auto !important;
    padding: 1.75rem 0 1.25rem !important;
  }
  .projects-grid {
    margin: 1.25rem auto 0;
    gap: 1.5rem;
  }
  .project-card {
    max-width: 100%;
    padding: 1.25rem 1rem;
    border-radius: 1.5rem;
  }
  .project-img-wrapper {
    height: 180px;
  }
  .project-title {
    font-size: 1.3rem;
  }
  .project-subtitle {
    font-size: 0.85rem;
  }
  .project-tech-tags {
    gap: 0.35rem;
    margin-bottom: 0.85rem;
  }
  .tech-tag {
    font-size: 0.74rem;
    padding: 0.2rem 0.55rem;
  }
  .project-bullets {
    font-size: 0.83rem;
    line-height: 1.5;
    padding: 0;
    margin-bottom: 1rem;
  }
  .project-bullets li {
    padding-left: 1rem;
    margin-bottom: 0.55rem;
  }
  .project-btn {
    padding: 0.6rem 1.5rem;
    font-size: 0.85rem;
  }

  /* Certifications */
  #certifications {
    height: auto !important;
    min-height: auto !important;
    padding: 1.75rem 0 1.25rem !important;
  }
  .certifications-container {
    margin: 1.25rem auto 0;
    gap: 1.25rem;
  }
  .cert-card {
    padding: 1.25rem 1rem;
    border-radius: 1.5rem;
  }
  .cert-title {
    font-size: 1.15rem;
  }
  .cert-issuer {
    font-size: 0.84rem;
  }
  .cert-desc {
    font-size: 0.84rem;
    margin-bottom: 1.25rem;
  }
  .cert-pill-btn {
    font-size: 0.78rem;
    padding: 0.4rem 0.75rem;
  }
  .cert-more-grid.open {
    max-height: 2500px;
  }
  .cert-toggle-btn {
    max-width: 100%;
    min-width: auto;
    padding: 0.8rem 1.25rem;
    font-size: 0.92rem;
  }

  /* Contact Me */
  #contact {
    height: auto !important;
    min-height: auto !important;
    padding: 1.75rem 0 1.25rem !important;
  }
  .contact-info-upper-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.85rem;
    padding: 1.25rem 1rem;
    margin: 1.25rem auto 1rem;
    width: 100%;
    max-width: 360px;
    box-sizing: border-box;
    border-radius: 1.5rem;
  }
  .contact-info-container {
    margin: 0;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
  }
  .contact-info-container p {
    font-size: 0.92rem;
    word-break: break-all;
    margin: 0;
  }
  .contact-icon,
  .email-icon {
    height: 1.65rem;
    width: 1.65rem;
    flex-shrink: 0;
  }

  /* Footer */
  footer {
    height: auto !important;
    min-height: auto !important;
    padding: 2rem 1rem 4rem !important;
    margin: 0;
  }
  footer nav {
    height: auto;
    margin-bottom: 1.25rem;
  }
  .nav-links {
    flex-direction: column;
    gap: 0.65rem;
    text-align: center;
  }
  .nav-links li a {
    font-size: 0.95rem;
  }
  footer p {
    font-size: 0.85rem;
    margin: 0.35rem 0;
  }
  .footer-repo {
    font-size: 0.82rem;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
  }
}

/* ULTRA-COMPACT SCREENS (<= 380px) */
@media screen and (max-width: 380px) {
  .section-pic-container {
    width: 175px !important;
    height: 175px !important;
    max-width: 55vw !important;
    max-height: 55vw !important;
    aspect-ratio: 1 / 1 !important;
  }
  .title {
    font-size: 1.65rem;
  }
  .logo {
    font-size: 1.2rem;
  }
  .btn {
    min-width: 7.2rem;
    padding: 0.75rem 0.9rem;
    font-size: 0.85rem;
  }
  article h3 {
    font-size: 0.82rem;
  }
  .contact-info-container p {
    font-size: 0.84rem;
  }
  .tech-tag {
    font-size: 0.7rem;
    padding: 0.15rem 0.45rem;
  }
  footer {
    padding: 2rem 0.75rem 4.5rem !important;
  }
}