/* ===========================================
   MEDIA QUERIES
   =========================================== */

/* Extra large displays (1200px and above) */
@media (min-width: 75.0625em) {
  .navbar-links-container {
    gap: 2rem;
  }

  .main-navbar-link:link,
  .main-navbar-link:visited {
    font-size: 2.2rem;
    padding: 1.1rem 1.4rem;
  }
}

/* Medium-large displays (1400px and above) - Show video for better experience */
@media (min-width: 87.5em) {
  .bg-image {
    display: none; /* Hide image on large screens */
  }

  .bg-video {
    display: block; /* Show video on large screens */
  }
}

/* Large tablets and small desktops (1200px and below) */
@media (max-width: 75em) {
  .container {
    max-width: 100rem;
    padding: 0 2rem;
  }

  .flex-IT-skills {
    gap: 8rem;
  }

  .certifications {
    max-width: 70%;
    margin: 0 auto;
    justify-content: center;
  }
}

/* Large screens where IT skills get cut off (1150px and below) */
@media (max-width: 71.875em) {
  .flex-IT-skills {
    gap: 8rem;
    flex-direction: column;
  }

  .profile-photo {
    height: 45rem;
    width: 45rem;
    margin-top: 4rem;
    margin-bottom: 4rem;
  }

  /* Certifications switch to single column at 1150px */
  .certifications {
    max-width: 100%;
    gap: 2rem;
    flex-direction: column;
    margin: 0 auto;
    justify-content: center;
    align-items: center;
  }

  .cert-row {
    width: 100%;
    max-width: none;
    display: flex;
    justify-content: center;
  }

  .inner-cert-row {
    gap: 1.5rem;
    margin: 0 auto;
    justify-content: center;
  }

  .cert {
    flex-direction: column;
    text-align: center;
    gap: 1.5rem;
  }

  .about-description {
    padding: 0 2rem;
  }
}

/* Tablets (984px and below) */
@media (max-width: 61.5em) {
  html {
    font-size: 56.25%; /* 9px */
  }

  .header {
    padding: 0 3.2rem;
  }

  .navbar-links-container {
    width: auto;
    gap: 1.4rem;
    justify-content: flex-end;
  }

  .main-navbar-link:link,
  .main-navbar-link:visited {
    font-size: 1.8rem;
    padding: 0.8rem 1rem;
  }

  .flex-IT-skills {
    gap: 6rem;
    flex-direction: column;
  }

  .IT-skills-flex {
    flex-wrap: wrap;
    gap: 2rem;
  }

  .profile-photo {
    height: 42rem;
    width: 42rem;
    margin-top: 3rem;
    margin-bottom: 3rem;
  }

  .certifications {
    max-width: 80%;
    gap: 4rem;
    margin: 0 auto;
    justify-content: center;
  }

  .grid--3-cols {
    justify-content: center;
    align-items: center;
    gap: 3rem;
  }

  .grid--3-cols > * {
    flex: 0 1 calc(50% - 1.5rem);
    min-width: 30rem;
    max-width: 45rem;
  }
}

/* Medium tablets (850px and below) - Single column for YouTube channels */
@media (max-width: 53em) {
  .grid--3-cols {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3rem;
  }

  .grid--3-cols > * {
    flex: none;
    width: 100%;
    max-width: 45rem;
    margin: 0 auto;
  }

  .fitfresh-preview {
    height: 40rem;
    object-fit: cover;
    object-position: center;
  }

  .heading-tertiary {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
  }

  .btn {
    padding: 0.8rem 1.5rem;
    font-size: 1.4rem;
  }
}

