/* --- Base (Mobile First) --- */
.grid {
  display: grid;
  grid-template-columns: 1fr;
}

.gallery {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
}

.gallery img {
  flex-shrink: 1;
  flex-grow: 1;
  flex-basis: 90%;  /* flex-basis practice */
}

/* STUDENT CODE STARTS HERE */

@media (min-width: 768px) {
  .grid {
    grid-template-columns: 45% 45%;
    gap: 10px;
    justify-items: center;
  }

  .grid > div:nth-child(3n) {
    grid-column: 1/-1;
    width: 50%;
  }

  .grid > div:nth-child(even) {
    background-color: yellow;
  }

  .grid > div:nth-child(even) img {
    filter: none;
    border: none;
  }

  .gallery {
    justify-content: space-around;
  }

  .gallery > img {
    flex: 1 1 30%;
  }
}

@media (min-width: 1200px) {
  .grid {
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
  }

  .grid > div:nth-child(3n) {
    grid-column: auto;
    width: inherit;
  }

  .grid > div:nth-child(even) {
    background-color: #f2f2f2;
  }

  .gallery {
    justify-content: space-between;
  }

  .gallery > img {
    flex: 1 1 200px;
  }

  .grid > div:hover {
    box-shadow: 0px 0px 10px black;
  }
}

@media print {
  * {
    background-color: white;
    color: black;
  }

  section {
    background-color: white;
  }

  .gallery {
    display: none;
  }

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

  .grid > div {
    background-color: white;
    border: 2px solid black;
    page-break-inside: avoid;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gallery img:hover, .grid > div:hover {
    transform: none;
    box-shadow: none;
  }
}

@media (prefers-color-scheme: dark) {
  body {
    background: #111;
    color: #eee;
  }

  .grid > div {
    background-color: #111;
    color: white;
    border: 1px #EB5B00 solid;
  }

  .grid > p {
    color: white;
  }
}

