/* rem and em do not depend on html font size in media queries
Instead, 1rem = 1em = 16px

rem = root font size
em = current font size

(rem) is getting some bugs in some browsers in media queries so 

instead of using (rem) in media queries we are using (em)
*/

/**************************/
/* BELOW 1344px (Smaller desktops) */
/**************************/

/* we can choose 1350, so 1350 / 16px = 84.374 so we can use round values so thats going with 84 */

@media (max-width: 84em) {
  .hero-container {
    max-width: 120rem;
  }

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

  .gallery {
    grid-template-columns: repeat(2, 1fr);
  }
}

/**************************/
/* BELOW 1200px (Landscape Tablets) */
/**************************/

@media (max-width: 75em) {
  html {
    /* 9px / 16px = 56.25% */
    font-size: 56.25%;
  }

  .grid {
    column-gap: 4.8rem;
    row-gap: 6.4rem;
  }

  .heading-secondary {
    font-size: 3.6rem;
  }

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

  .header {
    padding: 0 3.2rem;
  }

  .hero-container {
    gap: 4.8rem;
  }

  .main-nav-list {
    gap: 3.2rem;
  }

  .testimonials-container {
    padding: 9.6rem 3.2rem;
  }
}

/**************************/
/* BELOW 944px (Tablets) */
/**************************/

/* 940 / 16 = 58.75 instead 59 * 16 = 944 */
@media (max-width: 59em) {
  html {
    /* 8px / 16px = 0.5  = 50% */
    font-size: 50%;
  }

  .hero-container {
    grid-template-columns: 1fr;
    padding: 0 8rem;
    gap: 6.4rem;
  }

  .hero-img {
    width: 60%;
  }

  .hero-left-text-box,
  .hero-right-img-box {
    text-align: center;
  }

  .delivered-meals-happy-customer {
    justify-content: center;
    margin-top: 3.2rem;
  }

  .featured-logos img {
    height: 2.4rem;
  }

  .step-number {
    font-size: 7.4rem;
  }

  .meal-content {
    padding: 2.4rem 3.2rem 3.2rem 3.2rem;
  }

  .meal-price-and-cta {
    padding: 0 1.6rem 3.2rem 1.6rem;
  }

  .section-testimonials-and-gallery {
    grid-template-columns: 1fr;
  }

  .gallery {
    grid-template-columns: repeat(6, 1fr);
  }

  .cta-grid {
    /* 3/5 = 60% + 40%  */
    grid-template-columns: 3fr 2fr;
  }

  .cta-form {
    grid-template-columns: 1fr;
  }

  .btn.btn--form {
    margin-top: 1.2rem;
  }

  .btn-mobile-nav {
    display: block;
    z-index: 9999;
  }

  .main-nav {
    background-color: rgba(255, 255, 255, 0.9);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;

    transform: translateX(100%);
    transition: all 0.5s ease-in;

    /* Hide the navigation */
    /* Allow no transition at all */
    /* display: none; */

    /* This is the correct way of hiding elements without using display: none property */

    /* 1) Hide the element visually */
    opacity: 0;
    /* 2) Make it unaccessible to mouse and keyboard */
    pointer-events: none;

    /* 3) Hide it from the screen readers */
    visibility: hidden;
  }

  .nav-open .main-nav {
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
    transform: translateX(0);
  }

  .nav-open .icon-mobile-nav[name="close-outline"] {
    display: block;
  }

  .nav-open .icon-mobile-nav[name="menu-outline"] {
    display: none;
  }

  .main-nav-list {
    flex-direction: column;
    gap: 4.8rem;
  }

  .main-nav-link:link,
  .main-nav-link:visited {
    font-size: 3rem;
  }
}

/**************************/
/* BELOW 704px (Smaller Tablets) */
/**************************/

/* 704 / 16 = 43.75 instead 44 * 16 = 704 */

