/* 
 * CSS for the ingredients
 */
.ingredients {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-auto-rows: auto;
  list-style: none;
  width: 100%;
}

.ingredient {
  justify-content: center;
  align-items: center;
  position: relative;
  text-align: center;
  height: 100px;
  width: 100px;
}

.ingredient img {
  object-fit: cover;
  border-radius: 2%;
  height: 100%;
  width: 100%;
}

.ingredient input {
  transform: scale(1.8);
}

/* Ingredient style desktop mode  */
@media (min-width: 950px) {
  .toggle-checkbox {
    display: none;
  }
  .ingredients {
    grid-template-columns: repeat(4, 1fr);
    grid-gap: 2rem;
    grid-auto-rows: auto;
  }

  .ingredient {
    height: auto;
    width: 100%;
  }

  .ingredient img {
    transition: filter 0.5s ease;
    max-height: 120px;
  }

  .ingredient:hover img {
    filter: blur(1px) brightness(0.5);
  }

  .name {
    display: none;
    color: white;
    font-weight: 600;
    letter-spacing: 1.5px;
  }

  .ingredient:hover .name {
    display: block;
    position: absolute;
    top: 50%;
    transform: translateY(-50%) rotate(-28deg);
    text-align: center;
    left: 0;
    right: 0;
    text-transform: uppercase;
    padding: 5px;
    animation: fade 0.8s ease forwards; /* Fade in/out effect: https://www.youtube.com/watch?v=oMrdicdu-RE */
  }
  @keyframes fade {
    0% {
      opacity: 0;
    }
    100% {
      opacity: 1;
    }
  }
}

/* Ingredient style for < tablet */
@media (max-width: 949px) {
  .ingredients {
    grid-template-columns: repeat(2, 1fr);
    grid-gap: 30px;
    grid-auto-rows: auto;
  }

  .ingredient {
    height: auto;
    width: 100%;
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .ingredient img {
    height: auto;
    width: 100%;
    max-height: 80px;
  }

  .name {
    display: block;
    text-align: center;
    padding: 10px 0 8px 0;
  }
}

@media (max-width: 949px) and (min-width: 426px) {
  .ingredients {
    grid-template-columns: repeat(3, 1fr);
    grid-gap: 30px;
    grid-auto-rows: auto;
  }

  .ingredients img {
    height: auto;
    width: 100%;
    max-height: 150px;
  }
}

@media (min-width: 1440px) {
  .ingredients {
    grid-template-columns: repeat(8, 1fr);
    grid-gap: 30px;
    grid-auto-rows: auto;
  }
}