/* Small tablets (768px and below) */
@media (max-width: 48em) {
  html {
    font-size: 50%; /* 8px */
  }

  .header {
    padding: 0 2rem;
    height: 7rem;
  }

  body {
    padding-top: 7rem;
  }

  .navbar-name {
    font-size: 1.8rem;
  }

  .navbar-links-container {
    width: auto;
    gap: 1.4rem;
    justify-content: flex-end;
  }

  .main-navbar-link:link,
  .main-navbar-link:visited {
    font-size: 1.6rem;
    padding: 0.8rem 1rem;
  }

  .hero {
    height: 90vh;
    padding: 0 2rem;
  }

  .name-text {
    font-size: 3.2rem;
    text-align: center;
  }

  .typing-section {
    font-size: 1.8rem;
    text-align: center;
  }

  .about-description {
    font-size: 1.8rem;
    text-align: center;
    margin-bottom: 3rem;
    padding: 0 2rem;
  }

  .about-description p {
    margin-bottom: 1.2rem;
  }

  .profile-photo {
    height: 40rem;
    width: 40rem;
    margin-top: 3rem;
    margin-bottom: 3rem;
  }

  .IT-skill {
    height: 11rem;
    width: 11rem;
  }

  .IT-skill-text {
    font-size: 1.4rem;
    margin-top: 0.8rem;
  }

  .IT-skills-flex {
    gap: 1.5rem;
  }

  .certifications {
    max-width: 90%;
    gap: 3rem;
    margin: 0 auto;
    justify-content: center;
  }

  .education-logo {
    height: 15rem;
    width: auto;
    max-width: 15rem;
  }

  .grid--3-cols {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2rem;
  }

  .grid--3-cols > * {
    flex: none;
    width: 100%;
    max-width: 35rem;
    margin: 0 auto;
  }

  .fitfresh-preview {
    height: 35rem;
    object-fit: cover;
    object-position: center;
  }
}

/* Medium mobile phones (621px and below) - Navbar collision fix */
@media (max-width: 38.8125em) {
  .header {
    padding: 0 1.5rem;
    height: 6rem;
  }

  body {
    padding-top: 6rem;
  }

  .navbar {
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.5rem 0;
    overflow: visible;
  }

  .navbar-name {
    font-size: 1.6rem;
  }

  .navbar-links-container {
    width: 100%;
    gap: 1.4rem;
    justify-content: center;
    overflow: visible;
  }

  .main-navbar-link:link,
  .main-navbar-link:visited {
    font-size: 1.1rem;
    padding: 0.5rem 0.7rem;
    min-width: auto;
  }

  .fitfresh-preview {
    height: 30rem;
    object-fit: cover;
    object-position: center;
  }
}