@media (max-width: 44em) {
  .grid--3-cols,
  .grid--4-cols {
    grid-template-columns: repeat(2, 1fr);
  }

  .el--5 {
    grid-column: 1 / -1;
    grid-row: 4 / 5;
  }

  .el--6 {
    grid-column: 1 / -1;
  }

  .diet-list {
    justify-self: center;
  }

  .meal-content {
    padding: 2.4rem 2.4rem 3.2rem 2.4rem;
  }

  .heading-secondary {
    /* font-size: 2.4rem; */
    margin-bottom: 4.8rem;
  }

  .pricing-plan {
    width: 100%;
  }

  .grid--footer {
    grid-template-columns: repeat(6, 1fr);
  }
  .nav-col {
    grid-column: span 2;
    grid-row: 1;
    margin-bottom: 3.2rem;
  }

  .logo-col,
  .address-col {
    grid-column: span 3;
  }
}

/**************************/
/* BELOW 544px (Mobile Phones) */
/**************************/

/* 550 / 16 = 34.775 instead 34 * 16 = 544 */

@media (max-width: 34em) {
  .grid {
    row-gap: 4.8rem;
  }

  .grid--2-cols,
  .grid--3-cols,
  .grid--4-cols {
    grid-template-columns: 1fr;
  }

  .btn,
  .btn:link,
  .btn:visited {
    padding: 2.4rem 1.6rem;
  }

  .section-hero {
    padding: 2.4rem 0 6.4rem 0;
  }

  .hero-container {
    padding: 0 3.2rem;
  }

  .hero-img {
    width: 80%;
  }

  .featured-logos img {
    height: 1.2rem;
  }

  .step-img-box:nth-child(2) {
    grid-row: 1;
  }

  .step-img-box:nth-child(6) {
    grid-row: 5;
  }

  .step-img-box {
    transform: translateY(2.4rem);
  }

  .testimonials {
    grid-template-columns: 1fr;
  }

  .gallery {
    grid-template-columns: repeat(4, 1fr);
    gap: 1.2rem;
  }

  .cta-grid {
    grid-template-columns: 1fr;
  }

  .cta-text-box {
    padding: 3.2rem;
  }

  .cta-supporting-img-box {
    height: 32rem;
    grid-row: 1;
  }

  .el--5 {
    grid-row: 6;
  }

  .el--6 {
    grid-row: 5;
  }

  .social-links {
    gap: 1.6rem;
  }
  .footer-logo img {
    height: 2.6rem;
  }
}

/* - Font sizes (px)
10 / 12 / 14 / 16 / 18 / 20 / 24 / 30 / 36 / 44 / 52 / 62 / 74 / 86 / 98 */

/* 
- Spacing system (px)
2 / 4 / 8 / 12 / 16 / 24 / 32 / 48 / 64 / 80 / 96 / 128
*/

/**************************/
/* Fixing Safari Flexbox gap */
/**************************/

.no-flexbox-gap .main-nav-list li:not(:last-child) {
  margin-right: 4.8rem;
}

.no-flexbox-gap .list-item:not(:last-child) {
  margin-bottom: 1.6rem;
}

.no-flexbox-gap .list-icon:not(:last-child) {
  margin-right: 1.6rem;
}

.no-flexbox-gap .delivered-meals-happy-customer {
  margin-right: 1.6rem;
}

.no-flexbox-gap .meal-attribute:not(:last-child) {
  margin-bottom: 2rem;
}

.no-flexbox-gap .meal-icon {
  margin-right: 1.6rem;
}

.no-flexbox-gap .footer-row div:not(:last-child) {
  margin-right: 6.4rem;
}

.no-flexbox-gap .social-links li:not(:last-child) {
  margin-right: 2.4rem;
}

.no-flexbox-gap .footer-nav li:not(:last-child) {
  margin-bottom: 2.4rem;
}

/* writing the same media queries twice is not at problem at all */
@media (max-width: 75em) {
  .no-flexbox-gap .main-nav-list li:not(:last-child) {
    margin-right: 3.2rem;
  }
}

@media (max-width: 59em) {
  .no-flexbox-gap .main-nav-list li:not(:last-child) {
    margin-right: 0;
    margin-bottom: 4.8rem;
  }
}
