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

/* 
----------------------------
BELOW 1344px (Smaller desktops)
----------------------------
*/
@media (max-width: 88em) {
	.heading-primary {
		font-size: 4.4rem;
	}

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

/* 
----------------------------
BELOW 1200px (Landscape tablets)
----------------------------
*/
@media (max-width: 75em) {
	/* this trick will change all the size in rem unit decrease!!! */
	html {
		/* 9px / 16px = 56.25% */
		font-size: 56.25%;
	}

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

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

	.header {
		padding: 0 3.2rem;
	}

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

	.hero {
		gap: 4.8rem;
	}

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

/* 
----------------------------
BELOW 928px (Tablets)
----------------------------
*/
@media (max-width: 58em) {
	html {
		/* 8px / 16px = 50.00% */
		font-size: 50%;
	}

	.hero {
		grid-template-columns: 1fr;
		gap: 15rem;

		padding: 0 20rem;
	}

	.hero-img {
		width: 90%;
	}

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

	.delivered-meals {
		justify-content: center;
		margin-top: 4rem;
	}

	.delivered-imgs img {
		height: 3rem;
		width: 3rem;
	}

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

	.meal-text {
		padding: 2rem 3.2rem 3.6rem 3.2rem;
	}

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

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

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

	.pricing-plan--complete::after {
		top: 5%;
		right: -15%;

		font-size: 1.4rem;
		padding: 1rem 6rem;
	}

	.cta {
		grid-template-columns: 3fr 2fr;
	}

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

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

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

	.main-nav {
		background-color: rgba(255, 255, 255, 0.8);

		/* for safari */
		-webkit-backdrop-filter: blur(5px);
		backdrop-filter: blur(5px);

		/* We don't need to set the parent to relative, because we want the main-nav class's parent to be our view port */
		position: absolute;
		top: 0;
		left: 0;

		width: 100%;
		height: 100vh;
		transform: translateX(100%);

		display: flex;
		align-items: center;
		justify-content: center;

		transition: var(--transition-longer);

		/* default: hide, but setting display to none won't allow any animation, so */
		/* 1. hide visually */
		opacity: 0;
		/* 2. make it unaccessible to mouse and keyboard */
		pointer-events: none;
		/* 3. hide it from screen readers */
		visibility: hidden;
	}

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

	.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: 6rem;
	}

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

/* 
----------------------------
BELOW 768px (iPad mini and smaller tablets)
----------------------------
*/
@media (max-width: 48em) {
	.heading-primary {
		font-size: 4.8rem;
		margin-bottom: 2.8rem;
	}
	.heading-secondary {
		margin-bottom: 4.8rem;
	}
	.heading-tertiary {
		margin-bottom: 1.6rem;
	}

	.hero {
		gap: 10rem;
	}

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

	.grid--4-cols {
		padding: 0 9.6rem;
	}

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

	.meal-title {
		font-size: 2rem;
	}

	.meal-text {
		padding: 1.6rem 2.8rem 2.8rem 2.8rem;
	}

	.diets {
		grid-column: 1 / -1;
		justify-self: center;
	}

	.pricing-plan {
		width: 90%;
	}

	.footer {
		padding: 9.8rem 0;
	}

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

	.nav-col {
		grid-row: 1;
		grid-column: span 2;
		justify-self: center;
		margin-bottom: 2.8rem;
	}
	.logo-col,
	.addr-col {
		grid-row: 2;
		grid-column: span 3;
		justify-self: center;
	}
}

/* 
----------------------------
BELOW 480px (Mobile phones)
----------------------------
*/
@media (max-width: 30em) {
	html {
		/* 7px / 16px = 43.75% */
		font-size: 43.75%;
	}

	.grid {
		row-gap: 4.8rem;
	}

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

	.heading-primary {
		font-size: 4.2rem;
		margin-bottom: 2.8rem;
	}
	.heading-secondary {
		margin-bottom: 4.8rem;
	}
	.heading-tertiary {
		margin-bottom: 1.6rem;
	}

	.section-how,
	.section-meals,
	.section-pricing,
	.section-cta {
		padding: 4.8rem 0;
	}

	.hero {
		padding: 0 3.2rem;
		gap: 8rem;
	}

	.hero-description {
		font-size: 1.8rem;
	}

	.hero-img {
		width: 70%;
	}

	.btn,
	.btn:link,
	.btn:visited {
		font-size: 2rem;
		padding: 1.6rem 1.6rem;
	}

	.section-featured-in {
		padding: 3.2rem 0 2rem 0;
	}
	.heading-featured-in {
		font-size: 1.2rem;
	}
	.featured-in-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.8rem);
	}

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

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

	.pricing-plan {
		width: 100%;
	}

	.grid--4-cols {
		padding: 0 4.8rem;
	}

	.pricing-plan--complete::after {
		right: -13%;
	}

	.section-cta {
		padding: 2rem 0;
	}

	.cta {
		grid-template-columns: 1fr;
		grid-template-rows: 1fr 2fr;
	}
	.cta-input-box {
		padding: 2.4rem 3.2rem 3.2rem 3.2rem;
	}
	.cta-img-box {
		grid-row: 1;
	}

	.footer {
		padding: 6.4rem 0;
	}
}

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

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

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

.no-flexbox-gap .delivered-meals {
	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;
}

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

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