/* Mobile phones (576px and below) */
@media (max-width: 36em) {
  html {
    font-size: 43.75%; /* 7px */
  }

  .header {
    padding: 0 1.5rem;
    height: 6rem;
  }

  body {
    padding-top: 6rem;
  }

  .navbar {
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.5rem 0;
    overflow: visible;
  }

  .navbar-name {
    font-size: 1.6rem;
  }

  .navbar-links-container {
    width: 100%;
    gap: 1.4rem;
    justify-content: center;
    overflow: visible;
  }

  .main-navbar-link:link,
  .main-navbar-link:visited {
    font-size: 1.1rem;
    padding: 0.5rem 0.7rem;
    min-width: auto;
  }

  .section-hero {
    height: 80vh;
  }

  .hero {
    height: 80vh;
    padding: 0 1rem;
  }

  .name {
    margin-top: 6rem;
  }

  .name-text {
    font-size: 2.8rem;
    text-align: center;
    line-height: 1.2;
  }

  .typing-section {
    font-size: 1.6rem;
    text-align: center;
    margin-bottom: 2rem;
  }

  .container {
    max-width: 100%;
    padding: 0 1.5rem;
  }

  .heading-primary {
    font-size: 3.6rem;
    margin-bottom: 2rem;
    margin-top: 2rem;
  }

  .heading-project {
    font-size: 2.8rem;
    margin-bottom: 2rem;
  }

  .about-description {
    font-size: 1.6rem;
    text-align: left;
    margin-bottom: 2.5rem;
    padding: 0 2rem;
    line-height: 1.4;
  }

  .about-description p {
    margin-bottom: 1rem;
  }

  .flex-IT-skills {
    gap: 3rem;
    flex-direction: column;
  }

  .IT-skills-flex {
    gap: 0.8rem;
    flex-wrap: nowrap;
    justify-content: center;
  }

  .IT-skill {
    height: 8.5rem;
    width: 8.5rem;
    flex-shrink: 0;
  }

  .IT-skill-text {
    font-size: 1rem;
    margin-top: 0.6rem;
  }

  .profile-photo {
    height: 34rem;
    width: 34rem;
    margin-top: 3rem;
    margin-bottom: 3rem;
  }

  .section-education {
    padding: 3rem 0 6rem 0;
  }

  .cert h2 {
    font-size: 2.4rem;
  }

  .cert p {
    font-size: 1.8rem;
  }

  .education-logo {
    height: 12rem;
    width: auto;
    max-width: 12rem;
  }

  .section-projects {
    padding: 3rem 0 6rem 0;
  }

  .section-about {
    padding: 3rem 0 6rem 0;
  }

  .projects-inner-container {
    gap: 2rem;
  }

  .fitfresh-preview {
    height: 25rem;
    object-fit: cover;
    object-position: center;
  }

  .channel-container {
    margin-bottom: 2rem;
  }

  .channel-name {
    font-size: 1.8rem;
    margin: 1rem;
  }

  .video-container {
    height: 8rem;
    width: 8rem;
  }

  .youtube-channel-image {
    height: 100%;
    width: 100%;
    object-fit: cover;
    object-position: center;
  }

  /* Mobile-specific YouTube channel optimizations */
  .grid--3-cols {
    padding: 0 2rem;
  }

  .grid--3-cols > * {
    max-width: 26rem;
  }

  .channel-box {
    font-size: 1.2rem;
    padding: 0.6rem;
  }

  .channel-container {
    margin-bottom: 1.5rem;
  }

  /* Improve touch interaction on mobile */
  .channel-link {
    padding: 0.5rem;
    border-radius: 6px;
  }

  .channel-link:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
  }

  .description-item {
    font-size: 1.6rem;
    margin-bottom: 1.5rem;
  }

  .footer {
    padding: 1.75rem 0;
  }

  .heading-footer {
    font-size: 2.8rem;
    margin-bottom: 2.6rem;
  }

  .email {
    font-size: 1.8rem;
    flex-direction: column;
    gap: 0.8rem;
    text-align: center;
    margin-bottom: 2.6rem;
  }

  .footer-icons {
    gap: 2.4rem;
  }

  .footer-icon {
    height: 4.2rem;
    width: 4.2rem;
  }

  #myBtn {
    bottom: 1.5rem;
    right: 1.5rem;
    padding: 1.2rem;
    font-size: 1.4rem;
  }
}

/* Android-specific line-height fix for about-description */
@media screen and (-webkit-min-device-pixel-ratio: 0) and (max-width: 768px) {
  .about-description {
    line-height: 1.3;
  }

/* iOS-specific navbar link alignment fix */
@supports (-webkit-touch-callout: none) {
  .main-navbar-link:link,
  .main-navbar-link:visited {
    line-height: 1.1;
    vertical-align: middle;
    padding-top: 1.1rem;
    padding-bottom: 0.9rem;
  }

  /* iOS-specific banner background fix */
  .section-hero {
    background-attachment: scroll !important;
    background-size: cover !important;
    background-position: center center !important;
    background-repeat: no-repeat !important;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-perspective: 1000;
    perspective: 1000;
    will-change: auto;
  }

  /* Prevent iOS Safari from adjusting background during scroll */
  @media (max-width: 87.5em) {
    .section-hero {
      background-attachment: scroll !important;
      -webkit-transform: translate3d(0, 0, 0);
      transform: translate3d(0, 0, 0);
    }
  }

  /* iOS-specific fix for column navbar layout */
  @media (max-width: 38.8125em) {
    .navbar {
      align-items: center;
      justify-content: center;
    }

    .navbar-links-container {
      align-items: center;
    }

    .main-navbar-link:link,
    .main-navbar-link:visited {
      line-height: 1;
      padding-top: 0.6rem;
      padding-bottom: 0.4rem;
    }
  }

  /* iOS-specific fix for mobile navbar */
  @media (max-width: 36em) {
    .main-navbar-link:link,
    .main-navbar-link:visited {
      line-height: 1;
      padding-top: 0.6rem;
      padding-bottom: 0.4rem;
    }
  }
}

/* Small mobile phones (480px and below) */
@media (max-width: 30em) {
  html {
    font-size: 37.5%; /* 6px */
  }

  .header {
    padding: 0 1rem;
    height: 5.5rem;
  }

  body {
    padding-top: 5.5rem;
  }

  .navbar-name {
    font-size: 1.4rem;
  }

  .main-navbar-link:link,
  .main-navbar-link:visited {
    font-size: 1.2rem;
    padding: 0.6rem 0.8rem;
  }

  .name-text {
    font-size: 2.4rem;
  }

  .typing-section {
    font-size: 1.4rem;
  }

  .heading-primary {
    font-size: 3rem;
  }

  .heading-project {
    font-size: 2.4rem;
  }

  .about-description {
    font-size: 1.4rem;
    padding: 0 2rem;
  }

  .about-description p {
    margin-bottom: 0.8rem;
  }

  .IT-skill {
    height: 8rem;
    width: 8rem;
    flex-shrink: 0;
  }

  .IT-skill-text {
    font-size: 0.8rem;
    margin-top: 0.5rem;
  }

  .IT-skills-flex {
    gap: 0.6rem;
    flex-wrap: nowrap;
  }

  .profile-photo {
    height: 28rem;
    width: 28rem;
    margin-top: 3rem;
    margin-bottom: 3rem;
  }

  .cert h2 {
    font-size: 2rem;
  }

  .cert p {
    font-size: 1.6rem;
  }

  .education-logo {
    height: 10rem;
    width: auto;
    max-width: 10rem;
  }

  .fitfresh-preview {
    height: 20rem;
    object-fit: cover;
    object-position: center;
  }

  .channel-name {
    font-size: 1.6rem;
  }

  .video-container {
    height: 7rem;
    width: 7rem;
  }

  .youtube-channel-image {
    height: 100%;
    width: 100%;
    object-fit: cover;
    object-position: center;
  }

  .description-item {
    font-size: 1.4rem;
  }

  .heading-footer {
    font-size: 2.4rem;
  }

  .email {
    font-size: 1.6rem;
  }
}

/* Center YouTube channel boxes */
.grid--3-cols {
  margin: 0 auto;
  text-align: center;
}

.grid--3-cols .channel-container {
  margin: 0 auto;
  display: block;
}

.grid--3-cols .channel-link {
  display: block;
  margin: 0 auto;
}

/* Fix navbar overflow */
@media (max-width: 24em) {
  .navbar-links-container {
    gap: 1.4rem;
    overflow: visible;
    justify-content: center;
  }

  .main-navbar-link:link,
  .main-navbar-link:visited {
    font-size: 0.85rem;
    padding: 0.4rem 0.5rem;
    flex-shrink: 0;
  }
}

/* Small screens where IT skills layout breaks (420px and below) */
@media (max-width: 26.25em) {
  .IT-skills-flex {
    gap: 0.5rem;
    flex-wrap: nowrap;
    justify-content: center;
  }

  .IT-skill {
    height: 7rem;
    width: 7rem;
    flex-shrink: 0;
  }

  .IT-skill-text {
    font-size: 0.7rem;
    margin-top: 0.4rem;
  }

  .icon {
    height: 3.5rem;
    width: 3.5rem;
  }

  .profile-photo {
    height: 26rem;
    width: 26rem;
    margin-top: 3rem;
    margin-bottom: 3rem;
  }
}

/* Ultra small screens (320px and below) */
@media (max-width: 20em) {
  .navbar-links-container {
    gap: 1.4rem;
  }

  .main-navbar-link:link,
  .main-navbar-link:visited {
    font-size: 0.75rem;
    padding: 0.3rem 0.4rem;
  }
}

/* Small screen heights (360px and below) - Move hero button up to prevent cutoff */
@media (max-height: 22.5em) {
  .hero-btn {
    margin-top: -2rem;
  }
}
